inttegro.resources.payouts
Generated public typing surface. Do not edit by hand.
1"""Typed payout operations for transfers from an Inttegro balance.""" 2 3from __future__ import annotations 4 5from ..http_client import HttpClient 6from inttegro.payout.destinations_input import DestinationsInput 7from inttegro.payout.page import Page 8from inttegro.payout.page_request import PageRequest 9from inttegro.payout.payout import Payout 10from inttegro.payout.set_destinations_request import SetDestinationsRequest 11from inttegro.payout.settings_lookup import SettingsLookup 12from inttegro.payout.settings_mutation import SettingsMutation 13from inttegro.schedule.payout_request import PayoutRequest 14from inttegro.search import Page as SearchPage, Request as SearchRequest 15 16 17class Payouts: 18 """Configure payout routing and inspect payout lifecycle state. 19 20 Access this resource through :attr:`inttegro.Client.payouts`. Successful 21 responses are decoded into the payout models named in each return annotation; 22 callers do not need to traverse response envelopes or parse timestamps. 23 """ 24 25 def __init__(self, http: HttpClient) -> None: 26 """Create the resource with the client's authenticated HTTP transport.""" 27 self.http = http 28 29 def set_destinations( 30 self, 31 destinations: SetDestinationsRequest | DestinationsInput, 32 ) -> SettingsMutation: 33 """Assign the financial account that receives GHS payouts. 34 35 Pass :class:`DestinationsInput` for the concise form, or a complete 36 :class:`SetDestinationsRequest`. An empty ``ghs`` string removes the 37 existing assignment. The returned :class:`SettingsMutation` exposes the 38 updated ``destinations`` directly. 39 40 Example:: 41 42 settings = client.payouts.set_destinations( 43 DestinationsInput(ghs="fa_123") 44 ) 45 print(settings.destinations.ghs) 46 """ 47 if isinstance(destinations, SetDestinationsRequest): 48 return self.http.post("/payouts/set_destinations", destinations) 49 return self.http.post( 50 "/payouts/set_destinations", 51 SetDestinationsRequest(destinations=destinations), 52 ) 53 54 def settings(self) -> SettingsLookup: 55 """Return the complete payout settings read model. 56 57 ``destinations`` is a typed object with a ``ghs`` attribute. ``schedule`` 58 exposes its interval, execution day, and nested aging specification; it is 59 ``None`` when no schedule is configured. 60 """ 61 return self.http.post("/payouts/settings", {}) 62 63 def schedule(self, payload: PayoutRequest) -> Payout: 64 """Schedule a payout using typed destination, limit, reference, and time fields. 65 66 ``execute_after`` accepts a timezone-aware :class:`datetime.datetime` and 67 is serialized by the request model. The response is a :class:`Payout` 68 whose timestamp fields are parsed as datetimes. 69 """ 70 return self.http.post("/payouts/schedule", payload) 71 72 def lookup(self, payout_id: str) -> Payout: 73 """Retrieve one payout by its ``po_`` identifier.""" 74 return self.http.post("/payouts/lookup", {"payout_id": payout_id}) 75 76 def disable_automatic(self) -> SettingsMutation: 77 """Switch to manual payout scheduling and return the changed settings.""" 78 return self.http.post("/payouts/disable", {}) 79 80 def enable_automatic(self) -> SettingsMutation: 81 """Restore automatic payout scheduling and return the changed settings.""" 82 return self.http.post("/payouts/enable", {}) 83 84 def enable_fx(self) -> SettingsMutation: 85 """Enable payout currency conversion and return the changed settings.""" 86 return self.http.post("/payouts/enable_fx", {}) 87 88 def disable_fx(self) -> SettingsMutation: 89 """Disable payout currency conversion and return the changed settings.""" 90 return self.http.post("/payouts/disable_fx", {}) 91 92 def page(self, payload: PageRequest) -> Page: 93 """Return a typed page of payouts in reverse chronological order. 94 95 ``page_number`` is one-based and required. ``page_size`` is optional and 96 limited to 256. Each item is a :class:`Payout`, not a dictionary. 97 98 Example:: 99 100 page = client.payouts.page(PageRequest(page_number=1, page_size=50)) 101 for payout in page.payouts or []: 102 print(payout.id, payout.status, payout.initiated_at) 103 """ 104 return self.http.post("/payouts/page", payload) 105 106 def search(self, payload: SearchRequest) -> SearchPage: 107 """Search payout projections owned by the authenticated application.""" 108 return self.http.post("/payouts/search", payload) 109 110 def cancel(self, payout_id: str) -> Payout: 111 """Cancel a scheduled payout and return its updated typed representation.""" 112 return self.http.post("/payouts/cancel", {"payout_id": payout_id})
18class Payouts: 19 """Configure payout routing and inspect payout lifecycle state. 20 21 Access this resource through :attr:`inttegro.Client.payouts`. Successful 22 responses are decoded into the payout models named in each return annotation; 23 callers do not need to traverse response envelopes or parse timestamps. 24 """ 25 26 def __init__(self, http: HttpClient) -> None: 27 """Create the resource with the client's authenticated HTTP transport.""" 28 self.http = http 29 30 def set_destinations( 31 self, 32 destinations: SetDestinationsRequest | DestinationsInput, 33 ) -> SettingsMutation: 34 """Assign the financial account that receives GHS payouts. 35 36 Pass :class:`DestinationsInput` for the concise form, or a complete 37 :class:`SetDestinationsRequest`. An empty ``ghs`` string removes the 38 existing assignment. The returned :class:`SettingsMutation` exposes the 39 updated ``destinations`` directly. 40 41 Example:: 42 43 settings = client.payouts.set_destinations( 44 DestinationsInput(ghs="fa_123") 45 ) 46 print(settings.destinations.ghs) 47 """ 48 if isinstance(destinations, SetDestinationsRequest): 49 return self.http.post("/payouts/set_destinations", destinations) 50 return self.http.post( 51 "/payouts/set_destinations", 52 SetDestinationsRequest(destinations=destinations), 53 ) 54 55 def settings(self) -> SettingsLookup: 56 """Return the complete payout settings read model. 57 58 ``destinations`` is a typed object with a ``ghs`` attribute. ``schedule`` 59 exposes its interval, execution day, and nested aging specification; it is 60 ``None`` when no schedule is configured. 61 """ 62 return self.http.post("/payouts/settings", {}) 63 64 def schedule(self, payload: PayoutRequest) -> Payout: 65 """Schedule a payout using typed destination, limit, reference, and time fields. 66 67 ``execute_after`` accepts a timezone-aware :class:`datetime.datetime` and 68 is serialized by the request model. The response is a :class:`Payout` 69 whose timestamp fields are parsed as datetimes. 70 """ 71 return self.http.post("/payouts/schedule", payload) 72 73 def lookup(self, payout_id: str) -> Payout: 74 """Retrieve one payout by its ``po_`` identifier.""" 75 return self.http.post("/payouts/lookup", {"payout_id": payout_id}) 76 77 def disable_automatic(self) -> SettingsMutation: 78 """Switch to manual payout scheduling and return the changed settings.""" 79 return self.http.post("/payouts/disable", {}) 80 81 def enable_automatic(self) -> SettingsMutation: 82 """Restore automatic payout scheduling and return the changed settings.""" 83 return self.http.post("/payouts/enable", {}) 84 85 def enable_fx(self) -> SettingsMutation: 86 """Enable payout currency conversion and return the changed settings.""" 87 return self.http.post("/payouts/enable_fx", {}) 88 89 def disable_fx(self) -> SettingsMutation: 90 """Disable payout currency conversion and return the changed settings.""" 91 return self.http.post("/payouts/disable_fx", {}) 92 93 def page(self, payload: PageRequest) -> Page: 94 """Return a typed page of payouts in reverse chronological order. 95 96 ``page_number`` is one-based and required. ``page_size`` is optional and 97 limited to 256. Each item is a :class:`Payout`, not a dictionary. 98 99 Example:: 100 101 page = client.payouts.page(PageRequest(page_number=1, page_size=50)) 102 for payout in page.payouts or []: 103 print(payout.id, payout.status, payout.initiated_at) 104 """ 105 return self.http.post("/payouts/page", payload) 106 107 def search(self, payload: SearchRequest) -> SearchPage: 108 """Search payout projections owned by the authenticated application.""" 109 return self.http.post("/payouts/search", payload) 110 111 def cancel(self, payout_id: str) -> Payout: 112 """Cancel a scheduled payout and return its updated typed representation.""" 113 return self.http.post("/payouts/cancel", {"payout_id": payout_id})
Configure payout routing and inspect payout lifecycle state.
Access this resource through inttegro.Client.payouts. Successful
responses are decoded into the payout models named in each return annotation;
callers do not need to traverse response envelopes or parse timestamps.
26 def __init__(self, http: HttpClient) -> None: 27 """Create the resource with the client's authenticated HTTP transport.""" 28 self.http = http
Create the resource with the client's authenticated HTTP transport.
30 def set_destinations( 31 self, 32 destinations: SetDestinationsRequest | DestinationsInput, 33 ) -> SettingsMutation: 34 """Assign the financial account that receives GHS payouts. 35 36 Pass :class:`DestinationsInput` for the concise form, or a complete 37 :class:`SetDestinationsRequest`. An empty ``ghs`` string removes the 38 existing assignment. The returned :class:`SettingsMutation` exposes the 39 updated ``destinations`` directly. 40 41 Example:: 42 43 settings = client.payouts.set_destinations( 44 DestinationsInput(ghs="fa_123") 45 ) 46 print(settings.destinations.ghs) 47 """ 48 if isinstance(destinations, SetDestinationsRequest): 49 return self.http.post("/payouts/set_destinations", destinations) 50 return self.http.post( 51 "/payouts/set_destinations", 52 SetDestinationsRequest(destinations=destinations), 53 )
Assign the financial account that receives GHS payouts.
Pass DestinationsInput for the concise form, or a complete
SetDestinationsRequest. An empty ghs string removes the
existing assignment. The returned SettingsMutation exposes the
updated destinations directly.
Example::
settings = client.payouts.set_destinations(
DestinationsInput(ghs="fa_123")
)
print(settings.destinations.ghs)
55 def settings(self) -> SettingsLookup: 56 """Return the complete payout settings read model. 57 58 ``destinations`` is a typed object with a ``ghs`` attribute. ``schedule`` 59 exposes its interval, execution day, and nested aging specification; it is 60 ``None`` when no schedule is configured. 61 """ 62 return self.http.post("/payouts/settings", {})
Return the complete payout settings read model.
destinations is a typed object with a ghs attribute. schedule
exposes its interval, execution day, and nested aging specification; it is
None when no schedule is configured.
64 def schedule(self, payload: PayoutRequest) -> Payout: 65 """Schedule a payout using typed destination, limit, reference, and time fields. 66 67 ``execute_after`` accepts a timezone-aware :class:`datetime.datetime` and 68 is serialized by the request model. The response is a :class:`Payout` 69 whose timestamp fields are parsed as datetimes. 70 """ 71 return self.http.post("/payouts/schedule", payload)
Schedule a payout using typed destination, limit, reference, and time fields.
execute_after accepts a timezone-aware datetime.datetime and
is serialized by the request model. The response is a Payout
whose timestamp fields are parsed as datetimes.
73 def lookup(self, payout_id: str) -> Payout: 74 """Retrieve one payout by its ``po_`` identifier.""" 75 return self.http.post("/payouts/lookup", {"payout_id": payout_id})
Retrieve one payout by its po_ identifier.
77 def disable_automatic(self) -> SettingsMutation: 78 """Switch to manual payout scheduling and return the changed settings.""" 79 return self.http.post("/payouts/disable", {})
Switch to manual payout scheduling and return the changed settings.
81 def enable_automatic(self) -> SettingsMutation: 82 """Restore automatic payout scheduling and return the changed settings.""" 83 return self.http.post("/payouts/enable", {})
Restore automatic payout scheduling and return the changed settings.
85 def enable_fx(self) -> SettingsMutation: 86 """Enable payout currency conversion and return the changed settings.""" 87 return self.http.post("/payouts/enable_fx", {})
Enable payout currency conversion and return the changed settings.
89 def disable_fx(self) -> SettingsMutation: 90 """Disable payout currency conversion and return the changed settings.""" 91 return self.http.post("/payouts/disable_fx", {})
Disable payout currency conversion and return the changed settings.
93 def page(self, payload: PageRequest) -> Page: 94 """Return a typed page of payouts in reverse chronological order. 95 96 ``page_number`` is one-based and required. ``page_size`` is optional and 97 limited to 256. Each item is a :class:`Payout`, not a dictionary. 98 99 Example:: 100 101 page = client.payouts.page(PageRequest(page_number=1, page_size=50)) 102 for payout in page.payouts or []: 103 print(payout.id, payout.status, payout.initiated_at) 104 """ 105 return self.http.post("/payouts/page", payload)
Return a typed page of payouts in reverse chronological order.
page_number is one-based and required. page_size is optional and
limited to 256. Each item is a Payout, not a dictionary.
Example::
page = client.payouts.page(PageRequest(page_number=1, page_size=50))
for payout in page.payouts or []:
print(payout.id, payout.status, payout.initiated_at)
107 def search(self, payload: SearchRequest) -> SearchPage: 108 """Search payout projections owned by the authenticated application.""" 109 return self.http.post("/payouts/search", payload)
Search payout projections owned by the authenticated application.