|
1 | 1 | from datetime import datetime |
2 | 2 | from enum import Enum |
3 | 3 |
|
4 | | -from checkout_sdk.common.common import Address, CustomerRequest |
5 | 4 | from checkout_sdk.common.enums import Currency |
6 | 5 | from checkout_sdk.payments.payments import PaymentType, BillingDescriptor, PaymentCustomerRequest, ShippingDetails, \ |
7 | | - PaymentRecipient, ProcessingSettings, RiskRequest, PaymentRetryRequest, ThreeDsRequest, PaymentSender |
8 | | -from checkout_sdk.payments.payments_previous import BillingInformation |
| 6 | + PaymentRecipient, ProcessingSettings, RiskRequest, ThreeDsRequest, PaymentSender |
9 | 7 |
|
10 | 8 |
|
11 | 9 | class PaymentMethodsType(str, Enum): |
| 10 | + ALIPAY_CN = 'alipay_cn' |
| 11 | + ALIPAY_HK = 'alipay_hk' |
| 12 | + ALMA = 'alma' |
12 | 13 | APPLEPAY = 'applepay' |
13 | 14 | BANCONTACT = 'bancontact' |
| 15 | + BENEFIT = 'benefit' |
| 16 | + BIZUM = 'bizum' |
14 | 17 | CARD = 'card' |
| 18 | + DANA = 'dana' |
15 | 19 | EPS = 'eps' |
16 | | - GIROPAY = 'giropay' |
| 20 | + GCASH = 'gcash' |
17 | 21 | GOOGLEPAY = 'googlepay' |
18 | 22 | IDEAL = 'ideal' |
| 23 | + KAKAOPAY = 'kakaopay' |
| 24 | + KLARNA = 'klarna' |
19 | 25 | KNET = 'knet' |
| 26 | + MBWAY = 'mbway' |
| 27 | + MOBILEPAY = 'mobilepay' |
20 | 28 | MULTIBANCO = 'multibanco' |
21 | | - PRZELEWY24 = 'p24' |
| 29 | + P24 = 'p24' |
22 | 30 | PAYPAL = 'paypal' |
23 | | - SOFORT = 'sofort' |
| 31 | + PLAID = 'plaid' |
| 32 | + QPAY = 'qpay' |
| 33 | + REMEMBER_ME = 'remember_me' |
| 34 | + SEPA = 'sepa' |
| 35 | + STCPAY = 'stcpay' |
| 36 | + STORED_CARD = 'stored_card' |
| 37 | + TABBY = 'tabby' |
| 38 | + TAMARA = 'tamara' |
| 39 | + TNG = 'tng' |
| 40 | + TRUEMONEY = 'truemoney' |
| 41 | + TWINT = 'twint' |
| 42 | + VIPPS = 'vipps' |
| 43 | + |
| 44 | + |
| 45 | +class Locale(str, Enum): |
| 46 | + AR = 'ar' |
| 47 | + DA_DK = 'da-DK' |
| 48 | + DE_DE = 'de-DE' |
| 49 | + EL = 'el' |
| 50 | + EN_GB = 'en-GB' |
| 51 | + ES_ES = 'es-ES' |
| 52 | + FI_FI = 'fi-FI' |
| 53 | + FIL_PH = 'fil-PH' |
| 54 | + FR_FR = 'fr-FR' |
| 55 | + HI_IN = 'hi-IN' |
| 56 | + ID_ID = 'id-ID' |
| 57 | + IT_IT = 'it-IT' |
| 58 | + JA_JP = 'ja-JP' |
| 59 | + KO_KR = 'ko-KR' |
| 60 | + MS_MY = 'ms-MY' |
| 61 | + NB_NO = 'nb-NO' |
| 62 | + NL_NL = 'nl-NL' |
| 63 | + PT_PT = 'pt-PT' |
| 64 | + SV_SE = 'sv-SE' |
| 65 | + TH_TH = 'th-TH' |
| 66 | + VI_VN = 'vi-VN' |
| 67 | + ZH_CN = 'zh-CN' |
| 68 | + ZH_HK = 'zh-HK' |
| 69 | + ZH_TW = 'zh-TW' |
24 | 70 |
|
25 | 71 |
|
26 | 72 | class StorePaymentDetails(str, Enum): |
27 | 73 | DISABLED = 'disabled' |
28 | 74 | ENABLED = 'enabled' |
| 75 | + COLLECT_CONSENT = 'collect_consent' |
| 76 | + |
| 77 | + |
| 78 | +class InstructionPurpose(str, Enum): |
| 79 | + DONATIONS = 'donations' |
| 80 | + EDUCATION = 'education' |
| 81 | + EMERGENCY_NEED = 'emergency_need' |
| 82 | + EXPATRIATION = 'expatriation' |
| 83 | + FAMILY_SUPPORT = 'family_support' |
| 84 | + FINANCIAL_SERVICES = 'financial_services' |
| 85 | + GIFTS = 'gifts' |
| 86 | + INCOME = 'income' |
| 87 | + INSURANCE = 'insurance' |
| 88 | + INVESTMENT = 'investment' |
| 89 | + IT_SERVICES = 'it_services' |
| 90 | + LEISURE = 'leisure' |
| 91 | + LOAN_PAYMENT = 'loan_payment' |
| 92 | + MEDICAL_TREATMENT = 'medical_treatment' |
| 93 | + OTHER = 'other' |
| 94 | + PENSION = 'pension' |
| 95 | + ROYALTIES = 'royalties' |
| 96 | + SAVINGS = 'savings' |
| 97 | + TRAVEL_AND_TOURISM = 'travel_and_tourism' |
| 98 | + |
| 99 | + |
| 100 | +class Instruction: |
| 101 | + purpose: InstructionPurpose |
| 102 | + |
| 103 | + |
| 104 | +class CustomerRetry: |
| 105 | + max_attempts: int |
| 106 | + |
| 107 | + |
| 108 | +class AccountHolderType(str, Enum): |
| 109 | + INDIVIDUAL = 'individual' |
| 110 | + CORPORATE = 'corporate' |
| 111 | + GOVERNMENT = 'government' |
| 112 | + |
| 113 | + |
| 114 | +class BillingAddress: |
| 115 | + country: str |
| 116 | + address_line1: str |
| 117 | + address_line2: str |
| 118 | + city: str |
| 119 | + state: str |
| 120 | + zip: str |
| 121 | + |
| 122 | + |
| 123 | +class BillingPhone: |
| 124 | + country_code: str |
| 125 | + number: str |
| 126 | + |
| 127 | + |
| 128 | +class SessionBilling: |
| 129 | + address: BillingAddress |
| 130 | + phone: BillingPhone |
| 131 | + |
29 | 132 |
|
| 133 | +class AccountHolder: |
| 134 | + type: AccountHolderType |
30 | 135 |
|
31 | | -class Billing: |
32 | | - address: Address |
| 136 | + def __init__(self, type_p: AccountHolderType): |
| 137 | + self.type = type_p |
33 | 138 |
|
34 | 139 |
|
35 | | -class Card: |
| 140 | +class IndividualAccountHolder(AccountHolder): |
| 141 | + first_name: str |
| 142 | + last_name: str |
| 143 | + middle_name: str |
| 144 | + account_name_inquiry: bool |
| 145 | + |
| 146 | + def __init__(self): |
| 147 | + super().__init__(AccountHolderType.INDIVIDUAL) |
| 148 | + |
| 149 | + |
| 150 | +class CorporateAccountHolder(AccountHolder): |
| 151 | + company_name: str |
| 152 | + account_name_inquiry: bool |
| 153 | + |
| 154 | + def __init__(self): |
| 155 | + super().__init__(AccountHolderType.CORPORATE) |
| 156 | + |
| 157 | + |
| 158 | +class ApplePayConfiguration: |
| 159 | + store_payment_details: StorePaymentDetails |
| 160 | + account_holder: AccountHolder |
| 161 | + |
| 162 | + |
| 163 | +class CardConfiguration: |
36 | 164 | store_payment_details: StorePaymentDetails |
| 165 | + account_holder: AccountHolder |
37 | 166 |
|
38 | 167 |
|
39 | | -class PaymentMethodConfiguration: |
40 | | - card: Card |
| 168 | +class GooglePayConfiguration: |
| 169 | + store_payment_details: StorePaymentDetails |
| 170 | + account_holder: AccountHolder |
| 171 | + |
| 172 | + |
| 173 | +class StoredCardConfiguration: |
| 174 | + customer_id: str |
| 175 | + instrument_ids: list # list of strings |
| 176 | + default_instrument_id: str |
| 177 | + |
| 178 | + |
| 179 | +class SessionPaymentMethodConfiguration: |
| 180 | + applepay: ApplePayConfiguration |
| 181 | + card: CardConfiguration |
| 182 | + googlepay: GooglePayConfiguration |
| 183 | + stored_card: StoredCardConfiguration |
| 184 | + |
| 185 | + |
| 186 | +class Item: |
| 187 | + name: str |
| 188 | + quantity: int |
| 189 | + unit_price: int |
| 190 | + reference: str |
| 191 | + commodity_code: str |
| 192 | + unit_of_measure: str |
| 193 | + total_amount: int |
| 194 | + tax_amount: int |
| 195 | + discount_amount: int |
| 196 | + url: str |
| 197 | + image_url: str |
41 | 198 |
|
42 | 199 |
|
43 | 200 | class PaymentSessionsRequest: |
44 | 201 | amount: int |
45 | 202 | currency: Currency |
| 203 | + billing: SessionBilling |
| 204 | + success_url: str |
| 205 | + failure_url: str |
46 | 206 | payment_type: PaymentType |
47 | | - billing: BillingInformation |
48 | 207 | billing_descriptor: BillingDescriptor |
49 | 208 | reference: str |
50 | 209 | description: str |
51 | 210 | customer: PaymentCustomerRequest |
52 | | - customer: CustomerRequest |
53 | 211 | shipping: ShippingDetails |
54 | 212 | recipient: PaymentRecipient |
55 | 213 | processing: ProcessingSettings |
| 214 | + instruction: Instruction |
56 | 215 | processing_channel_id: str |
| 216 | + payment_method_configuration: SessionPaymentMethodConfiguration |
| 217 | + items: list # Item |
| 218 | + amount_allocations: list # AmountAllocations |
| 219 | + risk: RiskRequest |
| 220 | + display_name: str |
| 221 | + metadata: dict |
| 222 | + locale: str |
| 223 | + three_ds: ThreeDsRequest |
| 224 | + sender: PaymentSender |
| 225 | + capture: bool |
| 226 | + capture_on: datetime |
57 | 227 | expires_on: datetime |
58 | | - payment_method_configuration: PaymentMethodConfiguration |
59 | 228 | enabled_payment_methods: list # PaymentMethodsType |
60 | 229 | disabled_payment_methods: list # PaymentMethodsType |
61 | | - items: list # payments.Product |
62 | | - amount_allocations: list # values of AmountAllocations |
63 | | - risk: RiskRequest |
64 | | - customer_retry: PaymentRetryRequest |
65 | | - display_name: str |
| 230 | + customer_retry: CustomerRetry |
| 231 | + ip_address: str |
| 232 | + |
| 233 | + |
| 234 | +class PaymentSessionWithPaymentRequest: |
| 235 | + session_data: str |
| 236 | + amount: int |
| 237 | + currency: Currency |
| 238 | + billing: SessionBilling |
66 | 239 | success_url: str |
67 | 240 | failure_url: str |
| 241 | + payment_type: PaymentType |
| 242 | + billing_descriptor: BillingDescriptor |
| 243 | + reference: str |
| 244 | + description: str |
| 245 | + customer: PaymentCustomerRequest |
| 246 | + shipping: ShippingDetails |
| 247 | + recipient: PaymentRecipient |
| 248 | + processing: ProcessingSettings |
| 249 | + instruction: Instruction |
| 250 | + processing_channel_id: str |
| 251 | + payment_method_configuration: SessionPaymentMethodConfiguration |
| 252 | + items: list # Item |
| 253 | + amount_allocations: list # AmountAllocations |
| 254 | + risk: RiskRequest |
| 255 | + display_name: str |
68 | 256 | metadata: dict |
69 | 257 | locale: str |
70 | 258 | three_ds: ThreeDsRequest |
71 | 259 | sender: PaymentSender |
72 | 260 | capture: bool |
73 | 261 | capture_on: datetime |
| 262 | + |
| 263 | + |
| 264 | +class SubmitPaymentSessionRequest: |
| 265 | + session_data: str |
| 266 | + amount: int |
| 267 | + reference: str |
| 268 | + items: list # Item |
| 269 | + three_ds: ThreeDsRequest |
74 | 270 | ip_address: str |
0 commit comments