mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-18 22:34:21 +01:00
fix errors merchant
Co-Authored-By: itsdeka <dario.moceri@bitfinex.com>
This commit is contained in:
@@ -339,4 +339,13 @@ class RestAuthenticatedEndpoints(Middleware):
|
||||
|
||||
data = to_snake_case_keys(self._POST("auth/w/ext/pay/invoice/create", body=body))
|
||||
|
||||
return InvoiceSubmission.parse(data)
|
||||
return InvoiceSubmission.parse(data)
|
||||
|
||||
def get_invoices(self, id: Optional[str] = None, start: Optional[str] = None, end: Optional[str] = None, limit: Optional[int] = None) -> List[InvoiceSubmission]:
|
||||
return [ InvoiceSubmission.parse(sub_data) for sub_data in self._POST("auth/r/ext/pay/invoices", body={
|
||||
"id": id, "start": start, "end": end,
|
||||
"limit": limit
|
||||
}) ]
|
||||
|
||||
def get_invoice_count_stats(self, status: Literal["CREATED", "PENDING", "COMPLETED", "EXPIRED"], format: str) -> List[InvoiceCountStats]:
|
||||
return [ InvoiceCountStats(**sub_data) for sub_data in self._POST("auth/r/ext/pay/invoice/stats/count", body={ "status": status, "format": format }) ]
|
||||
@@ -564,7 +564,6 @@ class DerivativePositionCollateralLimits(_Type):
|
||||
#endregion
|
||||
|
||||
#region Type hinting for models which are not serializable
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class InvoiceSubmission(_Type):
|
||||
id: str
|
||||
@@ -590,7 +589,7 @@ class InvoiceSubmission(_Type):
|
||||
for index, invoice in enumerate(data["invoices"]):
|
||||
data["invoices"][index] = Invoice(**invoice)
|
||||
|
||||
return cls(**data)
|
||||
return InvoiceSubmission(**data)
|
||||
|
||||
@compose(dataclass, partial)
|
||||
class CustomerInfo(_Type):
|
||||
@@ -614,4 +613,9 @@ class Invoice(_Type):
|
||||
address: str
|
||||
ext: JSON
|
||||
|
||||
@dataclass
|
||||
class InvoiceCountStats(_Type):
|
||||
time: str
|
||||
count: float
|
||||
|
||||
#endregion
|
||||
@@ -27,4 +27,8 @@ print(bfx.rest.auth.submit_invoice(
|
||||
order_id="order123",
|
||||
customer_info=customer_info,
|
||||
pay_currencies=["ETH"]
|
||||
))
|
||||
))
|
||||
|
||||
print(bfx.rest.auth.get_invoices())
|
||||
|
||||
print(bfx.rest.auth.get_invoice_count_stats(status="CREATED", format="Y"))
|
||||
Reference in New Issue
Block a user