mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Fix bug in bfxapi.rest.endpoints.merchant sub-package.
This commit is contained in:
@@ -569,63 +569,54 @@ class DerivativePositionCollateralLimits(_Type):
|
||||
class InvoiceSubmission(_Type):
|
||||
id: str
|
||||
t: int
|
||||
merchant_name: str
|
||||
type: Literal["ECOMMERCE", "POS"]
|
||||
duration: int
|
||||
amount: float
|
||||
currency: str
|
||||
order_id: str
|
||||
pay_currencies: List[str]
|
||||
webhook: Optional[str]
|
||||
redirect_url: Optional[str]
|
||||
status: Literal["CREATED", "PENDING", "COMPLETED", "EXPIRED"]
|
||||
customer_info: Optional["CustomerInfo"]
|
||||
payment: Optional["Payment"]
|
||||
invoices: List["Invoice"]
|
||||
customer_info: Optional["_CustomerInfo"]
|
||||
invoices: List["_Invoice"]
|
||||
payment: Optional["_Payment"]
|
||||
additional_payments: Optional[List["_Payment"]]
|
||||
|
||||
merchant_name: str
|
||||
|
||||
@classmethod
|
||||
def parse(cls, data: Dict[str, Any]) -> "InvoiceSubmission":
|
||||
if "customer_info" in data and data["customer_info"] != None:
|
||||
data["customer_info"] = CustomerInfo(**data["customer_info"])
|
||||
data["customer_info"] = _CustomerInfo(**data["customer_info"])
|
||||
|
||||
for index, invoice in enumerate(data["invoices"]):
|
||||
data["invoices"][index] = _Invoice(**invoice)
|
||||
|
||||
if "payment" in data and data["payment"] != None:
|
||||
data["payment"] = Payment(**data["payment"])
|
||||
data["payment"] = _Payment(**data["payment"])
|
||||
|
||||
if "invoices" in data and data["invoices"] != None:
|
||||
for index, invoice in enumerate(data["invoices"]):
|
||||
data["invoices"][index] = Invoice(**invoice)
|
||||
if "additional_payments" in data and data["additional_payments"] != None:
|
||||
for index, additional_payment in enumerate(data["additional_payments"]):
|
||||
data["additional_payments"][index] = _Payment(**additional_payment)
|
||||
|
||||
return InvoiceSubmission(**data)
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class CustomerInfo(_Type):
|
||||
class _CustomerInfo:
|
||||
nationality: str
|
||||
resid_country: str
|
||||
resid_state: Optional[str]
|
||||
resid_city: str
|
||||
resid_zip_code: str
|
||||
resid_street: str
|
||||
resid_building_no: str
|
||||
resid_building_no: Optional[str]
|
||||
full_name: str
|
||||
email: str
|
||||
tos_accepted: bool
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class Payment(_Type):
|
||||
transaction_id: str
|
||||
amount: str
|
||||
currency: str
|
||||
method: str
|
||||
status: str
|
||||
confirmations: int
|
||||
created: str
|
||||
updated: str
|
||||
deposit_id: int
|
||||
ledger_id: int
|
||||
force_completed: bool
|
||||
amount_diff: str
|
||||
additional_payments: JSON
|
||||
additional_payment: JSON
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class Invoice(_Type):
|
||||
class _Invoice:
|
||||
amount: float
|
||||
currency: str
|
||||
pay_currency: str
|
||||
@@ -633,6 +624,21 @@ class Invoice(_Type):
|
||||
address: str
|
||||
ext: JSON
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class _Payment:
|
||||
txid: str
|
||||
amount: float
|
||||
currency: str
|
||||
method: str
|
||||
status: Literal["CREATED", "COMPLETED", "PROCESSING"]
|
||||
confirmations: int
|
||||
created_at: str
|
||||
updated_at: str
|
||||
deposit_id: Optional[int]
|
||||
ledger_id: Optional[int]
|
||||
force_completed: Optional[bool]
|
||||
amount_diff: Optional[str]
|
||||
|
||||
@dataclass
|
||||
class InvoiceStats(_Type):
|
||||
time: str
|
||||
|
||||
Reference in New Issue
Block a user