Skip to content

Commit

Permalink
Merge pull request #73 from mwarzybok-sumoheavy/feature/SP-738
Browse files Browse the repository at this point in the history
SP-738 Type Review: Python
  • Loading branch information
bobbrodie authored Jan 30, 2024
2 parents 646e232 + a9a9831 commit 93fa2d1
Show file tree
Hide file tree
Showing 49 changed files with 6,832 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/bitpay/models/invoice/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pydantic import Field
from .buyer import Buyer
from .buyer_provided_info import BuyerProvidedInfo
from .invoice_refund_addresses import InvoiceRefundAddresses
from .miner_fees import MinerFees
from .refund_info import RefundInfo
from .shopper import Shopper
Expand Down Expand Up @@ -46,7 +47,7 @@ class Invoice(BitPayModel):
payment_codes: Union[Dict[str, Dict[str, str]], None] = None
acceptance_window: Union[int, None] = None
buyer: Union[Buyer, None] = None
refund_addresses: Union[List[str], None] = None
refund_addresses: Union[List[Dict[str, InvoiceRefundAddresses]], None] = None
close_url: Union[str, None] = Field(alias="closeURL", default=None)
auto_redirect: Union[bool, None] = False
json_paypro_required: Union[bool, None] = False
Expand Down
16 changes: 16 additions & 0 deletions src/bitpay/models/invoice/invoice_refund_addresses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from datetime import datetime
from pydantic import field_serializer
from typing import Union

from bitpay.models.bitpay_model import BitPayModel


class InvoiceRefundAddresses(BitPayModel):
date: Union[datetime, None]
email: Union[str, None]
tag: Union[int, None] = None
type: Union[str, None] = None

@field_serializer("date")
def serialize_datetime(self, dt: datetime) -> str:
return super().serialize_datetime_to_iso8601(dt)
2 changes: 2 additions & 0 deletions src/bitpay/models/invoice/invoice_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ class InvoiceWebhook(BitPayModel):
status: Union[str, None] = None
transaction_currency: Union[str, None] = None
url: Union[str, None] = None
in_invoice_id: Union[str, None] = None
in_payment_request: Union[str, None] = None
8 changes: 8 additions & 0 deletions src/bitpay/models/invoice/refund_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ class RefundWebhook(BitPayModel):
request_date: Union[datetime, None] = None
status: Union[str, None] = None
support_request: Union[str, None] = None
reference: Union[str, None] = None
guid: Union[str, None] = None
refund_address: Union[str, None] = None
type: Union[str, None] = None
txid: Union[str, None] = None
transaction_currency: Union[str, None] = None
transaction_amount: Union[float, None] = None
transaction_refund_fee: Union[float, None] = None

@field_serializer("request_date", "last_refund_notification")
def serialize_datetime(self, dt: datetime) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/bitpay/models/payout/payout_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PayoutTransaction(BitPayModel):
txid: Union[str, None] = None
amount: Union[float, None] = None
date: Union[datetime, None] = None
confirmations: Union[str, None] = None
confirmations: Union[int, None] = None

@field_serializer("date")
def serialize_datetime_to_iso8601(self, dt: datetime) -> str:
Expand Down
32 changes: 32 additions & 0 deletions src/bitpay/models/payout/payout_webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from datetime import datetime
from pydantic import field_serializer
from typing import Union, Dict, List

from bitpay.models.bitpay_model import BitPayModel
from bitpay.models.payout.payout_transaction import PayoutTransaction


class PayoutWebhook(BitPayModel):
id: Union[str, None] = None
recipient_id: Union[str, None] = None
shopper_id: Union[str, None] = None
price: Union[float, None] = None
currency: Union[str, None] = None
ledger_currency: Union[str, None] = None
exchange_rates: Union[Dict[str, Dict[str, float]], None] = None
email: Union[str, None] = None
reference: Union[str, None] = None
label: Union[str, None] = None
notification_url: Union[str, None] = None
notification_email: Union[str, None] = None
effective_date: Union[datetime, None] = None
request_date: Union[datetime, None] = None
status: Union[str, None] = None
transactions: Union[List[PayoutTransaction], None] = None
account_id: Union[str, None] = None
date_executed: Union[datetime, None] = None
group_id: Union[str, None] = None

@field_serializer("effective_date", "request_date")
def serialize_datetime(self, dt: datetime) -> str:
return super().serialize_datetime_to_iso8601(dt)
Loading

0 comments on commit 93fa2d1

Please sign in to comment.