import pytest

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


class TestPay:
    data = BaseRequest().api_load(path_setting.PAY)
    pay_case, pay_data = get_ids(data, "pay")

    @pytest.mark.parametrize("param", pay_data, ids=pay_case)
    def test_pay(self, param):
        pay_r = settlement_request().create_v1(param["service_item_id"],param["number"],param["platform_coupon_id"],param["use_point"],param["is_doctor_see"],param["doctor_coupon_id"],param["insurance_info"],param["is_create_groupbuy"])
        id = pay_r["data"]["id"]
        r = settlement_request().pay(id)
        assert r["error"] == param["assert"]

