import pytest

from all_backend_api.janus_request import janus_request
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest


class TestBeautyCardPaymentDetail:
    data = BaseRequest().api_load(path_setting.BEAUTY_CARD_PAYMENT_DETAIL)
    beauty_card_payment_detail_case, beauty_card_payment_detail_data = get_ids(data, "beauty_card_payment_detail")

    @pytest.mark.parametrize("param", beauty_card_payment_detail_data, ids=beauty_card_payment_detail_case)
    def test_beauty_card_payment_detail(self, param):
        payment = janus_request().beauty_card_order_submit("12345678912", "10176", 1, 1, 0, 0)
        payment_id = payment["data"]["payment_id"]
        r = janus_request().beauty_card_payment_detail(payment_id)

        if param["case"] == "次卡订单详情-接口调用成功case":
            assert r["error"] == param["assert_error"]
        if param["case"] == "次卡订单详情-校验商品信息不为空":
            assert r["data"]["services"] != param["assert_services"]

