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