Call BigModel payment-related APIs with browser-like headers.
| 22 | |
| 23 | |
| 24 | class BigModelClient: |
| 25 | """Call BigModel payment-related APIs with browser-like headers.""" |
| 26 | |
| 27 | def __init__(self, http_client: FingerprintHttpClient | None = None) -> None: |
| 28 | self.settings = get_settings() |
| 29 | self.http_client = http_client or FingerprintHttpClient(self.settings) |
| 30 | |
| 31 | @property |
| 32 | def transport_name(self) -> str: |
| 33 | return self.http_client.transport_name |
| 34 | |
| 35 | def get_customer_info(self, account: AccountRecord, session: AccountSessionState) -> ApiCallResult: |
| 36 | return self._request(account, session, "GET", "/biz/customer/getCustomerInfo") |
| 37 | |
| 38 | def batch_preview( |
| 39 | self, |
| 40 | account: AccountRecord, |
| 41 | session: AccountSessionState, |
| 42 | invitation_code: str, |
| 43 | ) -> ApiCallResult: |
| 44 | return self._request( |
| 45 | account, |
| 46 | session, |
| 47 | "POST", |
| 48 | "/biz/pay/batch-preview", |
| 49 | json_body={"invitationCode": invitation_code}, |
| 50 | ) |
| 51 | |
| 52 | def preview_payment( |
| 53 | self, |
| 54 | account: AccountRecord, |
| 55 | session: AccountSessionState, |
| 56 | request: PreviewPaymentRequest, |
| 57 | *, |
| 58 | invitation_code: str, |
| 59 | ticket: str, |
| 60 | randstr: str, |
| 61 | ) -> ApiCallResult: |
| 62 | return self._request( |
| 63 | account, |
| 64 | session, |
| 65 | "POST", |
| 66 | "/biz/pay/preview", |
| 67 | json_body={ |
| 68 | "productId": request.product_id, |
| 69 | "invitationCode": invitation_code, |
| 70 | "ticket": ticket, |
| 71 | "randstr": randstr, |
| 72 | }, |
| 73 | ) |
| 74 | |
| 75 | def create_sign( |
| 76 | self, |
| 77 | account: AccountRecord, |
| 78 | session: AccountSessionState, |
| 79 | *, |
| 80 | pay_type: str, |
| 81 | product_id: str, |
no outgoing calls
no test coverage detected