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 TestBeautyCardPrepayAlipay:
    data = BaseRequest().api_load(path_setting.BEAUTY_CARD_PREPAY_ALIPAY)
    beauty_card_prepay_alipay_case, beauty_card_prepay_alipay_data = get_ids(data, "beauty_card_prepay_alipay")

    @pytest.mark.parametrize("param", beauty_card_prepay_alipay_data, ids=beauty_card_prepay_alipay_case)
    def test_beauty_card_prepay_alipay(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_prepay_alipay(param["is_huabei"], payment_id)

        if r["error"] == 0:
            assert r["error"] == param["assert_error"]

