airwallex-sdk 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airwallex/__init__.py +74 -0
- airwallex/api/__init__.py +37 -0
- airwallex/api/account.py +107 -0
- airwallex/api/account_detail.py +469 -0
- airwallex/api/base.py +488 -0
- airwallex/api/beneficiary.py +156 -0
- airwallex/api/financial_transaction.py +123 -0
- airwallex/api/invoice.py +257 -0
- airwallex/api/issuing_authorization.py +313 -0
- airwallex/api/issuing_card.py +411 -0
- airwallex/api/issuing_cardholder.py +234 -0
- airwallex/api/issuing_config.py +80 -0
- airwallex/api/issuing_digital_wallet_token.py +249 -0
- airwallex/api/issuing_transaction.py +231 -0
- airwallex/api/issuing_transaction_dispute.py +339 -0
- airwallex/api/payment.py +148 -0
- airwallex/client.py +396 -0
- airwallex/exceptions.py +222 -0
- airwallex/models/__init__.py +69 -0
- airwallex/models/account.py +51 -0
- airwallex/models/account_detail.py +259 -0
- airwallex/models/base.py +121 -0
- airwallex/models/beneficiary.py +70 -0
- airwallex/models/financial_transaction.py +30 -0
- airwallex/models/fx.py +58 -0
- airwallex/models/invoice.py +102 -0
- airwallex/models/issuing_authorization.py +41 -0
- airwallex/models/issuing_card.py +135 -0
- airwallex/models/issuing_cardholder.py +52 -0
- airwallex/models/issuing_common.py +83 -0
- airwallex/models/issuing_config.py +62 -0
- airwallex/models/issuing_digital_wallet_token.py +38 -0
- airwallex/models/issuing_transaction.py +42 -0
- airwallex/models/issuing_transaction_dispute.py +59 -0
- airwallex/models/payment.py +81 -0
- airwallex/utils.py +107 -0
- airwallex_sdk-0.1.0.dist-info/METADATA +202 -0
- airwallex_sdk-0.1.0.dist-info/RECORD +39 -0
- airwallex_sdk-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Invoice API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any, Union
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field, validator
|
7
|
+
from .base import AirwallexModel
|
8
|
+
|
9
|
+
|
10
|
+
class RecurringBilling(AirwallexModel):
|
11
|
+
"""Model for recurring billing information."""
|
12
|
+
period: int = Field(..., description="The length of the billing cycle")
|
13
|
+
period_unit: str = Field(..., description="The unit of the billing cycle, e.g., 'MONTH', 'YEAR'")
|
14
|
+
|
15
|
+
|
16
|
+
class PriceTier(AirwallexModel):
|
17
|
+
"""Model for price tier information."""
|
18
|
+
amount: float = Field(..., description="The price for this tier")
|
19
|
+
upper_bound: Optional[float] = Field(None, description="The upper bound of this tier")
|
20
|
+
|
21
|
+
|
22
|
+
class Price(AirwallexModel):
|
23
|
+
"""Model for price information."""
|
24
|
+
id: str = Field(..., description="Unique price ID")
|
25
|
+
name: str = Field(..., description="Price name")
|
26
|
+
description: Optional[str] = Field(None, description="Price description")
|
27
|
+
active: bool = Field(..., description="Whether this price is active")
|
28
|
+
currency: str = Field(..., description="Currency code (ISO 4217)")
|
29
|
+
product_id: str = Field(..., description="ID of the associated product")
|
30
|
+
pricing_model: str = Field(..., description="Pricing model type (e.g., 'tiered')")
|
31
|
+
recurring: Optional[RecurringBilling] = Field(None, description="Recurring billing details")
|
32
|
+
tiers: Optional[List[PriceTier]] = Field(None, description="Pricing tiers for tiered pricing")
|
33
|
+
metadata: Optional[Dict[str, str]] = Field(None, description="Additional metadata")
|
34
|
+
request_id: Optional[str] = Field(None, description="Request ID when creating this price")
|
35
|
+
|
36
|
+
|
37
|
+
class InvoiceItem(AirwallexModel):
|
38
|
+
"""Model for an Airwallex invoice item."""
|
39
|
+
id: str = Field(..., description="Unique invoice item ID")
|
40
|
+
invoice_id: str = Field(..., description="ID of the invoice this item belongs to")
|
41
|
+
amount: float = Field(..., description="Amount for this invoice item")
|
42
|
+
currency: str = Field(..., description="Currency code (ISO 4217)")
|
43
|
+
period_start_at: datetime = Field(..., description="Billing period start (inclusive)")
|
44
|
+
period_end_at: datetime = Field(..., description="Billing period end (exclusive)")
|
45
|
+
price: Price = Field(..., description="Price details")
|
46
|
+
quantity: Optional[float] = Field(None, description="Product quantity")
|
47
|
+
|
48
|
+
|
49
|
+
class Invoice(AirwallexModel):
|
50
|
+
"""Model for an Airwallex invoice."""
|
51
|
+
resource_name: str = "invoices"
|
52
|
+
|
53
|
+
id: str = Field(..., description="Unique invoice ID")
|
54
|
+
customer_id: str = Field(..., description="ID of the customer who will be charged")
|
55
|
+
subscription_id: Optional[str] = Field(None, description="ID of the subscription which generated this invoice")
|
56
|
+
currency: str = Field(..., description="Currency code (ISO 4217)")
|
57
|
+
total_amount: float = Field(..., description="Total amount of the invoice")
|
58
|
+
status: str = Field(..., description="Invoice status (SENT, PAID, PAYMENT_FAILED)")
|
59
|
+
payment_intent_id: Optional[str] = Field(None, description="ID of the associated payment intent")
|
60
|
+
period_start_at: datetime = Field(..., description="Billing period start (inclusive)")
|
61
|
+
period_end_at: datetime = Field(..., description="Billing period end (exclusive)")
|
62
|
+
created_at: datetime = Field(..., description="Invoice creation timestamp")
|
63
|
+
updated_at: Optional[datetime] = Field(None, description="Invoice last update timestamp")
|
64
|
+
paid_at: Optional[datetime] = Field(None, description="Timestamp when invoice was paid")
|
65
|
+
last_payment_attempt_at: Optional[datetime] = Field(None, description="Timestamp of last payment attempt")
|
66
|
+
next_payment_attempt_at: Optional[datetime] = Field(None, description="Timestamp of next scheduled payment attempt")
|
67
|
+
past_payment_attempt_count: Optional[int] = Field(None, description="Number of payment attempts made so far")
|
68
|
+
remaining_payment_attempt_count: Optional[int] = Field(None, description="Number of remaining payment attempts")
|
69
|
+
items: Optional[List[InvoiceItem]] = Field(None, description="Invoice items")
|
70
|
+
|
71
|
+
@validator('status')
|
72
|
+
def validate_status(cls, v):
|
73
|
+
"""Validate invoice status."""
|
74
|
+
valid_statuses = ['SENT', 'PAID', 'PAYMENT_FAILED']
|
75
|
+
if v not in valid_statuses:
|
76
|
+
raise ValueError(f"Status must be one of {valid_statuses}")
|
77
|
+
return v
|
78
|
+
|
79
|
+
|
80
|
+
class InvoicePreviewRequest(AirwallexModel):
|
81
|
+
"""Model for invoice preview request."""
|
82
|
+
customer_id: str = Field(..., description="ID of the customer for this invoice")
|
83
|
+
subscription_id: Optional[str] = Field(None, description="ID of the subscription to preview the invoice for")
|
84
|
+
trial_end_at: Optional[datetime] = Field(None, description="End of the trial period if applicable")
|
85
|
+
recurring: Optional[RecurringBilling] = Field(None, description="Recurring billing details")
|
86
|
+
|
87
|
+
class SubscriptionItem(AirwallexModel):
|
88
|
+
"""Model for subscription item in invoice preview."""
|
89
|
+
price_id: str = Field(..., description="ID of the price")
|
90
|
+
quantity: float = Field(1, description="Quantity of the product")
|
91
|
+
|
92
|
+
items: Optional[List[SubscriptionItem]] = Field(None, description="List of subscription items")
|
93
|
+
|
94
|
+
|
95
|
+
class InvoicePreviewResponse(AirwallexModel):
|
96
|
+
"""Model for invoice preview response."""
|
97
|
+
customer_id: str = Field(..., description="ID of the customer for this invoice")
|
98
|
+
subscription_id: Optional[str] = Field(None, description="ID of the subscription for this invoice")
|
99
|
+
currency: str = Field(..., description="Currency code (ISO 4217)")
|
100
|
+
total_amount: float = Field(..., description="Total amount of the invoice")
|
101
|
+
created_at: datetime = Field(..., description="Expected invoice creation timestamp")
|
102
|
+
items: List[InvoiceItem] = Field(..., description="Invoice items in the preview")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Authorization API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
from .issuing_common import Merchant, RiskDetails, HasMoreResponse
|
9
|
+
|
10
|
+
|
11
|
+
class Authorization(AirwallexModel):
|
12
|
+
"""Model for an Airwallex issuing authorization."""
|
13
|
+
resource_name: str = "issuing/authorizations"
|
14
|
+
|
15
|
+
acquiring_institution_identifier: Optional[str] = Field(None, description="Unique Identifier for acquiring institution")
|
16
|
+
auth_code: Optional[str] = Field(None, description="Authorization Code")
|
17
|
+
billing_amount: float = Field(..., description="Billing Amount")
|
18
|
+
billing_currency: str = Field(..., description="Billing Currency")
|
19
|
+
card_id: str = Field(..., description="Unique Identifier for card")
|
20
|
+
card_nickname: Optional[str] = Field(None, description="The nickname of the card used")
|
21
|
+
client_data: Optional[str] = Field(None, description="Client data stored against the card record")
|
22
|
+
create_time: datetime = Field(..., description="The time this outstanding authorization was created")
|
23
|
+
digital_wallet_token_id: Optional[str] = Field(None, description="Unique Identifier for digital token")
|
24
|
+
expiry_date: Optional[datetime] = Field(None, description="The authorization will expire after this date if not posted")
|
25
|
+
failure_reason: Optional[str] = Field(None, description="The reason why this authorization failed (if status is FAILED)")
|
26
|
+
lifecycle_id: Optional[str] = Field(None, description="A identifier that links multiple related transactions")
|
27
|
+
masked_card_number: Optional[str] = Field(None, description="Masked card number")
|
28
|
+
merchant: Optional[Merchant] = Field(None, description="Merchant details")
|
29
|
+
network_transaction_id: Optional[str] = Field(None, description="The transaction ID from network")
|
30
|
+
retrieval_ref: Optional[str] = Field(None, description="Transaction retrieval reference number")
|
31
|
+
risk_details: Optional[RiskDetails] = Field(None, description="Risk details")
|
32
|
+
status: str = Field(..., description="The status of this authorization")
|
33
|
+
transaction_amount: float = Field(..., description="Transaction amount")
|
34
|
+
transaction_currency: str = Field(..., description="Transaction currency")
|
35
|
+
transaction_id: str = Field(..., description="Unique id for transaction")
|
36
|
+
updated_by_transaction: Optional[str] = Field(None, description="Id of the transaction which updated status of this transaction")
|
37
|
+
|
38
|
+
|
39
|
+
class AuthorizationListResponse(HasMoreResponse):
|
40
|
+
"""Model for authorization list response."""
|
41
|
+
items: List[Authorization] = Field(..., description="List of authorizations")
|
@@ -0,0 +1,135 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Card API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
from .issuing_common import Address, TransactionUsage, DeliveryDetails, HasMoreResponse
|
9
|
+
|
10
|
+
|
11
|
+
class CardVersionInfo(AirwallexModel):
|
12
|
+
"""Model for card version information."""
|
13
|
+
card_number: str = Field(..., description="Masked card number")
|
14
|
+
card_status: str = Field(..., description="Current card status")
|
15
|
+
card_version: int = Field(..., description="Card version")
|
16
|
+
created_at: datetime = Field(..., description="Creation time of the card version")
|
17
|
+
|
18
|
+
|
19
|
+
class SpendLimit(AirwallexModel):
|
20
|
+
"""Model for spend limit."""
|
21
|
+
amount: float = Field(..., description="Limit amount")
|
22
|
+
interval: str = Field(..., description="Limit interval (e.g., 'PER_TRANSACTION')")
|
23
|
+
remaining: Optional[float] = Field(None, description="Remaining limit amount")
|
24
|
+
|
25
|
+
|
26
|
+
class CardLimits(AirwallexModel):
|
27
|
+
"""Model for card limits."""
|
28
|
+
cash_withdrawal_limits: List[SpendLimit] = Field(..., description="Cash withdrawal limits")
|
29
|
+
currency: str = Field(..., description="Currency of limits")
|
30
|
+
limits: List[SpendLimit] = Field(..., description="Spending limits")
|
31
|
+
|
32
|
+
|
33
|
+
class PrimaryContactDetails(AirwallexModel):
|
34
|
+
"""Model for primary contact details."""
|
35
|
+
email: Optional[str] = Field(None, description="Email address")
|
36
|
+
name: Optional[str] = Field(None, description="Name")
|
37
|
+
phone_number: Optional[str] = Field(None, description="Phone number")
|
38
|
+
|
39
|
+
|
40
|
+
class CardProgram(AirwallexModel):
|
41
|
+
"""Model for card program."""
|
42
|
+
id: str = Field(..., description="Program ID")
|
43
|
+
name: str = Field(..., description="Program name")
|
44
|
+
|
45
|
+
|
46
|
+
class AuthorizationControls(AirwallexModel):
|
47
|
+
"""Model for card authorization controls."""
|
48
|
+
active_from: Optional[datetime] = Field(None, description="Start time for card validity")
|
49
|
+
active_to: Optional[datetime] = Field(None, description="End time for card validity")
|
50
|
+
allowed_currencies: Optional[List[str]] = Field(None, description="Allowed currencies")
|
51
|
+
allowed_merchant_categories: Optional[List[str]] = Field(None, description="Allowed merchant category codes")
|
52
|
+
allowed_transaction_count: Optional[str] = Field(None, description="Allowed transaction count (SINGLE or MULTIPLE)")
|
53
|
+
blocked_transaction_usages: Optional[List[TransactionUsage]] = Field(None, description="Blocked transaction usages")
|
54
|
+
country_limitations: Optional[List[str]] = Field(None, description="Country limitations")
|
55
|
+
spend_limits: Optional[List[SpendLimit]] = Field(None, description="Spend limits")
|
56
|
+
|
57
|
+
|
58
|
+
class CardCreateRequest(AirwallexModel):
|
59
|
+
"""Model for card creation request."""
|
60
|
+
activate_on_issue: Optional[bool] = Field(None, description="Activate on issue")
|
61
|
+
additional_cardholder_ids: Optional[List[str]] = Field(None, description="Additional cardholder IDs")
|
62
|
+
authorization_controls: AuthorizationControls = Field(..., description="Authorization controls")
|
63
|
+
brand: Optional[str] = Field(None, description="Card brand")
|
64
|
+
cardholder_id: str = Field(..., description="Cardholder ID")
|
65
|
+
client_data: Optional[str] = Field(None, description="Client data")
|
66
|
+
created_by: str = Field(..., description="Full legal name of user requesting new card")
|
67
|
+
form_factor: str = Field(..., description="Form factor (PHYSICAL or VIRTUAL)")
|
68
|
+
funding_source_id: Optional[str] = Field(None, description="Funding source ID")
|
69
|
+
is_personalized: bool = Field(..., description="Whether the card is personalized")
|
70
|
+
metadata: Optional[Dict[str, str]] = Field(None, description="Metadata")
|
71
|
+
nick_name: Optional[str] = Field(None, description="Card nickname")
|
72
|
+
note: Optional[str] = Field(None, description="Note")
|
73
|
+
postal_address: Optional[Address] = Field(None, description="Postal address")
|
74
|
+
program: CardProgram = Field(..., description="Card program")
|
75
|
+
purpose: Optional[str] = Field(None, description="Card purpose")
|
76
|
+
request_id: str = Field(..., description="Request ID")
|
77
|
+
|
78
|
+
|
79
|
+
class CardUpdateRequest(AirwallexModel):
|
80
|
+
"""Model for card update request."""
|
81
|
+
additional_cardholder_ids: Optional[List[str]] = Field(None, description="Additional cardholder IDs")
|
82
|
+
authorization_controls: Optional[AuthorizationControls] = Field(None, description="Authorization controls")
|
83
|
+
card_status: Optional[str] = Field(None, description="Card status")
|
84
|
+
cardholder_id: Optional[str] = Field(None, description="Cardholder ID")
|
85
|
+
metadata: Optional[Dict[str, str]] = Field(None, description="Metadata")
|
86
|
+
nick_name: Optional[str] = Field(None, description="Card nickname")
|
87
|
+
purpose: Optional[str] = Field(None, description="Card purpose")
|
88
|
+
|
89
|
+
|
90
|
+
class Card(AirwallexModel):
|
91
|
+
"""Model for an Airwallex issuing card."""
|
92
|
+
resource_name: str = "issuing/cards"
|
93
|
+
|
94
|
+
activate_on_issue: Optional[bool] = Field(None, description="Activate on issue")
|
95
|
+
additional_cardholder_ids: Optional[List[str]] = Field(None, description="Additional cardholder IDs")
|
96
|
+
all_card_versions: Optional[List[CardVersionInfo]] = Field(None, description="All card versions")
|
97
|
+
authorization_controls: AuthorizationControls = Field(..., description="Authorization controls")
|
98
|
+
brand: str = Field(..., description="Card brand")
|
99
|
+
card_id: str = Field(..., description="Card ID")
|
100
|
+
card_number: str = Field(..., description="Masked card number")
|
101
|
+
card_status: str = Field(..., description="Card status")
|
102
|
+
card_version: int = Field(..., description="Card version")
|
103
|
+
cardholder_id: str = Field(..., description="Cardholder ID")
|
104
|
+
client_data: Optional[str] = Field(None, description="Client data")
|
105
|
+
created_at: datetime = Field(..., description="Creation time")
|
106
|
+
created_by: str = Field(..., description="Created by")
|
107
|
+
delivery_details: Optional[DeliveryDetails] = Field(None, description="Delivery details")
|
108
|
+
form_factor: str = Field(..., description="Form factor")
|
109
|
+
funding_source_id: Optional[str] = Field(None, description="Funding source ID")
|
110
|
+
is_personalized: bool = Field(..., description="Whether the card is personalized")
|
111
|
+
issue_to: str = Field(..., description="Who the card is issued to")
|
112
|
+
metadata: Optional[Dict[str, str]] = Field(None, description="Metadata")
|
113
|
+
name_on_card: Optional[str] = Field(None, description="Name on card")
|
114
|
+
nick_name: Optional[str] = Field(None, description="Nickname")
|
115
|
+
note: Optional[str] = Field(None, description="Note")
|
116
|
+
postal_address: Optional[Address] = Field(None, description="Postal address")
|
117
|
+
primary_contact_details: Optional[PrimaryContactDetails] = Field(None, description="Primary contact details")
|
118
|
+
program: CardProgram = Field(..., description="Card program")
|
119
|
+
purpose: Optional[str] = Field(None, description="Purpose")
|
120
|
+
request_id: str = Field(..., description="Request ID")
|
121
|
+
updated_at: datetime = Field(..., description="Last update time")
|
122
|
+
|
123
|
+
|
124
|
+
class CardDetails(AirwallexModel):
|
125
|
+
"""Model for sensitive card details."""
|
126
|
+
card_number: str = Field(..., description="Full card number")
|
127
|
+
cvv: str = Field(..., description="Card verification value")
|
128
|
+
expiry_month: int = Field(..., description="Expiry month")
|
129
|
+
expiry_year: int = Field(..., description="Expiry year")
|
130
|
+
name_on_card: str = Field(..., description="Name on card")
|
131
|
+
|
132
|
+
|
133
|
+
class CardListResponse(HasMoreResponse):
|
134
|
+
"""Model for card list response."""
|
135
|
+
items: List[Card] = Field(..., description="List of cards")
|
@@ -0,0 +1,52 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Cardholder API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any, Literal
|
5
|
+
from pydantic import Field, EmailStr
|
6
|
+
from .base import AirwallexModel
|
7
|
+
from .issuing_common import Address, Name, Employer, HasMoreResponse
|
8
|
+
|
9
|
+
|
10
|
+
class Individual(AirwallexModel):
|
11
|
+
"""Model for individual cardholder details."""
|
12
|
+
address: Address = Field(..., description="Address of the cardholder")
|
13
|
+
cardholder_agreement_terms_consent_obtained: Optional[str] = Field(None, description="Whether consent was obtained")
|
14
|
+
date_of_birth: str = Field(..., description="Date of birth in YYYY-MM-DD format")
|
15
|
+
employers: Optional[List[Employer]] = Field(None, description="Employers")
|
16
|
+
express_consent_obtained: Optional[str] = Field(None, description="Whether express consent was obtained")
|
17
|
+
name: Name = Field(..., description="Name of the cardholder")
|
18
|
+
|
19
|
+
|
20
|
+
class CardholderCreateRequest(AirwallexModel):
|
21
|
+
"""Model for cardholder creation request."""
|
22
|
+
email: EmailStr = Field(..., description="Email address of the cardholder")
|
23
|
+
individual: Individual = Field(..., description="Details about the cardholder")
|
24
|
+
mobile_number: Optional[str] = Field(None, description="Mobile number of the cardholder")
|
25
|
+
postal_address: Optional[Address] = Field(None, description="Postal address of the cardholder")
|
26
|
+
type: str = Field(..., description="The type of cardholder (INDIVIDUAL or DELEGATE)")
|
27
|
+
|
28
|
+
|
29
|
+
class CardholderUpdateRequest(AirwallexModel):
|
30
|
+
"""Model for cardholder update request."""
|
31
|
+
individual: Optional[Individual] = Field(None, description="Details about the cardholder")
|
32
|
+
mobile_number: Optional[str] = Field(None, description="Mobile number of the cardholder")
|
33
|
+
postal_address: Optional[Address] = Field(None, description="Postal address of the cardholder")
|
34
|
+
type: Optional[str] = Field(None, description="The type of cardholder (INDIVIDUAL or DELEGATE)")
|
35
|
+
|
36
|
+
|
37
|
+
class Cardholder(AirwallexModel):
|
38
|
+
"""Model for an Airwallex cardholder."""
|
39
|
+
resource_name: str = "issuing/cardholders"
|
40
|
+
|
41
|
+
cardholder_id: str = Field(..., description="Unique Identifier for cardholder")
|
42
|
+
email: EmailStr = Field(..., description="Email address of the cardholder")
|
43
|
+
individual: Optional[Individual] = Field(None, description="Details about the cardholder")
|
44
|
+
mobile_number: Optional[str] = Field(None, description="The mobile number of the cardholder")
|
45
|
+
postal_address: Optional[Address] = Field(None, description="Postal address for the cardholder")
|
46
|
+
status: str = Field(..., description="The status of the cardholder (PENDING, READY, DISABLED, INCOMPLETE)")
|
47
|
+
type: str = Field(..., description="The type of cardholder (INDIVIDUAL or DELEGATE)")
|
48
|
+
|
49
|
+
|
50
|
+
class CardholderListResponse(HasMoreResponse):
|
51
|
+
"""Model for cardholder list response."""
|
52
|
+
items: List[Cardholder] = Field(..., description="List of cardholders")
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"""
|
2
|
+
Common models for the Airwallex Issuing API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any, Union
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field, EmailStr
|
7
|
+
from .base import AirwallexModel
|
8
|
+
|
9
|
+
|
10
|
+
class Address(AirwallexModel):
|
11
|
+
"""Model for address information."""
|
12
|
+
city: str = Field(..., description="City")
|
13
|
+
country: str = Field(..., description="Country code (ISO 3166-1 alpha-2)")
|
14
|
+
line1: str = Field(..., description="Street address line 1")
|
15
|
+
line2: Optional[str] = Field(None, description="Street address line 2")
|
16
|
+
postcode: Optional[str] = Field(None, description="Postal or ZIP code")
|
17
|
+
state: Optional[str] = Field(None, description="State or province")
|
18
|
+
|
19
|
+
|
20
|
+
class Name(AirwallexModel):
|
21
|
+
"""Model for person name."""
|
22
|
+
first_name: str = Field(..., description="First name")
|
23
|
+
last_name: str = Field(..., description="Last name")
|
24
|
+
middle_name: Optional[str] = Field(None, description="Middle name")
|
25
|
+
title: Optional[str] = Field(None, description="Title (Mr, Mrs, etc.)")
|
26
|
+
|
27
|
+
|
28
|
+
class BusinessIdentifier(AirwallexModel):
|
29
|
+
"""Model for business identifier."""
|
30
|
+
country_code: str = Field(..., description="Country code (ISO 3166-1 alpha-2)")
|
31
|
+
number: str = Field(..., description="Identifier number")
|
32
|
+
type: str = Field(..., description="Identifier type (e.g., 'BRN')")
|
33
|
+
|
34
|
+
|
35
|
+
class Employer(AirwallexModel):
|
36
|
+
"""Model for employer information."""
|
37
|
+
business_name: str = Field(..., description="Business name")
|
38
|
+
business_identifiers: Optional[List[BusinessIdentifier]] = Field(None, description="Business identifiers")
|
39
|
+
|
40
|
+
|
41
|
+
class Merchant(AirwallexModel):
|
42
|
+
"""Model for merchant information."""
|
43
|
+
category_code: Optional[str] = Field(None, description="Merchant category code")
|
44
|
+
city: Optional[str] = Field(None, description="Merchant city")
|
45
|
+
country: Optional[str] = Field(None, description="Merchant country")
|
46
|
+
identifier: Optional[str] = Field(None, description="Merchant identifier")
|
47
|
+
name: Optional[str] = Field(None, description="Merchant name")
|
48
|
+
postcode: Optional[str] = Field(None, description="Merchant postal code")
|
49
|
+
state: Optional[str] = Field(None, description="Merchant state")
|
50
|
+
|
51
|
+
|
52
|
+
class RiskDetails(AirwallexModel):
|
53
|
+
"""Model for risk details."""
|
54
|
+
risk_actions_performed: Optional[List[str]] = Field(None, description="Risk actions performed")
|
55
|
+
risk_factors: Optional[List[str]] = Field(None, description="Risk factors identified")
|
56
|
+
three_dsecure_outcome: Optional[str] = Field(None, description="3D Secure outcome")
|
57
|
+
|
58
|
+
|
59
|
+
class DeviceInformation(AirwallexModel):
|
60
|
+
"""Model for device information."""
|
61
|
+
device_id: Optional[str] = Field(None, description="Device identifier")
|
62
|
+
device_type: Optional[str] = Field(None, description="Device type")
|
63
|
+
|
64
|
+
|
65
|
+
class TransactionUsage(AirwallexModel):
|
66
|
+
"""Model for transaction usage."""
|
67
|
+
transaction_scope: str = Field(..., description="Transaction scope (e.g., 'MAGSTRIPE')")
|
68
|
+
usage_scope: str = Field(..., description="Usage scope (e.g., 'INTERNATIONAL')")
|
69
|
+
|
70
|
+
|
71
|
+
class DeliveryDetails(AirwallexModel):
|
72
|
+
"""Model for delivery details."""
|
73
|
+
delivery_method: Optional[str] = Field(None, description="Delivery method")
|
74
|
+
tracking_number: Optional[str] = Field(None, description="Tracking number")
|
75
|
+
courier: Optional[str] = Field(None, description="Courier")
|
76
|
+
status: Optional[str] = Field(None, description="Delivery status")
|
77
|
+
estimated_delivery_date: Optional[datetime] = Field(None, description="Estimated delivery date")
|
78
|
+
|
79
|
+
|
80
|
+
class HasMoreResponse(AirwallexModel):
|
81
|
+
"""Base model for paginated responses with has_more field."""
|
82
|
+
has_more: bool = Field(..., description="Whether there are more items available")
|
83
|
+
items: List[Any] = Field(..., description="List of items")
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Config API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
from .issuing_common import TransactionUsage
|
9
|
+
|
10
|
+
|
11
|
+
class RemoteAuthSettings(AirwallexModel):
|
12
|
+
"""Model for remote auth settings."""
|
13
|
+
created_at: Optional[datetime] = Field(None, description="Creation timestamp")
|
14
|
+
default_action: Optional[str] = Field(None, description="Default action when remote auth fails")
|
15
|
+
enabled: Optional[bool] = Field(None, description="Whether remote auth is enabled")
|
16
|
+
shared_secret: Optional[str] = Field(None, description="Shared secret key")
|
17
|
+
updated_at: Optional[datetime] = Field(None, description="Last update timestamp")
|
18
|
+
url: Optional[str] = Field(None, description="Remote auth endpoint URL")
|
19
|
+
|
20
|
+
|
21
|
+
class RemoteCallMethod(AirwallexModel):
|
22
|
+
"""Model for remote call method."""
|
23
|
+
name: str = Field(..., description="Method name")
|
24
|
+
path: str = Field(..., description="Method path")
|
25
|
+
|
26
|
+
|
27
|
+
class RemoteCallConfig(AirwallexModel):
|
28
|
+
"""Model for remote call configuration."""
|
29
|
+
methods: List[RemoteCallMethod] = Field(..., description="Available methods")
|
30
|
+
shared_secret: Optional[str] = Field(None, description="Shared secret key")
|
31
|
+
url: str = Field(..., description="Base URL")
|
32
|
+
|
33
|
+
|
34
|
+
class RemoteProvisioningConfig(AirwallexModel):
|
35
|
+
"""Model for remote provisioning configuration."""
|
36
|
+
activated: Optional[bool] = Field(None, description="Whether remote provisioning is activated")
|
37
|
+
shared_secret: Optional[str] = Field(None, description="Shared secret key")
|
38
|
+
url: Optional[str] = Field(None, description="Remote provisioning endpoint URL")
|
39
|
+
|
40
|
+
|
41
|
+
class SpendingLimitSettings(AirwallexModel):
|
42
|
+
"""Model for spending limit settings."""
|
43
|
+
default_limits: Optional[Dict[str, Dict[str, float]]] = Field(None, description="Default limits")
|
44
|
+
maximum_limits: Optional[Dict[str, Dict[str, float]]] = Field(None, description="Maximum limits")
|
45
|
+
|
46
|
+
|
47
|
+
class IssuingConfig(AirwallexModel):
|
48
|
+
"""Model for issuing configuration."""
|
49
|
+
resource_name: str = "issuing/config"
|
50
|
+
|
51
|
+
blocked_transaction_usages: Optional[List[TransactionUsage]] = Field(None, description="Blocked transaction usages")
|
52
|
+
remote_auth_settings: Optional[RemoteAuthSettings] = Field(None, description="Remote authorization settings")
|
53
|
+
remote_call_config: Optional[RemoteCallConfig] = Field(None, description="Remote call configuration")
|
54
|
+
remote_provisioning_config: Optional[RemoteProvisioningConfig] = Field(None, description="Remote provisioning configuration")
|
55
|
+
spending_limit_settings: Optional[SpendingLimitSettings] = Field(None, description="Spending limit settings")
|
56
|
+
|
57
|
+
|
58
|
+
class IssuingConfigUpdateRequest(AirwallexModel):
|
59
|
+
"""Model for issuing config update request."""
|
60
|
+
remote_auth: Optional[RemoteAuthSettings] = Field(None, description="Remote authorization configuration")
|
61
|
+
remote_call_config: Optional[RemoteCallConfig] = Field(None, description="Remote call configuration")
|
62
|
+
remote_provisioning_config: Optional[RemoteProvisioningConfig] = Field(None, description="Remote provisioning configuration")
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Digital Wallet Token API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
from .issuing_common import DeviceInformation, HasMoreResponse
|
9
|
+
|
10
|
+
|
11
|
+
class RiskInformation(AirwallexModel):
|
12
|
+
"""Model for token risk information."""
|
13
|
+
wallet_provider_account_score: Optional[str] = Field(None, description="Wallet provider account score")
|
14
|
+
wallet_provider_device_score: Optional[str] = Field(None, description="Wallet provider device score")
|
15
|
+
|
16
|
+
|
17
|
+
class DigitalWalletToken(AirwallexModel):
|
18
|
+
"""Model for an Airwallex digital wallet token."""
|
19
|
+
resource_name: str = "issuing/digital_wallet_tokens"
|
20
|
+
|
21
|
+
card_id: str = Field(..., description="Unique identifier for card associated with the token")
|
22
|
+
cardholder_id: str = Field(..., description="Unique identifier for cardholder associated with the token")
|
23
|
+
create_time: datetime = Field(..., description="The time this token was created")
|
24
|
+
device_information: Optional[DeviceInformation] = Field(None, description="Device information")
|
25
|
+
expiry_month: int = Field(..., description="Token expiry month")
|
26
|
+
expiry_year: int = Field(..., description="Token expiry year")
|
27
|
+
masked_card_number: str = Field(..., description="Masked card number")
|
28
|
+
pan_reference_id: str = Field(..., description="Unique identifier for the tokenization of this card")
|
29
|
+
risk_information: Optional[RiskInformation] = Field(None, description="Risk information")
|
30
|
+
token_id: str = Field(..., description="Unique Identifier for token")
|
31
|
+
token_reference_id: str = Field(..., description="Unique identifier of the digital wallet token within the card network")
|
32
|
+
token_status: str = Field(..., description="Status of the token")
|
33
|
+
token_type: str = Field(..., description="The type of this token")
|
34
|
+
|
35
|
+
|
36
|
+
class DigitalWalletTokenListResponse(HasMoreResponse):
|
37
|
+
"""Model for digital wallet token list response."""
|
38
|
+
items: List[DigitalWalletToken] = Field(..., description="List of digital wallet tokens")
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Transaction API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
from .issuing_common import Merchant, RiskDetails, HasMoreResponse
|
9
|
+
|
10
|
+
|
11
|
+
class Transaction(AirwallexModel):
|
12
|
+
"""Model for an Airwallex issuing transaction."""
|
13
|
+
resource_name: str = "issuing/transactions"
|
14
|
+
|
15
|
+
acquiring_institution_identifier: Optional[str] = Field(None, description="Unique Identifier for acquiring institution")
|
16
|
+
auth_code: Optional[str] = Field(None, description="Authorization Code")
|
17
|
+
billing_amount: float = Field(..., description="Billing amount")
|
18
|
+
billing_currency: str = Field(..., description="Billing Currency")
|
19
|
+
card_id: str = Field(..., description="Unique Identifier for card")
|
20
|
+
card_nickname: Optional[str] = Field(None, description="The nickname of the card used")
|
21
|
+
client_data: Optional[str] = Field(None, description="Client data stored against the card record")
|
22
|
+
digital_wallet_token_id: Optional[str] = Field(None, description="Unique Identifier for digital token")
|
23
|
+
failure_reason: Optional[str] = Field(None, description="The reason why this transaction failed")
|
24
|
+
lifecycle_id: Optional[str] = Field(None, description="Lifecycle ID")
|
25
|
+
masked_card_number: str = Field(..., description="Masked card number")
|
26
|
+
matched_authorizations: Optional[List[str]] = Field(None, description="Matched authorization IDs")
|
27
|
+
merchant: Optional[Merchant] = Field(None, description="Merchant details")
|
28
|
+
network_transaction_id: Optional[str] = Field(None, description="Network transaction ID")
|
29
|
+
posted_date: Optional[datetime] = Field(None, description="Posted date")
|
30
|
+
retrieval_ref: Optional[str] = Field(None, description="Retrieval reference number")
|
31
|
+
risk_details: Optional[RiskDetails] = Field(None, description="Risk details")
|
32
|
+
status: str = Field(..., description="Transaction status")
|
33
|
+
transaction_amount: float = Field(..., description="Transaction amount")
|
34
|
+
transaction_currency: str = Field(..., description="Transaction currency")
|
35
|
+
transaction_date: datetime = Field(..., description="Transaction date")
|
36
|
+
transaction_id: str = Field(..., description="Transaction ID")
|
37
|
+
transaction_type: str = Field(..., description="Transaction type")
|
38
|
+
|
39
|
+
|
40
|
+
class TransactionListResponse(HasMoreResponse):
|
41
|
+
"""Model for transaction list response."""
|
42
|
+
items: List[Transaction] = Field(..., description="List of transactions")
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"""
|
2
|
+
Models for the Airwallex Issuing Transaction Dispute API.
|
3
|
+
"""
|
4
|
+
from typing import Optional, List, Dict, Any
|
5
|
+
from datetime import datetime
|
6
|
+
from pydantic import Field
|
7
|
+
from .base import AirwallexModel
|
8
|
+
|
9
|
+
|
10
|
+
class DisputeUpdateHistory(AirwallexModel):
|
11
|
+
"""Model for dispute update history."""
|
12
|
+
evidence_files: Optional[List[str]] = Field(None, description="Evidence files")
|
13
|
+
note: Optional[str] = Field(None, description="Note")
|
14
|
+
updated_at: datetime = Field(..., description="Update timestamp")
|
15
|
+
updated_by: str = Field(..., description="Entity that performed the update")
|
16
|
+
|
17
|
+
|
18
|
+
class TransactionDisputeCreateRequest(AirwallexModel):
|
19
|
+
"""Model for transaction dispute creation request."""
|
20
|
+
amount: Optional[float] = Field(None, description="The amount to be disputed")
|
21
|
+
evidence_files: Optional[List[str]] = Field(None, description="Evidence file IDs")
|
22
|
+
notes: Optional[str] = Field(None, description="Explanation for the dispute")
|
23
|
+
reason: str = Field(..., description="The reason for raising the dispute")
|
24
|
+
reference: Optional[str] = Field(None, description="Internal reference")
|
25
|
+
transaction_id: str = Field(..., description="The transaction ID to dispute")
|
26
|
+
|
27
|
+
|
28
|
+
class TransactionDisputeUpdateRequest(AirwallexModel):
|
29
|
+
"""Model for transaction dispute update request."""
|
30
|
+
amount: Optional[float] = Field(None, description="The disputed amount")
|
31
|
+
evidence_files: Optional[List[str]] = Field(None, description="Evidence file IDs")
|
32
|
+
notes: Optional[str] = Field(None, description="Explanation for the dispute")
|
33
|
+
reason: Optional[str] = Field(None, description="The reason for raising the dispute")
|
34
|
+
request_id: str = Field(..., description="A unique request ID")
|
35
|
+
|
36
|
+
|
37
|
+
class TransactionDispute(AirwallexModel):
|
38
|
+
"""Model for an Airwallex transaction dispute."""
|
39
|
+
resource_name: str = "issuing/transaction_disputes"
|
40
|
+
|
41
|
+
amount: float = Field(..., description="Dispute amount")
|
42
|
+
created_at: datetime = Field(..., description="Creation timestamp")
|
43
|
+
detailed_status: Optional[str] = Field(None, description="Detailed status")
|
44
|
+
id: str = Field(..., description="Unique identifier")
|
45
|
+
notes: Optional[str] = Field(None, description="Notes")
|
46
|
+
reason: str = Field(..., description="Dispute reason")
|
47
|
+
reference: Optional[str] = Field(None, description="Internal reference")
|
48
|
+
status: str = Field(..., description="Status")
|
49
|
+
transaction_id: str = Field(..., description="Transaction ID")
|
50
|
+
update_history: List[DisputeUpdateHistory] = Field(..., description="Update history")
|
51
|
+
updated_at: datetime = Field(..., description="Last update timestamp")
|
52
|
+
updated_by: str = Field(..., description="Last updated by")
|
53
|
+
|
54
|
+
|
55
|
+
class TransactionDisputeListResponse(AirwallexModel):
|
56
|
+
"""Model for transaction dispute list response."""
|
57
|
+
items: List[TransactionDispute] = Field(..., description="List of transaction disputes")
|
58
|
+
page_after: Optional[str] = Field(None, description="Page bookmark for next page")
|
59
|
+
page_before: Optional[str] = Field(None, description="Page bookmark for previous page")
|