bitpesa-sdk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (633) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +92 -0
  4. data/LICENSE +7 -0
  5. data/README.md +264 -0
  6. data/Rakefile +10 -0
  7. data/bitpesa-sdk.gemspec +46 -0
  8. data/docs/APILogsApi.md +141 -0
  9. data/docs/Account.md +9 -0
  10. data/docs/AccountBase.md +9 -0
  11. data/docs/AccountDebitsApi.md +199 -0
  12. data/docs/AccountListResponse.md +9 -0
  13. data/docs/AccountMeta.md +8 -0
  14. data/docs/AccountResponse.md +9 -0
  15. data/docs/AccountValidationApi.md +70 -0
  16. data/docs/AccountValidationError.md +8 -0
  17. data/docs/AccountValidationRequest.md +12 -0
  18. data/docs/AccountValidationResponse.md +9 -0
  19. data/docs/AccountValidationResult.md +8 -0
  20. data/docs/AccountsApi.md +128 -0
  21. data/docs/ApiLog.md +16 -0
  22. data/docs/ApiLogBase.md +16 -0
  23. data/docs/ApiLogListResponse.md +9 -0
  24. data/docs/ApiLogResponse.md +8 -0
  25. data/docs/Body.md +12 -0
  26. data/docs/Currency.md +17 -0
  27. data/docs/CurrencyBase.md +17 -0
  28. data/docs/CurrencyExchange.md +18 -0
  29. data/docs/CurrencyExchangeListResponse.md +8 -0
  30. data/docs/CurrencyInfoApi.md +182 -0
  31. data/docs/CurrencyListResponse.md +8 -0
  32. data/docs/CurrencyOpposite.md +18 -0
  33. data/docs/Debit.md +17 -0
  34. data/docs/DebitBase.md +12 -0
  35. data/docs/DebitErrorResponse.md +13 -0
  36. data/docs/DebitListRequest.md +8 -0
  37. data/docs/DebitListResponse.md +9 -0
  38. data/docs/DebitRequest.md +8 -0
  39. data/docs/DebitRequestWrapper.md +8 -0
  40. data/docs/DebitResponse.md +8 -0
  41. data/docs/DebitValidResponse.md +16 -0
  42. data/docs/DefaultDocument.md +16 -0
  43. data/docs/DefaultRecipient.md +11 -0
  44. data/docs/DefaultSender.md +24 -0
  45. data/docs/DefaultWebhook.md +11 -0
  46. data/docs/Document.md +17 -0
  47. data/docs/DocumentBase.md +15 -0
  48. data/docs/DocumentErrorResponse.md +16 -0
  49. data/docs/DocumentListResponse.md +9 -0
  50. data/docs/DocumentRequest.md +8 -0
  51. data/docs/DocumentResponse.md +8 -0
  52. data/docs/DocumentValidResponse.md +16 -0
  53. data/docs/DocumentWebhook.md +10 -0
  54. data/docs/DocumentsApi.md +199 -0
  55. data/docs/ErrorStatus.md +9 -0
  56. data/docs/FieldDescription.md +9 -0
  57. data/docs/FieldSelectValidation.md +9 -0
  58. data/docs/FieldValidation.md +10 -0
  59. data/docs/FullInvalidTransaction.md +12 -0
  60. data/docs/FullInvalidTransactionRequest.md +14 -0
  61. data/docs/FullValidTransaction.md +11 -0
  62. data/docs/FullValidTransactionRequest.md +12 -0
  63. data/docs/InlineResponse200.md +9 -0
  64. data/docs/InlineResponse2001.md +8 -0
  65. data/docs/InlineResponse20010.md +9 -0
  66. data/docs/InlineResponse20011.md +9 -0
  67. data/docs/InlineResponse20012.md +8 -0
  68. data/docs/InlineResponse20013.md +9 -0
  69. data/docs/InlineResponse20014.md +9 -0
  70. data/docs/InlineResponse20015.md +8 -0
  71. data/docs/InlineResponse20016.md +9 -0
  72. data/docs/InlineResponse20017.md +8 -0
  73. data/docs/InlineResponse20018.md +9 -0
  74. data/docs/InlineResponse20019.md +9 -0
  75. data/docs/InlineResponse2002.md +9 -0
  76. data/docs/InlineResponse20020.md +9 -0
  77. data/docs/InlineResponse20021.md +8 -0
  78. data/docs/InlineResponse20021Object.md +8 -0
  79. data/docs/InlineResponse20022.md +8 -0
  80. data/docs/InlineResponse20022Object.md +8 -0
  81. data/docs/InlineResponse20023.md +9 -0
  82. data/docs/InlineResponse20023Object.md +8 -0
  83. data/docs/InlineResponse20024.md +8 -0
  84. data/docs/InlineResponse20025.md +8 -0
  85. data/docs/InlineResponse20026.md +8 -0
  86. data/docs/InlineResponse20027.md +9 -0
  87. data/docs/InlineResponse20028.md +8 -0
  88. data/docs/InlineResponse20029.md +9 -0
  89. data/docs/InlineResponse2002Object.md +8 -0
  90. data/docs/InlineResponse2003.md +8 -0
  91. data/docs/InlineResponse20030.md +8 -0
  92. data/docs/InlineResponse20031.md +9 -0
  93. data/docs/InlineResponse20032.md +9 -0
  94. data/docs/InlineResponse20033.md +8 -0
  95. data/docs/InlineResponse20034.md +9 -0
  96. data/docs/InlineResponse20035.md +9 -0
  97. data/docs/InlineResponse20036.md +8 -0
  98. data/docs/InlineResponse20037.md +9 -0
  99. data/docs/InlineResponse20038.md +8 -0
  100. data/docs/InlineResponse20039.md +9 -0
  101. data/docs/InlineResponse2004.md +8 -0
  102. data/docs/InlineResponse20040.md +8 -0
  103. data/docs/InlineResponse2004Object.md +8 -0
  104. data/docs/InlineResponse2005.md +8 -0
  105. data/docs/InlineResponse2006.md +9 -0
  106. data/docs/InlineResponse2007.md +8 -0
  107. data/docs/InlineResponse2008.md +9 -0
  108. data/docs/InlineResponse2009.md +8 -0
  109. data/docs/InlineResponse201.md +8 -0
  110. data/docs/InlineResponse2011.md +8 -0
  111. data/docs/InlineResponse20110.md +8 -0
  112. data/docs/InlineResponse20111.md +8 -0
  113. data/docs/InlineResponse2012.md +8 -0
  114. data/docs/InlineResponse2013.md +8 -0
  115. data/docs/InlineResponse2014.md +8 -0
  116. data/docs/InlineResponse2015.md +8 -0
  117. data/docs/InlineResponse2016.md +8 -0
  118. data/docs/InlineResponse2017.md +8 -0
  119. data/docs/InlineResponse2018.md +8 -0
  120. data/docs/InlineResponse2019.md +8 -0
  121. data/docs/InlineResponse400.md +9 -0
  122. data/docs/InlineResponse4001.md +9 -0
  123. data/docs/InlineResponse422.md +8 -0
  124. data/docs/InlineResponse4221.md +8 -0
  125. data/docs/InlineResponse42210.md +8 -0
  126. data/docs/InlineResponse42211.md +8 -0
  127. data/docs/InlineResponse42212.md +8 -0
  128. data/docs/InlineResponse42213.md +8 -0
  129. data/docs/InlineResponse42214.md +8 -0
  130. data/docs/InlineResponse4221Meta.md +8 -0
  131. data/docs/InlineResponse4221Object.md +8 -0
  132. data/docs/InlineResponse4222.md +8 -0
  133. data/docs/InlineResponse4223.md +8 -0
  134. data/docs/InlineResponse4224.md +8 -0
  135. data/docs/InlineResponse4225.md +8 -0
  136. data/docs/InlineResponse4226.md +8 -0
  137. data/docs/InlineResponse4227.md +8 -0
  138. data/docs/InlineResponse4227Meta.md +8 -0
  139. data/docs/InlineResponse4228.md +8 -0
  140. data/docs/InlineResponse4228Meta.md +8 -0
  141. data/docs/InlineResponse4228Object.md +8 -0
  142. data/docs/InlineResponse4229.md +8 -0
  143. data/docs/InlineResponse422Meta.md +8 -0
  144. data/docs/InlineResponse422Object.md +8 -0
  145. data/docs/InvalidDebit.md +14 -0
  146. data/docs/InvalidDocument.md +17 -0
  147. data/docs/InvalidRecipient.md +12 -0
  148. data/docs/InvalidSender.md +25 -0
  149. data/docs/InvalidWebhook.md +11 -0
  150. data/docs/LogsApi.md +141 -0
  151. data/docs/Meta.md +8 -0
  152. data/docs/Meta2.md +8 -0
  153. data/docs/Meta2Pagination.md +12 -0
  154. data/docs/MetaPagination.md +12 -0
  155. data/docs/Object.md +9 -0
  156. data/docs/OppositePaymentMethod.md +13 -0
  157. data/docs/OppositePaymentMethodBase.md +13 -0
  158. data/docs/Pagination.md +12 -0
  159. data/docs/PaginationMeta.md +8 -0
  160. data/docs/PaginationPagination.md +12 -0
  161. data/docs/PayinMethod.md +12 -0
  162. data/docs/PayinMethodBase.md +12 -0
  163. data/docs/PayinMethodDetails.md +10 -0
  164. data/docs/PayinMethodDetailsBase.md +7 -0
  165. data/docs/PayinMethodDetailsMobile.md +9 -0
  166. data/docs/PayinMethodDetailsNGNBank.md +8 -0
  167. data/docs/PayinMethodRequest.md +8 -0
  168. data/docs/PayinMethodType.md +8 -0
  169. data/docs/PayinMethodTypeBase.md +8 -0
  170. data/docs/PaymentMethod.md +13 -0
  171. data/docs/PaymentMethodBase.md +15 -0
  172. data/docs/PaymentMethodListResponse.md +8 -0
  173. data/docs/PaymentMethodOpposite.md +14 -0
  174. data/docs/PaymentMethodsApi.md +124 -0
  175. data/docs/PayoutMethod.md +13 -0
  176. data/docs/PayoutMethodBankAccountTypeEnum.md +7 -0
  177. data/docs/PayoutMethodBase.md +10 -0
  178. data/docs/PayoutMethodDetails.md +26 -0
  179. data/docs/PayoutMethodDetailsBalance.md +8 -0
  180. data/docs/PayoutMethodDetailsBase.md +7 -0
  181. data/docs/PayoutMethodDetailsGHSBank.md +11 -0
  182. data/docs/PayoutMethodDetailsIBAN.md +12 -0
  183. data/docs/PayoutMethodDetailsMADCash.md +18 -0
  184. data/docs/PayoutMethodDetailsMobile.md +10 -0
  185. data/docs/PayoutMethodDetailsNGNBank.md +12 -0
  186. data/docs/PayoutMethodDetailsXOFMobile.md +11 -0
  187. data/docs/PayoutMethodErrorResponse.md +11 -0
  188. data/docs/PayoutMethodGenderEnum.md +7 -0
  189. data/docs/PayoutMethodIdentityCardTypeEnum.md +7 -0
  190. data/docs/PayoutMethodListResponse.md +9 -0
  191. data/docs/PayoutMethodMobileProviderEnum.md +7 -0
  192. data/docs/PayoutMethodRequest.md +8 -0
  193. data/docs/PayoutMethodResponse.md +8 -0
  194. data/docs/PayoutMethodValidResponse.md +11 -0
  195. data/docs/PayoutMethodWebhook.md +10 -0
  196. data/docs/PayoutMethodsApi.md +334 -0
  197. data/docs/Recipient.md +27 -0
  198. data/docs/RecipientBase.md +11 -0
  199. data/docs/RecipientErrorResponse.md +26 -0
  200. data/docs/RecipientListResponse.md +9 -0
  201. data/docs/RecipientRequest.md +8 -0
  202. data/docs/RecipientResponse.md +8 -0
  203. data/docs/RecipientState.md +7 -0
  204. data/docs/RecipientValidResponse.md +26 -0
  205. data/docs/RecipientWebhook.md +10 -0
  206. data/docs/RecipientsApi.md +212 -0
  207. data/docs/Sender.md +32 -0
  208. data/docs/SenderBase.md +30 -0
  209. data/docs/SenderErrorResponse.md +32 -0
  210. data/docs/SenderExistingRequest.md +8 -0
  211. data/docs/SenderFullRequest.md +30 -0
  212. data/docs/SenderListResponse.md +9 -0
  213. data/docs/SenderRequest.md +8 -0
  214. data/docs/SenderResponse.md +8 -0
  215. data/docs/SenderState.md +7 -0
  216. data/docs/SenderValidResponse.md +32 -0
  217. data/docs/SenderWebhook.md +10 -0
  218. data/docs/SendersApi.md +328 -0
  219. data/docs/Transaction.md +22 -0
  220. data/docs/TransactionBase.md +13 -0
  221. data/docs/TransactionErrorResponse.md +21 -0
  222. data/docs/TransactionListResponse.md +9 -0
  223. data/docs/TransactionRequest.md +8 -0
  224. data/docs/TransactionRequestBase.md +9 -0
  225. data/docs/TransactionRequestErrorResponse.md +10 -0
  226. data/docs/TransactionRequestRequest.md +9 -0
  227. data/docs/TransactionRequestValidResponse.md +10 -0
  228. data/docs/TransactionRequestsApi.md +199 -0
  229. data/docs/TransactionResponse.md +8 -0
  230. data/docs/TransactionState.md +7 -0
  231. data/docs/TransactionTraits.md +9 -0
  232. data/docs/TransactionValidResponse.md +21 -0
  233. data/docs/TransactionWebhook.md +10 -0
  234. data/docs/TransactionsApi.md +448 -0
  235. data/docs/ValidDebit.md +16 -0
  236. data/docs/ValidationErrorDescription.md +8 -0
  237. data/docs/Webhook.md +10 -0
  238. data/docs/WebhookBase.md +10 -0
  239. data/docs/WebhookDefinition.md +12 -0
  240. data/docs/WebhookDefinitionBase.md +10 -0
  241. data/docs/WebhookDefinitionErrorResponse.md +11 -0
  242. data/docs/WebhookDefinitionEventListResponse.md +8 -0
  243. data/docs/WebhookDefinitionListResponse.md +9 -0
  244. data/docs/WebhookDefinitionRequest.md +8 -0
  245. data/docs/WebhookDefinitionResponse.md +8 -0
  246. data/docs/WebhookDefinitionValidResponse.md +11 -0
  247. data/docs/WebhookErrorResponse.md +11 -0
  248. data/docs/WebhookLog.md +13 -0
  249. data/docs/WebhookLogBase.md +13 -0
  250. data/docs/WebhookLogBaseMetadata.md +17 -0
  251. data/docs/WebhookLogBaseMetadataParams.md +8 -0
  252. data/docs/WebhookLogBaseMetadataRequest.md +10 -0
  253. data/docs/WebhookLogBaseMetadataResponse.md +10 -0
  254. data/docs/WebhookLogListResponse.md +9 -0
  255. data/docs/WebhookLogMetadata.md +17 -0
  256. data/docs/WebhookLogMetadataParams.md +8 -0
  257. data/docs/WebhookLogMetadataRequest.md +10 -0
  258. data/docs/WebhookLogMetadataResponse.md +10 -0
  259. data/docs/WebhookLogResponse.md +8 -0
  260. data/docs/WebhookRequest.md +10 -0
  261. data/docs/WebhookValidResponse.md +11 -0
  262. data/docs/WebhooksApi.md +319 -0
  263. data/example/.LICENSE.un~ +0 -0
  264. data/example/.client.rb.un~ +0 -0
  265. data/example/client.rb +395 -0
  266. data/git_push.sh +55 -0
  267. data/lib/bitpesa-sdk/api/account_debits_api.rb +187 -0
  268. data/lib/bitpesa-sdk/api/account_validation_api.rb +79 -0
  269. data/lib/bitpesa-sdk/api/accounts_api.rb +135 -0
  270. data/lib/bitpesa-sdk/api/api_logs_api.rb +137 -0
  271. data/lib/bitpesa-sdk/api/currency_info_api.rb +167 -0
  272. data/lib/bitpesa-sdk/api/documents_api.rb +197 -0
  273. data/lib/bitpesa-sdk/api/logs_api.rb +137 -0
  274. data/lib/bitpesa-sdk/api/payment_methods_api.rb +119 -0
  275. data/lib/bitpesa-sdk/api/payout_methods_api.rb +321 -0
  276. data/lib/bitpesa-sdk/api/recipients_api.rb +221 -0
  277. data/lib/bitpesa-sdk/api/senders_api.rb +319 -0
  278. data/lib/bitpesa-sdk/api/transactions_api.rb +425 -0
  279. data/lib/bitpesa-sdk/api/webhooks_api.rb +299 -0
  280. data/lib/bitpesa-sdk/api_client.rb +449 -0
  281. data/lib/bitpesa-sdk/api_error.rb +61 -0
  282. data/lib/bitpesa-sdk/configuration.rb +220 -0
  283. data/lib/bitpesa-sdk/models/account.rb +206 -0
  284. data/lib/bitpesa-sdk/models/account_list_response.rb +206 -0
  285. data/lib/bitpesa-sdk/models/account_meta.rb +196 -0
  286. data/lib/bitpesa-sdk/models/account_response.rb +204 -0
  287. data/lib/bitpesa-sdk/models/account_validation_error.rb +196 -0
  288. data/lib/bitpesa-sdk/models/account_validation_request.rb +319 -0
  289. data/lib/bitpesa-sdk/models/account_validation_response.rb +204 -0
  290. data/lib/bitpesa-sdk/models/account_validation_result.rb +196 -0
  291. data/lib/bitpesa-sdk/models/api_log.rb +281 -0
  292. data/lib/bitpesa-sdk/models/api_log_list_response.rb +207 -0
  293. data/lib/bitpesa-sdk/models/api_log_response.rb +195 -0
  294. data/lib/bitpesa-sdk/models/currency.rb +286 -0
  295. data/lib/bitpesa-sdk/models/currency_exchange.rb +305 -0
  296. data/lib/bitpesa-sdk/models/currency_exchange_list_response.rb +198 -0
  297. data/lib/bitpesa-sdk/models/currency_list_response.rb +198 -0
  298. data/lib/bitpesa-sdk/models/currency_opposite.rb +303 -0
  299. data/lib/bitpesa-sdk/models/debit.rb +303 -0
  300. data/lib/bitpesa-sdk/models/debit_list_request.rb +197 -0
  301. data/lib/bitpesa-sdk/models/debit_list_response.rb +206 -0
  302. data/lib/bitpesa-sdk/models/debit_request.rb +195 -0
  303. data/lib/bitpesa-sdk/models/debit_request_wrapper.rb +221 -0
  304. data/lib/bitpesa-sdk/models/debit_response.rb +195 -0
  305. data/lib/bitpesa-sdk/models/document.rb +329 -0
  306. data/lib/bitpesa-sdk/models/document_list_response.rb +206 -0
  307. data/lib/bitpesa-sdk/models/document_request.rb +195 -0
  308. data/lib/bitpesa-sdk/models/document_response.rb +195 -0
  309. data/lib/bitpesa-sdk/models/document_webhook.rb +237 -0
  310. data/lib/bitpesa-sdk/models/error_status.rb +204 -0
  311. data/lib/bitpesa-sdk/models/field_description.rb +239 -0
  312. data/lib/bitpesa-sdk/models/field_select_validation.rb +206 -0
  313. data/lib/bitpesa-sdk/models/field_validation.rb +215 -0
  314. data/lib/bitpesa-sdk/models/pagination.rb +236 -0
  315. data/lib/bitpesa-sdk/models/pagination_meta.rb +195 -0
  316. data/lib/bitpesa-sdk/models/payin_method.rb +236 -0
  317. data/lib/bitpesa-sdk/models/payin_method_details.rb +251 -0
  318. data/lib/bitpesa-sdk/models/payin_method_details_mobile.rb +212 -0
  319. data/lib/bitpesa-sdk/models/payin_method_details_ngn_bank.rb +202 -0
  320. data/lib/bitpesa-sdk/models/payin_method_request.rb +195 -0
  321. data/lib/bitpesa-sdk/models/payment_method.rb +251 -0
  322. data/lib/bitpesa-sdk/models/payment_method_list_response.rb +197 -0
  323. data/lib/bitpesa-sdk/models/payment_method_opposite.rb +269 -0
  324. data/lib/bitpesa-sdk/models/payout_method.rb +249 -0
  325. data/lib/bitpesa-sdk/models/payout_method_bank_account_type_enum.rb +38 -0
  326. data/lib/bitpesa-sdk/models/payout_method_details.rb +456 -0
  327. data/lib/bitpesa-sdk/models/payout_method_details_balance.rb +196 -0
  328. data/lib/bitpesa-sdk/models/payout_method_details_ghs_bank.rb +243 -0
  329. data/lib/bitpesa-sdk/models/payout_method_details_iban.rb +252 -0
  330. data/lib/bitpesa-sdk/models/payout_method_details_mad_cash.rb +326 -0
  331. data/lib/bitpesa-sdk/models/payout_method_details_mobile.rb +229 -0
  332. data/lib/bitpesa-sdk/models/payout_method_details_ngn_bank.rb +257 -0
  333. data/lib/bitpesa-sdk/models/payout_method_details_xof_mobile.rb +243 -0
  334. data/lib/bitpesa-sdk/models/payout_method_gender_enum.rb +38 -0
  335. data/lib/bitpesa-sdk/models/payout_method_identity_card_type_enum.rb +39 -0
  336. data/lib/bitpesa-sdk/models/payout_method_list_response.rb +206 -0
  337. data/lib/bitpesa-sdk/models/payout_method_mobile_provider_enum.rb +38 -0
  338. data/lib/bitpesa-sdk/models/payout_method_request.rb +195 -0
  339. data/lib/bitpesa-sdk/models/payout_method_response.rb +195 -0
  340. data/lib/bitpesa-sdk/models/payout_method_webhook.rb +237 -0
  341. data/lib/bitpesa-sdk/models/recipient.rb +400 -0
  342. data/lib/bitpesa-sdk/models/recipient_list_response.rb +206 -0
  343. data/lib/bitpesa-sdk/models/recipient_request.rb +195 -0
  344. data/lib/bitpesa-sdk/models/recipient_response.rb +195 -0
  345. data/lib/bitpesa-sdk/models/recipient_state.rb +46 -0
  346. data/lib/bitpesa-sdk/models/recipient_webhook.rb +237 -0
  347. data/lib/bitpesa-sdk/models/sender.rb +513 -0
  348. data/lib/bitpesa-sdk/models/sender_list_response.rb +206 -0
  349. data/lib/bitpesa-sdk/models/sender_request.rb +195 -0
  350. data/lib/bitpesa-sdk/models/sender_response.rb +195 -0
  351. data/lib/bitpesa-sdk/models/sender_state.rb +42 -0
  352. data/lib/bitpesa-sdk/models/sender_webhook.rb +237 -0
  353. data/lib/bitpesa-sdk/models/transaction.rb +354 -0
  354. data/lib/bitpesa-sdk/models/transaction_list_response.rb +206 -0
  355. data/lib/bitpesa-sdk/models/transaction_request.rb +195 -0
  356. data/lib/bitpesa-sdk/models/transaction_response.rb +195 -0
  357. data/lib/bitpesa-sdk/models/transaction_state.rb +46 -0
  358. data/lib/bitpesa-sdk/models/transaction_traits.rb +207 -0
  359. data/lib/bitpesa-sdk/models/transaction_webhook.rb +237 -0
  360. data/lib/bitpesa-sdk/models/validation_error_description.rb +197 -0
  361. data/lib/bitpesa-sdk/models/webhook.rb +232 -0
  362. data/lib/bitpesa-sdk/models/webhook_definition.rb +250 -0
  363. data/lib/bitpesa-sdk/models/webhook_definition_event_list_response.rb +197 -0
  364. data/lib/bitpesa-sdk/models/webhook_definition_list_response.rb +206 -0
  365. data/lib/bitpesa-sdk/models/webhook_definition_request.rb +195 -0
  366. data/lib/bitpesa-sdk/models/webhook_definition_response.rb +195 -0
  367. data/lib/bitpesa-sdk/models/webhook_log.rb +243 -0
  368. data/lib/bitpesa-sdk/models/webhook_log_list_response.rb +207 -0
  369. data/lib/bitpesa-sdk/models/webhook_log_metadata.rb +283 -0
  370. data/lib/bitpesa-sdk/models/webhook_log_metadata_request.rb +218 -0
  371. data/lib/bitpesa-sdk/models/webhook_log_metadata_response.rb +219 -0
  372. data/lib/bitpesa-sdk/models/webhook_log_response.rb +195 -0
  373. data/lib/bitpesa-sdk/version.rb +15 -0
  374. data/lib/bitpesa-sdk.rb +142 -0
  375. data/spec/api/account_debits_api_spec.rb +70 -0
  376. data/spec/api/account_validation_api_spec.rb +47 -0
  377. data/spec/api/accounts_api_spec.rb +58 -0
  378. data/spec/api/api_logs_api_spec.rb +58 -0
  379. data/spec/api/currency_info_api_spec.rb +68 -0
  380. data/spec/api/documents_api_spec.rb +70 -0
  381. data/spec/api/logs_api_spec.rb +58 -0
  382. data/spec/api/payment_methods_api_spec.rb +57 -0
  383. data/spec/api/payout_methods_api_spec.rb +58 -0
  384. data/spec/api/recipients_api_spec.rb +74 -0
  385. data/spec/api/senders_api_spec.rb +95 -0
  386. data/spec/api/transaction_requests_api_spec.rb +76 -0
  387. data/spec/api/transactions_api_spec.rb +96 -0
  388. data/spec/api/webhooks_api_spec.rb +95 -0
  389. data/spec/api_client_spec.rb +226 -0
  390. data/spec/configuration_spec.rb +42 -0
  391. data/spec/models/account_base_spec.rb +48 -0
  392. data/spec/models/account_list_response_spec.rb +47 -0
  393. data/spec/models/account_meta_spec.rb +42 -0
  394. data/spec/models/account_response_spec.rb +47 -0
  395. data/spec/models/account_spec.rb +47 -0
  396. data/spec/models/account_validation_error_spec.rb +41 -0
  397. data/spec/models/account_validation_request_spec.rb +77 -0
  398. data/spec/models/account_validation_response_spec.rb +47 -0
  399. data/spec/models/account_validation_result_spec.rb +41 -0
  400. data/spec/models/api_log_base_spec.rb +90 -0
  401. data/spec/models/api_log_list_response_spec.rb +47 -0
  402. data/spec/models/api_log_response_spec.rb +41 -0
  403. data/spec/models/api_log_spec.rb +90 -0
  404. data/spec/models/body_spec.rb +58 -0
  405. data/spec/models/currency_base_spec.rb +84 -0
  406. data/spec/models/currency_exchange_list_response_spec.rb +41 -0
  407. data/spec/models/currency_exchange_spec.rb +101 -0
  408. data/spec/models/currency_list_response_spec.rb +41 -0
  409. data/spec/models/currency_opposite_spec.rb +101 -0
  410. data/spec/models/currency_spec.rb +84 -0
  411. data/spec/models/debit_base_spec.rb +66 -0
  412. data/spec/models/debit_error_response_spec.rb +72 -0
  413. data/spec/models/debit_list_request_spec.rb +41 -0
  414. data/spec/models/debit_list_response_spec.rb +47 -0
  415. data/spec/models/debit_request_spec.rb +66 -0
  416. data/spec/models/debit_request_wrapper_spec.rb +41 -0
  417. data/spec/models/debit_response_spec.rb +41 -0
  418. data/spec/models/debit_spec.rb +66 -0
  419. data/spec/models/debit_valid_response_spec.rb +72 -0
  420. data/spec/models/default_document_spec.rb +94 -0
  421. data/spec/models/default_recipient_spec.rb +60 -0
  422. data/spec/models/default_sender_spec.rb +142 -0
  423. data/spec/models/default_webhook_spec.rb +60 -0
  424. data/spec/models/document_base_spec.rb +88 -0
  425. data/spec/models/document_error_response_spec.rb +94 -0
  426. data/spec/models/document_list_response_spec.rb +47 -0
  427. data/spec/models/document_request_spec.rb +88 -0
  428. data/spec/models/document_response_spec.rb +41 -0
  429. data/spec/models/document_spec.rb +36 -0
  430. data/spec/models/document_valid_response_spec.rb +94 -0
  431. data/spec/models/document_webhook_spec.rb +53 -0
  432. data/spec/models/error_status_spec.rb +47 -0
  433. data/spec/models/field_description_spec.rb +51 -0
  434. data/spec/models/field_select_validation_spec.rb +47 -0
  435. data/spec/models/field_validation_spec.rb +53 -0
  436. data/spec/models/full_invalid_transaction_request_spec.rb +78 -0
  437. data/spec/models/full_invalid_transaction_spec.rb +66 -0
  438. data/spec/models/full_valid_transaction_request_spec.rb +66 -0
  439. data/spec/models/full_valid_transaction_spec.rb +60 -0
  440. data/spec/models/inline_response_200_10_spec.rb +42 -0
  441. data/spec/models/inline_response_200_11_spec.rb +48 -0
  442. data/spec/models/inline_response_200_12_spec.rb +42 -0
  443. data/spec/models/inline_response_200_13_spec.rb +48 -0
  444. data/spec/models/inline_response_200_14_spec.rb +42 -0
  445. data/spec/models/inline_response_200_15_spec.rb +48 -0
  446. data/spec/models/inline_response_200_16_spec.rb +48 -0
  447. data/spec/models/inline_response_200_17_spec.rb +48 -0
  448. data/spec/models/inline_response_200_18_spec.rb +42 -0
  449. data/spec/models/inline_response_200_19_spec.rb +48 -0
  450. data/spec/models/inline_response_200_1_spec.rb +48 -0
  451. data/spec/models/inline_response_200_20_spec.rb +42 -0
  452. data/spec/models/inline_response_200_21_object_spec.rb +42 -0
  453. data/spec/models/inline_response_200_21_spec.rb +42 -0
  454. data/spec/models/inline_response_200_22_object_spec.rb +42 -0
  455. data/spec/models/inline_response_200_22_spec.rb +42 -0
  456. data/spec/models/inline_response_200_23_object_spec.rb +42 -0
  457. data/spec/models/inline_response_200_23_spec.rb +48 -0
  458. data/spec/models/inline_response_200_24_spec.rb +42 -0
  459. data/spec/models/inline_response_200_25_spec.rb +42 -0
  460. data/spec/models/inline_response_200_26_spec.rb +42 -0
  461. data/spec/models/inline_response_200_27_spec.rb +48 -0
  462. data/spec/models/inline_response_200_28_spec.rb +42 -0
  463. data/spec/models/inline_response_200_29_spec.rb +48 -0
  464. data/spec/models/inline_response_200_2_object_spec.rb +42 -0
  465. data/spec/models/inline_response_200_2_spec.rb +42 -0
  466. data/spec/models/inline_response_200_30_spec.rb +42 -0
  467. data/spec/models/inline_response_200_31_spec.rb +48 -0
  468. data/spec/models/inline_response_200_32_spec.rb +42 -0
  469. data/spec/models/inline_response_200_33_spec.rb +48 -0
  470. data/spec/models/inline_response_200_34_spec.rb +42 -0
  471. data/spec/models/inline_response_200_35_spec.rb +48 -0
  472. data/spec/models/inline_response_200_36_spec.rb +48 -0
  473. data/spec/models/inline_response_200_37_spec.rb +48 -0
  474. data/spec/models/inline_response_200_38_spec.rb +42 -0
  475. data/spec/models/inline_response_200_39_spec.rb +48 -0
  476. data/spec/models/inline_response_200_3_spec.rb +48 -0
  477. data/spec/models/inline_response_200_40_spec.rb +42 -0
  478. data/spec/models/inline_response_200_4_object_spec.rb +42 -0
  479. data/spec/models/inline_response_200_4_spec.rb +42 -0
  480. data/spec/models/inline_response_200_5_spec.rb +42 -0
  481. data/spec/models/inline_response_200_6_spec.rb +42 -0
  482. data/spec/models/inline_response_200_7_spec.rb +48 -0
  483. data/spec/models/inline_response_200_8_spec.rb +42 -0
  484. data/spec/models/inline_response_200_9_spec.rb +48 -0
  485. data/spec/models/inline_response_200_spec.rb +48 -0
  486. data/spec/models/inline_response_201_10_spec.rb +42 -0
  487. data/spec/models/inline_response_201_11_spec.rb +42 -0
  488. data/spec/models/inline_response_201_1_spec.rb +42 -0
  489. data/spec/models/inline_response_201_2_spec.rb +42 -0
  490. data/spec/models/inline_response_201_3_spec.rb +42 -0
  491. data/spec/models/inline_response_201_4_spec.rb +42 -0
  492. data/spec/models/inline_response_201_5_spec.rb +42 -0
  493. data/spec/models/inline_response_201_6_spec.rb +42 -0
  494. data/spec/models/inline_response_201_7_spec.rb +42 -0
  495. data/spec/models/inline_response_201_8_spec.rb +42 -0
  496. data/spec/models/inline_response_201_9_spec.rb +42 -0
  497. data/spec/models/inline_response_201_spec.rb +42 -0
  498. data/spec/models/inline_response_400_1_spec.rb +48 -0
  499. data/spec/models/inline_response_400_spec.rb +48 -0
  500. data/spec/models/inline_response_422_10_spec.rb +42 -0
  501. data/spec/models/inline_response_422_11_spec.rb +42 -0
  502. data/spec/models/inline_response_422_12_spec.rb +42 -0
  503. data/spec/models/inline_response_422_13_spec.rb +42 -0
  504. data/spec/models/inline_response_422_14_spec.rb +42 -0
  505. data/spec/models/inline_response_422_1_meta_spec.rb +42 -0
  506. data/spec/models/inline_response_422_1_object_spec.rb +42 -0
  507. data/spec/models/inline_response_422_1_spec.rb +42 -0
  508. data/spec/models/inline_response_422_2_spec.rb +42 -0
  509. data/spec/models/inline_response_422_3_spec.rb +42 -0
  510. data/spec/models/inline_response_422_4_spec.rb +42 -0
  511. data/spec/models/inline_response_422_5_spec.rb +42 -0
  512. data/spec/models/inline_response_422_6_spec.rb +42 -0
  513. data/spec/models/inline_response_422_7_meta_spec.rb +42 -0
  514. data/spec/models/inline_response_422_7_spec.rb +42 -0
  515. data/spec/models/inline_response_422_8_meta_spec.rb +42 -0
  516. data/spec/models/inline_response_422_8_object_spec.rb +42 -0
  517. data/spec/models/inline_response_422_8_spec.rb +48 -0
  518. data/spec/models/inline_response_422_9_spec.rb +42 -0
  519. data/spec/models/inline_response_422_meta_spec.rb +42 -0
  520. data/spec/models/inline_response_422_object_spec.rb +42 -0
  521. data/spec/models/inline_response_422_spec.rb +48 -0
  522. data/spec/models/invalid_debit_spec.rb +78 -0
  523. data/spec/models/invalid_document_spec.rb +100 -0
  524. data/spec/models/invalid_recipient_spec.rb +66 -0
  525. data/spec/models/invalid_sender_spec.rb +148 -0
  526. data/spec/models/invalid_webhook_spec.rb +60 -0
  527. data/spec/models/meta_2_pagination_spec.rb +66 -0
  528. data/spec/models/meta_2_spec.rb +42 -0
  529. data/spec/models/meta_pagination_spec.rb +66 -0
  530. data/spec/models/meta_spec.rb +42 -0
  531. data/spec/models/object_spec.rb +48 -0
  532. data/spec/models/opposite_payment_method_base_spec.rb +72 -0
  533. data/spec/models/opposite_payment_method_spec.rb +72 -0
  534. data/spec/models/pagination_meta_spec.rb +41 -0
  535. data/spec/models/pagination_pagination_spec.rb +66 -0
  536. data/spec/models/pagination_spec.rb +42 -0
  537. data/spec/models/payin_method_base_spec.rb +66 -0
  538. data/spec/models/payin_method_details_base_spec.rb +36 -0
  539. data/spec/models/payin_method_details_mobile_spec.rb +48 -0
  540. data/spec/models/payin_method_details_ngn_bank_spec.rb +42 -0
  541. data/spec/models/payin_method_details_spec.rb +53 -0
  542. data/spec/models/payin_method_request_spec.rb +41 -0
  543. data/spec/models/payin_method_spec.rb +65 -0
  544. data/spec/models/payin_method_type_base_spec.rb +42 -0
  545. data/spec/models/payin_method_type_spec.rb +42 -0
  546. data/spec/models/payment_method_base_spec.rb +66 -0
  547. data/spec/models/payment_method_list_response_spec.rb +41 -0
  548. data/spec/models/payment_method_opposite_spec.rb +77 -0
  549. data/spec/models/payment_method_spec.rb +66 -0
  550. data/spec/models/payout_method_bank_account_type_enum_spec.rb +35 -0
  551. data/spec/models/payout_method_base_spec.rb +54 -0
  552. data/spec/models/payout_method_details_balance_spec.rb +42 -0
  553. data/spec/models/payout_method_details_base_spec.rb +36 -0
  554. data/spec/models/payout_method_details_ghs_bank_spec.rb +60 -0
  555. data/spec/models/payout_method_details_iban_spec.rb +66 -0
  556. data/spec/models/payout_method_details_mad_cash_spec.rb +110 -0
  557. data/spec/models/payout_method_details_mobile_spec.rb +54 -0
  558. data/spec/models/payout_method_details_ngn_bank_spec.rb +70 -0
  559. data/spec/models/payout_method_details_spec.rb +149 -0
  560. data/spec/models/payout_method_details_xof_mobile_spec.rb +64 -0
  561. data/spec/models/payout_method_error_response_spec.rb +60 -0
  562. data/spec/models/payout_method_gender_enum_spec.rb +35 -0
  563. data/spec/models/payout_method_identity_card_type_enum_spec.rb +35 -0
  564. data/spec/models/payout_method_list_response_spec.rb +47 -0
  565. data/spec/models/payout_method_mobile_provider_enum_spec.rb +35 -0
  566. data/spec/models/payout_method_request_spec.rb +54 -0
  567. data/spec/models/payout_method_response_spec.rb +54 -0
  568. data/spec/models/payout_method_spec.rb +72 -0
  569. data/spec/models/payout_method_valid_response_spec.rb +60 -0
  570. data/spec/models/payout_method_webhook_spec.rb +53 -0
  571. data/spec/models/recipient_base_spec.rb +54 -0
  572. data/spec/models/recipient_error_response_spec.rb +60 -0
  573. data/spec/models/recipient_list_response_spec.rb +47 -0
  574. data/spec/models/recipient_request_spec.rb +60 -0
  575. data/spec/models/recipient_response_spec.rb +138 -0
  576. data/spec/models/recipient_spec.rb +36 -0
  577. data/spec/models/recipient_state_spec.rb +35 -0
  578. data/spec/models/recipient_valid_response_spec.rb +60 -0
  579. data/spec/models/recipient_webhook_spec.rb +53 -0
  580. data/spec/models/sender_base_spec.rb +136 -0
  581. data/spec/models/sender_error_response_spec.rb +142 -0
  582. data/spec/models/sender_existing_request_spec.rb +42 -0
  583. data/spec/models/sender_full_request_spec.rb +136 -0
  584. data/spec/models/sender_list_response_spec.rb +47 -0
  585. data/spec/models/sender_request_spec.rb +136 -0
  586. data/spec/models/sender_response_spec.rb +142 -0
  587. data/spec/models/sender_spec.rb +36 -0
  588. data/spec/models/sender_state_spec.rb +35 -0
  589. data/spec/models/sender_valid_response_spec.rb +142 -0
  590. data/spec/models/sender_webhook_spec.rb +53 -0
  591. data/spec/models/transaction_base_spec.rb +60 -0
  592. data/spec/models/transaction_error_response_spec.rb +66 -0
  593. data/spec/models/transaction_list_response_spec.rb +47 -0
  594. data/spec/models/transaction_request_base_spec.rb +48 -0
  595. data/spec/models/transaction_request_error_response_spec.rb +54 -0
  596. data/spec/models/transaction_request_request_spec.rb +48 -0
  597. data/spec/models/transaction_request_spec.rb +48 -0
  598. data/spec/models/transaction_request_valid_response_spec.rb +54 -0
  599. data/spec/models/transaction_response_spec.rb +114 -0
  600. data/spec/models/transaction_spec.rb +60 -0
  601. data/spec/models/transaction_state_spec.rb +35 -0
  602. data/spec/models/transaction_traits_spec.rb +48 -0
  603. data/spec/models/transaction_valid_response_spec.rb +66 -0
  604. data/spec/models/transaction_webhook_spec.rb +53 -0
  605. data/spec/models/valid_debit_spec.rb +90 -0
  606. data/spec/models/validation_error_description_spec.rb +41 -0
  607. data/spec/models/webhook_base_spec.rb +54 -0
  608. data/spec/models/webhook_definition_base_spec.rb +54 -0
  609. data/spec/models/webhook_definition_error_response_spec.rb +60 -0
  610. data/spec/models/webhook_definition_event_list_response_spec.rb +41 -0
  611. data/spec/models/webhook_definition_list_response_spec.rb +47 -0
  612. data/spec/models/webhook_definition_request_spec.rb +54 -0
  613. data/spec/models/webhook_definition_response_spec.rb +41 -0
  614. data/spec/models/webhook_definition_spec.rb +65 -0
  615. data/spec/models/webhook_definition_valid_response_spec.rb +60 -0
  616. data/spec/models/webhook_error_response_spec.rb +60 -0
  617. data/spec/models/webhook_log_base_metadata_params_spec.rb +42 -0
  618. data/spec/models/webhook_log_base_metadata_request_spec.rb +54 -0
  619. data/spec/models/webhook_log_base_metadata_response_spec.rb +54 -0
  620. data/spec/models/webhook_log_base_metadata_spec.rb +96 -0
  621. data/spec/models/webhook_log_base_spec.rb +72 -0
  622. data/spec/models/webhook_log_list_response_spec.rb +47 -0
  623. data/spec/models/webhook_log_metadata_params_spec.rb +42 -0
  624. data/spec/models/webhook_log_metadata_request_spec.rb +54 -0
  625. data/spec/models/webhook_log_metadata_response_spec.rb +54 -0
  626. data/spec/models/webhook_log_metadata_spec.rb +96 -0
  627. data/spec/models/webhook_log_response_spec.rb +41 -0
  628. data/spec/models/webhook_log_spec.rb +72 -0
  629. data/spec/models/webhook_request_spec.rb +54 -0
  630. data/spec/models/webhook_spec.rb +54 -0
  631. data/spec/models/webhook_valid_response_spec.rb +60 -0
  632. data/spec/spec_helper.rb +111 -0
  633. metadata +1127 -0
