mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-20 07:14:20 +01:00
fix errors merchant
Co-Authored-By: itsdeka <dario.moceri@bitfinex.com>
This commit is contained in:
@@ -340,3 +340,12 @@ class RestAuthenticatedEndpoints(Middleware):
|
|||||||
data = to_snake_case_keys(self._POST("auth/w/ext/pay/invoice/create", body=body))
|
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
|
#endregion
|
||||||
|
|
||||||
#region Type hinting for models which are not serializable
|
#region Type hinting for models which are not serializable
|
||||||
|
|
||||||
@compose(dataclass, partial)
|
@compose(dataclass, partial)
|
||||||
class InvoiceSubmission(_Type):
|
class InvoiceSubmission(_Type):
|
||||||
id: str
|
id: str
|
||||||
@@ -590,7 +589,7 @@ class InvoiceSubmission(_Type):
|
|||||||
for index, invoice in enumerate(data["invoices"]):
|
for index, invoice in enumerate(data["invoices"]):
|
||||||
data["invoices"][index] = Invoice(**invoice)
|
data["invoices"][index] = Invoice(**invoice)
|
||||||
|
|
||||||
return cls(**data)
|
return InvoiceSubmission(**data)
|
||||||
|
|
||||||
@compose(dataclass, partial)
|
@compose(dataclass, partial)
|
||||||
class CustomerInfo(_Type):
|
class CustomerInfo(_Type):
|
||||||
@@ -614,4 +613,9 @@ class Invoice(_Type):
|
|||||||
address: str
|
address: str
|
||||||
ext: JSON
|
ext: JSON
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class InvoiceCountStats(_Type):
|
||||||
|
time: str
|
||||||
|
count: float
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -28,3 +28,7 @@ print(bfx.rest.auth.submit_invoice(
|
|||||||
customer_info=customer_info,
|
customer_info=customer_info,
|
||||||
pay_currencies=["ETH"]
|
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