nomba-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nomba_python/__init__.py +40 -0
- nomba_python/client.py +161 -0
- nomba_python/concurrency.py +54 -0
- nomba_python/data/__init__.py +0 -0
- nomba_python/data/nomba_openapi.json +13321 -0
- nomba_python/exceptions.py +49 -0
- nomba_python/flows/__init__.py +3 -0
- nomba_python/flows/card_payment.py +204 -0
- nomba_python/http.py +418 -0
- nomba_python/models.py +749 -0
- nomba_python/pagination.py +111 -0
- nomba_python/py.typed +0 -0
- nomba_python/resources/__init__.py +33 -0
- nomba_python/resources/accounts.py +379 -0
- nomba_python/resources/airtime_data.py +252 -0
- nomba_python/resources/cabletv.py +173 -0
- nomba_python/resources/charge.py +410 -0
- nomba_python/resources/checkout.py +239 -0
- nomba_python/resources/electricity.py +204 -0
- nomba_python/resources/terminals.py +184 -0
- nomba_python/resources/transactions.py +460 -0
- nomba_python/resources/transfers.py +298 -0
- nomba_python/resources/virtual_accounts.py +230 -0
- nomba_python/validation.py +97 -0
- nomba_python/webhooks.py +190 -0
- nomba_python-0.1.0.dist-info/METADATA +312 -0
- nomba_python-0.1.0.dist-info/RECORD +29 -0
- nomba_python-0.1.0.dist-info/WHEEL +4 -0
- nomba_python-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
# This file is auto-generated from Nomba's OpenAPI spec. Do not edit by hand;
|
|
2
|
+
# regenerate via scripts/generate_resources.py instead.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..http import AsyncNombaClient, NombaClient
|
|
7
|
+
from ..validation import validate_body
|
|
8
|
+
from .. import models as _models
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Charge:
|
|
12
|
+
"""Sync resource methods for the Charge group."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client: NombaClient) -> None:
|
|
15
|
+
self._client = client
|
|
16
|
+
|
|
17
|
+
def fetch_checkout_order_details(self, order_reference: str, **extra: object) -> _models.FetchCheckoutOrderDetailsResponse:
|
|
18
|
+
"""
|
|
19
|
+
Get Order details based on the generated Order reference
|
|
20
|
+
|
|
21
|
+
Use this endpoint to fetch a single checkout order, using the order reference that was returned when the Order was created
|
|
22
|
+
"""
|
|
23
|
+
path = f"/v1/checkout/order/{order_reference}"
|
|
24
|
+
params = None
|
|
25
|
+
return self._client.get(path, params=params) # type: ignore[return-value]
|
|
26
|
+
|
|
27
|
+
def submit_customer_card_details(self, *, card_details: object | None = None, key: object | None = None, order_reference: object | None = None, save_card: object | None = None, device_information: object | None = None, **extra: object) -> _models.SubmitCustomerCardDetailsResponse:
|
|
28
|
+
"""
|
|
29
|
+
Submit customer card details
|
|
30
|
+
|
|
31
|
+
Use this endpoint to submit the customers card details
|
|
32
|
+
|
|
33
|
+
Body fields:
|
|
34
|
+
cardDetails: Stringified card details
|
|
35
|
+
key: encryption key is data encrption is in use, else empty string
|
|
36
|
+
orderReference: the order reference returned when the order was created
|
|
37
|
+
saveCard: if true, this this user cardn will be saved for the user's future use. Note the process is not complete until the user-card verification endpoints are called to authenticate the user's phone number.
|
|
38
|
+
deviceInformation:
|
|
39
|
+
"""
|
|
40
|
+
path = "/v1/checkout/checkout-card-detail"
|
|
41
|
+
params = None
|
|
42
|
+
body: dict[str, object] = {}
|
|
43
|
+
if card_details is not None:
|
|
44
|
+
body["cardDetails"] = card_details
|
|
45
|
+
if key is not None:
|
|
46
|
+
body["key"] = key
|
|
47
|
+
if order_reference is not None:
|
|
48
|
+
body["orderReference"] = order_reference
|
|
49
|
+
if save_card is not None:
|
|
50
|
+
body["saveCard"] = save_card
|
|
51
|
+
if device_information is not None:
|
|
52
|
+
body["deviceInformation"] = device_information
|
|
53
|
+
body.update(extra)
|
|
54
|
+
validate_body("post", "/v1/checkout/checkout-card-detail", body)
|
|
55
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
56
|
+
|
|
57
|
+
def submit_customer_payment_otp(self, otp, order_reference, transaction_id, **extra: object) -> _models.SubmitCustomerPaymentOtpResponse:
|
|
58
|
+
"""
|
|
59
|
+
Submit customer card OTP
|
|
60
|
+
|
|
61
|
+
Use this endpoint to submit the payment OTP sent to the customer's phones from the payment gateway
|
|
62
|
+
|
|
63
|
+
Body fields:
|
|
64
|
+
otp (required): otp send to the customer's mobile phone
|
|
65
|
+
orderReference (required): order reference
|
|
66
|
+
transactionId (required): transaction id returend when the card details were submitted
|
|
67
|
+
"""
|
|
68
|
+
path = "/v1/checkout/checkout-card-otp"
|
|
69
|
+
params = None
|
|
70
|
+
body: dict[str, object] = {}
|
|
71
|
+
body["otp"] = otp
|
|
72
|
+
body["orderReference"] = order_reference
|
|
73
|
+
body["transactionId"] = transaction_id
|
|
74
|
+
body.update(extra)
|
|
75
|
+
validate_body("post", "/v1/checkout/checkout-card-otp", body)
|
|
76
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
77
|
+
|
|
78
|
+
def resend_customer_payment_otp(self, order_reference, **extra: object) -> _models.ResendCustomerPaymentOtpResponse:
|
|
79
|
+
"""
|
|
80
|
+
Resend OTP to customer's phone
|
|
81
|
+
|
|
82
|
+
Use this endpoint to resend the payment OTP to the customer's phone
|
|
83
|
+
|
|
84
|
+
Body fields:
|
|
85
|
+
orderReference (required): order reference
|
|
86
|
+
"""
|
|
87
|
+
path = "/v1/checkout/resend-otp"
|
|
88
|
+
params = None
|
|
89
|
+
body: dict[str, object] = {}
|
|
90
|
+
body["orderReference"] = order_reference
|
|
91
|
+
body.update(extra)
|
|
92
|
+
validate_body("post", "/v1/checkout/resend-otp", body)
|
|
93
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
94
|
+
|
|
95
|
+
def fetch_checkout_transaction_details(self, order_reference, **extra: object) -> _models.FetchCheckoutTransactionDetailsResponse:
|
|
96
|
+
"""
|
|
97
|
+
Fetch checkout transaction details
|
|
98
|
+
|
|
99
|
+
Use this endpoint to fetch the checkout transaction details and get the status of the transaction after OTP is submitted or transfer is made
|
|
100
|
+
|
|
101
|
+
Body fields:
|
|
102
|
+
orderReference (required): order reference
|
|
103
|
+
"""
|
|
104
|
+
path = "/v1/checkout/confirm-transaction-receipt"
|
|
105
|
+
params = None
|
|
106
|
+
body: dict[str, object] = {}
|
|
107
|
+
body["orderReference"] = order_reference
|
|
108
|
+
body.update(extra)
|
|
109
|
+
validate_body("post", "/v1/checkout/confirm-transaction-receipt", body)
|
|
110
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
111
|
+
|
|
112
|
+
def fetch_checkout_flash_account_number(self, order_reference: str, **extra: object) -> _models.FetchCheckoutFlashAccountNumberResponse:
|
|
113
|
+
"""
|
|
114
|
+
Fetch checkout Flash account number for transfer payment
|
|
115
|
+
|
|
116
|
+
Use this endpoint to Get a flash account number which the customer cna use to make a transfer payment.
|
|
117
|
+
"""
|
|
118
|
+
path = f"/v1/checkout/get-checkout-kta/{order_reference}"
|
|
119
|
+
params = None
|
|
120
|
+
return self._client.get(path, params=params) # type: ignore[return-value]
|
|
121
|
+
|
|
122
|
+
def request_user_otp_to_authenticate_user(self, order_reference, phone_number, **extra: object) -> _models.RequestUserOtpToAuthenticateUserResponse:
|
|
123
|
+
"""
|
|
124
|
+
Request OTP before saving a user's card
|
|
125
|
+
|
|
126
|
+
Use this endpoint to request an OTP to be sent to be sent to the users phone number to authenticate the user before saving the card. This endpoint is called after payment is successful, and the user requested to save their card for later.
|
|
127
|
+
|
|
128
|
+
Body fields:
|
|
129
|
+
orderReference (required): order reference
|
|
130
|
+
phoneNumber (required): customer's phone number
|
|
131
|
+
"""
|
|
132
|
+
path = "/v1/checkout/user-card/auth"
|
|
133
|
+
params = None
|
|
134
|
+
body: dict[str, object] = {}
|
|
135
|
+
body["orderReference"] = order_reference
|
|
136
|
+
body["phoneNumber"] = phone_number
|
|
137
|
+
body.update(extra)
|
|
138
|
+
validate_body("post", "/v1/checkout/user-card/auth", body)
|
|
139
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
140
|
+
|
|
141
|
+
def request_user_otp_to_authenticate_user_who_already_has_saved_cards(self, order_reference, **extra: object) -> _models.RequestUserOtpToAuthenticateUserWhoAlreadyHasSavedCardsResponse:
|
|
142
|
+
"""
|
|
143
|
+
Request OTP to validate a user before fetching saved cards
|
|
144
|
+
|
|
145
|
+
Use this endpoint to request an OTP to be sent to a user's phone number to authenticate before retrieving the saved cards mapped to the user's email. Use this endpoint when the Order details endpoint indicates the user already has saved cards.
|
|
146
|
+
|
|
147
|
+
Body fields:
|
|
148
|
+
orderReference (required): order reference
|
|
149
|
+
"""
|
|
150
|
+
path = "/v1/checkout/user-card/saved-card/auth"
|
|
151
|
+
params = None
|
|
152
|
+
body: dict[str, object] = {}
|
|
153
|
+
body["orderReference"] = order_reference
|
|
154
|
+
body.update(extra)
|
|
155
|
+
validate_body("post", "/v1/checkout/user-card/saved-card/auth", body)
|
|
156
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
157
|
+
|
|
158
|
+
def submit_user_otp(self, order_reference, phone_number, otp, **extra: object) -> _models.SubmitUserOtpResponse:
|
|
159
|
+
"""
|
|
160
|
+
Submit user OTP
|
|
161
|
+
|
|
162
|
+
Use this endpoint to submit the user OTP send to the user's mobile number. This will result in the user's card being saved for later use.
|
|
163
|
+
|
|
164
|
+
Body fields:
|
|
165
|
+
orderReference (required): order reference
|
|
166
|
+
phoneNumber (required): customer's phone number
|
|
167
|
+
otp (required): otp send to the customer's mobile phone
|
|
168
|
+
"""
|
|
169
|
+
path = "/v1/checkout/user-card"
|
|
170
|
+
params = None
|
|
171
|
+
body: dict[str, object] = {}
|
|
172
|
+
body["orderReference"] = order_reference
|
|
173
|
+
body["phoneNumber"] = phone_number
|
|
174
|
+
body["otp"] = otp
|
|
175
|
+
body.update(extra)
|
|
176
|
+
validate_body("post", "/v1/checkout/user-card", body)
|
|
177
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
178
|
+
|
|
179
|
+
def fetch_user_saved_cards(self, order_reference: str, *, otp: str, **extra: object) -> _models.FetchUserSavedCardsResponse:
|
|
180
|
+
"""
|
|
181
|
+
Get user saved cards
|
|
182
|
+
|
|
183
|
+
Use this endpoint to Get a user's saved cards. Requires user OTP send to the user after calling /checkout/user-card/saved-card/auth
|
|
184
|
+
"""
|
|
185
|
+
path = f"/v1/checkout/user-card/{order_reference}"
|
|
186
|
+
params: dict[str, object] = {}
|
|
187
|
+
if otp is not None:
|
|
188
|
+
params["otp"] = otp
|
|
189
|
+
return self._client.get(path, params=params) # type: ignore[return-value]
|
|
190
|
+
|
|
191
|
+
def cancel_checkout_transaction(self, transaction_id, force_cancel, **extra: object) -> _models.CancelCheckoutTransactionResponse:
|
|
192
|
+
"""
|
|
193
|
+
Cancel Checkout transaction
|
|
194
|
+
|
|
195
|
+
Use this endpoint to Cancel an incomplete checkout transaction
|
|
196
|
+
|
|
197
|
+
Body fields:
|
|
198
|
+
transactionId (required): the transaction Id returned when the card details were submitted
|
|
199
|
+
forceCancel (required): Force the cancelation of the transaction
|
|
200
|
+
"""
|
|
201
|
+
path = "/v1/checkout/transaction/cancel"
|
|
202
|
+
params = None
|
|
203
|
+
body: dict[str, object] = {}
|
|
204
|
+
body["transactionId"] = transaction_id
|
|
205
|
+
body["forceCancel"] = force_cancel
|
|
206
|
+
body.update(extra)
|
|
207
|
+
validate_body("post", "/v1/checkout/transaction/cancel", body)
|
|
208
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class AsyncCharge:
|
|
213
|
+
"""Async resource methods for the Charge group."""
|
|
214
|
+
|
|
215
|
+
def __init__(self, client: AsyncNombaClient) -> None:
|
|
216
|
+
self._client = client
|
|
217
|
+
|
|
218
|
+
async def fetch_checkout_order_details(self, order_reference: str, **extra: object) -> _models.FetchCheckoutOrderDetailsResponse:
|
|
219
|
+
"""
|
|
220
|
+
Get Order details based on the generated Order reference
|
|
221
|
+
|
|
222
|
+
Use this endpoint to fetch a single checkout order, using the order reference that was returned when the Order was created
|
|
223
|
+
"""
|
|
224
|
+
path = f"/v1/checkout/order/{order_reference}"
|
|
225
|
+
params = None
|
|
226
|
+
return await self._client.get(path, params=params) # type: ignore[return-value]
|
|
227
|
+
|
|
228
|
+
async def submit_customer_card_details(self, *, card_details: object | None = None, key: object | None = None, order_reference: object | None = None, save_card: object | None = None, device_information: object | None = None, **extra: object) -> _models.SubmitCustomerCardDetailsResponse:
|
|
229
|
+
"""
|
|
230
|
+
Submit customer card details
|
|
231
|
+
|
|
232
|
+
Use this endpoint to submit the customers card details
|
|
233
|
+
|
|
234
|
+
Body fields:
|
|
235
|
+
cardDetails: Stringified card details
|
|
236
|
+
key: encryption key is data encrption is in use, else empty string
|
|
237
|
+
orderReference: the order reference returned when the order was created
|
|
238
|
+
saveCard: if true, this this user cardn will be saved for the user's future use. Note the process is not complete until the user-card verification endpoints are called to authenticate the user's phone number.
|
|
239
|
+
deviceInformation:
|
|
240
|
+
"""
|
|
241
|
+
path = "/v1/checkout/checkout-card-detail"
|
|
242
|
+
params = None
|
|
243
|
+
body: dict[str, object] = {}
|
|
244
|
+
if card_details is not None:
|
|
245
|
+
body["cardDetails"] = card_details
|
|
246
|
+
if key is not None:
|
|
247
|
+
body["key"] = key
|
|
248
|
+
if order_reference is not None:
|
|
249
|
+
body["orderReference"] = order_reference
|
|
250
|
+
if save_card is not None:
|
|
251
|
+
body["saveCard"] = save_card
|
|
252
|
+
if device_information is not None:
|
|
253
|
+
body["deviceInformation"] = device_information
|
|
254
|
+
body.update(extra)
|
|
255
|
+
validate_body("post", "/v1/checkout/checkout-card-detail", body)
|
|
256
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
257
|
+
|
|
258
|
+
async def submit_customer_payment_otp(self, otp, order_reference, transaction_id, **extra: object) -> _models.SubmitCustomerPaymentOtpResponse:
|
|
259
|
+
"""
|
|
260
|
+
Submit customer card OTP
|
|
261
|
+
|
|
262
|
+
Use this endpoint to submit the payment OTP sent to the customer's phones from the payment gateway
|
|
263
|
+
|
|
264
|
+
Body fields:
|
|
265
|
+
otp (required): otp send to the customer's mobile phone
|
|
266
|
+
orderReference (required): order reference
|
|
267
|
+
transactionId (required): transaction id returend when the card details were submitted
|
|
268
|
+
"""
|
|
269
|
+
path = "/v1/checkout/checkout-card-otp"
|
|
270
|
+
params = None
|
|
271
|
+
body: dict[str, object] = {}
|
|
272
|
+
body["otp"] = otp
|
|
273
|
+
body["orderReference"] = order_reference
|
|
274
|
+
body["transactionId"] = transaction_id
|
|
275
|
+
body.update(extra)
|
|
276
|
+
validate_body("post", "/v1/checkout/checkout-card-otp", body)
|
|
277
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
278
|
+
|
|
279
|
+
async def resend_customer_payment_otp(self, order_reference, **extra: object) -> _models.ResendCustomerPaymentOtpResponse:
|
|
280
|
+
"""
|
|
281
|
+
Resend OTP to customer's phone
|
|
282
|
+
|
|
283
|
+
Use this endpoint to resend the payment OTP to the customer's phone
|
|
284
|
+
|
|
285
|
+
Body fields:
|
|
286
|
+
orderReference (required): order reference
|
|
287
|
+
"""
|
|
288
|
+
path = "/v1/checkout/resend-otp"
|
|
289
|
+
params = None
|
|
290
|
+
body: dict[str, object] = {}
|
|
291
|
+
body["orderReference"] = order_reference
|
|
292
|
+
body.update(extra)
|
|
293
|
+
validate_body("post", "/v1/checkout/resend-otp", body)
|
|
294
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
295
|
+
|
|
296
|
+
async def fetch_checkout_transaction_details(self, order_reference, **extra: object) -> _models.FetchCheckoutTransactionDetailsResponse:
|
|
297
|
+
"""
|
|
298
|
+
Fetch checkout transaction details
|
|
299
|
+
|
|
300
|
+
Use this endpoint to fetch the checkout transaction details and get the status of the transaction after OTP is submitted or transfer is made
|
|
301
|
+
|
|
302
|
+
Body fields:
|
|
303
|
+
orderReference (required): order reference
|
|
304
|
+
"""
|
|
305
|
+
path = "/v1/checkout/confirm-transaction-receipt"
|
|
306
|
+
params = None
|
|
307
|
+
body: dict[str, object] = {}
|
|
308
|
+
body["orderReference"] = order_reference
|
|
309
|
+
body.update(extra)
|
|
310
|
+
validate_body("post", "/v1/checkout/confirm-transaction-receipt", body)
|
|
311
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
312
|
+
|
|
313
|
+
async def fetch_checkout_flash_account_number(self, order_reference: str, **extra: object) -> _models.FetchCheckoutFlashAccountNumberResponse:
|
|
314
|
+
"""
|
|
315
|
+
Fetch checkout Flash account number for transfer payment
|
|
316
|
+
|
|
317
|
+
Use this endpoint to Get a flash account number which the customer cna use to make a transfer payment.
|
|
318
|
+
"""
|
|
319
|
+
path = f"/v1/checkout/get-checkout-kta/{order_reference}"
|
|
320
|
+
params = None
|
|
321
|
+
return await self._client.get(path, params=params) # type: ignore[return-value]
|
|
322
|
+
|
|
323
|
+
async def request_user_otp_to_authenticate_user(self, order_reference, phone_number, **extra: object) -> _models.RequestUserOtpToAuthenticateUserResponse:
|
|
324
|
+
"""
|
|
325
|
+
Request OTP before saving a user's card
|
|
326
|
+
|
|
327
|
+
Use this endpoint to request an OTP to be sent to be sent to the users phone number to authenticate the user before saving the card. This endpoint is called after payment is successful, and the user requested to save their card for later.
|
|
328
|
+
|
|
329
|
+
Body fields:
|
|
330
|
+
orderReference (required): order reference
|
|
331
|
+
phoneNumber (required): customer's phone number
|
|
332
|
+
"""
|
|
333
|
+
path = "/v1/checkout/user-card/auth"
|
|
334
|
+
params = None
|
|
335
|
+
body: dict[str, object] = {}
|
|
336
|
+
body["orderReference"] = order_reference
|
|
337
|
+
body["phoneNumber"] = phone_number
|
|
338
|
+
body.update(extra)
|
|
339
|
+
validate_body("post", "/v1/checkout/user-card/auth", body)
|
|
340
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
341
|
+
|
|
342
|
+
async def request_user_otp_to_authenticate_user_who_already_has_saved_cards(self, order_reference, **extra: object) -> _models.RequestUserOtpToAuthenticateUserWhoAlreadyHasSavedCardsResponse:
|
|
343
|
+
"""
|
|
344
|
+
Request OTP to validate a user before fetching saved cards
|
|
345
|
+
|
|
346
|
+
Use this endpoint to request an OTP to be sent to a user's phone number to authenticate before retrieving the saved cards mapped to the user's email. Use this endpoint when the Order details endpoint indicates the user already has saved cards.
|
|
347
|
+
|
|
348
|
+
Body fields:
|
|
349
|
+
orderReference (required): order reference
|
|
350
|
+
"""
|
|
351
|
+
path = "/v1/checkout/user-card/saved-card/auth"
|
|
352
|
+
params = None
|
|
353
|
+
body: dict[str, object] = {}
|
|
354
|
+
body["orderReference"] = order_reference
|
|
355
|
+
body.update(extra)
|
|
356
|
+
validate_body("post", "/v1/checkout/user-card/saved-card/auth", body)
|
|
357
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
358
|
+
|
|
359
|
+
async def submit_user_otp(self, order_reference, phone_number, otp, **extra: object) -> _models.SubmitUserOtpResponse:
|
|
360
|
+
"""
|
|
361
|
+
Submit user OTP
|
|
362
|
+
|
|
363
|
+
Use this endpoint to submit the user OTP send to the user's mobile number. This will result in the user's card being saved for later use.
|
|
364
|
+
|
|
365
|
+
Body fields:
|
|
366
|
+
orderReference (required): order reference
|
|
367
|
+
phoneNumber (required): customer's phone number
|
|
368
|
+
otp (required): otp send to the customer's mobile phone
|
|
369
|
+
"""
|
|
370
|
+
path = "/v1/checkout/user-card"
|
|
371
|
+
params = None
|
|
372
|
+
body: dict[str, object] = {}
|
|
373
|
+
body["orderReference"] = order_reference
|
|
374
|
+
body["phoneNumber"] = phone_number
|
|
375
|
+
body["otp"] = otp
|
|
376
|
+
body.update(extra)
|
|
377
|
+
validate_body("post", "/v1/checkout/user-card", body)
|
|
378
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
379
|
+
|
|
380
|
+
async def fetch_user_saved_cards(self, order_reference: str, *, otp: str, **extra: object) -> _models.FetchUserSavedCardsResponse:
|
|
381
|
+
"""
|
|
382
|
+
Get user saved cards
|
|
383
|
+
|
|
384
|
+
Use this endpoint to Get a user's saved cards. Requires user OTP send to the user after calling /checkout/user-card/saved-card/auth
|
|
385
|
+
"""
|
|
386
|
+
path = f"/v1/checkout/user-card/{order_reference}"
|
|
387
|
+
params: dict[str, object] = {}
|
|
388
|
+
if otp is not None:
|
|
389
|
+
params["otp"] = otp
|
|
390
|
+
return await self._client.get(path, params=params) # type: ignore[return-value]
|
|
391
|
+
|
|
392
|
+
async def cancel_checkout_transaction(self, transaction_id, force_cancel, **extra: object) -> _models.CancelCheckoutTransactionResponse:
|
|
393
|
+
"""
|
|
394
|
+
Cancel Checkout transaction
|
|
395
|
+
|
|
396
|
+
Use this endpoint to Cancel an incomplete checkout transaction
|
|
397
|
+
|
|
398
|
+
Body fields:
|
|
399
|
+
transactionId (required): the transaction Id returned when the card details were submitted
|
|
400
|
+
forceCancel (required): Force the cancelation of the transaction
|
|
401
|
+
"""
|
|
402
|
+
path = "/v1/checkout/transaction/cancel"
|
|
403
|
+
params = None
|
|
404
|
+
body: dict[str, object] = {}
|
|
405
|
+
body["transactionId"] = transaction_id
|
|
406
|
+
body["forceCancel"] = force_cancel
|
|
407
|
+
body.update(extra)
|
|
408
|
+
validate_body("post", "/v1/checkout/transaction/cancel", body)
|
|
409
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
410
|
+
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# This file is auto-generated from Nomba's OpenAPI spec. Do not edit by hand;
|
|
2
|
+
# regenerate via scripts/generate_resources.py instead.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ..http import AsyncNombaClient, NombaClient
|
|
6
|
+
from ..validation import validate_body
|
|
7
|
+
from .. import models as _models
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Checkout:
|
|
11
|
+
"""Sync resource methods for the Checkout group."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, client: NombaClient) -> None:
|
|
14
|
+
self._client = client
|
|
15
|
+
|
|
16
|
+
def create_an_online_checkout_order(self, order, *, tokenize_card: object | None = None, **extra: object) -> _models.CreateAnOnlineCheckoutOrderResponse:
|
|
17
|
+
"""
|
|
18
|
+
Create an online checkout order
|
|
19
|
+
|
|
20
|
+
You can use this endpoint to create an online checkout order. Load the URL returned in 'checkoutLink' property in a browser to allow your customer initiate payment.
|
|
21
|
+
|
|
22
|
+
Body fields:
|
|
23
|
+
order (required):
|
|
24
|
+
tokenizeCard: Determines if the card used for payment is to be tokenized
|
|
25
|
+
"""
|
|
26
|
+
path = "/v1/checkout/order"
|
|
27
|
+
params = None
|
|
28
|
+
body: dict[str, object] = {}
|
|
29
|
+
body["order"] = order
|
|
30
|
+
if tokenize_card is not None:
|
|
31
|
+
body["tokenizeCard"] = tokenize_card
|
|
32
|
+
body.update(extra)
|
|
33
|
+
validate_body("post", "/v1/checkout/order", body)
|
|
34
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
35
|
+
|
|
36
|
+
def charge_customer_with_tokenized_card_data(self, token_key, *, order: object | None = None, **extra: object) -> _models.ChargeCustomerWithTokenizedCardDataResponse:
|
|
37
|
+
"""
|
|
38
|
+
Charge a customer using tokenized card data
|
|
39
|
+
|
|
40
|
+
You can use this endpoint to charge a customer's card using the tokenized card details.
|
|
41
|
+
|
|
42
|
+
Body fields:
|
|
43
|
+
tokenKey (required): the token key returned in the webhook
|
|
44
|
+
order:
|
|
45
|
+
"""
|
|
46
|
+
path = "/v1/checkout/tokenized-card-payment"
|
|
47
|
+
params = None
|
|
48
|
+
body: dict[str, object] = {}
|
|
49
|
+
body["tokenKey"] = token_key
|
|
50
|
+
if order is not None:
|
|
51
|
+
body["order"] = order
|
|
52
|
+
body.update(extra)
|
|
53
|
+
validate_body("post", "/v1/checkout/tokenized-card-payment", body)
|
|
54
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
55
|
+
|
|
56
|
+
def list_all_tokenized_cards_for_merchant(self, *, customer_email: str | None = None, start_date: str | None = None, end_date: str | None = None, page: str | None = None, **extra: object) -> _models.ListAllTokenizedCardsForMerchantResponse:
|
|
57
|
+
"""
|
|
58
|
+
List tokenized cards
|
|
59
|
+
|
|
60
|
+
Fetch list of merchant's tokenized cards
|
|
61
|
+
"""
|
|
62
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
63
|
+
params: dict[str, object] = {}
|
|
64
|
+
if customer_email is not None:
|
|
65
|
+
params["customerEmail"] = customer_email
|
|
66
|
+
if start_date is not None:
|
|
67
|
+
params["startDate"] = start_date
|
|
68
|
+
if end_date is not None:
|
|
69
|
+
params["endDate"] = end_date
|
|
70
|
+
if page is not None:
|
|
71
|
+
params["page"] = page
|
|
72
|
+
return self._client.get(path, params=params) # type: ignore[return-value]
|
|
73
|
+
|
|
74
|
+
def update_tokenized_card_data(self, token_key, current_email_address, new_email_address, **extra: object) -> _models.UpdateTokenizedCardDataResponse:
|
|
75
|
+
"""
|
|
76
|
+
Update tokenzied card data
|
|
77
|
+
|
|
78
|
+
Update a tokenized card details
|
|
79
|
+
|
|
80
|
+
Body fields:
|
|
81
|
+
tokenKey (required): token key
|
|
82
|
+
currentEmailAddress (required): customer email currently associated with the key
|
|
83
|
+
newEmailAddress (required): new email to replace the old one
|
|
84
|
+
"""
|
|
85
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
86
|
+
params = None
|
|
87
|
+
body: dict[str, object] = {}
|
|
88
|
+
body["tokenKey"] = token_key
|
|
89
|
+
body["currentEmailAddress"] = current_email_address
|
|
90
|
+
body["newEmailAddress"] = new_email_address
|
|
91
|
+
body.update(extra)
|
|
92
|
+
validate_body("post", "/v1/checkout/tokenized-card-data", body)
|
|
93
|
+
return self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
94
|
+
|
|
95
|
+
def delete_tokenized_card_data(self, token_key, **extra: object) -> _models.DeleteTokenizedCardDataResponse:
|
|
96
|
+
"""
|
|
97
|
+
Update tokenzied card data
|
|
98
|
+
|
|
99
|
+
Delete a tokenized card details
|
|
100
|
+
|
|
101
|
+
Body fields:
|
|
102
|
+
tokenKey (required): token key
|
|
103
|
+
"""
|
|
104
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
105
|
+
params = None
|
|
106
|
+
body: dict[str, object] = {}
|
|
107
|
+
body["tokenKey"] = token_key
|
|
108
|
+
body.update(extra)
|
|
109
|
+
validate_body("delete", "/v1/checkout/tokenized-card-data", body)
|
|
110
|
+
return self._client.delete(path, json=body, params=params) # type: ignore[return-value]
|
|
111
|
+
|
|
112
|
+
def fetch_a_checkout_transaction(self, *, id_type: str | None = None, id: str | None = None, **extra: object) -> _models.FetchACheckoutTransactionResponse:
|
|
113
|
+
"""
|
|
114
|
+
Fetch checkout transaction
|
|
115
|
+
"""
|
|
116
|
+
path = "/v1/checkout/transaction"
|
|
117
|
+
params: dict[str, object] = {}
|
|
118
|
+
if id_type is not None:
|
|
119
|
+
params["idType"] = id_type
|
|
120
|
+
if id is not None:
|
|
121
|
+
params["id"] = id
|
|
122
|
+
return self._client.get(path, params=params) # type: ignore[return-value]
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class AsyncCheckout:
|
|
127
|
+
"""Async resource methods for the Checkout group."""
|
|
128
|
+
|
|
129
|
+
def __init__(self, client: AsyncNombaClient) -> None:
|
|
130
|
+
self._client = client
|
|
131
|
+
|
|
132
|
+
async def create_an_online_checkout_order(self, order, *, tokenize_card: object | None = None, **extra: object) -> _models.CreateAnOnlineCheckoutOrderResponse:
|
|
133
|
+
"""
|
|
134
|
+
Create an online checkout order
|
|
135
|
+
|
|
136
|
+
You can use this endpoint to create an online checkout order. Load the URL returned in 'checkoutLink' property in a browser to allow your customer initiate payment.
|
|
137
|
+
|
|
138
|
+
Body fields:
|
|
139
|
+
order (required):
|
|
140
|
+
tokenizeCard: Determines if the card used for payment is to be tokenized
|
|
141
|
+
"""
|
|
142
|
+
path = "/v1/checkout/order"
|
|
143
|
+
params = None
|
|
144
|
+
body: dict[str, object] = {}
|
|
145
|
+
body["order"] = order
|
|
146
|
+
if tokenize_card is not None:
|
|
147
|
+
body["tokenizeCard"] = tokenize_card
|
|
148
|
+
body.update(extra)
|
|
149
|
+
validate_body("post", "/v1/checkout/order", body)
|
|
150
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
151
|
+
|
|
152
|
+
async def charge_customer_with_tokenized_card_data(self, token_key, *, order: object | None = None, **extra: object) -> _models.ChargeCustomerWithTokenizedCardDataResponse:
|
|
153
|
+
"""
|
|
154
|
+
Charge a customer using tokenized card data
|
|
155
|
+
|
|
156
|
+
You can use this endpoint to charge a customer's card using the tokenized card details.
|
|
157
|
+
|
|
158
|
+
Body fields:
|
|
159
|
+
tokenKey (required): the token key returned in the webhook
|
|
160
|
+
order:
|
|
161
|
+
"""
|
|
162
|
+
path = "/v1/checkout/tokenized-card-payment"
|
|
163
|
+
params = None
|
|
164
|
+
body: dict[str, object] = {}
|
|
165
|
+
body["tokenKey"] = token_key
|
|
166
|
+
if order is not None:
|
|
167
|
+
body["order"] = order
|
|
168
|
+
body.update(extra)
|
|
169
|
+
validate_body("post", "/v1/checkout/tokenized-card-payment", body)
|
|
170
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
171
|
+
|
|
172
|
+
async def list_all_tokenized_cards_for_merchant(self, *, customer_email: str | None = None, start_date: str | None = None, end_date: str | None = None, page: str | None = None, **extra: object) -> _models.ListAllTokenizedCardsForMerchantResponse:
|
|
173
|
+
"""
|
|
174
|
+
List tokenized cards
|
|
175
|
+
|
|
176
|
+
Fetch list of merchant's tokenized cards
|
|
177
|
+
"""
|
|
178
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
179
|
+
params: dict[str, object] = {}
|
|
180
|
+
if customer_email is not None:
|
|
181
|
+
params["customerEmail"] = customer_email
|
|
182
|
+
if start_date is not None:
|
|
183
|
+
params["startDate"] = start_date
|
|
184
|
+
if end_date is not None:
|
|
185
|
+
params["endDate"] = end_date
|
|
186
|
+
if page is not None:
|
|
187
|
+
params["page"] = page
|
|
188
|
+
return await self._client.get(path, params=params) # type: ignore[return-value]
|
|
189
|
+
|
|
190
|
+
async def update_tokenized_card_data(self, token_key, current_email_address, new_email_address, **extra: object) -> _models.UpdateTokenizedCardDataResponse:
|
|
191
|
+
"""
|
|
192
|
+
Update tokenzied card data
|
|
193
|
+
|
|
194
|
+
Update a tokenized card details
|
|
195
|
+
|
|
196
|
+
Body fields:
|
|
197
|
+
tokenKey (required): token key
|
|
198
|
+
currentEmailAddress (required): customer email currently associated with the key
|
|
199
|
+
newEmailAddress (required): new email to replace the old one
|
|
200
|
+
"""
|
|
201
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
202
|
+
params = None
|
|
203
|
+
body: dict[str, object] = {}
|
|
204
|
+
body["tokenKey"] = token_key
|
|
205
|
+
body["currentEmailAddress"] = current_email_address
|
|
206
|
+
body["newEmailAddress"] = new_email_address
|
|
207
|
+
body.update(extra)
|
|
208
|
+
validate_body("post", "/v1/checkout/tokenized-card-data", body)
|
|
209
|
+
return await self._client.post(path, json=body, params=params) # type: ignore[return-value]
|
|
210
|
+
|
|
211
|
+
async def delete_tokenized_card_data(self, token_key, **extra: object) -> _models.DeleteTokenizedCardDataResponse:
|
|
212
|
+
"""
|
|
213
|
+
Update tokenzied card data
|
|
214
|
+
|
|
215
|
+
Delete a tokenized card details
|
|
216
|
+
|
|
217
|
+
Body fields:
|
|
218
|
+
tokenKey (required): token key
|
|
219
|
+
"""
|
|
220
|
+
path = "/v1/checkout/tokenized-card-data"
|
|
221
|
+
params = None
|
|
222
|
+
body: dict[str, object] = {}
|
|
223
|
+
body["tokenKey"] = token_key
|
|
224
|
+
body.update(extra)
|
|
225
|
+
validate_body("delete", "/v1/checkout/tokenized-card-data", body)
|
|
226
|
+
return await self._client.delete(path, json=body, params=params) # type: ignore[return-value]
|
|
227
|
+
|
|
228
|
+
async def fetch_a_checkout_transaction(self, *, id_type: str | None = None, id: str | None = None, **extra: object) -> _models.FetchACheckoutTransactionResponse:
|
|
229
|
+
"""
|
|
230
|
+
Fetch checkout transaction
|
|
231
|
+
"""
|
|
232
|
+
path = "/v1/checkout/transaction"
|
|
233
|
+
params: dict[str, object] = {}
|
|
234
|
+
if id_type is not None:
|
|
235
|
+
params["idType"] = id_type
|
|
236
|
+
if id is not None:
|
|
237
|
+
params["id"] = id
|
|
238
|
+
return await self._client.get(path, params=params) # type: ignore[return-value]
|
|
239
|
+
|