@@ -0,0 +1,319 @@
1
+ =begin
2
+ #BitPesa API
3
+
4
+ #Reference documentation for the BitPesa API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Bitpesa
16
+ class SendersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+
24
+ # Deleting a sender
25
+ # Deletes a single sender by the Sender ID
26
+ # @param sender_id ID of the sender to delete. Example: `/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670`
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [SenderResponse]
29
+ def delete_sender(sender_id, opts = {})
30
+ data, _status_code, _headers = delete_sender_with_http_info(sender_id, opts)
31
+ data
32
+ end
33
+
34
+ # Deleting a sender
35
+ # Deletes a single sender by the Sender ID
36
+ # @param sender_id ID of the sender to delete. Example: `/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670`
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(SenderResponse, Fixnum, Hash)>] SenderResponse data, response status code and response headers
39
+ def delete_sender_with_http_info(sender_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: SendersApi.delete_sender ...'
42
+ end
43
+ # verify the required parameter 'sender_id' is set
44
+ if @api_client.config.client_side_validation && sender_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.delete_sender"
46
+ end
47
+ # resource path
48
+ local_var_path = '/senders/{Sender ID}'.sub('{' + 'Sender ID' + '}', sender_id.to_s)
49
+
50
+ # query parameters
51
+ query_params = {}
52
+
53
+ # header parameters
54
+ header_params = {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = {}
60
+
61
+ # http body (model)
62
+ post_body = nil
63
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
64
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
65
+ :header_params => header_params,
66
+ :query_params => query_params,
67
+ :form_params => form_params,
68
+ :body => post_body,
69
+ :auth_names => auth_names,
70
+ :return_type => 'SenderResponse')
71
+ if @api_client.config.debugging
72
+ @api_client.config.logger.debug "API called: SendersApi#delete_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
73
+ end
74
+ return data, status_code, headers
75
+ end
76
+
77
+
78
+ # Fetching a sender
79
+ # Returns a single sender by the Sender ID
80
+ # @param sender_id ID of the sender to get. Example: &#x60;/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
81
+ # @param [Hash] opts the optional parameters
82
+ # @return [SenderResponse]
83
+ def get_sender(sender_id, opts = {})
84
+ data, _status_code, _headers = get_sender_with_http_info(sender_id, opts)
85
+ data
86
+ end
87
+
88
+ # Fetching a sender
89
+ # Returns a single sender by the Sender ID
90
+ # @param sender_id ID of the sender to get. Example: &#x60;/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [Array<(SenderResponse, Fixnum, Hash)>] SenderResponse data, response status code and response headers
93
+ def get_sender_with_http_info(sender_id, opts = {})
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug 'Calling API: SendersApi.get_sender ...'
96
+ end
97
+ # verify the required parameter 'sender_id' is set
98
+ if @api_client.config.client_side_validation && sender_id.nil?
99
+ fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.get_sender"
100
+ end
101
+ # resource path
102
+ local_var_path = '/senders/{Sender ID}'.sub('{' + 'Sender ID' + '}', sender_id.to_s)
103
+
104
+ # query parameters
105
+ query_params = {}
106
+
107
+ # header parameters
108
+ header_params = {}
109
+ # HTTP header 'Accept' (if needed)
110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
111
+
112
+ # form parameters
113
+ form_params = {}
114
+
115
+ # http body (model)
116
+ post_body = nil
117
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
118
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
119
+ :header_params => header_params,
120
+ :query_params => query_params,
121
+ :form_params => form_params,
122
+ :body => post_body,
123
+ :auth_names => auth_names,
124
+ :return_type => 'SenderResponse')
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug "API called: SendersApi#get_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
127
+ end
128
+ return data, status_code, headers
129
+ end
130
+
131
+ def get_senders_all(opts = {})
132
+ result = []
133
+ response = get_senders(opts)
134
+ result += response["object"]
135
+ while next_page = response["meta"]["pagination"]["next_page"]
136
+ response = get_senders(opts.merge(page: next_page))
137
+ result += response["object"]
138
+ end
139
+ result
140
+ end
141
+
142
+ # Listing senders
143
+ # Get a list of available senders
144
+ # @param [Hash] opts the optional parameters
145
+ # @option opts [Integer] :page The page number to request (defaults to 1)
146
+ # @option opts [Integer] :per The number of results to load per page (defaults to 10)
147
+ # @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60;
148
+ # @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60;
149
+ # @return [SenderListResponse]
150
+ def get_senders(opts = {})
151
+ data, _status_code, _headers = get_senders_with_http_info(opts)
152
+ data
153
+ end
154
+
155
+ # Listing senders
156
+ # Get a list of available senders
157
+ # @param [Hash] opts the optional parameters
158
+ # @option opts [Integer] :page The page number to request (defaults to 1)
159
+ # @option opts [Integer] :per The number of results to load per page (defaults to 10)
160
+ # @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60;
161
+ # @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60;
162
+ # @return [Array<(SenderListResponse, Fixnum, Hash)>] SenderListResponse data, response status code and response headers
163
+ def get_senders_with_http_info(opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: SendersApi.get_senders ...'
166
+ end
167
+ # resource path
168
+ local_var_path = '/senders'
169
+
170
+ # query parameters
171
+ query_params = {}
172
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
173
+ query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
174
+ query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?
175
+ query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?
176
+
177
+ # header parameters
178
+ header_params = {}
179
+ # HTTP header 'Accept' (if needed)
180
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
181
+
182
+ # form parameters
183
+ form_params = {}
184
+
185
+ # http body (model)
186
+ post_body = nil
187
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
188
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
189
+ :header_params => header_params,
190
+ :query_params => query_params,
191
+ :form_params => form_params,
192
+ :body => post_body,
193
+ :auth_names => auth_names,
194
+ :return_type => 'SenderListResponse')
195
+ if @api_client.config.debugging
196
+ @api_client.config.logger.debug "API called: SendersApi#get_senders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
197
+ end
198
+ return data, status_code, headers
199
+ end
200
+
201
+
202
+ # Updating a sender
203
+ # Updates the sender specified in the URL path.
204
+ # @param sender_id ID of the sender to get. Example: &#x60;/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
205
+ # @param sender_request
206
+ # @param [Hash] opts the optional parameters
207
+ # @return [SenderResponse]
208
+ def patch_sender(sender_id, sender_request, opts = {})
209
+ data, _status_code, _headers = patch_sender_with_http_info(sender_id, sender_request, opts)
210
+ data
211
+ end
212
+
213
+ # Updating a sender
214
+ # Updates the sender specified in the URL path.
215
+ # @param sender_id ID of the sender to get. Example: &#x60;/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
216
+ # @param sender_request
217
+ # @param [Hash] opts the optional parameters
218
+ # @return [Array<(SenderResponse, Fixnum, Hash)>] SenderResponse data, response status code and response headers
219
+ def patch_sender_with_http_info(sender_id, sender_request, opts = {})
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug 'Calling API: SendersApi.patch_sender ...'
222
+ end
223
+ # verify the required parameter 'sender_id' is set
224
+ if @api_client.config.client_side_validation && sender_id.nil?
225
+ fail ArgumentError, "Missing the required parameter 'sender_id' when calling SendersApi.patch_sender"
226
+ end
227
+ # verify the required parameter 'sender_request' is set
228
+ if @api_client.config.client_side_validation && sender_request.nil?
229
+ fail ArgumentError, "Missing the required parameter 'sender_request' when calling SendersApi.patch_sender"
230
+ end
231
+ # resource path
232
+ local_var_path = '/senders/{Sender ID}'.sub('{' + 'Sender ID' + '}', sender_id.to_s)
233
+
234
+ # query parameters
235
+ query_params = {}
236
+
237
+ # header parameters
238
+ header_params = {}
239
+ # HTTP header 'Accept' (if needed)
240
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
241
+ # HTTP header 'Content-Type'
242
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
243
+
244
+ # form parameters
245
+ form_params = {}
246
+
247
+ # http body (model)
248
+ post_body = @api_client.object_to_http_body(sender_request)
249
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
250
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
251
+ :header_params => header_params,
252
+ :query_params => query_params,
253
+ :form_params => form_params,
254
+ :body => post_body,
255
+ :auth_names => auth_names,
256
+ :return_type => 'SenderResponse')
257
+ if @api_client.config.debugging
258
+ @api_client.config.logger.debug "API called: SendersApi#patch_sender\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
259
+ end
260
+ return data, status_code, headers
261
+ end
262
+
263
+
264
+ # Creating a sender
265
+ # Creates a new sender in our system.
266
+ # @param sender_request
267
+ # @param [Hash] opts the optional parameters
268
+ # @return [SenderResponse]
269
+ def post_senders(sender_request, opts = {})
270
+ data, _status_code, _headers = post_senders_with_http_info(sender_request, opts)
271
+ data
272
+ end
273
+
274
+ # Creating a sender
275
+ # Creates a new sender in our system.
276
+ # @param sender_request
277
+ # @param [Hash] opts the optional parameters
278
+ # @return [Array<(SenderResponse, Fixnum, Hash)>] SenderResponse data, response status code and response headers
279
+ def post_senders_with_http_info(sender_request, opts = {})
280
+ if @api_client.config.debugging
281
+ @api_client.config.logger.debug 'Calling API: SendersApi.post_senders ...'
282
+ end
283
+ # verify the required parameter 'sender_request' is set
284
+ if @api_client.config.client_side_validation && sender_request.nil?
285
+ fail ArgumentError, "Missing the required parameter 'sender_request' when calling SendersApi.post_senders"
286
+ end
287
+ # resource path
288
+ local_var_path = '/senders'
289
+
290
+ # query parameters
291
+ query_params = {}
292
+
293
+ # header parameters
294
+ header_params = {}
295
+ # HTTP header 'Accept' (if needed)
296
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
297
+ # HTTP header 'Content-Type'
298
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
299
+
300
+ # form parameters
301
+ form_params = {}
302
+
303
+ # http body (model)
304
+ post_body = @api_client.object_to_http_body(sender_request)
305
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
306
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
307
+ :header_params => header_params,
308
+ :query_params => query_params,
309
+ :form_params => form_params,
310
+ :body => post_body,
311
+ :auth_names => auth_names,
312
+ :return_type => 'SenderResponse')
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug "API called: SendersApi#post_senders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
315
+ end
316
+ return data, status_code, headers
317
+ end
318
+ end
319
+ end
@@ -0,0 +1,425 @@
1
+ =begin
2
+ #BitPesa API
3
+
4
+ #Reference documentation for the BitPesa API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'uri'
14
+
15
+ module Bitpesa
16
+ class TransactionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+
24
+ # Calculates transaction amounts for a transaction payload
25
+ # Calculates the input, output and fee amounts for the recipients in a transaction payload
26
+ # @param transaction_request
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [TransactionResponse]
29
+ def calculate_transactions(transaction_request, opts = {})
30
+ data, _status_code, _headers = calculate_transactions_with_http_info(transaction_request, opts)
31
+ data
32
+ end
33
+
34
+ # Calculates transaction amounts for a transaction payload
35
+ # Calculates the input, output and fee amounts for the recipients in a transaction payload
36
+ # @param transaction_request
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
39
+ def calculate_transactions_with_http_info(transaction_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.calculate_transactions ...'
42
+ end
43
+ # verify the required parameter 'transaction_request' is set
44
+ if @api_client.config.client_side_validation && transaction_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'transaction_request' when calling TransactionsApi.calculate_transactions"
46
+ end
47
+ # resource path
48
+ local_var_path = '/transactions/calculate'
49
+
50
+ # query parameters
51
+ query_params = {}
52
+
53
+ # header parameters
54
+ header_params = {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
57
+ # HTTP header 'Content-Type'
58
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
59
+
60
+ # form parameters
61
+ form_params = {}
62
+
63
+ # http body (model)
64
+ post_body = @api_client.object_to_http_body(transaction_request)
65
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
66
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
67
+ :header_params => header_params,
68
+ :query_params => query_params,
69
+ :form_params => form_params,
70
+ :body => post_body,
71
+ :auth_names => auth_names,
72
+ :return_type => 'TransactionResponse')
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: TransactionsApi#calculate_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+
79
+
80
+ # Fetch a single transaction
81
+ # Finds and returns a Transaction created by the requesting API key, using the provided Transaction ID.
82
+ # @param transaction_id ID of the transaction. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
83
+ # @param [Hash] opts the optional parameters
84
+ # @return [TransactionResponse]
85
+ def get_transaction(transaction_id, opts = {})
86
+ data, _status_code, _headers = get_transaction_with_http_info(transaction_id, opts)
87
+ data
88
+ end
89
+
90
+ # Fetch a single transaction
91
+ # Finds and returns a Transaction created by the requesting API key, using the provided Transaction ID.
92
+ # @param transaction_id ID of the transaction. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60;
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
95
+ def get_transaction_with_http_info(transaction_id, opts = {})
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transaction ...'
98
+ end
99
+ # verify the required parameter 'transaction_id' is set
100
+ if @api_client.config.client_side_validation && transaction_id.nil?
101
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transaction"
102
+ end
103
+ # resource path
104
+ local_var_path = '/transactions/{Transaction ID}'.sub('{' + 'Transaction ID' + '}', transaction_id.to_s)
105
+
106
+ # query parameters
107
+ query_params = {}
108
+
109
+ # header parameters
110
+ header_params = {}
111
+ # HTTP header 'Accept' (if needed)
112
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
113
+
114
+ # form parameters
115
+ form_params = {}
116
+
117
+ # http body (model)
118
+ post_body = nil
119
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
120
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
121
+ :header_params => header_params,
122
+ :query_params => query_params,
123
+ :form_params => form_params,
124
+ :body => post_body,
125
+ :auth_names => auth_names,
126
+ :return_type => 'TransactionResponse')
127
+ if @api_client.config.debugging
128
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
129
+ end
130
+ return data, status_code, headers
131
+ end
132
+
133
+ def get_transactions_all(opts = {})
134
+ result = []
135
+ response = get_transactions(opts)
136
+ result += response["object"]
137
+ while next_page = response["meta"]["pagination"]["next_page"]
138
+ response = get_transactions(opts.merge(page: next_page))
139
+ result += response["object"]
140
+ end
141
+ result
142
+ end
143
+
144
+ # Get a list of transactions
145
+ # Retrieves a paginated list of the Transactions created by your API key.
146
+ # @param [Hash] opts the optional parameters
147
+ # @option opts [Integer] :page The page number to request (defaults to 1)
148
+ # @option opts [Integer] :per The number of results to load per page (defaults to 10)
149
+ # @return [TransactionListResponse]
150
+ def get_transactions(opts = {})
151
+ data, _status_code, _headers = get_transactions_with_http_info(opts)
152
+ data
153
+ end
154
+
155
+ # Get a list of transactions
156
+ # Retrieves a paginated list of the Transactions created by your API key.
157
+ # @param [Hash] opts the optional parameters
158
+ # @option opts [Integer] :page The page number to request (defaults to 1)
159
+ # @option opts [Integer] :per The number of results to load per page (defaults to 10)
160
+ # @return [Array<(TransactionListResponse, Fixnum, Hash)>] TransactionListResponse data, response status code and response headers
161
+ def get_transactions_with_http_info(opts = {})
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'
164
+ end
165
+ # resource path
166
+ local_var_path = '/transactions'
167
+
168
+ # query parameters
169
+ query_params = {}
170
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
171
+ query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
172
+
173
+ # header parameters
174
+ header_params = {}
175
+ # HTTP header 'Accept' (if needed)
176
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
177
+
178
+ # form parameters
179
+ form_params = {}
180
+
181
+ # http body (model)
182
+ post_body = nil
183
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
184
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
185
+ :header_params => header_params,
186
+ :query_params => query_params,
187
+ :form_params => form_params,
188
+ :body => post_body,
189
+ :auth_names => auth_names,
190
+ :return_type => 'TransactionListResponse')
191
+ if @api_client.config.debugging
192
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
193
+ end
194
+ return data, status_code, headers
195
+ end
196
+
197
+
198
+ # Creates a fake payin for transaction
199
+ # This method is available only in sandbox environment and is supposed to be used only for testing integration. It allows you to emulate a payin without paying actual money.
200
+ # @param transaction_id ID of the transaction to payin. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payin&#x60;
201
+ # @param payin_method_request
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [TransactionResponse]
204
+ def payin_transaction(transaction_id, payin_method_request, opts = {})
205
+ data, _status_code, _headers = payin_transaction_with_http_info(transaction_id, payin_method_request, opts)
206
+ data
207
+ end
208
+
209
+ # Creates a fake payin for transaction
210
+ # This method is available only in sandbox environment and is supposed to be used only for testing integration. It allows you to emulate a payin without paying actual money.
211
+ # @param transaction_id ID of the transaction to payin. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payin&#x60;
212
+ # @param payin_method_request
213
+ # @param [Hash] opts the optional parameters
214
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
215
+ def payin_transaction_with_http_info(transaction_id, payin_method_request, opts = {})
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.payin_transaction ...'
218
+ end
219
+ # verify the required parameter 'transaction_id' is set
220
+ if @api_client.config.client_side_validation && transaction_id.nil?
221
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.payin_transaction"
222
+ end
223
+ # verify the required parameter 'payin_method_request' is set
224
+ if @api_client.config.client_side_validation && payin_method_request.nil?
225
+ fail ArgumentError, "Missing the required parameter 'payin_method_request' when calling TransactionsApi.payin_transaction"
226
+ end
227
+ # resource path
228
+ local_var_path = '/transactions/{Transaction ID}/payin'.sub('{' + 'Transaction ID' + '}', transaction_id.to_s)
229
+
230
+ # query parameters
231
+ query_params = {}
232
+
233
+ # header parameters
234
+ header_params = {}
235
+ # HTTP header 'Accept' (if needed)
236
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
237
+ # HTTP header 'Content-Type'
238
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
239
+
240
+ # form parameters
241
+ form_params = {}
242
+
243
+ # http body (model)
244
+ post_body = @api_client.object_to_http_body(payin_method_request)
245
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
246
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
247
+ :header_params => header_params,
248
+ :query_params => query_params,
249
+ :form_params => form_params,
250
+ :body => post_body,
251
+ :auth_names => auth_names,
252
+ :return_type => 'TransactionResponse')
253
+ if @api_client.config.debugging
254
+ @api_client.config.logger.debug "API called: TransactionsApi#payin_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
255
+ end
256
+ return data, status_code, headers
257
+ end
258
+
259
+
260
+ # Creates a fake payout for transaction
261
+ # This method is available only in sandbox environment and is supposed to be used only for testing. It allows you to emulate the payout of a transaction after payin.
262
+ # @param transaction_id ID of the transaction to payout. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payout&#x60;
263
+ # @param [Hash] opts the optional parameters
264
+ # @return [TransactionResponse]
265
+ def payout_transaction(transaction_id, opts = {})
266
+ data, _status_code, _headers = payout_transaction_with_http_info(transaction_id, opts)
267
+ data
268
+ end
269
+
270
+ # Creates a fake payout for transaction
271
+ # This method is available only in sandbox environment and is supposed to be used only for testing. It allows you to emulate the payout of a transaction after payin.
272
+ # @param transaction_id ID of the transaction to payout. Example: &#x60;/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payout&#x60;
273
+ # @param [Hash] opts the optional parameters
274
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
275
+ def payout_transaction_with_http_info(transaction_id, opts = {})
276
+ if @api_client.config.debugging
277
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.payout_transaction ...'
278
+ end
279
+ # verify the required parameter 'transaction_id' is set
280
+ if @api_client.config.client_side_validation && transaction_id.nil?
281
+ fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.payout_transaction"
282
+ end
283
+ # resource path
284
+ local_var_path = '/transactions/{Transaction ID}/payout'.sub('{' + 'Transaction ID' + '}', transaction_id.to_s)
285
+
286
+ # query parameters
287
+ query_params = {}
288
+
289
+ # header parameters
290
+ header_params = {}
291
+ # HTTP header 'Accept' (if needed)
292
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
293
+
294
+ # form parameters
295
+ form_params = {}
296
+
297
+ # http body (model)
298
+ post_body = nil
299
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
300
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
301
+ :header_params => header_params,
302
+ :query_params => query_params,
303
+ :form_params => form_params,
304
+ :body => post_body,
305
+ :auth_names => auth_names,
306
+ :return_type => 'TransactionResponse')
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug "API called: TransactionsApi#payout_transaction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
309
+ end
310
+ return data, status_code, headers
311
+ end
312
+
313
+
314
+ # Creates a new transaction
315
+ # Transactions are the main objects in the BitPesa API, so it's important to understand how to create and manage them. Transactions facilitate money movement from one Sender in a specific currency to one or multiple Recipients in another currency. The main flow of a successful transaction flow is the following - - Transaction is created linking the Sender to the Recipient(s) with the requested amounts. - Once the sender is KYC'd and approved the transaction can be funded. - Once the transaction is funded, we will initiate the payout to the recipient(s). - After the recipient (or all recipients) has received the money, the transaction is finished.
316
+ # @param transaction_request
317
+ # @param [Hash] opts the optional parameters
318
+ # @return [TransactionResponse]
319
+ def post_transactions(transaction_request, opts = {})
320
+ data, _status_code, _headers = post_transactions_with_http_info(transaction_request, opts)
321
+ data
322
+ end
323
+
324
+ # Creates a new transaction
325
+ # Transactions are the main objects in the BitPesa API, so it&#39;s important to understand how to create and manage them. Transactions facilitate money movement from one Sender in a specific currency to one or multiple Recipients in another currency. The main flow of a successful transaction flow is the following - - Transaction is created linking the Sender to the Recipient(s) with the requested amounts. - Once the sender is KYC&#39;d and approved the transaction can be funded. - Once the transaction is funded, we will initiate the payout to the recipient(s). - After the recipient (or all recipients) has received the money, the transaction is finished.
326
+ # @param transaction_request
327
+ # @param [Hash] opts the optional parameters
328
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
329
+ def post_transactions_with_http_info(transaction_request, opts = {})
330
+ if @api_client.config.debugging
331
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.post_transactions ...'
332
+ end
333
+ # verify the required parameter 'transaction_request' is set
334
+ if @api_client.config.client_side_validation && transaction_request.nil?
335
+ fail ArgumentError, "Missing the required parameter 'transaction_request' when calling TransactionsApi.post_transactions"
336
+ end
337
+ # resource path
338
+ local_var_path = '/transactions'
339
+
340
+ # query parameters
341
+ query_params = {}
342
+
343
+ # header parameters
344
+ header_params = {}
345
+ # HTTP header 'Accept' (if needed)
346
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
347
+ # HTTP header 'Content-Type'
348
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
349
+
350
+ # form parameters
351
+ form_params = {}
352
+
353
+ # http body (model)
354
+ post_body = @api_client.object_to_http_body(transaction_request)
355
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
356
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
357
+ :header_params => header_params,
358
+ :query_params => query_params,
359
+ :form_params => form_params,
360
+ :body => post_body,
361
+ :auth_names => auth_names,
362
+ :return_type => 'TransactionResponse')
363
+ if @api_client.config.debugging
364
+ @api_client.config.logger.debug "API called: TransactionsApi#post_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
365
+ end
366
+ return data, status_code, headers
367
+ end
368
+
369
+
370
+ # Validates a transaction payload
371
+ # Validates fields in a transaction payload and displays invalid or missing fields
372
+ # @param transaction_request
373
+ # @param [Hash] opts the optional parameters
374
+ # @return [TransactionResponse]
375
+ def validate_transactions(transaction_request, opts = {})
376
+ data, _status_code, _headers = validate_transactions_with_http_info(transaction_request, opts)
377
+ data
378
+ end
379
+
380
+ # Validates a transaction payload
381
+ # Validates fields in a transaction payload and displays invalid or missing fields
382
+ # @param transaction_request
383
+ # @param [Hash] opts the optional parameters
384
+ # @return [Array<(TransactionResponse, Fixnum, Hash)>] TransactionResponse data, response status code and response headers
385
+ def validate_transactions_with_http_info(transaction_request, opts = {})
386
+ if @api_client.config.debugging
387
+ @api_client.config.logger.debug 'Calling API: TransactionsApi.validate_transactions ...'
388
+ end
389
+ # verify the required parameter 'transaction_request' is set
390
+ if @api_client.config.client_side_validation && transaction_request.nil?
391
+ fail ArgumentError, "Missing the required parameter 'transaction_request' when calling TransactionsApi.validate_transactions"
392
+ end
393
+ # resource path
394
+ local_var_path = '/transactions/validate'
395
+
396
+ # query parameters
397
+ query_params = {}
398
+
399
+ # header parameters
400
+ header_params = {}
401
+ # HTTP header 'Accept' (if needed)
402
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
403
+ # HTTP header 'Content-Type'
404
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
405
+
406
+ # form parameters
407
+ form_params = {}
408
+
409
+ # http body (model)
410
+ post_body = @api_client.object_to_http_body(transaction_request)
411
+ auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
412
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
413
+ :header_params => header_params,
414
+ :query_params => query_params,
415
+ :form_params => form_params,
416
+ :body => post_body,
417
+ :auth_names => auth_names,
418
+ :return_type => 'TransactionResponse')
419
+ if @api_client.config.debugging
420
+ @api_client.config.logger.debug "API called: TransactionsApi#validate_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
421
+ end
422
+ return data, status_code, headers
423
+ end
424
+ end
425
+ end