ps-apimatic-sdk 0.0.1

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.
Files changed (418) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +231 -0
  4. data/bin/console +15 -0
  5. data/lib/paysecure_api_documentation_live/api_helper.rb +10 -0
  6. data/lib/paysecure_api_documentation_live/apis/ap_is_api.rb +2969 -0
  7. data/lib/paysecure_api_documentation_live/apis/api.rb +91 -0
  8. data/lib/paysecure_api_documentation_live/apis/base_api.rb +67 -0
  9. data/lib/paysecure_api_documentation_live/apis/cashier_ap_is_api.rb +466 -0
  10. data/lib/paysecure_api_documentation_live/apis/get_balance_api.rb +136 -0
  11. data/lib/paysecure_api_documentation_live/apis/get_balance_api_v2_orchestration_api.rb +40 -0
  12. data/lib/paysecure_api_documentation_live/apis/global_collection_api.rb +381 -0
  13. data/lib/paysecure_api_documentation_live/apis/m_paypal_wallet_api.rb +126 -0
  14. data/lib/paysecure_api_documentation_live/apis/m_virtual_cards_payout_api.rb +182 -0
  15. data/lib/paysecure_api_documentation_live/apis/pay_in_api.rb +1764 -0
  16. data/lib/paysecure_api_documentation_live/apis/pay_out_api.rb +844 -0
  17. data/lib/paysecure_api_documentation_live/apis/payin_api.rb +265 -0
  18. data/lib/paysecure_api_documentation_live/apis/payout_api.rb +196 -0
  19. data/lib/paysecure_api_documentation_live/apis/payout_manual_review_api.rb +175 -0
  20. data/lib/paysecure_api_documentation_live/apis/refund_api.rb +38 -0
  21. data/lib/paysecure_api_documentation_live/apis/transaction_reporting_api.rb +148 -0
  22. data/lib/paysecure_api_documentation_live/apis/trust_score_api.rb +347 -0
  23. data/lib/paysecure_api_documentation_live/client.rb +163 -0
  24. data/lib/paysecure_api_documentation_live/configuration.rb +181 -0
  25. data/lib/paysecure_api_documentation_live/exceptions/api_exception.rb +21 -0
  26. data/lib/paysecure_api_documentation_live/exceptions/cancel_exception.rb +363 -0
  27. data/lib/paysecure_api_documentation_live/exceptions/capture_exception.rb +377 -0
  28. data/lib/paysecure_api_documentation_live/exceptions/empty_refund_amt_exception.rb +51 -0
  29. data/lib/paysecure_api_documentation_live/exceptions/error1_exception.rb +51 -0
  30. data/lib/paysecure_api_documentation_live/exceptions/existing_customer_exception.rb +51 -0
  31. data/lib/paysecure_api_documentation_live/exceptions/failure_exception.rb +51 -0
  32. data/lib/paysecure_api_documentation_live/exceptions/invalid_customer_exception.rb +51 -0
  33. data/lib/paysecure_api_documentation_live/exceptions/invalid_purchase_id_exception.rb +51 -0
  34. data/lib/paysecure_api_documentation_live/exceptions/invalid_session_exception.rb +51 -0
  35. data/lib/paysecure_api_documentation_live/exceptions/m400_bad_request_exception.rb +51 -0
  36. data/lib/paysecure_api_documentation_live/exceptions/m401_unauthorized_exception.rb +51 -0
  37. data/lib/paysecure_api_documentation_live/exceptions/payment_error_exception.rb +51 -0
  38. data/lib/paysecure_api_documentation_live/exceptions/payment_methods_error_exception.rb +55 -0
  39. data/lib/paysecure_api_documentation_live/exceptions/refund_amt_exceeds_purchase_amt_exception.rb +51 -0
  40. data/lib/paysecure_api_documentation_live/exceptions/refund_amt_is0_or_ve_exception.rb +51 -0
  41. data/lib/paysecure_api_documentation_live/exceptions/refund_error_exception.rb +51 -0
  42. data/lib/paysecure_api_documentation_live/exceptions/refund_exceeds_remaining_balance_after_a_partial_refund_exception.rb +51 -0
  43. data/lib/paysecure_api_documentation_live/exceptions/refund_on_an_already_refunded_purchase_exception.rb +51 -0
  44. data/lib/paysecure_api_documentation_live/exceptions/refund_on_failed_or_pending_transactions_exception.rb +51 -0
  45. data/lib/paysecure_api_documentation_live/exceptions/success33_exception.rb +363 -0
  46. data/lib/paysecure_api_documentation_live/exceptions/success36_exception.rb +147 -0
  47. data/lib/paysecure_api_documentation_live/exceptions/success42_exception.rb +46 -0
  48. data/lib/paysecure_api_documentation_live/exceptions/success44_exception.rb +46 -0
  49. data/lib/paysecure_api_documentation_live/exceptions/success51_exception.rb +86 -0
  50. data/lib/paysecure_api_documentation_live/exceptions/transaction_already_refunded_exception.rb +51 -0
  51. data/lib/paysecure_api_documentation_live/exceptions/trust_score_error_exception.rb +51 -0
  52. data/lib/paysecure_api_documentation_live/exceptions/whitelist_upload_failure_exception.rb +57 -0
  53. data/lib/paysecure_api_documentation_live/http/api_response.rb +19 -0
  54. data/lib/paysecure_api_documentation_live/http/auth/oauth_2.rb +53 -0
  55. data/lib/paysecure_api_documentation_live/http/http_call_back.rb +10 -0
  56. data/lib/paysecure_api_documentation_live/http/http_method_enum.rb +10 -0
  57. data/lib/paysecure_api_documentation_live/http/http_request.rb +10 -0
  58. data/lib/paysecure_api_documentation_live/http/http_response.rb +10 -0
  59. data/lib/paysecure_api_documentation_live/http/proxy_settings.rb +22 -0
  60. data/lib/paysecure_api_documentation_live/logging/configuration/api_logging_configuration.rb +186 -0
  61. data/lib/paysecure_api_documentation_live/logging/sdk_logger.rb +17 -0
  62. data/lib/paysecure_api_documentation_live/models/action_status.rb +459 -0
  63. data/lib/paysecure_api_documentation_live/models/aft.rb +239 -0
  64. data/lib/paysecure_api_documentation_live/models/aggregated_balance.rb +104 -0
  65. data/lib/paysecure_api_documentation_live/models/all.rb +82 -0
  66. data/lib/paysecure_api_documentation_live/models/applepay_decrypted_payload.rb +142 -0
  67. data/lib/paysecure_api_documentation_live/models/applepay_param.rb +74 -0
  68. data/lib/paysecure_api_documentation_live/models/applepay_param1.rb +76 -0
  69. data/lib/paysecure_api_documentation_live/models/applepay_token.rb +100 -0
  70. data/lib/paysecure_api_documentation_live/models/approve_payout_with_remarks_request.rb +73 -0
  71. data/lib/paysecure_api_documentation_live/models/attempt.rb +147 -0
  72. data/lib/paysecure_api_documentation_live/models/attempt1.rb +138 -0
  73. data/lib/paysecure_api_documentation_live/models/attempt2.rb +142 -0
  74. data/lib/paysecure_api_documentation_live/models/attempt26.rb +147 -0
  75. data/lib/paysecure_api_documentation_live/models/attempt27.rb +138 -0
  76. data/lib/paysecure_api_documentation_live/models/attempt28.rb +147 -0
  77. data/lib/paysecure_api_documentation_live/models/attempt4.rb +138 -0
  78. data/lib/paysecure_api_documentation_live/models/attempt5.rb +138 -0
  79. data/lib/paysecure_api_documentation_live/models/balance.rb +104 -0
  80. data/lib/paysecure_api_documentation_live/models/balance1.rb +95 -0
  81. data/lib/paysecure_api_documentation_live/models/bank_account.rb +82 -0
  82. data/lib/paysecure_api_documentation_live/models/base_model.rb +110 -0
  83. data/lib/paysecure_api_documentation_live/models/beneficiary_detail.rb +110 -0
  84. data/lib/paysecure_api_documentation_live/models/beneficiary_detail1.rb +95 -0
  85. data/lib/paysecure_api_documentation_live/models/beneficiary_detail2.rb +96 -0
  86. data/lib/paysecure_api_documentation_live/models/beneficiary_detail3.rb +95 -0
  87. data/lib/paysecure_api_documentation_live/models/beneficiary_detail4.rb +134 -0
  88. data/lib/paysecure_api_documentation_live/models/beneficiary_detail5.rb +72 -0
  89. data/lib/paysecure_api_documentation_live/models/beneficiary_detail6.rb +82 -0
  90. data/lib/paysecure_api_documentation_live/models/bulk_update_invoice_no.rb +100 -0
  91. data/lib/paysecure_api_documentation_live/models/bulk_update_invoice_no_request.rb +82 -0
  92. data/lib/paysecure_api_documentation_live/models/by_country.rb +72 -0
  93. data/lib/paysecure_api_documentation_live/models/capture_request.rb +75 -0
  94. data/lib/paysecure_api_documentation_live/models/capture_txn.rb +318 -0
  95. data/lib/paysecure_api_documentation_live/models/check_transaction_allowed_request.rb +82 -0
  96. data/lib/paysecure_api_documentation_live/models/check_white_list_doesn_t_exists.rb +73 -0
  97. data/lib/paysecure_api_documentation_live/models/check_white_list_exists.rb +73 -0
  98. data/lib/paysecure_api_documentation_live/models/check_white_list_request.rb +82 -0
  99. data/lib/paysecure_api_documentation_live/models/checking_balance_partial_success.rb +119 -0
  100. data/lib/paysecure_api_documentation_live/models/checking_balance_payout_error.rb +82 -0
  101. data/lib/paysecure_api_documentation_live/models/checking_balance_payout_error2.rb +111 -0
  102. data/lib/paysecure_api_documentation_live/models/checking_balance_payout_success.rb +99 -0
  103. data/lib/paysecure_api_documentation_live/models/checking_balance_payout_success2.rb +119 -0
  104. data/lib/paysecure_api_documentation_live/models/checking_balance_request.rb +74 -0
  105. data/lib/paysecure_api_documentation_live/models/client.rb +146 -0
  106. data/lib/paysecure_api_documentation_live/models/client1.rb +154 -0
  107. data/lib/paysecure_api_documentation_live/models/client10.rb +180 -0
  108. data/lib/paysecure_api_documentation_live/models/client100.rb +146 -0
  109. data/lib/paysecure_api_documentation_live/models/client103.rb +154 -0
  110. data/lib/paysecure_api_documentation_live/models/client104.rb +192 -0
  111. data/lib/paysecure_api_documentation_live/models/client12.rb +216 -0
  112. data/lib/paysecure_api_documentation_live/models/client13.rb +109 -0
  113. data/lib/paysecure_api_documentation_live/models/client15.rb +180 -0
  114. data/lib/paysecure_api_documentation_live/models/client17.rb +100 -0
  115. data/lib/paysecure_api_documentation_live/models/client2.rb +268 -0
  116. data/lib/paysecure_api_documentation_live/models/client24.rb +154 -0
  117. data/lib/paysecure_api_documentation_live/models/client26.rb +90 -0
  118. data/lib/paysecure_api_documentation_live/models/client29.rb +164 -0
  119. data/lib/paysecure_api_documentation_live/models/client35.rb +162 -0
  120. data/lib/paysecure_api_documentation_live/models/client37.rb +109 -0
  121. data/lib/paysecure_api_documentation_live/models/client4.rb +172 -0
  122. data/lib/paysecure_api_documentation_live/models/client41.rb +146 -0
  123. data/lib/paysecure_api_documentation_live/models/client45.rb +117 -0
  124. data/lib/paysecure_api_documentation_live/models/client46.rb +126 -0
  125. data/lib/paysecure_api_documentation_live/models/client52.rb +162 -0
  126. data/lib/paysecure_api_documentation_live/models/client57.rb +73 -0
  127. data/lib/paysecure_api_documentation_live/models/client6.rb +250 -0
  128. data/lib/paysecure_api_documentation_live/models/client65.rb +127 -0
  129. data/lib/paysecure_api_documentation_live/models/client66.rb +162 -0
  130. data/lib/paysecure_api_documentation_live/models/client67.rb +109 -0
  131. data/lib/paysecure_api_documentation_live/models/client68.rb +117 -0
  132. data/lib/paysecure_api_documentation_live/models/client7.rb +154 -0
  133. data/lib/paysecure_api_documentation_live/models/client70.rb +162 -0
  134. data/lib/paysecure_api_documentation_live/models/client75.rb +180 -0
  135. data/lib/paysecure_api_documentation_live/models/client8.rb +135 -0
  136. data/lib/paysecure_api_documentation_live/models/client80.rb +146 -0
  137. data/lib/paysecure_api_documentation_live/models/client86.rb +127 -0
  138. data/lib/paysecure_api_documentation_live/models/client88.rb +162 -0
  139. data/lib/paysecure_api_documentation_live/models/client9.rb +190 -0
  140. data/lib/paysecure_api_documentation_live/models/content.rb +83 -0
  141. data/lib/paysecure_api_documentation_live/models/country_names.rb +72 -0
  142. data/lib/paysecure_api_documentation_live/models/create_brand_id.rb +100 -0
  143. data/lib/paysecure_api_documentation_live/models/create_brand_id_request.rb +72 -0
  144. data/lib/paysecure_api_documentation_live/models/create_customer_request.rb +165 -0
  145. data/lib/paysecure_api_documentation_live/models/create_customer_request1.rb +182 -0
  146. data/lib/paysecure_api_documentation_live/models/create_merchant_api.rb +100 -0
  147. data/lib/paysecure_api_documentation_live/models/create_merchant_api_request.rb +348 -0
  148. data/lib/paysecure_api_documentation_live/models/create_merchant_api_token.rb +100 -0
  149. data/lib/paysecure_api_documentation_live/models/create_merchant_api_token_request.rb +82 -0
  150. data/lib/paysecure_api_documentation_live/models/create_pay_out_request.rb +140 -0
  151. data/lib/paysecure_api_documentation_live/models/create_pay_out_request1.rb +130 -0
  152. data/lib/paysecure_api_documentation_live/models/create_pay_out_request3.rb +170 -0
  153. data/lib/paysecure_api_documentation_live/models/create_pay_out_request4.rb +130 -0
  154. data/lib/paysecure_api_documentation_live/models/create_pay_out_request5.rb +139 -0
  155. data/lib/paysecure_api_documentation_live/models/create_pay_out_request6.rb +181 -0
  156. data/lib/paysecure_api_documentation_live/models/create_pay_out_request7.rb +140 -0
  157. data/lib/paysecure_api_documentation_live/models/create_payout_error.rb +82 -0
  158. data/lib/paysecure_api_documentation_live/models/create_payout_success.rb +630 -0
  159. data/lib/paysecure_api_documentation_live/models/create_payout_success1.rb +237 -0
  160. data/lib/paysecure_api_documentation_live/models/create_payout_success2.rb +229 -0
  161. data/lib/paysecure_api_documentation_live/models/create_purchase.rb +82 -0
  162. data/lib/paysecure_api_documentation_live/models/create_purchase_cit_request.rb +179 -0
  163. data/lib/paysecure_api_documentation_live/models/create_purchase_mit_request.rb +170 -0
  164. data/lib/paysecure_api_documentation_live/models/create_purchase_request.rb +141 -0
  165. data/lib/paysecure_api_documentation_live/models/create_purchase_request1.rb +153 -0
  166. data/lib/paysecure_api_documentation_live/models/create_purchase_request2.rb +161 -0
  167. data/lib/paysecure_api_documentation_live/models/create_session_cit_request.rb +188 -0
  168. data/lib/paysecure_api_documentation_live/models/customer_request.rb +182 -0
  169. data/lib/paysecure_api_documentation_live/models/customer_request1.rb +163 -0
  170. data/lib/paysecure_api_documentation_live/models/data.rb +154 -0
  171. data/lib/paysecure_api_documentation_live/models/data11.rb +91 -0
  172. data/lib/paysecure_api_documentation_live/models/data12.rb +91 -0
  173. data/lib/paysecure_api_documentation_live/models/data13.rb +92 -0
  174. data/lib/paysecure_api_documentation_live/models/data14.rb +99 -0
  175. data/lib/paysecure_api_documentation_live/models/data16.rb +109 -0
  176. data/lib/paysecure_api_documentation_live/models/data18.rb +84 -0
  177. data/lib/paysecure_api_documentation_live/models/data2.rb +242 -0
  178. data/lib/paysecure_api_documentation_live/models/data4.rb +91 -0
  179. data/lib/paysecure_api_documentation_live/models/data5.rb +90 -0
  180. data/lib/paysecure_api_documentation_live/models/data7.rb +74 -0
  181. data/lib/paysecure_api_documentation_live/models/data8.rb +91 -0
  182. data/lib/paysecure_api_documentation_live/models/data9.rb +348 -0
  183. data/lib/paysecure_api_documentation_live/models/datum.rb +82 -0
  184. data/lib/paysecure_api_documentation_live/models/delete_brand_id.rb +100 -0
  185. data/lib/paysecure_api_documentation_live/models/delete_merchant_api.rb +100 -0
  186. data/lib/paysecure_api_documentation_live/models/delete_merchant_token.rb +100 -0
  187. data/lib/paysecure_api_documentation_live/models/empty_refund_amt1.rb +82 -0
  188. data/lib/paysecure_api_documentation_live/models/error.rb +82 -0
  189. data/lib/paysecure_api_documentation_live/models/error3.rb +247 -0
  190. data/lib/paysecure_api_documentation_live/models/error7.rb +95 -0
  191. data/lib/paysecure_api_documentation_live/models/extra.rb +139 -0
  192. data/lib/paysecure_api_documentation_live/models/extra10.rb +82 -0
  193. data/lib/paysecure_api_documentation_live/models/extra5.rb +148 -0
  194. data/lib/paysecure_api_documentation_live/models/extra52.rb +148 -0
  195. data/lib/paysecure_api_documentation_live/models/extra57.rb +153 -0
  196. data/lib/paysecure_api_documentation_live/models/extra8.rb +82 -0
  197. data/lib/paysecure_api_documentation_live/models/extra_param.rb +102 -0
  198. data/lib/paysecure_api_documentation_live/models/extra_param1.rb +74 -0
  199. data/lib/paysecure_api_documentation_live/models/extra_param10.rb +100 -0
  200. data/lib/paysecure_api_documentation_live/models/extra_param13.rb +74 -0
  201. data/lib/paysecure_api_documentation_live/models/extra_param2.rb +75 -0
  202. data/lib/paysecure_api_documentation_live/models/extra_param20.rb +112 -0
  203. data/lib/paysecure_api_documentation_live/models/extra_param21.rb +86 -0
  204. data/lib/paysecure_api_documentation_live/models/extra_param25.rb +75 -0
  205. data/lib/paysecure_api_documentation_live/models/extra_param26.rb +72 -0
  206. data/lib/paysecure_api_documentation_live/models/extra_param3.rb +75 -0
  207. data/lib/paysecure_api_documentation_live/models/extra_param4.rb +74 -0
  208. data/lib/paysecure_api_documentation_live/models/extra_param5.rb +74 -0
  209. data/lib/paysecure_api_documentation_live/models/extra_param6.rb +75 -0
  210. data/lib/paysecure_api_documentation_live/models/extra_param7.rb +91 -0
  211. data/lib/paysecure_api_documentation_live/models/extra_param8.rb +91 -0
  212. data/lib/paysecure_api_documentation_live/models/extra_param9.rb +91 -0
  213. data/lib/paysecure_api_documentation_live/models/failure7.rb +243 -0
  214. data/lib/paysecure_api_documentation_live/models/fee.rb +118 -0
  215. data/lib/paysecure_api_documentation_live/models/gateway.rb +111 -0
  216. data/lib/paysecure_api_documentation_live/models/gateway1.rb +134 -0
  217. data/lib/paysecure_api_documentation_live/models/gateway2.rb +100 -0
  218. data/lib/paysecure_api_documentation_live/models/get_error_status.rb +82 -0
  219. data/lib/paysecure_api_documentation_live/models/get_global_accounts.rb +109 -0
  220. data/lib/paysecure_api_documentation_live/models/get_merchants.rb +100 -0
  221. data/lib/paysecure_api_documentation_live/models/get_missing_invoice_transactions.rb +100 -0
  222. data/lib/paysecure_api_documentation_live/models/get_settlement_data.rb +90 -0
  223. data/lib/paysecure_api_documentation_live/models/get_single_merchant.rb +100 -0
  224. data/lib/paysecure_api_documentation_live/models/get_status.rb +221 -0
  225. data/lib/paysecure_api_documentation_live/models/get_status_error.rb +82 -0
  226. data/lib/paysecure_api_documentation_live/models/get_success_status.rb +248 -0
  227. data/lib/paysecure_api_documentation_live/models/get_success_status1.rb +248 -0
  228. data/lib/paysecure_api_documentation_live/models/get_success_status2.rb +249 -0
  229. data/lib/paysecure_api_documentation_live/models/get_success_status3.rb +249 -0
  230. data/lib/paysecure_api_documentation_live/models/googlepay_decrypted_payload.rb +115 -0
  231. data/lib/paysecure_api_documentation_live/models/googlepay_param.rb +86 -0
  232. data/lib/paysecure_api_documentation_live/models/googlepay_param1.rb +87 -0
  233. data/lib/paysecure_api_documentation_live/models/header.rb +94 -0
  234. data/lib/paysecure_api_documentation_live/models/invalid_purchase_id1.rb +82 -0
  235. data/lib/paysecure_api_documentation_live/models/issuer_details.rb +159 -0
  236. data/lib/paysecure_api_documentation_live/models/issuer_details1.rb +168 -0
  237. data/lib/paysecure_api_documentation_live/models/issuer_details11.rb +101 -0
  238. data/lib/paysecure_api_documentation_live/models/m202_success.rb +563 -0
  239. data/lib/paysecure_api_documentation_live/models/mandate.rb +130 -0
  240. data/lib/paysecure_api_documentation_live/models/mandate2.rb +144 -0
  241. data/lib/paysecure_api_documentation_live/models/mandate4.rb +202 -0
  242. data/lib/paysecure_api_documentation_live/models/merchant.rb +348 -0
  243. data/lib/paysecure_api_documentation_live/models/metadata.rb +97 -0
  244. data/lib/paysecure_api_documentation_live/models/names.rb +265 -0
  245. data/lib/paysecure_api_documentation_live/models/new_request.rb +247 -0
  246. data/lib/paysecure_api_documentation_live/models/new_request_request.rb +139 -0
  247. data/lib/paysecure_api_documentation_live/models/open_banking_eu_uk.rb +515 -0
  248. data/lib/paysecure_api_documentation_live/models/optional_input.rb +795 -0
  249. data/lib/paysecure_api_documentation_live/models/pagination.rb +136 -0
  250. data/lib/paysecure_api_documentation_live/models/partial_refund_api_request.rb +82 -0
  251. data/lib/paysecure_api_documentation_live/models/partial_refund_status_api_request.rb +74 -0
  252. data/lib/paysecure_api_documentation_live/models/pause_mandate.rb +111 -0
  253. data/lib/paysecure_api_documentation_live/models/pause_mandate_request.rb +103 -0
  254. data/lib/paysecure_api_documentation_live/models/pay_in_details.rb +100 -0
  255. data/lib/paysecure_api_documentation_live/models/pay_in_details10.rb +109 -0
  256. data/lib/paysecure_api_documentation_live/models/pay_in_details2.rb +293 -0
  257. data/lib/paysecure_api_documentation_live/models/pay_in_details3.rb +93 -0
  258. data/lib/paysecure_api_documentation_live/models/pay_in_details4.rb +96 -0
  259. data/lib/paysecure_api_documentation_live/models/pay_in_details6.rb +83 -0
  260. data/lib/paysecure_api_documentation_live/models/pay_in_details7.rb +90 -0
  261. data/lib/paysecure_api_documentation_live/models/pay_out_details.rb +100 -0
  262. data/lib/paysecure_api_documentation_live/models/pay_out_details1.rb +92 -0
  263. data/lib/paysecure_api_documentation_live/models/pay_out_details3.rb +74 -0
  264. data/lib/paysecure_api_documentation_live/models/pay_out_request.rb +179 -0
  265. data/lib/paysecure_api_documentation_live/models/pay_out_request1.rb +180 -0
  266. data/lib/paysecure_api_documentation_live/models/pay_out_request3.rb +179 -0
  267. data/lib/paysecure_api_documentation_live/models/payin_api_request.rb +153 -0
  268. data/lib/paysecure_api_documentation_live/models/payment.rb +169 -0
  269. data/lib/paysecure_api_documentation_live/models/payment17.rb +169 -0
  270. data/lib/paysecure_api_documentation_live/models/payment3.rb +169 -0
  271. data/lib/paysecure_api_documentation_live/models/payment4.rb +169 -0
  272. data/lib/paysecure_api_documentation_live/models/payment_data.rb +85 -0
  273. data/lib/paysecure_api_documentation_live/models/payment_method_details.rb +120 -0
  274. data/lib/paysecure_api_documentation_live/models/payment_method_success.rb +111 -0
  275. data/lib/paysecure_api_documentation_live/models/payout_api_request.rb +170 -0
  276. data/lib/paysecure_api_documentation_live/models/payout_api_request1.rb +130 -0
  277. data/lib/paysecure_api_documentation_live/models/payout_request2.rb +161 -0
  278. data/lib/paysecure_api_documentation_live/models/payout_session.rb +118 -0
  279. data/lib/paysecure_api_documentation_live/models/payout_session_request.rb +197 -0
  280. data/lib/paysecure_api_documentation_live/models/payout_session_with_crypto_conversion.rb +118 -0
  281. data/lib/paysecure_api_documentation_live/models/pix_payload.rb +93 -0
  282. data/lib/paysecure_api_documentation_live/models/product.rb +82 -0
  283. data/lib/paysecure_api_documentation_live/models/product1.rb +109 -0
  284. data/lib/paysecure_api_documentation_live/models/product16.rb +73 -0
  285. data/lib/paysecure_api_documentation_live/models/product17.rb +73 -0
  286. data/lib/paysecure_api_documentation_live/models/product2.rb +109 -0
  287. data/lib/paysecure_api_documentation_live/models/product48.rb +82 -0
  288. data/lib/paysecure_api_documentation_live/models/product49.rb +109 -0
  289. data/lib/paysecure_api_documentation_live/models/product7.rb +82 -0
  290. data/lib/paysecure_api_documentation_live/models/purchase.rb +91 -0
  291. data/lib/paysecure_api_documentation_live/models/purchase1.rb +184 -0
  292. data/lib/paysecure_api_documentation_live/models/purchase10.rb +91 -0
  293. data/lib/paysecure_api_documentation_live/models/purchase16.rb +128 -0
  294. data/lib/paysecure_api_documentation_live/models/purchase17.rb +128 -0
  295. data/lib/paysecure_api_documentation_live/models/purchase2.rb +164 -0
  296. data/lib/paysecure_api_documentation_live/models/purchase21.rb +164 -0
  297. data/lib/paysecure_api_documentation_live/models/purchase24.rb +174 -0
  298. data/lib/paysecure_api_documentation_live/models/purchase26.rb +184 -0
  299. data/lib/paysecure_api_documentation_live/models/purchase45.rb +175 -0
  300. data/lib/paysecure_api_documentation_live/models/purchase47.rb +183 -0
  301. data/lib/paysecure_api_documentation_live/models/purchase48.rb +91 -0
  302. data/lib/paysecure_api_documentation_live/models/purchase49.rb +183 -0
  303. data/lib/paysecure_api_documentation_live/models/purchase52.rb +82 -0
  304. data/lib/paysecure_api_documentation_live/models/purchase55.rb +99 -0
  305. data/lib/paysecure_api_documentation_live/models/purchase56.rb +175 -0
  306. data/lib/paysecure_api_documentation_live/models/purchase62.rb +174 -0
  307. data/lib/paysecure_api_documentation_live/models/purchase7.rb +100 -0
  308. data/lib/paysecure_api_documentation_live/models/purchase73.rb +361 -0
  309. data/lib/paysecure_api_documentation_live/models/purchase8.rb +184 -0
  310. data/lib/paysecure_api_documentation_live/models/purchase9.rb +165 -0
  311. data/lib/paysecure_api_documentation_live/models/purchase_error.rb +82 -0
  312. data/lib/paysecure_api_documentation_live/models/purchase_request.rb +161 -0
  313. data/lib/paysecure_api_documentation_live/models/purchase_request1.rb +162 -0
  314. data/lib/paysecure_api_documentation_live/models/purchase_request2.rb +162 -0
  315. data/lib/paysecure_api_documentation_live/models/purchase_request3.rb +142 -0
  316. data/lib/paysecure_api_documentation_live/models/purchase_request4.rb +170 -0
  317. data/lib/paysecure_api_documentation_live/models/purchase_session_request.rb +189 -0
  318. data/lib/paysecure_api_documentation_live/models/purchase_success.rb +497 -0
  319. data/lib/paysecure_api_documentation_live/models/purchase_success1.rb +479 -0
  320. data/lib/paysecure_api_documentation_live/models/purchase_success2.rb +462 -0
  321. data/lib/paysecure_api_documentation_live/models/purchase_success3.rb +471 -0
  322. data/lib/paysecure_api_documentation_live/models/purchase_success4.rb +527 -0
  323. data/lib/paysecure_api_documentation_live/models/purchase_sucess.rb +471 -0
  324. data/lib/paysecure_api_documentation_live/models/purchases1.rb +479 -0
  325. data/lib/paysecure_api_documentation_live/models/purchases_decrypted_flow_request.rb +161 -0
  326. data/lib/paysecure_api_documentation_live/models/purchases_decrypted_flow_request1.rb +140 -0
  327. data/lib/paysecure_api_documentation_live/models/purchases_encrypted_flow_request.rb +161 -0
  328. data/lib/paysecure_api_documentation_live/models/purchases_encrypted_flow_request1.rb +140 -0
  329. data/lib/paysecure_api_documentation_live/models/purchases_error.rb +378 -0
  330. data/lib/paysecure_api_documentation_live/models/purchases_request.rb +153 -0
  331. data/lib/paysecure_api_documentation_live/models/purchases_request11.rb +161 -0
  332. data/lib/paysecure_api_documentation_live/models/purchases_request2.rb +161 -0
  333. data/lib/paysecure_api_documentation_live/models/purchases_request3.rb +153 -0
  334. data/lib/paysecure_api_documentation_live/models/purchases_request4.rb +161 -0
  335. data/lib/paysecure_api_documentation_live/models/purchases_request5.rb +153 -0
  336. data/lib/paysecure_api_documentation_live/models/purchases_request6.rb +153 -0
  337. data/lib/paysecure_api_documentation_live/models/purchases_request8.rb +161 -0
  338. data/lib/paysecure_api_documentation_live/models/purchases_request9.rb +171 -0
  339. data/lib/paysecure_api_documentation_live/models/purchases_success.rb +397 -0
  340. data/lib/paysecure_api_documentation_live/models/purchases_success1.rb +497 -0
  341. data/lib/paysecure_api_documentation_live/models/purchases_success2.rb +480 -0
  342. data/lib/paysecure_api_documentation_live/models/purchases_success5.rb +470 -0
  343. data/lib/paysecure_api_documentation_live/models/refund_amt_exceeds_purchase_amt1.rb +82 -0
  344. data/lib/paysecure_api_documentation_live/models/refund_amt_is0_or_ve1.rb +82 -0
  345. data/lib/paysecure_api_documentation_live/models/refund_exceeds_remaining_balance_after_a_partial_refund1.rb +82 -0
  346. data/lib/paysecure_api_documentation_live/models/refund_on_an_already_refunded_purchase1.rb +82 -0
  347. data/lib/paysecure_api_documentation_live/models/refund_on_failed_or_pending_transactions1.rb +82 -0
  348. data/lib/paysecure_api_documentation_live/models/refund_pending.rb +388 -0
  349. data/lib/paysecure_api_documentation_live/models/refund_pending1.rb +388 -0
  350. data/lib/paysecure_api_documentation_live/models/refund_success.rb +388 -0
  351. data/lib/paysecure_api_documentation_live/models/refund_success1.rb +388 -0
  352. data/lib/paysecure_api_documentation_live/models/reject_payout_with_remarks_request.rb +73 -0
  353. data/lib/paysecure_api_documentation_live/models/request_global_account.rb +90 -0
  354. data/lib/paysecure_api_documentation_live/models/request_global_account_request.rb +82 -0
  355. data/lib/paysecure_api_documentation_live/models/requiredinput.rb +90 -0
  356. data/lib/paysecure_api_documentation_live/models/revoke_mandate_request.rb +82 -0
  357. data/lib/paysecure_api_documentation_live/models/routing_param.rb +83 -0
  358. data/lib/paysecure_api_documentation_live/models/s2_s_api_request.rb +202 -0
  359. data/lib/paysecure_api_documentation_live/models/s2_s_payment_request.rb +184 -0
  360. data/lib/paysecure_api_documentation_live/models/s2_srequest.rb +202 -0
  361. data/lib/paysecure_api_documentation_live/models/session_with_crypto_conversion.rb +118 -0
  362. data/lib/paysecure_api_documentation_live/models/settlement.rb +109 -0
  363. data/lib/paysecure_api_documentation_live/models/status_history.rb +82 -0
  364. data/lib/paysecure_api_documentation_live/models/status_history8.rb +112 -0
  365. data/lib/paysecure_api_documentation_live/models/success.rb +535 -0
  366. data/lib/paysecure_api_documentation_live/models/success1.rb +90 -0
  367. data/lib/paysecure_api_documentation_live/models/success10.rb +470 -0
  368. data/lib/paysecure_api_documentation_live/models/success11.rb +470 -0
  369. data/lib/paysecure_api_documentation_live/models/success12.rb +268 -0
  370. data/lib/paysecure_api_documentation_live/models/success13.rb +526 -0
  371. data/lib/paysecure_api_documentation_live/models/success14.rb +118 -0
  372. data/lib/paysecure_api_documentation_live/models/success16.rb +450 -0
  373. data/lib/paysecure_api_documentation_live/models/success17.rb +461 -0
  374. data/lib/paysecure_api_documentation_live/models/success18.rb +247 -0
  375. data/lib/paysecure_api_documentation_live/models/success19.rb +228 -0
  376. data/lib/paysecure_api_documentation_live/models/success2.rb +369 -0
  377. data/lib/paysecure_api_documentation_live/models/success21.rb +256 -0
  378. data/lib/paysecure_api_documentation_live/models/success22.rb +462 -0
  379. data/lib/paysecure_api_documentation_live/models/success23.rb +252 -0
  380. data/lib/paysecure_api_documentation_live/models/success24.rb +99 -0
  381. data/lib/paysecure_api_documentation_live/models/success29.rb +221 -0
  382. data/lib/paysecure_api_documentation_live/models/success3.rb +462 -0
  383. data/lib/paysecure_api_documentation_live/models/success32.rb +129 -0
  384. data/lib/paysecure_api_documentation_live/models/success38.rb +552 -0
  385. data/lib/paysecure_api_documentation_live/models/success39.rb +100 -0
  386. data/lib/paysecure_api_documentation_live/models/success40.rb +82 -0
  387. data/lib/paysecure_api_documentation_live/models/success41.rb +553 -0
  388. data/lib/paysecure_api_documentation_live/models/success46.rb +85 -0
  389. data/lib/paysecure_api_documentation_live/models/success47.rb +527 -0
  390. data/lib/paysecure_api_documentation_live/models/success49.rb +73 -0
  391. data/lib/paysecure_api_documentation_live/models/success5.rb +229 -0
  392. data/lib/paysecure_api_documentation_live/models/success6.rb +100 -0
  393. data/lib/paysecure_api_documentation_live/models/success7.rb +453 -0
  394. data/lib/paysecure_api_documentation_live/models/success8.rb +243 -0
  395. data/lib/paysecure_api_documentation_live/models/to_address.rb +90 -0
  396. data/lib/paysecure_api_documentation_live/models/to_address1.rb +90 -0
  397. data/lib/paysecure_api_documentation_live/models/transaction.rb +101 -0
  398. data/lib/paysecure_api_documentation_live/models/transaction_already_refunded1.rb +82 -0
  399. data/lib/paysecure_api_documentation_live/models/transaction_data.rb +110 -0
  400. data/lib/paysecure_api_documentation_live/models/transaction_data1.rb +119 -0
  401. data/lib/paysecure_api_documentation_live/models/transaction_data2.rb +119 -0
  402. data/lib/paysecure_api_documentation_live/models/transaction_data3.rb +119 -0
  403. data/lib/paysecure_api_documentation_live/models/transaction_data37.rb +119 -0
  404. data/lib/paysecure_api_documentation_live/models/transaction_data40.rb +119 -0
  405. data/lib/paysecure_api_documentation_live/models/transaction_data41.rb +119 -0
  406. data/lib/paysecure_api_documentation_live/models/transaction_data6.rb +119 -0
  407. data/lib/paysecure_api_documentation_live/models/transaction_data7.rb +119 -0
  408. data/lib/paysecure_api_documentation_live/models/trust_score_detailed_request.rb +82 -0
  409. data/lib/paysecure_api_documentation_live/models/trust_score_exists.rb +145 -0
  410. data/lib/paysecure_api_documentation_live/models/trust_score_exists1.rb +75 -0
  411. data/lib/paysecure_api_documentation_live/models/update_merchant.rb +100 -0
  412. data/lib/paysecure_api_documentation_live/models/update_merchant_request.rb +302 -0
  413. data/lib/paysecure_api_documentation_live/models/whitelist_upload_success.rb +92 -0
  414. data/lib/paysecure_api_documentation_live/utilities/date_time_helper.rb +11 -0
  415. data/lib/paysecure_api_documentation_live/utilities/file_wrapper.rb +28 -0
  416. data/lib/paysecure_api_documentation_live/utilities/union_type_lookup.rb +50 -0
  417. data/lib/paysecure_api_documentation_live.rb +528 -0
  418. metadata +501 -0
@@ -0,0 +1,2969 @@
1
+ # paysecure_api_documentation_live
2
+ #
3
+ # This file was automatically generated
4
+ # by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module PaysecureApiDocumentationLive
7
+ # ApIsApi
8
+ class ApIsApi < BaseApi
9
+ # To Initiate a payment, the very first call to make is `/purchases` with
10
+ # the required data in the request body.
11
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
12
+ # request body) and `API key` (in the header) Both can be located in the
13
+ # Dashboard section of your merchant account login.
14
+ # The request body structure is shown on the request body of the example
15
+ # request shown here.
16
+ # The following (see table below) are the mandatory parameters that are
17
+ # required to create a purchase request.
18
+ # ### **Mandatory parameters in the request body:**
19
+ # | **Parameter** | **Notes** |
20
+ # | --- | --- |
21
+ # | client.email | The customer's email. |
22
+ # | client.city | The customer's city. |
23
+ # | client.country | ISO-3166 Country Code. Must be upper case. Example “SG”
24
+ # (Alpha2) |
25
+ # | client.stateCode | Example “AL”, “XZ”. Must be in upper case. |
26
+ # | Client.street_address | The customer's address. |
27
+ # | client.zip_code | The customer's ZIP or postal code. If country=US, zip
28
+ # format must be NNNNN or NNNNN-NNNN. |
29
+ # | purchase.currency | ISO 4217 code for currency you want to send the
30
+ # transaction in. <br> <br>Please note, the currency has to be enabled by
31
+ # the account manager for your account. |
32
+ # | purchase.products | An object which contains the list of products which
33
+ # the customer is buying. |
34
+ # | purchase.products.name | The name of the product. |
35
+ # | purchase.products.price | Price in decimal format. <br>example 1:
36
+ # <br>EUR 5 , should be sent as 5.00 <br> <br>example 2: <br>USD 10 and
37
+ # 37 cents , should be sent as 10.37 |
38
+ # | brand_id | Obtain from Dashboard section of your merchant account login.
39
+ # |
40
+ # | success_redirect | URL to send the user if the transactions is
41
+ # successful. |
42
+ # | pending_redirect | URL to send the user if the transactions is in
43
+ # pending. |
44
+ # | failure_redirect | URL to send the user if the transactions is
45
+ # unsuccessful. |
46
+ # ## Essential Optional Parameters
47
+ # ### merchantRef
48
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
49
+ # for merchants to specify. Its inclusion offers two significant advantages
50
+ # for the merchant:
51
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
52
+ # it acts as a unique identifier. This means that if a second purchase
53
+ # request is made using the same `merchantRef` (reference number), the
54
+ # system will recognize it and prevent duplicate transactions from
55
+ # occurring. This prevents unintended or duplicate purchases.
56
+ #
57
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
58
+ # response from the initial purchase request times out or the 'purchaseId'
59
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
60
+ # detailed transaction information. This ensures they can track and access
61
+ # the specific purchase details related to that reference, even if the
62
+ # immediate response was not received.
63
+ #
64
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
65
+ # platform will automatically assign and use an internal 'purchaseId' as a
66
+ # reference for that transaction.
67
+ # Upon successul create on a Purchase you'd get a `"purchaseId"` . Use this
68
+ # ID for the next step in Server to server call by calling
69
+ # `p/{purchaseId}/?s2s=true .`
70
+ # ### paymentMethod
71
+ # The `paymentMethod` parameter identifies which payment solution merchant
72
+ # wants to use to perform a transaction. If parameter is provided, than
73
+ # Paysecure will perform direct payment with the selected payment method
74
+ # instead of loading Paysecure URL.
75
+ # ### Errors
76
+ # If there are any errors then it'll be in the format of :
77
+ # ``` json
78
+ # {
79
+ # "message": "descriptive error message",
80
+ # "code": "error_code"
81
+ # }
82
+ # ```
83
+ # ### Possible Error Messages
84
+ # | **Error Messages** |
85
+ # | --- |
86
+ # | Allowed Limit for this card for particular time period has been consumed
87
+ # |
88
+ # | some Mandatory Parameter are missing |
89
+ # | Invalid format of Date_of_Birth \[allowed format: yyyy-mm-dd\] |
90
+ # | Invalid Email Format |
91
+ # | Please submit Valid Alpha2 Country Code Ex:(AF,IN) in \\"country\\"
92
+ # parameter |
93
+ # | Please pass Valid State Code |
94
+ # | Please pass valid street address in \\"street_address\\" parameter |
95
+ # | Please pass valid city name in \\"city\\" parameter |
96
+ # | Please pass valid postal Code name in \\"zip_code\\" parameter |
97
+ # | You are not Allowed for Live Transaction |
98
+ # | Merchant Limit is not set |
99
+ # | Minimum amount is not set for this merchant |
100
+ # | Brand not found ! |
101
+ # | Your charges setting is incomplete .Plese Contact to Administrator. |
102
+ # | Only {{currencyCode}} currency is allowed. |
103
+ # | Transaction amount must be equal or greater to minimum trans amount |
104
+ # | Invalid_Parameter <br>You'd usually get it when one or more mandatory
105
+ # parameters are not present in the request. |
106
+ # @param [PurchaseRequest] body Required parameter: TODO: type description
107
+ # here
108
+ # @return [ApiResponse] Complete http response with raw body and status code.
109
+ def purchase(body)
110
+ @api_call
111
+ .request(new_request_builder(HttpMethodEnum::POST,
112
+ '/api/v1/purchases',
113
+ Server::SERVER_3)
114
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
115
+ .body_param(new_parameter(body)
116
+ .is_required(true))
117
+ .header_param(new_parameter('application/json', key: 'accept'))
118
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
119
+ .response(new_response_handler
120
+ .deserializer(APIHelper.method(:custom_type_deserializer))
121
+ .deserialize_into(Success.method(:from_hash))
122
+ .is_api_response(true))
123
+ .execute
124
+ end
125
+
126
+ # This API would be the 2nd in sequence to call if the call to `/purchases/`
127
+ # was successful in step 1. and you want to do the transaction via
128
+ # Server-to-Server mode.
129
+ # The request body would contain the details of the card that's to be
130
+ # transacted upon.
131
+ # ### **Mandatory parameters in request body:**
132
+ # | Parameter | **Notes** |
133
+ # | --- | --- |
134
+ # | remote_ip | IP address of the customer’s device used for transaction.
135
+ # Helps in fraud checks and risk scoring. Ex- 157.38.242.7 |
136
+ # | remember_card | "on" or "off" if you want us to store the card details
137
+ # on our end. |
138
+ # | user_agent | Full browser and operating system details captured from
139
+ # HTTP header. EX- Chrome/5.0 (X11; Linux x86_64) |
140
+ # | accept_header | Browser’s accepted content types (from HTTP header).
141
+ # Used for validating request origin and device info. EX- text/html |
142
+ # **Note:**
143
+ # If you want to use token_reference for doing a card transaction, please
144
+ # have a look at Network Tokenisation Section.
145
+ # ### **Essential parameters in request body:**
146
+ # | Parameter | **Notes** |
147
+ # | --- | --- |
148
+ # | cardholder_name | Name of the cardholder |
149
+ # | card_number | The card numbers Must be 10-20 characters. |
150
+ # | expires | must be greater than the current month/year. MM/YY format. |
151
+ # | cvc | 3 or 4 digit |
152
+ #
153
+ # **Other optional parameters in request body:**
154
+ # | Parameter | **Notes** |
155
+ # | --- | --- |
156
+ # | language | Preferred language of the user’s browser . EX - en-US |
157
+ # | java_enabled | Indicates if Java is enabled in the browser. Helps PSPs
158
+ # in device profiling. Ex- true/false |
159
+ # | javascript_enabled | Indicates if JavaScript is enabled in the client
160
+ # browser. Used for 3DS or risk-based checks. Ex- true |
161
+ # | color_depth | Bit depth of the display screen. Ex- 24 |
162
+ # | utc_offset | Difference in minutes between local time and UTC. Used for
163
+ # location and timezone checks. Ex- 330 |
164
+ # | screen_width | Width of the device screen in pixels. Used in device
165
+ # profiling. Ex- 1920 |
166
+ # | screen_height | Height of the device screen in pixels. Ex- 1080 |
167
+ # ### Successful Response
168
+ # If all the details are correct you'll get a 202 response with staus as
169
+ # Pending
170
+ # ``` json
171
+ # {
172
+ # "status": "pending",
173
+ # "callback_url":
174
+ # "https://paysecure.net/payment/63bd0bf80fb42a076e8a4dd1/",
175
+ # "method": "GET"
176
+ # }
177
+ # ```
178
+ # If the response code is 202, after receiving the response body, direct the
179
+ # customer to the callback_url provided in the response.
180
+ # ### Errors
181
+ # If there are any errors then it'll be in the format of :
182
+ # ``` json
183
+ # {
184
+ # "message": "descriptive error message",
185
+ # "code": "error_code"
186
+ # }
187
+ # ```
188
+ # Please see the Status Code section for further details.
189
+ # | **Error Messages** |
190
+ # | --- |
191
+ # | Client Ip could not be matched with Merchant Ip |
192
+ # | Invalid Card Information |
193
+ # | Card is Blocked |
194
+ # | Different Type of key used to create purchase and payment |
195
+ # | You charges setting is incomplete .Plese Contact to adminstrartor. |
196
+ # | Allowed Attempt for this Transaction has been consumed |
197
+ # | Invalid Card Expiry(Valid Format:MM/YY) must be greator than current
198
+ # month/year |
199
+ # | Customer profile is Blocked |
200
+ # | Customer/Card not allowed for transaction |
201
+ # @param [TrueClass | FalseClass] s2s Required parameter: TODO: type
202
+ # description here
203
+ # @param [S2Srequest] body Required parameter: TODO: type description here
204
+ # @return [ApiResponse] Complete http response with raw body and status code.
205
+ def s2_s(s2s,
206
+ body)
207
+ @api_call
208
+ .request(new_request_builder(HttpMethodEnum::POST,
209
+ '/api/v1/p/purchaseid',
210
+ Server::SERVER_3)
211
+ .query_param(new_parameter(s2s, key: 's2s')
212
+ .is_required(true))
213
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
214
+ .body_param(new_parameter(body)
215
+ .is_required(true))
216
+ .header_param(new_parameter('application/json', key: 'accept'))
217
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
218
+ .response(new_response_handler
219
+ .deserializer(APIHelper.method(:custom_type_deserializer))
220
+ .deserialize_into(Success1.method(:from_hash))
221
+ .is_api_response(true)
222
+ .local_error('401',
223
+ 'Unauthorized',
224
+ FailureException))
225
+ .execute
226
+ end
227
+
228
+ # This is the callback URL that is in the response object of the
229
+ # Server-to-Server Call
230
+ # When this URL is called from the end user's browser, the user would be
231
+ # redirected to the `success_redirect` or `failure_redirect` URL given by
232
+ # the merchant at the time of create purchase
233
+ # When this URL is called from the end user's browser, if card is 3DS
234
+ # enrolled, the user will be redirect to a verification screen or challenge
235
+ # by the issuing bank and upon successful user verification, the user would
236
+ # be redictected to the success URL given in `/purchases API` .
237
+ # If for some reason the transactions is unsuccessful, the user will be
238
+ # redirect to failure URL given in `/purchases API` API .
239
+ # @param [String] accept Required parameter: TODO: type description here
240
+ # @return [ApiResponse] Complete http response with raw body and status code.
241
+ def payment_to_be_initiated_from_client_browser(accept)
242
+ @api_call
243
+ .request(new_request_builder(HttpMethodEnum::GET,
244
+ '/api/v1/payment/purchaseid',
245
+ Server::SERVER_3)
246
+ .header_param(new_parameter(accept, key: 'Accept')
247
+ .is_required(true)))
248
+ .response(new_response_handler
249
+ .is_response_void(true)
250
+ .is_api_response(true)
251
+ .local_error('400',
252
+ 'Bad Request',
253
+ PaymentErrorException))
254
+ .execute
255
+ end
256
+
257
+ # This API tells you about all the details of a purchase, including its
258
+ # history
259
+ # ### Mandatory
260
+ # you need to pass the `PurchaseID` in the API URL
261
+ # ### Possible Value of Status
262
+ # | **Status** | **Notes** |
263
+ # | --- | --- |
264
+ # | created | When Purchase order is created. |
265
+ # | paid | Transaction Successful |
266
+ # | payment_in_process | Payment is under Processing |
267
+ # | chargeback | Payment is chargeback state |
268
+ # | refund_in_process | Refund is under Processing. |
269
+ # | expired | Purchase has Expired. |
270
+ # | overdue | Purchase is Overdued. |
271
+ # | cancelled | Purchase is cancelled. |
272
+ # | error | Transaction has Failed. |
273
+ # | refunded | Payment is refunded |
274
+ # ### Response Examples
275
+ # In the response examples you can see instances of both `Paid` and `Error`
276
+ # Status purchases.
277
+ # ### Error Details
278
+ # If there are any issues on the Purchase you can get more details from the
279
+ # `transaction_data.attempts.error` attribute of the response object
280
+ # ### Errors
281
+ # If there are any errors then it'll be in the format of :
282
+ # ``` json
283
+ # {
284
+ # "message": "descriptive error message",
285
+ # "code": "error_code"
286
+ # }
287
+ # ```
288
+ # Please see the Status Code section for further details.
289
+ # @return [ApiResponse] Complete http response with raw body and status code.
290
+ def get_status
291
+ @api_call
292
+ .request(new_request_builder(HttpMethodEnum::GET,
293
+ '/api/v1/purchases/purchaseid',
294
+ Server::SERVER_3)
295
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
296
+ .header_param(new_parameter('application/json', key: 'accept')))
297
+ .response(new_response_handler
298
+ .deserializer(APIHelper.method(:custom_type_deserializer))
299
+ .deserialize_into(PurchasesError.method(:from_hash))
300
+ .is_api_response(true))
301
+ .execute
302
+ end
303
+
304
+ # This API is used to initate refund (Full Refund) of the purchases that
305
+ # have status as `PAID` can be initiated for refund
306
+ # Once the refund has been initiated, the status of the purchase would
307
+ # become `REFUND_IN_PROCESS` and once the refund has been approved by the
308
+ # bank, the status woud become `REFUNDED`
309
+ # Purchase ID is **mandatory** for this API.
310
+ # Currently we don't support partial refunds.
311
+ # ### Response Examples
312
+ # In the response examples you can see instances of both `successful` and
313
+ # `unsuccessful` in refund of purchases.
314
+ # @return [ApiResponse] Complete http response with raw body and status code.
315
+ def refund
316
+ @api_call
317
+ .request(new_request_builder(HttpMethodEnum::GET,
318
+ '/api/v1/purchases/purchaseid/refund',
319
+ Server::SERVER_3)
320
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
321
+ .header_param(new_parameter('application/json', key: 'accept')))
322
+ .response(new_response_handler
323
+ .deserializer(APIHelper.method(:custom_type_deserializer))
324
+ .deserialize_into(RefundSuccess.method(:from_hash))
325
+ .is_api_response(true)
326
+ .local_error('400',
327
+ 'Bad Request',
328
+ RefundErrorException))
329
+ .execute
330
+ end
331
+
332
+ # This API gives back the list of Payment methods available for a brand.
333
+ # @param [String] brand_id Required parameter: TODO: type description here
334
+ # @return [ApiResponse] Complete http response with raw body and status code.
335
+ def payment_methods(brand_id)
336
+ @api_call
337
+ .request(new_request_builder(HttpMethodEnum::GET,
338
+ '/api/v1/payment_methods',
339
+ Server::SERVER_3)
340
+ .query_param(new_parameter(brand_id, key: 'brand_id')
341
+ .is_required(true))
342
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
343
+ .header_param(new_parameter('application/json', key: 'accept')))
344
+ .response(new_response_handler
345
+ .deserializer(APIHelper.method(:custom_type_deserializer))
346
+ .deserialize_into(PaymentMethodSuccess.method(:from_hash))
347
+ .is_api_response(true)
348
+ .local_error('401',
349
+ 'Unauthorized',
350
+ PaymentMethodsErrorException))
351
+ .execute
352
+ end
353
+
354
+ # Cancels an in-progress or completed purchase transaction, preventing
355
+ # further processing or reversing the authorization hold. Use this endpoint
356
+ # to void a transaction that has not yet been settled to the merchant's
357
+ # account.
358
+ # **When to use:**
359
+ # - **Post-creation cancellation:** Cancel a purchase immediately after it
360
+ # has been created via the Purchase API, before the customer completes the
361
+ # payment flow.
362
+ #
363
+ # - **Pre-redirect cancellation:** Cancel a transaction after completing the
364
+ # server-to-server (S2S) call but before redirecting the cardholder to the
365
+ # `callbackURL`. This is useful when your backend validation logic
366
+ # determines the transaction should not proceed (e.g., inventory check
367
+ # failure, fraud flag, duplicate order detection).
368
+ #
369
+ # Purchase ID is **mandatory** for this API.
370
+ # @return [ApiResponse] Complete http response with raw body and status code.
371
+ def cancel
372
+ @api_call
373
+ .request(new_request_builder(HttpMethodEnum::GET,
374
+ '/api/v1/purchases/64bff556f63e36669499e9d3/cancel',
375
+ Server::SERVER_3)
376
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
377
+ .header_param(new_parameter('application/json', key: 'accept')))
378
+ .response(new_response_handler
379
+ .deserializer(APIHelper.method(:custom_type_deserializer))
380
+ .deserialize_into(Success2.method(:from_hash))
381
+ .is_api_response(true)
382
+ .local_error('400',
383
+ 'Bad Request',
384
+ Error1Exception))
385
+ .execute
386
+ end
387
+
388
+ # ### Overview
389
+ # Paysecure supports the concept of whitelisted cards. The merchant can send
390
+ # PaySecure a list of cards that are to be whitelisted. Once whitelisted,
391
+ # only whitelisted cards are allowed to be transacted for that merchant.
392
+ # The merchant can check the individual card status with this API by giving
393
+ # the email and card numbers of the customers.
394
+ # ### Mandatory Parameters (in body)
395
+ # | **Parameters** |
396
+ # | --- |
397
+ # | email |
398
+ # | card_num |
399
+ # ### Other parameters:
400
+ # | **Parameters** |
401
+ # | --- |
402
+ # | signup_date |
403
+ # | deposit_date |
404
+ # | number_of_deposits |
405
+ # ### Response Examples
406
+ # In the response examples, you can observe both instances of verifying
407
+ # whether a card exists in a merchant's whitelist, one for an existing card
408
+ # and another for a non-existing card.
409
+ # @param [String] accept Required parameter: TODO: type description here
410
+ # @param [CheckWhiteListRequest] body Required parameter: TODO: type
411
+ # description here
412
+ # @return [ApiResponse] Complete http response with raw body and status code.
413
+ def check_white_list(accept,
414
+ body)
415
+ @api_call
416
+ .request(new_request_builder(HttpMethodEnum::POST,
417
+ '/api/v1/checkWhiteList',
418
+ Server::SERVER_3)
419
+ .header_param(new_parameter(accept, key: 'Accept')
420
+ .is_required(true))
421
+ .body_param(new_parameter(body)
422
+ .is_required(true))
423
+ .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
424
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
425
+ .response(new_response_handler
426
+ .deserializer(APIHelper.method(:custom_type_deserializer))
427
+ .deserialize_into(CheckWhiteListDoesnTExists.method(:from_hash))
428
+ .is_api_response(true))
429
+ .execute
430
+ end
431
+
432
+ # ### Overview
433
+ # The merchant can upload a list of whitelist cards and email ids through
434
+ # this API. All cards successfully uploaded will be considered whitelisted
435
+ # and allowed for that merchant.
436
+ # ### Mandatory parameters in the request body:
437
+ # | Parameter | Notes |
438
+ # | --- | --- |
439
+ # | csvFile | Upload a CSV file |
440
+ # **Please note:**
441
+ # 1. CSV file should contain the following headers (both mandatory)
442
+ #
443
+ # 1. card_number
444
+ #
445
+ # 2. email_id
446
+ #
447
+ # 2. CSV file should not be empty
448
+ #
449
+ # ``` java
450
+ # public class FileUploader {
451
+ # public static void uploadFile(String apiUrl, String filePath, String
452
+ # authorizationHeader) {
453
+ # try {
454
+ # File file = new File(filePath);
455
+ # OkHttpClient client = new OkHttpClient();
456
+ # RequestBody requestBody = new
457
+ # MultipartBody.Builder().setType(MultipartBody.FORM)
458
+ # .addFormDataPart("csvFile", file.getName(),
459
+ # RequestBody.create(MediaType.parse("text/csv"), file))
460
+ # .build();
461
+ # Request request = new
462
+ # Request.Builder().url(apiUrl).post(requestBody)
463
+ # .addHeader("Authorization",
464
+ # authorizationHeader).build();
465
+ # Response response = client.newCall(request).execute();
466
+ # if (response.code() == 202) {
467
+ # System.out.println("File uploaded successfully!");
468
+ # System.out.println("Response: " +
469
+ # response.body().string());
470
+ # } else {
471
+ # System.out.println("File upload failed.");
472
+ # System.out.println("Status: " + response.code());
473
+ # System.out.println("Error: " + response.body().string());
474
+ # }
475
+ # } catch (IOException e) {
476
+ # e.printStackTrace();
477
+ # }
478
+ # }
479
+ # public static void main(String[] args) {
480
+ # String apiUrl = "https://{{base_url}}/api/v1/whitelist/upload";
481
+ # String filePath = "whitelist.csv.file.path";
482
+ # String authorizationHeader = "Bearer YOUR API KEY";
483
+ # uploadFile(apiUrl, filePath, authorizationHeader);
484
+ # }
485
+ # }
486
+ # ```
487
+ # @param [File | UploadIO] csv_file Required parameter: TODO: type
488
+ # description here
489
+ # @return [ApiResponse] Complete http response with raw body and status code.
490
+ def whitelist_upload(csv_file)
491
+ @api_call
492
+ .request(new_request_builder(HttpMethodEnum::POST,
493
+ '/api/v1/whitelist/upload',
494
+ Server::SERVER_3)
495
+ .multipart_param(new_parameter(csv_file, key: 'csvFile')
496
+ .is_required(true)
497
+ .default_content_type('application/octet-stream'))
498
+ .header_param(new_parameter('application/json', key: 'accept')))
499
+ .response(new_response_handler
500
+ .deserializer(APIHelper.method(:custom_type_deserializer))
501
+ .deserialize_into(WhitelistUploadSuccess.method(:from_hash))
502
+ .is_api_response(true)
503
+ .local_error('401',
504
+ 'Unauthorized',
505
+ WhitelistUploadFailureException))
506
+ .execute
507
+ end
508
+
509
+ # ## Overview
510
+ # The **Original Credit Transaction (OCT)**, commonly referred to as **Push
511
+ # to Card**, enables merchants to facilitate near-instantaneous fund
512
+ # transfers directly to a customer’s eligible Visa or Mastercard debit or
513
+ # credit card. Unlike traditional refund processes that can only return
514
+ # funds from a previous purchase, OCT allows for independent disbursements
515
+ # of funds to a cardholder's account.
516
+ # This feature is designed for high-velocity industries that require
517
+ # frictionless, real-time payouts, such as:
518
+ # - **Gaming & Betting:** Real-time withdrawal of player winnings.
519
+ #
520
+ # - **Marketplaces:** Payouts to sellers or service providers.
521
+ #
522
+ # - **Corporate Disbursements:** Instant insurance claims, rebates, or
523
+ # compensation payments.
524
+ #
525
+ # - **Merchant Settlements:** Faster access to processed funds for
526
+ # sub-merchants.
527
+ #
528
+ # By utilizing the Paysecure `/payout` API with the `PAYOUT-CARDS` method,
529
+ # you benefit from a unified orchestration layer that handles the
530
+ # complexities of card network routing, ensuring high success rates and
531
+ # global reach while maintaining the same security standards as your
532
+ # standard payment integrations.
533
+ # ---
534
+ # ## Integration Steps
535
+ # 1. **Enable OCT:** Ensure "Push to Card" permissions are enabled for your
536
+ # merchant account in the Paysecure Merchant Portal.
537
+ #
538
+ # 2. **Collect Card Details:** Collect the recipient's card details
539
+ # securely, or use Paysecure's Cashier to collect the card information on
540
+ # your behalf.
541
+ #
542
+ # 3. **Execute Payout:** Call the `/payout` endpoint with the OCT-specific
543
+ # payout method.
544
+ #
545
+ # 4. **Handle Webhooks:** Listen for the `paid` or `failure` events to
546
+ # update your internal records.
547
+ #
548
+ # ### **Mandatory parameters in the request body:**
549
+ # | **Parameter** | **Required** | **Notes** |
550
+ # | --- | --- | --- |
551
+ # | client.email | Yes | The customer's email. |
552
+ # | client.phone | Yes | The customer's phone number along with the country
553
+ # code. <br>Example: +91 9634088651 |
554
+ # | client.city | Yes | The customer's city. |
555
+ # | client.country | Yes | ISO-3166 Country Code. Must be upper case.
556
+ # Example “SG” (Alpha2) |
557
+ # | client.stateCode | Optional | Example “AL”, “XZ”. Must be in upper case.
558
+ # |
559
+ # | Client.street_address | Optional | The customer's address. |
560
+ # | client.zip_code | Optional | The customer's ZIP or postal code. If
561
+ # country=US, zip format must be NNNNN or NNNNN-NNNN. |
562
+ # | currency | Yes | ISO 4217 code for currency you want to send the
563
+ # transaction in. <br> <br>Please note, the currency has to be enabled by
564
+ # the account manager for your account. |
565
+ # | amount | Yes | amount in decimal format. <br>example 1: <br>EUR 5 ,
566
+ # should be sent as 5.00 <br> <br>example 2: <br>USD 10 and 37 cents ,
567
+ # should be sent as 10.37 |
568
+ # | payoutMethod | Optional | example: PAYOUT-CARDS |
569
+ # | success_redirect | Yes | URL to send the user if the transactions is
570
+ # successful. |
571
+ # | pending_redirect | Yes | URL to send the user if the transactions is in
572
+ # pending. |
573
+ # | failure_redirect | Yes | URL to send the user if the transactions is
574
+ # unsuccessful. |
575
+ # | Purpose | Optional | The purpose of doing a payout. |
576
+ # | extraParam.cardNumber | Yes | The recipient's 16-digit card number. |
577
+ # | extraParam.expiryYear | Yes | YYYY format (e.g., 2028). |
578
+ # | extraParam.expiryMonth | Yes | MM format (e.g., 05). |
579
+ # | extraParam.cardHolderName | Yes | The receiver's Full Name. Preferred a
580
+ # 2 word name with each word atleast 3 characters long. |
581
+ # **Note:**
582
+ # If the merchant is not PCI DSS compliant then they will need to use our
583
+ # **cashier** and asking the user to enter the card details there. Check the
584
+ # cashier section for more details. If the merchant is PCI DSS compliant
585
+ # then they can use the payout API and send the card details as shown above.
586
+ # If the merchant wants to use **token_reference** for doing a payout, then
587
+ # please have a look at the Network Tokenisation Section.
588
+ # @param [String] accept Required parameter: TODO: type description here
589
+ # @param [PayOutRequest] body Required parameter: TODO: type description
590
+ # here
591
+ # @return [ApiResponse] Complete http response with raw body and status code.
592
+ def pay_out(accept,
593
+ body)
594
+ @api_call
595
+ .request(new_request_builder(HttpMethodEnum::POST,
596
+ '/api/v1/payout',
597
+ Server::SERVER_3)
598
+ .header_param(new_parameter(accept, key: 'Accept')
599
+ .is_required(true))
600
+ .body_param(new_parameter(body)
601
+ .is_required(true))
602
+ .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
603
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
604
+ .response(new_response_handler
605
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
606
+ .deserialize_into(proc do |response| response&.to_s end)
607
+ .is_api_response(true)
608
+ .is_primitive_response(true))
609
+ .execute
610
+ end
611
+
612
+ # To Initiate a payment, the very first call to make is `/purchases` with
613
+ # the required data in the request body.
614
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
615
+ # request body) and `API key` (in the header) Both can be located in the
616
+ # Dashboard section of your merchant account login.
617
+ # The request body structure is shown on the request body of the example
618
+ # request shown here.
619
+ # The following (see table below) are the mandatory parameters that are
620
+ # required to create a purchase request.
621
+ # ### **Parameters in the request body:**
622
+ # | **Parameter** | **Notes** |
623
+ # | --- | --- |
624
+ # | client.full_name | Conditional. <br>But Recommended to pass the
625
+ # complete name of the client. Atleast 2 words recommended. |
626
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
627
+ # id. |
628
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
629
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: GOOGLEPAY-REDIRECT |
630
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
631
+ # to send the transaction in. This should be 'BRL' for PIX. |
632
+ # | purchase.products.name | Mandatory. |
633
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
634
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
635
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
636
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
637
+ # merchant account login. |
638
+ # | success_redirect | Mandatory. <br>URL to send the user if the
639
+ # transactions is successful. |
640
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
641
+ # transactions is in progress state. |
642
+ # | failure_redirect | Mandatory <br>URL to send the user if the
643
+ # transactions has failed. |
644
+ # ## Optional Parameters
645
+ # ### expireInMin
646
+ # This parameter, when passed in the PayIn request, sets the time window
647
+ # within which a customer should make the Interac payment through their
648
+ # bank's app. If a customer doesn't complete the payment within the
649
+ # configured time window, the status of the payment will be marked as
650
+ # 'EXPIRED' in Paysecure.
651
+ # However, in certain cases, a payment made outside of this window could
652
+ # still be successful i.e. customer's account may be debited which would
653
+ # result in inconsistencies among Paysecure's, merchant's and customer's
654
+ # status of the transaction. To avoid such cases it is advised to set the
655
+ # expiry time limit appropriately and advise the customers to make payment
656
+ # within this window. However, if there is an inconsistency between the
657
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
658
+ # will reconcile the amounts during the settlement.
659
+ # ### merchantRef
660
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
661
+ # for merchants to specify. Its inclusion offers two significant advantages
662
+ # for the merchant:
663
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
664
+ # it acts as a unique identifier. This means that if a second purchase
665
+ # request is made using the same `merchantRef` (reference number), the
666
+ # system will recognize it and prevent duplicate transactions from
667
+ # occurring. This prevents unintended or duplicate purchases.
668
+ #
669
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
670
+ # response from the initial purchase request times out or the 'purchaseId'
671
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
672
+ # detailed transaction information. This ensures they can track and access
673
+ # the specific purchase details related to that reference, even if the
674
+ # immediate response was not received.
675
+ #
676
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
677
+ # platform will automatically assign and use an internal 'purchaseId' as a
678
+ # reference for that transaction.
679
+ # ### paymentMethod
680
+ # The `paymentMethod` parameter identifies which payment solution merchant
681
+ # wants to use to perform a transaction. If parameter is provided, than
682
+ # Paysecure will perform direct payment with the selected payment method
683
+ # instead of loading Paysecure URL.
684
+ # @param [PurchasesRequest6] body Required parameter: TODO: type description
685
+ # here
686
+ # @return [ApiResponse] Complete http response with raw body and status code.
687
+ def purchases(body)
688
+ @api_call
689
+ .request(new_request_builder(HttpMethodEnum::POST,
690
+ '/api/v1/purchases',
691
+ Server::SERVER_3)
692
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
693
+ .body_param(new_parameter(body)
694
+ .is_required(true))
695
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
696
+ .response(new_response_handler
697
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
698
+ .deserialize_into(proc do |response| response&.to_s end)
699
+ .is_api_response(true)
700
+ .is_primitive_response(true))
701
+ .execute
702
+ end
703
+
704
+ # **OVERVIEW**
705
+ # The `createSession` API is designed to initiate a payment session for a
706
+ # customer after their profile has been created via the **createCustomer**
707
+ # API. The session is automatically generated at the backend on the
708
+ # merchant’s checkout URL. This session allows the customer to continue with
709
+ # their transaction without having to manually interact with the session
710
+ # URL, and ensures the session remains active until the payment is completed
711
+ # or the session expires.
712
+ # This API improves the user experience by reducing transaction failures and
713
+ # enhancing the overall payment process, thus reducing transaction churn
714
+ # rates.
715
+ # ### Mandatory Parameters
716
+ # | Parameter | Type | Description | Example |
717
+ # | --- | --- | --- | --- |
718
+ # | customerId | String | The unique ID of the customer (generated from
719
+ # createCustomer). | 6731a609b6bb5a43ad66c4a6 |
720
+ # ### **Usage Flow**
721
+ # 1. **Customer completes the** **`createCustomer`** **API**: Once the
722
+ # customer is created via the `createCustomer` API, the merchant proceeds to
723
+ # call the `createSession` API to generate a session.
724
+ #
725
+ # 2. **Merchant sends** **`createSession`** **request**: The merchant sends
726
+ # a `POST` request to the `createSession` API with the customer’s
727
+ # `customerId` and the merchant’s `brandId`.
728
+ #
729
+ # 3. **Session created automatically on the checkout URL**: PaySecure
730
+ # creates the session and associates it with the merchant’s checkout page.
731
+ # This session remains active on the backend, allowing the customer to
732
+ # continue the payment process without interruption.
733
+ #
734
+ # 4. **Customer proceeds to checkout**: The customer is redirected to the
735
+ # checkout page as part of the merchant's payment flow, where the session is
736
+ # automatically validated. The session remains active for a set period,
737
+ # allowing the customer to complete the payment without needing to manually
738
+ # interact with the session URL.
739
+ #
740
+ # 5. **Session Expiry**: The session expires after the set expiration time
741
+ # (`expiryOn`), ensuring the payment process is completed within the defined
742
+ # window. Default is 15 mins from the creation time.
743
+ #
744
+ # ---
745
+ # ### **Benefits**
746
+ # - **Seamless Checkout**: The session URL is automatically generated and
747
+ # active at the backend, ensuring a smoother and uninterrupted customer
748
+ # experience.
749
+ #
750
+ # - **Reduced Transaction Failures**: By ensuring the session remains active
751
+ # during the payment process, the chances of transaction failures due to
752
+ # session timeouts are minimized.
753
+ #
754
+ # - **Improved User Experience**: The customer does not need to click on a
755
+ # session URL or navigate away from the page, leading to faster and more
756
+ # secure payment processing.
757
+ # @return [ApiResponse] Complete http response with raw body and status code.
758
+ def session
759
+ @api_call
760
+ .request(new_request_builder(HttpMethodEnum::POST,
761
+ '/api/v1/createSession',
762
+ Server::SERVER_3)
763
+ .header_param(new_parameter('application/json', key: 'accept')))
764
+ .response(new_response_handler
765
+ .deserializer(APIHelper.method(:custom_type_deserializer))
766
+ .deserialize_into(Success14.method(:from_hash))
767
+ .is_api_response(true)
768
+ .local_error('400',
769
+ 'Bad Request',
770
+ InvalidSessionException))
771
+ .execute
772
+ end
773
+
774
+ # This API tells you about all the details of a purchase (PayIn), including
775
+ # its history
776
+ # ### Mandatory
777
+ # you need to pass the `PurchaseID` in the API URL
778
+ # ### Possible Value of Status
779
+ # | **Status** | **Notes** |
780
+ # | --- | --- |
781
+ # | paid | Transaction Successful |
782
+ # | payment_in_process | Payment is under Processing |
783
+ # | expired | Purchase has Expired. |
784
+ # | error | Transaction has Failed. |
785
+ # ### Response Examples
786
+ # In the response examples you can see instances of both `Paid` and `Error`
787
+ # Status purchases.
788
+ # ### Error Details
789
+ # If there are any issues on the Purchase you can get more details from the
790
+ # `transaction_data.attempts.error` attribute of the response object
791
+ # ### Errors
792
+ # If there are any errors then it'll be in the format of :
793
+ # ``` json
794
+ # {
795
+ # "message": "descriptive error message",
796
+ # "code": "error_code"
797
+ # }
798
+ # ```
799
+ # Please see the Status Code section for further details.
800
+ # @param [String] purchase_id Required parameter: TODO: type description
801
+ # here
802
+ # @return [ApiResponse] Complete http response with raw body and status code.
803
+ def get_status5(purchase_id)
804
+ @api_call
805
+ .request(new_request_builder(HttpMethodEnum::GET,
806
+ '/api/v1/purchases/{purchaseId}',
807
+ Server::SERVER_3)
808
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
809
+ .template_param(new_parameter(purchase_id, key: 'purchaseId')
810
+ .is_required(true)
811
+ .should_encode(true)))
812
+ .response(new_response_handler
813
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
814
+ .deserialize_into(proc do |response| response&.to_s end)
815
+ .is_api_response(true)
816
+ .is_primitive_response(true))
817
+ .execute
818
+ end
819
+
820
+ # To Initiate a payment, the very first call to make is `/purchases` with
821
+ # the required data in the request body.
822
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
823
+ # request body) and `API key` (in the header) Both can be located in the
824
+ # Dashboard section of your merchant account login.
825
+ # The request body structure is shown on the request body of the example
826
+ # request shown here.
827
+ # The following (see table below) are the mandatory parameters that are
828
+ # required to create a purchase request.
829
+ # ### **Parameters in the request body:**
830
+ # | **Parameter** | **Notes** |
831
+ # | --- | --- |
832
+ # | client.full_name | Conditional. <br>But Recommended to pass the
833
+ # complete name of the client. Atleast 2 words recommended. |
834
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
835
+ # id. |
836
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
837
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: APPLEPAY-REDIRECT |
838
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
839
+ # to send the transaction in. This should be 'BRL' for PIX. |
840
+ # | purchase.products.name | Mandatory. |
841
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
842
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
843
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
844
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
845
+ # merchant account login. |
846
+ # | success_redirect | Mandatory. <br>URL to send the user if the
847
+ # transactions is successful. |
848
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
849
+ # transactions is in progress state. |
850
+ # | failure_redirect | Mandatory <br>URL to send the user if the
851
+ # transactions has failed. |
852
+ # ## Optional Parameters
853
+ # ### expireInMin
854
+ # This parameter, when passed in the PayIn request, sets the time window
855
+ # within which a customer should make the Interac payment through their
856
+ # bank's app. If a customer doesn't complete the payment within the
857
+ # configured time window, the status of the payment will be marked as
858
+ # 'EXPIRED' in Paysecure.
859
+ # However, in certain cases, a payment made outside of this window could
860
+ # still be successful i.e. customer's account may be debited which would
861
+ # result in inconsistencies among Paysecure's, merchant's and customer's
862
+ # status of the transaction. To avoid such cases it is advised to set the
863
+ # expiry time limit appropriately and advise the customers to make payment
864
+ # within this window. However, if there is an inconsistency between the
865
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
866
+ # will reconcile the amounts during the settlement.
867
+ # ### merchantRef
868
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
869
+ # for merchants to specify. Its inclusion offers two significant advantages
870
+ # for the merchant:
871
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
872
+ # it acts as a unique identifier. This means that if a second purchase
873
+ # request is made using the same `merchantRef` (reference number), the
874
+ # system will recognize it and prevent duplicate transactions from
875
+ # occurring. This prevents unintended or duplicate purchases.
876
+ #
877
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
878
+ # response from the initial purchase request times out or the 'purchaseId'
879
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
880
+ # detailed transaction information. This ensures they can track and access
881
+ # the specific purchase details related to that reference, even if the
882
+ # immediate response was not received.
883
+ #
884
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
885
+ # platform will automatically assign and use an internal 'purchaseId' as a
886
+ # reference for that transaction.
887
+ # ### paymentMethod
888
+ # The `paymentMethod` parameter identifies which payment solution merchant
889
+ # wants to use to perform a transaction. If parameter is provided, than
890
+ # Paysecure will perform direct payment with the selected payment method
891
+ # instead of loading Paysecure URL.
892
+ # @param [PurchasesRequest6] body Required parameter: TODO: type description
893
+ # here
894
+ # @return [ApiResponse] Complete http response with raw body and status code.
895
+ def purchases1(body)
896
+ @api_call
897
+ .request(new_request_builder(HttpMethodEnum::POST,
898
+ '/api/v1/purchases',
899
+ Server::SERVER_3)
900
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
901
+ .body_param(new_parameter(body)
902
+ .is_required(true))
903
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
904
+ .response(new_response_handler
905
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
906
+ .deserialize_into(proc do |response| response&.to_s end)
907
+ .is_api_response(true)
908
+ .is_primitive_response(true))
909
+ .execute
910
+ end
911
+
912
+ # **OVERVIEW**
913
+ # The `createSession` API is designed to initiate a payment session for a
914
+ # customer after their profile has been created via the **createCustomer**
915
+ # API. The session is automatically generated at the backend on the
916
+ # merchant’s checkout URL. This session allows the customer to continue with
917
+ # their transaction without having to manually interact with the session
918
+ # URL, and ensures the session remains active until the payment is completed
919
+ # or the session expires.
920
+ # This API improves the user experience by reducing transaction failures and
921
+ # enhancing the overall payment process, thus reducing transaction churn
922
+ # rates.
923
+ # ### Mandatory Parameters
924
+ # | Parameter | Type | Description | Example |
925
+ # | --- | --- | --- | --- |
926
+ # | customerId | String | The unique ID of the customer (generated from
927
+ # createCustomer). | 6731a609b6bb5a43ad66c4a6 |
928
+ # ### **Usage Flow**
929
+ # 1. **Customer completes the** **`createCustomer`** **API**: Once the
930
+ # customer is created via the `createCustomer` API, the merchant proceeds to
931
+ # call the `createSession` API to generate a session.
932
+ #
933
+ # 2. **Merchant sends** **`createSession`** **request**: The merchant sends
934
+ # a `POST` request to the `createSession` API with the customer’s
935
+ # `customerId` and the merchant’s `brandId`.
936
+ #
937
+ # 3. **Session created automatically on the checkout URL**: PaySecure
938
+ # creates the session and associates it with the merchant’s checkout page.
939
+ # This session remains active on the backend, allowing the customer to
940
+ # continue the payment process without interruption.
941
+ #
942
+ # 4. **Customer proceeds to checkout**: The customer is redirected to the
943
+ # checkout page as part of the merchant's payment flow, where the session is
944
+ # automatically validated. The session remains active for a set period,
945
+ # allowing the customer to complete the payment without needing to manually
946
+ # interact with the session URL.
947
+ #
948
+ # 5. **Session Expiry**: The session expires after the set expiration time
949
+ # (`expiryOn`), ensuring the payment process is completed within the defined
950
+ # window. Default is 15 mins from the creation time.
951
+ #
952
+ # ---
953
+ # ### **Benefits**
954
+ # - **Seamless Checkout**: The session URL is automatically generated and
955
+ # active at the backend, ensuring a smoother and uninterrupted customer
956
+ # experience.
957
+ #
958
+ # - **Reduced Transaction Failures**: By ensuring the session remains active
959
+ # during the payment process, the chances of transaction failures due to
960
+ # session timeouts are minimized.
961
+ #
962
+ # - **Improved User Experience**: The customer does not need to click on a
963
+ # session URL or navigate away from the page, leading to faster and more
964
+ # secure payment processing.
965
+ # @return [ApiResponse] Complete http response with raw body and status code.
966
+ def session1
967
+ @api_call
968
+ .request(new_request_builder(HttpMethodEnum::POST,
969
+ '/api/v1/createSession',
970
+ Server::SERVER_3)
971
+ .header_param(new_parameter('application/json', key: 'accept')))
972
+ .response(new_response_handler
973
+ .deserializer(APIHelper.method(:custom_type_deserializer))
974
+ .deserialize_into(Success14.method(:from_hash))
975
+ .is_api_response(true)
976
+ .local_error('400',
977
+ 'Bad Request',
978
+ InvalidSessionException))
979
+ .execute
980
+ end
981
+
982
+ # This API tells you about all the details of a purchase (PayIn), including
983
+ # its history
984
+ # ### Mandatory
985
+ # you need to pass the `PurchaseID` in the API URL
986
+ # ### Possible Value of Status
987
+ # | **Status** | **Notes** |
988
+ # | --- | --- |
989
+ # | paid | Transaction Successful |
990
+ # | payment_in_process | Payment is under Processing |
991
+ # | expired | Purchase has Expired. |
992
+ # | error | Transaction has Failed. |
993
+ # ### Response Examples
994
+ # In the response examples you can see instances of both `Paid` and `Error`
995
+ # Status purchases.
996
+ # ### Error Details
997
+ # If there are any issues on the Purchase you can get more details from the
998
+ # `transaction_data.attempts.error` attribute of the response object
999
+ # ### Errors
1000
+ # If there are any errors then it'll be in the format of :
1001
+ # ``` json
1002
+ # {
1003
+ # "message": "descriptive error message",
1004
+ # "code": "error_code"
1005
+ # }
1006
+ # ```
1007
+ # Please see the Status Code section for further details.
1008
+ # @param [String] purchase_id Required parameter: TODO: type description
1009
+ # here
1010
+ # @return [ApiResponse] Complete http response with raw body and status code.
1011
+ def get_status1(purchase_id)
1012
+ @api_call
1013
+ .request(new_request_builder(HttpMethodEnum::GET,
1014
+ '/api/v1/purchases/{purchaseId}',
1015
+ Server::SERVER_3)
1016
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1017
+ .template_param(new_parameter(purchase_id, key: 'purchaseId')
1018
+ .is_required(true)
1019
+ .should_encode(true)))
1020
+ .response(new_response_handler
1021
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
1022
+ .deserialize_into(proc do |response| response&.to_s end)
1023
+ .is_api_response(true)
1024
+ .is_primitive_response(true))
1025
+ .execute
1026
+ end
1027
+
1028
+ # To process a Google Pay transaction, a Purchase must first be created
1029
+ # using the /purchases API. The Google Pay token must be included in the
1030
+ # request under extraParam.googlepay_param.
1031
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
1032
+ # request body) and `API key` (in the header) Both can be located in the
1033
+ # Dashboard section of your merchant account login.
1034
+ # The request body structure is shown on the request body of the example
1035
+ # request shown here.
1036
+ # The following (see table below) are the mandatory parameters that are
1037
+ # required to create a purchase request.
1038
+ # ### **Parameters in the request body:**
1039
+ # | **Parameter** | **Notes** |
1040
+ # | --- | --- |
1041
+ # | client.full_name | Conditional. <br>But Recommended to pass the
1042
+ # complete name of the client. Atleast 2 words recommended. |
1043
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
1044
+ # id. |
1045
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
1046
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: GOOGLEPAY |
1047
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
1048
+ # to send the transaction in. This should be 'BRL' for PIX. |
1049
+ # | purchase.products.name | Mandatory. |
1050
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
1051
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
1052
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
1053
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
1054
+ # merchant account login. |
1055
+ # | success_redirect | Mandatory. <br>URL to send the user if the
1056
+ # transactions is successful. |
1057
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
1058
+ # transactions is in progress state. |
1059
+ # | failure_redirect | Mandatory <br>URL to send the user if the
1060
+ # transactions has failed. |
1061
+ # ## Optional Parameters
1062
+ # ### expireInMin
1063
+ # This parameter, when passed in the PayIn request, sets the time window
1064
+ # within which a customer should make the Interac payment through their
1065
+ # bank's app. If a customer doesn't complete the payment within the
1066
+ # configured time window, the status of the payment will be marked as
1067
+ # 'EXPIRED' in Paysecure.
1068
+ # However, in certain cases, a payment made outside of this window could
1069
+ # still be successful i.e. customer's account may be debited which would
1070
+ # result in inconsistencies among Paysecure's, merchant's and customer's
1071
+ # status of the transaction. To avoid such cases it is advised to set the
1072
+ # expiry time limit appropriately and advise the customers to make payment
1073
+ # within this window. However, if there is an inconsistency between the
1074
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
1075
+ # will reconcile the amounts during the settlement.
1076
+ # ### merchantRef
1077
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
1078
+ # for merchants to specify. Its inclusion offers two significant advantages
1079
+ # for the merchant:
1080
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
1081
+ # it acts as a unique identifier. This means that if a second purchase
1082
+ # request is made using the same `merchantRef` (reference number), the
1083
+ # system will recognize it and prevent duplicate transactions from
1084
+ # occurring. This prevents unintended or duplicate purchases.
1085
+ #
1086
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
1087
+ # response from the initial purchase request times out or the 'purchaseId'
1088
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
1089
+ # detailed transaction information. This ensures they can track and access
1090
+ # the specific purchase details related to that reference, even if the
1091
+ # immediate response was not received.
1092
+ #
1093
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
1094
+ # platform will automatically assign and use an internal 'purchaseId' as a
1095
+ # reference for that transaction.
1096
+ # ### paymentMethod
1097
+ # The `paymentMethod` parameter identifies which payment solution merchant
1098
+ # wants to use to perform a transaction. If parameter is provided, than
1099
+ # Paysecure will perform direct payment with the selected payment method
1100
+ # instead of loading Paysecure URL.
1101
+ # ### Flow Diagram:
1102
+ # <img
1103
+ # src="https://content.pstmn.io/2dd13473-b015-4a40-b71a-542585919bcc/RW5jcnl
1104
+ # wdGVkIEZsb3cucG5n">
1105
+ # @param [PurchasesEncryptedFlowRequest] body Required parameter: TODO: type
1106
+ # description here
1107
+ # @return [ApiResponse] Complete http response with raw body and status code.
1108
+ def purchases_encrypted_flow(body)
1109
+ @api_call
1110
+ .request(new_request_builder(HttpMethodEnum::POST,
1111
+ '/api/v1/purchases',
1112
+ Server::SERVER_3)
1113
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1114
+ .body_param(new_parameter(body)
1115
+ .is_required(true))
1116
+ .header_param(new_parameter('application/json', key: 'accept'))
1117
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1118
+ .response(new_response_handler
1119
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1120
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1121
+ .is_api_response(true))
1122
+ .execute
1123
+ end
1124
+
1125
+ # To process a Google Pay transaction, a Purchase must first be created
1126
+ # using the /purchases API. The Google Pay token must be included in the
1127
+ # request under extraParam.googlepay_param.
1128
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
1129
+ # request body) and `API key` (in the header) Both can be located in the
1130
+ # Dashboard section of your merchant account login.
1131
+ # The request body structure is shown on the request body of the example
1132
+ # request shown here.
1133
+ # The following (see table below) are the mandatory parameters that are
1134
+ # required to create a purchase request.
1135
+ # ### **Parameters in the request body:**
1136
+ # | **Parameter** | **Notes** |
1137
+ # | --- | --- |
1138
+ # | client.full_name | Conditional. <br>But Recommended to pass the
1139
+ # complete name of the client. Atleast 2 words recommended. |
1140
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
1141
+ # id. |
1142
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
1143
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: GOOGLEPAY |
1144
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
1145
+ # to send the transaction in. This should be 'BRL' for PIX. |
1146
+ # | purchase.products.name | Mandatory. |
1147
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
1148
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
1149
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
1150
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
1151
+ # merchant account login. |
1152
+ # | success_redirect | Mandatory. <br>URL to send the user if the
1153
+ # transactions is successful. |
1154
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
1155
+ # transactions is in progress state. |
1156
+ # | failure_redirect | Mandatory <br>URL to send the user if the
1157
+ # transactions has failed. |
1158
+ # ## Optional Parameters
1159
+ # ### expireInMin
1160
+ # This parameter, when passed in the PayIn request, sets the time window
1161
+ # within which a customer should make the Interac payment through their
1162
+ # bank's app. If a customer doesn't complete the payment within the
1163
+ # configured time window, the status of the payment will be marked as
1164
+ # 'EXPIRED' in Paysecure.
1165
+ # However, in certain cases, a payment made outside of this window could
1166
+ # still be successful i.e. customer's account may be debited which would
1167
+ # result in inconsistencies among Paysecure's, merchant's and customer's
1168
+ # status of the transaction. To avoid such cases it is advised to set the
1169
+ # expiry time limit appropriately and advise the customers to make payment
1170
+ # within this window. However, if there is an inconsistency between the
1171
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
1172
+ # will reconcile the amounts during the settlement.
1173
+ # ### merchantRef
1174
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
1175
+ # for merchants to specify. Its inclusion offers two significant advantages
1176
+ # for the merchant:
1177
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
1178
+ # it acts as a unique identifier. This means that if a second purchase
1179
+ # request is made using the same `merchantRef` (reference number), the
1180
+ # system will recognize it and prevent duplicate transactions from
1181
+ # occurring. This prevents unintended or duplicate purchases.
1182
+ #
1183
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
1184
+ # response from the initial purchase request times out or the 'purchaseId'
1185
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
1186
+ # detailed transaction information. This ensures they can track and access
1187
+ # the specific purchase details related to that reference, even if the
1188
+ # immediate response was not received.
1189
+ #
1190
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
1191
+ # platform will automatically assign and use an internal 'purchaseId' as a
1192
+ # reference for that transaction.
1193
+ # ### paymentMethod
1194
+ # The `paymentMethod` parameter identifies which payment solution merchant
1195
+ # wants to use to perform a transaction. If parameter is provided, than
1196
+ # Paysecure will perform direct payment with the selected payment method
1197
+ # instead of loading Paysecure URL.
1198
+ # ### Flow Diagram:
1199
+ # <img
1200
+ # src="https://content.pstmn.io/8d726da8-02f8-49a4-a3a9-765cd3e1dd9a/RGVjcnl
1201
+ # wdGVkIEZsb3cucG5n">
1202
+ # @param [PurchasesDecryptedFlowRequest] body Required parameter: TODO: type
1203
+ # description here
1204
+ # @return [ApiResponse] Complete http response with raw body and status code.
1205
+ def purchases_decrypted_flow(body)
1206
+ @api_call
1207
+ .request(new_request_builder(HttpMethodEnum::POST,
1208
+ '/api/v1/purchases',
1209
+ Server::SERVER_3)
1210
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1211
+ .body_param(new_parameter(body)
1212
+ .is_required(true))
1213
+ .header_param(new_parameter('application/json', key: 'accept'))
1214
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1215
+ .response(new_response_handler
1216
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1217
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1218
+ .is_api_response(true))
1219
+ .execute
1220
+ end
1221
+
1222
+ # This API tells you about all the details of a purchase (PayIn), including
1223
+ # its history
1224
+ # ### Mandatory
1225
+ # you need to pass the `PurchaseID` in the API URL
1226
+ # ### Possible Value of Status
1227
+ # | **Status** | **Notes** |
1228
+ # | --- | --- |
1229
+ # | paid | Transaction Successful |
1230
+ # | payment_in_process | Payment is under Processing |
1231
+ # | expired | Purchase has Expired. |
1232
+ # | error | Transaction has Failed. |
1233
+ # ### Response Examples
1234
+ # In the response examples you can see instances of both `Paid` and `Error`
1235
+ # Status purchases.
1236
+ # ### Error Details
1237
+ # If there are any issues on the Purchase you can get more details from the
1238
+ # `transaction_data.attempts.error` attribute of the response object
1239
+ # ### Errors
1240
+ # If there are any errors then it'll be in the format of :
1241
+ # ``` json
1242
+ # {
1243
+ # "message": "descriptive error message",
1244
+ # "code": "error_code"
1245
+ # }
1246
+ # ```
1247
+ # Please see the Status Code section for further details.
1248
+ # @param [String] purchase_id Required parameter: TODO: type description
1249
+ # here
1250
+ # @return [ApiResponse] Complete http response with raw body and status code.
1251
+ def get_status2(purchase_id)
1252
+ @api_call
1253
+ .request(new_request_builder(HttpMethodEnum::GET,
1254
+ '/api/v1/purchases/{purchaseId}',
1255
+ Server::SERVER_3)
1256
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1257
+ .template_param(new_parameter(purchase_id, key: 'purchaseId')
1258
+ .is_required(true)
1259
+ .should_encode(true))
1260
+ .header_param(new_parameter('application/json', key: 'accept')))
1261
+ .response(new_response_handler
1262
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1263
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1264
+ .is_api_response(true))
1265
+ .execute
1266
+ end
1267
+
1268
+ # To process an Apple Pay transaction, a Purchase must be created using the
1269
+ # /purchases API. The Apple Pay token must be included under
1270
+ # extraParam.applepay_param.
1271
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
1272
+ # request body) and `API key` (in the header) Both can be located in the
1273
+ # Dashboard section of your merchant account login.
1274
+ # The request body structure is shown on the request body of the example
1275
+ # request shown here.
1276
+ # The following (see table below) are the mandatory parameters that are
1277
+ # required to create a purchase request.
1278
+ # ### **Parameters in the request body:**
1279
+ # | **Parameter** | **Notes** |
1280
+ # | --- | --- |
1281
+ # | client.full_name | Conditional. <br>But Recommended to pass the
1282
+ # complete name of the client. Atleast 2 words recommended. |
1283
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
1284
+ # id. |
1285
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
1286
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: APPLEPAY |
1287
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
1288
+ # to send the transaction in. This should be 'BRL' for PIX. |
1289
+ # | purchase.products.name | Mandatory. |
1290
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
1291
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
1292
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
1293
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
1294
+ # merchant account login. |
1295
+ # | success_redirect | Mandatory. <br>URL to send the user if the
1296
+ # transactions is successful. |
1297
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
1298
+ # transactions is in progress state. |
1299
+ # | failure_redirect | Mandatory <br>URL to send the user if the
1300
+ # transactions has failed. |
1301
+ # ## Optional Parameters
1302
+ # ### expireInMin
1303
+ # This parameter, when passed in the PayIn request, sets the time window
1304
+ # within which a customer should make the Interac payment through their
1305
+ # bank's app. If a customer doesn't complete the payment within the
1306
+ # configured time window, the status of the payment will be marked as
1307
+ # 'EXPIRED' in Paysecure.
1308
+ # However, in certain cases, a payment made outside of this window could
1309
+ # still be successful i.e. customer's account may be debited which would
1310
+ # result in inconsistencies among Paysecure's, merchant's and customer's
1311
+ # status of the transaction. To avoid such cases it is advised to set the
1312
+ # expiry time limit appropriately and advise the customers to make payment
1313
+ # within this window. However, if there is an inconsistency between the
1314
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
1315
+ # will reconcile the amounts during the settlement.
1316
+ # ### merchantRef
1317
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
1318
+ # for merchants to specify. Its inclusion offers two significant advantages
1319
+ # for the merchant:
1320
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
1321
+ # it acts as a unique identifier. This means that if a second purchase
1322
+ # request is made using the same `merchantRef` (reference number), the
1323
+ # system will recognize it and prevent duplicate transactions from
1324
+ # occurring. This prevents unintended or duplicate purchases.
1325
+ #
1326
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
1327
+ # response from the initial purchase request times out or the 'purchaseId'
1328
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
1329
+ # detailed transaction information. This ensures they can track and access
1330
+ # the specific purchase details related to that reference, even if the
1331
+ # immediate response was not received.
1332
+ #
1333
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
1334
+ # platform will automatically assign and use an internal 'purchaseId' as a
1335
+ # reference for that transaction.
1336
+ # ### paymentMethod
1337
+ # The `paymentMethod` parameter identifies which payment solution merchant
1338
+ # wants to use to perform a transaction. If parameter is provided, than
1339
+ # Paysecure will perform direct payment with the selected payment method
1340
+ # instead of loading Paysecure URL.
1341
+ # @param [PurchasesEncryptedFlowRequest1] body Required parameter: TODO:
1342
+ # type description here
1343
+ # @return [ApiResponse] Complete http response with raw body and status code.
1344
+ def purchases_encrypted_flow_1(body)
1345
+ @api_call
1346
+ .request(new_request_builder(HttpMethodEnum::POST,
1347
+ '/api/v1/purchases',
1348
+ Server::SERVER_3)
1349
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1350
+ .body_param(new_parameter(body)
1351
+ .is_required(true))
1352
+ .header_param(new_parameter('application/json', key: 'accept'))
1353
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1354
+ .response(new_response_handler
1355
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1356
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1357
+ .is_api_response(true))
1358
+ .execute
1359
+ end
1360
+
1361
+ # To process an Apple Pay transaction, a Purchase must be created using the
1362
+ # /purchases API. The Apple Pay token must be included under
1363
+ # extraParam.applepay_param.
1364
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
1365
+ # request body) and `API key` (in the header) Both can be located in the
1366
+ # Dashboard section of your merchant account login.
1367
+ # The request body structure is shown on the request body of the example
1368
+ # request shown here.
1369
+ # The following (see table below) are the mandatory parameters that are
1370
+ # required to create a purchase request.
1371
+ # ### **Parameters in the request body:**
1372
+ # | **Parameter** | **Notes** |
1373
+ # | --- | --- |
1374
+ # | client.full_name | Conditional. <br>But Recommended to pass the
1375
+ # complete name of the client. Atleast 2 words recommended. |
1376
+ # | client.email | Conditional. <br>But Recommended to pass a correct email
1377
+ # id. |
1378
+ # | paymentMethod | Conditional. <br>Mandatory if you are not using
1379
+ # Paysecure Cashier. Else Non Mandatory. <br>Value: APPLEPAY |
1380
+ # | purchase.currency | Mandatory. <br>ISO 4217 code for currency you want
1381
+ # to send the transaction in. This should be 'BRL' for PIX. |
1382
+ # | purchase.products.name | Mandatory. |
1383
+ # | purchase.products.price | Mandatory. <br>Price in decimal format upto 2
1384
+ # decimals. <br>example 1: <br>EUR 5 , should be sent as 5.00 <br>example
1385
+ # 2: <br>USD 10 and 37 cents , should be sent as 10.37 |
1386
+ # | brand_id | Mandatory. <br>Obtain from Dashboard section of your
1387
+ # merchant account login. |
1388
+ # | success_redirect | Mandatory. <br>URL to send the user if the
1389
+ # transactions is successful. |
1390
+ # | pending_redirect | Mandatory. <br>URL to send the user if the
1391
+ # transactions is in progress state. |
1392
+ # | failure_redirect | Mandatory <br>URL to send the user if the
1393
+ # transactions has failed. |
1394
+ # ## Optional Parameters
1395
+ # ### expireInMin
1396
+ # This parameter, when passed in the PayIn request, sets the time window
1397
+ # within which a customer should make the Interac payment through their
1398
+ # bank's app. If a customer doesn't complete the payment within the
1399
+ # configured time window, the status of the payment will be marked as
1400
+ # 'EXPIRED' in Paysecure.
1401
+ # However, in certain cases, a payment made outside of this window could
1402
+ # still be successful i.e. customer's account may be debited which would
1403
+ # result in inconsistencies among Paysecure's, merchant's and customer's
1404
+ # status of the transaction. To avoid such cases it is advised to set the
1405
+ # expiry time limit appropriately and advise the customers to make payment
1406
+ # within this window. However, if there is an inconsistency between the
1407
+ # status at Paysecure and at customer's Bank, the merchant and Paysecure
1408
+ # will reconcile the amounts during the settlement.
1409
+ # ### merchantRef
1410
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
1411
+ # for merchants to specify. Its inclusion offers two significant advantages
1412
+ # for the merchant:
1413
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
1414
+ # it acts as a unique identifier. This means that if a second purchase
1415
+ # request is made using the same `merchantRef` (reference number), the
1416
+ # system will recognize it and prevent duplicate transactions from
1417
+ # occurring. This prevents unintended or duplicate purchases.
1418
+ #
1419
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
1420
+ # response from the initial purchase request times out or the 'purchaseId'
1421
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
1422
+ # detailed transaction information. This ensures they can track and access
1423
+ # the specific purchase details related to that reference, even if the
1424
+ # immediate response was not received.
1425
+ #
1426
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
1427
+ # platform will automatically assign and use an internal 'purchaseId' as a
1428
+ # reference for that transaction.
1429
+ # ### paymentMethod
1430
+ # The `paymentMethod` parameter identifies which payment solution merchant
1431
+ # wants to use to perform a transaction. If parameter is provided, than
1432
+ # Paysecure will perform direct payment with the selected payment method
1433
+ # instead of loading Paysecure URL.
1434
+ # @param [PurchasesDecryptedFlowRequest1] body Required parameter: TODO:
1435
+ # type description here
1436
+ # @return [ApiResponse] Complete http response with raw body and status code.
1437
+ def purchases_decrypted_flow_1(body)
1438
+ @api_call
1439
+ .request(new_request_builder(HttpMethodEnum::POST,
1440
+ '/api/v1/purchases',
1441
+ Server::SERVER_3)
1442
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1443
+ .body_param(new_parameter(body)
1444
+ .is_required(true))
1445
+ .header_param(new_parameter('application/json', key: 'accept'))
1446
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1447
+ .response(new_response_handler
1448
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1449
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1450
+ .is_api_response(true))
1451
+ .execute
1452
+ end
1453
+
1454
+ # This API tells you about all the details of a purchase (PayIn), including
1455
+ # its history
1456
+ # ### Mandatory
1457
+ # you need to pass the `PurchaseID` in the API URL
1458
+ # ### Possible Value of Status
1459
+ # | **Status** | **Notes** |
1460
+ # | --- | --- |
1461
+ # | paid | Transaction Successful |
1462
+ # | payment_in_process | Payment is under Processing |
1463
+ # | expired | Purchase has Expired. |
1464
+ # | error | Transaction has Failed. |
1465
+ # ### Response Examples
1466
+ # In the response examples you can see instances of both `Paid` and `Error`
1467
+ # Status purchases.
1468
+ # ### Error Details
1469
+ # If there are any issues on the Purchase you can get more details from the
1470
+ # `transaction_data.attempts.error` attribute of the response object
1471
+ # ### Errors
1472
+ # If there are any errors then it'll be in the format of :
1473
+ # ``` json
1474
+ # {
1475
+ # "message": "descriptive error message",
1476
+ # "code": "error_code"
1477
+ # }
1478
+ # ```
1479
+ # Please see the Status Code section for further details.
1480
+ # @param [String] purchase_id Required parameter: TODO: type description
1481
+ # here
1482
+ # @return [ApiResponse] Complete http response with raw body and status code.
1483
+ def get_status3(purchase_id)
1484
+ @api_call
1485
+ .request(new_request_builder(HttpMethodEnum::GET,
1486
+ '/api/v1/purchases/{purchaseId}',
1487
+ Server::SERVER_3)
1488
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1489
+ .template_param(new_parameter(purchase_id, key: 'purchaseId')
1490
+ .is_required(true)
1491
+ .should_encode(true))
1492
+ .header_param(new_parameter('application/json', key: 'accept')))
1493
+ .response(new_response_handler
1494
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1495
+ .deserialize_into(PurchaseSuccess4.method(:from_hash))
1496
+ .is_api_response(true))
1497
+ .execute
1498
+ end
1499
+
1500
+ # To Initiate a payment, the very first call to make is `/purchases` with
1501
+ # the required data in the request body.
1502
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
1503
+ # request body) and `API key` (in the header) Both can be located in the
1504
+ # Dashboard section of your merchant account login.
1505
+ # The request body structure is shown on the request body of the example
1506
+ # request shown here.
1507
+ # The following (see table below) are the mandatory parameters that are
1508
+ # required to create a purchase request.
1509
+ # ### **Mandatory parameters in the request body:**
1510
+ # | **Parameter** | **Notes** |
1511
+ # | --- | --- |
1512
+ # | client.email | The customer's email. |
1513
+ # | client.city | The customer's city. |
1514
+ # | client.country | ISO-3166 Country Code. Must be upper case. Example “SG”
1515
+ # (Alpha2) |
1516
+ # | client.stateCode | Example “AL”, “XZ”. Must be in upper case. |
1517
+ # | Client.street_address | The customer's address. |
1518
+ # | client.zip_code | The customer's ZIP or postal code. If country=US, zip
1519
+ # format must be NNNNN or NNNNN-NNNN. |
1520
+ # | purchase.currency | ISO 4217 code for currency you want to send the
1521
+ # transaction in. <br> <br>Please note, the currency has to be enabled by
1522
+ # the account manager for your account. |
1523
+ # | purchase.products | An object which contains the list of products which
1524
+ # the customer is buying. |
1525
+ # | purchase.products.name | The name of the product. |
1526
+ # | purchase.products.price | Price in decimal format. <br>example 1:
1527
+ # <br>EUR 5 , should be sent as 5.00 <br> <br>example 2: <br>USD 10 and
1528
+ # 37 cents , should be sent as 10.37 |
1529
+ # | brand_id | Obtain from Dashboard section of your merchant account login.
1530
+ # |
1531
+ # | success_redirect | URL to send the user if the transactions is
1532
+ # successful. |
1533
+ # | pending_redirect | URL to send the user if the transactions is in
1534
+ # pending. |
1535
+ # | failure_redirect | URL to send the user if the transactions is
1536
+ # unsuccessful. |
1537
+ # ## Essential Optional Parameters
1538
+ # ### merchantRef
1539
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
1540
+ # for merchants to specify. Its inclusion offers two significant advantages
1541
+ # for the merchant:
1542
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
1543
+ # it acts as a unique identifier. This means that if a second purchase
1544
+ # request is made using the same `merchantRef` (reference number), the
1545
+ # system will recognize it and prevent duplicate transactions from
1546
+ # occurring. This prevents unintended or duplicate purchases.
1547
+ #
1548
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
1549
+ # response from the initial purchase request times out or the 'purchaseId'
1550
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
1551
+ # detailed transaction information. This ensures they can track and access
1552
+ # the specific purchase details related to that reference, even if the
1553
+ # immediate response was not received.
1554
+ #
1555
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
1556
+ # platform will automatically assign and use an internal 'purchaseId' as a
1557
+ # reference for that transaction.
1558
+ # Upon successul create on a Purchase you'd get a `"purchaseId"` . Use this
1559
+ # ID for the next step in Server to server call by calling
1560
+ # `p/{purchaseId}/?s2s=true .`
1561
+ # ### paymentMethod
1562
+ # The `paymentMethod` parameter identifies which payment solution merchant
1563
+ # wants to use to perform a transaction. If parameter is provided, than
1564
+ # Paysecure will perform direct payment with the selected payment method
1565
+ # instead of loading Paysecure URL.
1566
+ # ### Errors
1567
+ # If there are any errors then it'll be in the format of :
1568
+ # ``` json
1569
+ # {
1570
+ # "message": "descriptive error message",
1571
+ # "code": "error_code"
1572
+ # }
1573
+ # ```
1574
+ # ### Possible Error Messages
1575
+ # | **Error Messages** |
1576
+ # | --- |
1577
+ # | Allowed Limit for this card for particular time period has been consumed
1578
+ # |
1579
+ # | some Mandatory Parameter are missing |
1580
+ # | Invalid format of Date_of_Birth \[allowed format: yyyy-mm-dd\] |
1581
+ # | Invalid Email Format |
1582
+ # | Please submit Valid Alpha2 Country Code Ex:(AF,IN) in \\"country\\"
1583
+ # parameter |
1584
+ # | Please pass Valid State Code |
1585
+ # | Please pass valid street address in \\"street_address\\" parameter |
1586
+ # | Please pass valid city name in \\"city\\" parameter |
1587
+ # | Please pass valid postal Code name in \\"zip_code\\" parameter |
1588
+ # | You are not Allowed for Live Transaction |
1589
+ # | Merchant Limit is not set |
1590
+ # | Minimum amount is not set for this merchant |
1591
+ # | Brand not found ! |
1592
+ # | Your charges setting is incomplete .Plese Contact to Administrator. |
1593
+ # | Only {{currencyCode}} currency is allowed. |
1594
+ # | Transaction amount must be equal or greater to minimum trans amount |
1595
+ # | Invalid_Parameter <br>You'd usually get it when one or more mandatory
1596
+ # parameters are not present in the request. |
1597
+ # @param [PurchaseRequest2] body Required parameter: TODO: type description
1598
+ # here
1599
+ # @return [ApiResponse] Complete http response with raw body and status code.
1600
+ def purchase1(body)
1601
+ @api_call
1602
+ .request(new_request_builder(HttpMethodEnum::POST,
1603
+ '/api/v1/purchases',
1604
+ Server::SERVER_3)
1605
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1606
+ .body_param(new_parameter(body)
1607
+ .is_required(true))
1608
+ .header_param(new_parameter('application/json', key: 'accept'))
1609
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1610
+ .response(new_response_handler
1611
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1612
+ .deserialize_into(OpenBankingEuUk.method(:from_hash))
1613
+ .is_api_response(true))
1614
+ .execute
1615
+ end
1616
+
1617
+ # This API tells you about all the details of a purchase, including its
1618
+ # history
1619
+ # ### Mandatory
1620
+ # you need to pass the `PurchaseID` in the API URL
1621
+ # ### Possible Value of Status
1622
+ # | **Status** | **Notes** |
1623
+ # | --- | --- |
1624
+ # | created | When Purchase order is created. |
1625
+ # | paid | Transaction Successful |
1626
+ # | payment_in_process | Payment is under Processing |
1627
+ # | chargeback | Payment is chargeback state |
1628
+ # | refund_in_process | Refund is under Processing. |
1629
+ # | expired | Purchase has Expired. |
1630
+ # | overdue | Purchase is Overdued. |
1631
+ # | cancelled | Purchase is cancelled. |
1632
+ # | error | Transaction has Failed. |
1633
+ # | refunded | Payment is refunded |
1634
+ # ### Response Examples
1635
+ # In the response examples you can see instances of both `Paid` and `Error`
1636
+ # Status purchases.
1637
+ # ### Error Details
1638
+ # If there are any issues on the Purchase you can get more details from the
1639
+ # `transaction_data.attempts.error` attribute of the response object
1640
+ # ### Errors
1641
+ # If there are any errors then it'll be in the format of :
1642
+ # ``` json
1643
+ # {
1644
+ # "message": "descriptive error message",
1645
+ # "code": "error_code"
1646
+ # }
1647
+ # ```
1648
+ # Please see the Status Code section for further details.
1649
+ # @return [ApiResponse] Complete http response with raw body and status code.
1650
+ def get_status11
1651
+ @api_call
1652
+ .request(new_request_builder(HttpMethodEnum::GET,
1653
+ '/api/v1/purchases/64bff12bf63e36669499e97d',
1654
+ Server::SERVER_3)
1655
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1656
+ .header_param(new_parameter('application/json', key: 'accept')))
1657
+ .response(new_response_handler
1658
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1659
+ .deserialize_into(PurchasesSuccess.method(:from_hash))
1660
+ .is_api_response(true))
1661
+ .execute
1662
+ end
1663
+
1664
+ # This API is used to initate refund of the purchases that have status as
1665
+ # `PAID` can be initiated for refund
1666
+ # Once the refund has been initiated, the status of the purchase would
1667
+ # become `REFUND_IN_PROCESS` and once the refund has been approved by the
1668
+ # bank, the status woud become `REFUNDED`
1669
+ # Purchase ID is **mandatory** for this API.
1670
+ # Currently we don't support partial refunds.
1671
+ # ### Response Examples
1672
+ # In the response examples you can see instances of both `successful` and
1673
+ # `unsuccessful` in refund of purchases.
1674
+ # @return [ApiResponse] Complete http response with raw body and status code.
1675
+ def refund1
1676
+ @api_call
1677
+ .request(new_request_builder(HttpMethodEnum::GET,
1678
+ '/api/v1/purchases/657af976c3fceb7beb30eeb4/refund',
1679
+ Server::SERVER_3)
1680
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1681
+ .header_param(new_parameter('application/json', key: 'accept')))
1682
+ .response(new_response_handler
1683
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1684
+ .deserialize_into(RefundSuccess1.method(:from_hash))
1685
+ .is_api_response(true)
1686
+ .local_error('400',
1687
+ 'Bad Request',
1688
+ RefundErrorException))
1689
+ .execute
1690
+ end
1691
+
1692
+ # **OVERIEW**
1693
+ # The **createCustomer API** allows merchants to create a customer profile
1694
+ # on Paysecure when a user visits their website, facilitating a seamless
1695
+ # payment experience by pre-filling the customer's details, on the Paysecure
1696
+ # Cashier.
1697
+ # The API takes in customer information and returns a unique customerID that
1698
+ # can be passed in purchase payload, eliminating the need for customers to
1699
+ # manually enter their details during transactions.
1700
+ # | Parameter | Type | **Required** | Description | Example |
1701
+ # | --- | --- | --- | --- | --- |
1702
+ # | merchantCustomerId | String | Yes | unique customer ID provided by
1703
+ # merchant. This can be email, mobile or an alphanumeric string |
1704
+ # [rahultestcustomer@paysecure.net](https://mailto:rahultestcustomer@paysecu
1705
+ # re.net) |
1706
+ # | fullName | String | Yes | Full name of the customer. | Rahul Agarwal |
1707
+ # | emailId | String | Yes | Email address of the customer. |
1708
+ # [test@paysecure.net](https://mailto:test@paysecure.net) |
1709
+ # | dateOfBirth | String | Optional | Customer's date of birth in YYYY-MM-DD
1710
+ # format. | 1995-12-27 |
1711
+ # | phoneNo | String | Yes | Customer's phone number. Preferred with the
1712
+ # country code | +91 797639082 |
1713
+ # | city | String | Optional | City of the customer. | Jaipur |
1714
+ # | stateCode | String | Yes | State code of the customer. | RJ |
1715
+ # | zipCode | String | Optional | Postal code of the customer's location. |
1716
+ # 302018 |
1717
+ # | address | String | Optional | Full address of the customer. | House
1718
+ # Number 53, Vaishali Nagar, Jaipur |
1719
+ # | country | String | Yes | Country code (ISO 3166-1 alpha-2). | IN |
1720
+ # | custRegDate | Sting | Optional | Customer registration date on merchant
1721
+ # site in YYYY-MM-DD format. | 2023-12-27 |
1722
+ # | successTxn | String | Optional | Number of successful transactions
1723
+ # customer has carried on merchant site. | 32 |
1724
+ # ### **User Flow**
1725
+ # 1. **Customer visits merchant's website**: The customer selects the
1726
+ # product or service and proceeds to checkout page.
1727
+ #
1728
+ # 2. **Merchant calls the** **`createCustomer`** **API**: The merchant sends
1729
+ # a `POST` request to the Paysecure API with the customer's details.
1730
+ #
1731
+ # 3. **Customer ID generation**: Paysecure processes the request and
1732
+ # generates a unique `customerId` which is returned in the response.
1733
+ #
1734
+ # 4. **Payment Process**: The merchant uses the `customerId` for subsequent
1735
+ # session creation, ensuring the customer doesn’t need to re-enter their
1736
+ # details for future payments.
1737
+ #
1738
+ # ---
1739
+ # ### **Benefits**
1740
+ # - **Seamless user experience**: The customer does not have to enter their
1741
+ # details manually for every purchase.
1742
+ #
1743
+ # - **Faster Checkout**: The merchant can use the `customerId` for faster
1744
+ # payment processing.
1745
+ #
1746
+ # - **Data Security**: Customer details are stored securely and can be
1747
+ # reused across transactions, reducing the chances of errors.
1748
+ #
1749
+ # ### Implementing createCustomer on merchant site:
1750
+ # The `createCustomer` can be implemented on merchant site in one of two
1751
+ # ways, depending on merchant’s integration flow:
1752
+ # **At Checkout:**
1753
+ # When a customer initiates the checkout process, your system should invoke
1754
+ # the `createCustomer` API, before actually starting the session.
1755
+ # - **Call** **`createCustomer`**: This API call generates a unique customer
1756
+ # ID.
1757
+ #
1758
+ # - **Use of Customer ID:** Pass the returned customer ID in Session API,
1759
+ # when creating a payment session.
1760
+ #
1761
+ # **Upon Customer Login:**
1762
+ # Alternatively, merchants may choose to call `createCustomer` at the time
1763
+ # of customer login on their site.
1764
+ # - **Persistent Customer Profiles:** This approach can help build or
1765
+ # maintain a persistent customer profile, ensuring the customer ID is
1766
+ # available for any subsequent payment sessions without needing to call
1767
+ # `createCustomer` again.
1768
+ #
1769
+ # - **Integration Flexibility:** This is useful for merchants who want to
1770
+ # initialize customer data early in the customer journey rather than during
1771
+ # checkout.
1772
+ #
1773
+ # The method you choose depends on your business requirements and how your
1774
+ # system is architected. Regardless of when you call it, the resulting
1775
+ # customer ID must be passed to the `createSession` API to initiate a
1776
+ # payment session.
1777
+ # @param [String] brand_id Required parameter: TODO: type description here
1778
+ # @param [CreateCustomerRequest1] body Required parameter: TODO: type
1779
+ # description here
1780
+ # @return [ApiResponse] Complete http response with raw body and status code.
1781
+ def create_customer(brand_id,
1782
+ body)
1783
+ @api_call
1784
+ .request(new_request_builder(HttpMethodEnum::POST,
1785
+ '/api/v1/customer',
1786
+ Server::SERVER_3)
1787
+ .header_param(new_parameter(brand_id, key: 'BrandId')
1788
+ .is_required(true))
1789
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1790
+ .body_param(new_parameter(body)
1791
+ .is_required(true))
1792
+ .header_param(new_parameter('application/json', key: 'accept'))
1793
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1794
+ .response(new_response_handler
1795
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1796
+ .deserialize_into(Success19.method(:from_hash))
1797
+ .is_api_response(true))
1798
+ .execute
1799
+ end
1800
+
1801
+ # This endpoint makes an HTTP GET request to retrieve customer information
1802
+ # from the Paysecure API.
1803
+ # ### Request
1804
+ # The request does not include any query parameters, but it uses a raw
1805
+ # request body with the following parameter "merchantCustomerId", which will
1806
+ # be the customer id on the merchant's side.
1807
+ # ### Response
1808
+ # The response of this request can be documented as a JSON schema.
1809
+ # @param [String] brand_id Required parameter: TODO: type description here
1810
+ # @param [String] accept Required parameter: TODO: type description here
1811
+ # @return [ApiResponse] Complete http response with raw body and status code.
1812
+ def get_customer(brand_id,
1813
+ accept)
1814
+ @api_call
1815
+ .request(new_request_builder(HttpMethodEnum::GET,
1816
+ '/customer',
1817
+ Server::SERVER_2)
1818
+ .header_param(new_parameter(brand_id, key: 'BrandId')
1819
+ .is_required(true))
1820
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1821
+ .header_param(new_parameter(accept, key: 'Accept')
1822
+ .is_required(true)))
1823
+ .response(new_response_handler
1824
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1825
+ .deserialize_into(Success19.method(:from_hash))
1826
+ .is_api_response(true))
1827
+ .execute
1828
+ end
1829
+
1830
+ # **OVERIEW**
1831
+ # The `createSession` API is designed to initiate a payment session for a
1832
+ # customer after their profile has been created via the **createCustomer**
1833
+ # API. The session is automatically generated at the backend on the
1834
+ # merchant’s checkout URL. This session allows the customer to continue with
1835
+ # their transaction without having to manually interact with the session
1836
+ # URL, and ensures the session remains active until the payment is completed
1837
+ # or the session expires.
1838
+ # This API improves the user experience by reducing transaction failures and
1839
+ # enhancing the overall payment process, thus reducing transaction churn
1840
+ # rates.
1841
+ # ### Mandatory Parameters
1842
+ # | Parameter | Type | Description | Example |
1843
+ # | --- | --- | --- | --- |
1844
+ # | customerId | String | The unique ID of the customer (generated from
1845
+ # createCustomer). | 6731a609b6bb5a43ad66c4a6 |
1846
+ # To register a mandate, pass mandate related parameters in the Create
1847
+ # Session API to create a mandate registration purchase. Post transaction
1848
+ # completion, use Get Status API and Webhooks to capture mandate
1849
+ # registration details.
1850
+ # ### Additional **parameters for this usecase:**
1851
+ # | **Parameter** | **Notes** |
1852
+ # | --- | --- |
1853
+ # | payment_type | Mandatory. <br>To be passed as "mandate". |
1854
+ # | mandate | Mandatory. <br>This object is mandatory for mandate flow |
1855
+ # | mandate.mandate_max_amount | Optional <br>Maximum amount for a mandate.
1856
+ # |
1857
+ # | mandate.amount_variability | Optional <br>Specifies whether the amount
1858
+ # is fixed or variable for each recurrence. <br> <br>Possible values:
1859
+ # Fixed or Variable |
1860
+ # | mandate.start_date | Mandatory <br>Specifies the time when the mandate
1861
+ # will start. |
1862
+ # | mandate.end_date | Mandatory <br>Specifies the time when the mandate
1863
+ # will end. |
1864
+ # | mandate.frequency | Mandatory <br>Defines the frequency of mandate
1865
+ # execution, how often a customer should be charged. <br> <br>Possible
1866
+ # Values: <br>**ONETIME**: This is for a one-time mandate. The customer
1867
+ # provides authorisation to debit their account a single time for a specific
1868
+ # amount. <br> <br>**DAILY**: Recurring mandate. The customer provides
1869
+ # authorisation to debit their account daily for a specific amount. <br>
1870
+ # <br>**WEEKLY**: Recurring mandate. Authorisation given by a customer to
1871
+ # debit their account weekly once for a specified amount. <br>
1872
+ # <br>**FORTNIGHTLY**: Recurring mandate. The customer provides
1873
+ # authorisation to debit their account fortnightly for a specific amount.
1874
+ # <br> <br>**MONTHLY**: Recurring mandate. The customer provides
1875
+ # authorisation to debit their account monthly for a specific amount. <br>
1876
+ # <br>**BIMONTHLY**: Recurring mandate. The customer provides authorisation
1877
+ # to debit their account bimonthly for a specific amount. <br>
1878
+ # <br>**QUARTERLY**: Recurring mandate. The customer provides authorisation
1879
+ # to debit their account quarterly for a specific amount. <br>
1880
+ # <br>**HALFYEARLY**: Recurring mandate. The customer provides authorisation
1881
+ # to debit their account once in every 6 months for a specific amount. <br>
1882
+ # <br>**YEARLY**: Recurring mandate. The customer provides authorisation to
1883
+ # debit their account once a year for a specific amount. <br>
1884
+ # <br>**ASPRESENTED**: For cases where the scheduling is handled by the
1885
+ # merchant. The customer provides authorization to debit their account
1886
+ # whenever there is an execution request. |
1887
+ # | mandate.rule | Optional. <br>Indicates the recurrence rule of the
1888
+ # mandate. This rule is not required for onetime, daily, and aspresented
1889
+ # recurrence patterns. <br>Possible values: on/before/after <br>By
1890
+ # Default: on |
1891
+ # | mandate.value | Conditional. <br>The recurrence Value of the mandate.
1892
+ # <br>It is not required for ONETIME, DAILY and ASPRESENTED frequencies.
1893
+ # <br> <br>Possible values: <br>For WEEKLY: The value should be 1-Monday
1894
+ # to 7-Sunday. <br>For MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY or YEARLY:
1895
+ # The value should be between 1 to 30/31 days. <br> <br>By Default: The
1896
+ # value will be treated as 1. |
1897
+ # ### **Usage Flow**
1898
+ # 1. **Customer completes the** **`createCustomer`** **API**: Once the
1899
+ # customer is created via the `createCustomer` API, the merchant proceeds to
1900
+ # call the `createSession` API to generate a session.
1901
+ #
1902
+ # 2. **Merchant sends** **`createSession`** **request**: The merchant sends
1903
+ # a `POST` request to the `createSession` API with the customer’s
1904
+ # `customerId` and the merchant’s `brandId`.
1905
+ #
1906
+ # 3. **Session created automatically on the checkout URL**: PaySecure
1907
+ # creates the session and associates it with the merchant’s checkout page.
1908
+ # This session remains active on the backend, allowing the customer to
1909
+ # continue the payment process without interruption.
1910
+ #
1911
+ # 4. **Customer proceeds to checkout**: The customer is redirected to the
1912
+ # checkout page as part of the merchant's payment flow, where the session is
1913
+ # automatically validated. The session remains active for a set period,
1914
+ # allowing the customer to complete the payment without needing to manually
1915
+ # interact with the session URL.
1916
+ #
1917
+ # 5. **Session Expiry**: The session expires after the set expiration time
1918
+ # (`expiryOn`), ensuring the payment process is completed within the defined
1919
+ # window. Default is 15 mins from the creation time.
1920
+ #
1921
+ # ---
1922
+ # ### **Benefits**
1923
+ # - **Seamless Checkout**: The session URL is automatically generated and
1924
+ # active at the backend, ensuring a smoother and uninterrupted customer
1925
+ # experience.
1926
+ #
1927
+ # - **Reduced Transaction Failures**: By ensuring the session remains active
1928
+ # during the payment process, the chances of transaction failures due to
1929
+ # session timeouts are minimized.
1930
+ #
1931
+ # - **Improved User Experience**: The customer does not need to click on a
1932
+ # session URL or navigate away from the page, leading to faster and more
1933
+ # secure payment processing.
1934
+ # @param [String] brand_id Required parameter: TODO: type description here
1935
+ # @param [CreateSessionCitRequest] body Required parameter: TODO: type
1936
+ # description here
1937
+ # @return [ApiResponse] Complete http response with raw body and status code.
1938
+ def create_session_cit(brand_id,
1939
+ body)
1940
+ @api_call
1941
+ .request(new_request_builder(HttpMethodEnum::POST,
1942
+ '/api/v1/createSession',
1943
+ Server::SERVER_3)
1944
+ .header_param(new_parameter(brand_id, key: 'BrandId')
1945
+ .is_required(true))
1946
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
1947
+ .body_param(new_parameter(body)
1948
+ .is_required(true))
1949
+ .header_param(new_parameter('application/json', key: 'accept'))
1950
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
1951
+ .response(new_response_handler
1952
+ .deserializer(APIHelper.method(:custom_type_deserializer))
1953
+ .deserialize_into(Success32.method(:from_hash))
1954
+ .is_api_response(true))
1955
+ .execute
1956
+ end
1957
+
1958
+ # **OVERIEW**
1959
+ # The `create Purchase` API is designed to initiate a payment for a merchant
1960
+ # who doesn't want to use Paysecure's cashier and wants to keep everything
1961
+ # S2S.
1962
+ # The merchant doesn't need to create a customer in this case and directly
1963
+ # needs to call the purchase API and then call the S2S API after that.
1964
+ # ### Additional **parameters for this usecase:**
1965
+ # | **Parameter** | **Notes** |
1966
+ # | --- | --- |
1967
+ # | payment_type | Mandatory. <br>To be passed as "mandate". |
1968
+ # | paymentMethod | Mandatory. <br>Example: MASTER, VISA |
1969
+ # | brand_id | Mandatory. <br>Your brand id. |
1970
+ # | mandate | Mandatory. <br>This object is mandatory for mandate flow |
1971
+ # | mandate.mandate_max_amount | Conditional. <br>Mandatory when
1972
+ # amount_variability is "Variable". <br>Maximum amount for a mandate. |
1973
+ # | mandate.amount_variability | Optional <br>Specifies whether the amount
1974
+ # is fixed or variable for each recurrence. <br> <br>Possible values:
1975
+ # Fixed or Variable |
1976
+ # | mandate.start_date | Optional <br>Specifies the time when the mandate
1977
+ # will start. |
1978
+ # | mandate.end_date | Optional <br>Specifies the time when the mandate
1979
+ # will end. <br>(If not passed then indefinite) |
1980
+ # | mandate.frequency | Mandatory <br>Defines the frequency of mandate
1981
+ # execution, how often a customer should be charged. <br> <br>Possible
1982
+ # Values: <br>**ONETIME**: This is for a one-time mandate. The customer
1983
+ # provides authorisation to debit their account a single time for a specific
1984
+ # amount. <br> <br>**DAILY**: Recurring mandate. The customer provides
1985
+ # authorisation to debit their account daily for a specific amount. <br>
1986
+ # <br>**WEEKLY**: Recurring mandate. Authorisation given by a customer to
1987
+ # debit their account weekly once for a specified amount. <br>
1988
+ # <br>**FORTNIGHTLY**: Recurring mandate. The customer provides
1989
+ # authorisation to debit their account fortnightly for a specific amount.
1990
+ # <br> <br>**MONTHLY**: Recurring mandate. The customer provides
1991
+ # authorisation to debit their account monthly for a specific amount. <br>
1992
+ # <br>**BIMONTHLY**: Recurring mandate. The customer provides authorisation
1993
+ # to debit their account bimonthly for a specific amount. <br>
1994
+ # <br>**QUARTERLY**: Recurring mandate. The customer provides authorisation
1995
+ # to debit their account quarterly for a specific amount. <br>
1996
+ # <br>**HALFYEARLY**: Recurring mandate. The customer provides authorisation
1997
+ # to debit their account once in every 6 months for a specific amount. <br>
1998
+ # <br>**YEARLY**: Recurring mandate. The customer provides authorisation to
1999
+ # debit their account once a year for a specific amount. <br>
2000
+ # <br>**ASPRESENTED**: For cases where the scheduling is handled by the
2001
+ # merchant. The customer provides authorization to debit their account
2002
+ # whenever there is an execution request. |
2003
+ # | mandate.rule | Optional. <br>Indicates the recurrence rule of the
2004
+ # mandate. This rule is not required for onetime, daily, and aspresented
2005
+ # recurrence patterns. <br>Possible values: on/before/after <br>By
2006
+ # Default: on |
2007
+ # | mandate.value | Conditional. <br>The recurrence Value of the mandate.
2008
+ # <br>It is not required for ONETIME, DAILY and ASPRESENTED frequencies.
2009
+ # <br> <br>Possible values: <br>For WEEKLY: The value should be 1-Monday
2010
+ # to 7-Sunday. <br>For MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY or YEARLY:
2011
+ # The value should be between 1 to 30/31 days. <br> <br>By Default: The
2012
+ # value will be treated as 1. |
2013
+ # @param [CreatePurchaseCitRequest] body Required parameter: TODO: type
2014
+ # description here
2015
+ # @return [ApiResponse] Complete http response with raw body and status code.
2016
+ def create_purchase_cit(body)
2017
+ @api_call
2018
+ .request(new_request_builder(HttpMethodEnum::POST,
2019
+ '/api/v1/purchases',
2020
+ Server::SERVER_3)
2021
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2022
+ .body_param(new_parameter(body)
2023
+ .is_required(true))
2024
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2025
+ .response(new_response_handler
2026
+ .is_response_void(true)
2027
+ .is_api_response(true)
2028
+ .local_error('401',
2029
+ 'Unauthorized',
2030
+ Success33Exception))
2031
+ .execute
2032
+ end
2033
+
2034
+ # This API would be the 2nd in sequence to call if the call to `/purchases/`
2035
+ # was successful in step 1. and you want to do the transaction via
2036
+ # Server-to-Server mode.
2037
+ # The request body would contain the details of the card that's to be
2038
+ # transacted upon.
2039
+ # ### **Mandatory parameters in request body:**
2040
+ # | Parameter | **Notes** |
2041
+ # | --- | --- |
2042
+ # | remote_ip | IP address of the customer’s device used for transaction.
2043
+ # Helps in fraud checks and risk scoring. Ex- 157.38.242.7 |
2044
+ # | user_agent | Full browser and operating system details captured from
2045
+ # HTTP header. EX- Chrome/5.0 (X11; Linux x86_64) |
2046
+ # | accept_header | Browser’s accepted content types (from HTTP header).
2047
+ # Used for validating request origin and device info. EX- text/html |
2048
+ # ### **Essential parameters in request body:**
2049
+ # | Parameter | **Notes** |
2050
+ # | --- | --- |
2051
+ # | cardholder_name | Name of the cardholder |
2052
+ # | card_number | The card numbers Must be 10-20 characters. |
2053
+ # | expires | must be greater than the current month/year. |
2054
+ # | cvc | 3 or 4 digit |
2055
+ # **
2056
+ # Other optional parameters in request body:**
2057
+ # | Parameter | **Notes** |
2058
+ # | --- | --- |
2059
+ # | language | Preferred language of the user’s browser . EX - en-US |
2060
+ # | java_enabled | Indicates if Java is enabled in the browser. Helps PSPs
2061
+ # in device profiling. Ex- true/false |
2062
+ # | javascript_enabled | Indicates if JavaScript is enabled in the client
2063
+ # browser. Used for 3DS or risk-based checks. Ex- true |
2064
+ # | color_depth | Bit depth of the display screen. Ex- 24 |
2065
+ # | utc_offset | Difference in minutes between local time and UTC. Used for
2066
+ # location and timezone checks. Ex- 330 |
2067
+ # | screen_width | Width of the device screen in pixels. Used in device
2068
+ # profiling. Ex- 1920 |
2069
+ # | screen_height | Height of the device screen in pixels. Ex- 1080 |
2070
+ # **Successful Response**
2071
+ # If all the details are correct you'll get a 202 response with staus as
2072
+ # Pending
2073
+ # ``` json
2074
+ # {
2075
+ # "status": "pending",
2076
+ # "callback_url":
2077
+ # "https://paysecure.net/payment/63bd0bf80fb42a076e8a4dd1/",
2078
+ # "method": "GET"
2079
+ # }
2080
+ # ```
2081
+ # If the response code is 202, after receiving the response body, direct the
2082
+ # customer to the callback_url provided in the response.
2083
+ # **Errors**
2084
+ # If there are any errors then it'll be in the format of :
2085
+ # ``` json
2086
+ # {
2087
+ # "message": "descriptive error message",
2088
+ # "code": "error_code"
2089
+ # }
2090
+ # ```
2091
+ # Please see the Status Code section for further details.
2092
+ # | **Error Messages** |
2093
+ # | --- |
2094
+ # | Client Ip could not be matched with Merchant Ip |
2095
+ # | Invalid Card Information |
2096
+ # | Card is Blocked |
2097
+ # | Different Type of key used to create purchase and payment |
2098
+ # | You charges setting is incomplete .Plese Contact to adminstrartor. |
2099
+ # | Allowed Attempt for this Transaction has been consumed |
2100
+ # | Invalid Card Expiry(Valid Format:MM/YY) must be greator than current
2101
+ # month/year |
2102
+ # | Customer profile is Blocked |
2103
+ # | Customer/Card not allowed for transaction |
2104
+ # @param [TrueClass | FalseClass] s2s Required parameter: TODO: type
2105
+ # description here
2106
+ # @param [S2SApiRequest] body Required parameter: TODO: type description
2107
+ # here
2108
+ # @return [ApiResponse] Complete http response with raw body and status code.
2109
+ def s2_s_api(s2s,
2110
+ body)
2111
+ @api_call
2112
+ .request(new_request_builder(HttpMethodEnum::POST,
2113
+ '/api/v1/p/64bff4fff63e36669499e9c8',
2114
+ Server::SERVER_3)
2115
+ .query_param(new_parameter(s2s, key: 's2s')
2116
+ .is_required(true))
2117
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2118
+ .body_param(new_parameter(body)
2119
+ .is_required(true))
2120
+ .header_param(new_parameter('application/json', key: 'accept'))
2121
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2122
+ .response(new_response_handler
2123
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2124
+ .deserialize_into(Success1.method(:from_hash))
2125
+ .is_api_response(true))
2126
+ .execute
2127
+ end
2128
+
2129
+ # This endpoint will be used to get all the details of a particular mandate.
2130
+ # You can search for a particular mandate id or for a particular session id.
2131
+ # ### Response **parameters:**
2132
+ # 1. **totalDeductedAmount**
2133
+ # This is the total amount which is deducted from the user's account.
2134
+ #
2135
+ # 2. **recurringMandateIds**
2136
+ # This object returns a list of all the MIT transactions done for the
2137
+ # respective mandate.
2138
+ #
2139
+ # 3. **nextMandateDate**
2140
+ # This is the date when the next recurring payment will happen.
2141
+ # @param [String] accept Required parameter: TODO: type description here
2142
+ # @param [String] brand_id Required parameter: TODO: type description here
2143
+ # @return [ApiResponse] Complete http response with raw body and status code.
2144
+ def get_mandate(accept,
2145
+ brand_id)
2146
+ @api_call
2147
+ .request(new_request_builder(HttpMethodEnum::GET,
2148
+ '/api/v1/mandate/{mandate_id or session_id}',
2149
+ Server::SERVER_3)
2150
+ .header_param(new_parameter(accept, key: 'Accept')
2151
+ .is_required(true))
2152
+ .header_param(new_parameter(brand_id, key: 'BrandId')
2153
+ .is_required(true)))
2154
+ .response(new_response_handler
2155
+ .is_response_void(true)
2156
+ .is_api_response(true)
2157
+ .local_error('500',
2158
+ 'Internal Server Error',
2159
+ Success36Exception))
2160
+ .execute
2161
+ end
2162
+
2163
+ # After the successful Mandate registration, Merchant will receive a
2164
+ # mandate_id from Paysecure that should be stored against a customer at
2165
+ # their end.
2166
+ # If the **merchant handles their own scheduling,** then for the subsequent
2167
+ # transactions, the merchant is supposed to pass a combination of
2168
+ # customer_id and mandate_id to do a debit. This API will perform a
2169
+ # transaction with a PSP based on the mandate_id passed in the request.
2170
+ # If **Paysecure handles the scheduling for the merchant** on their behalf,
2171
+ # then this API is not for them. The MIT transactions will be handled by
2172
+ # Paysecure from our side.
2173
+ # Note:
2174
+ # Recurring payments should only be done if the mandate registration has
2175
+ # been successful and the mandate is ACTIVE.
2176
+ # @param [String] accept Required parameter: TODO: type description here
2177
+ # @param [CreatePurchaseMitRequest] body Required parameter: TODO: type
2178
+ # description here
2179
+ # @return [ApiResponse] Complete http response with raw body and status code.
2180
+ def create_purchase_mit(accept,
2181
+ body)
2182
+ @api_call
2183
+ .request(new_request_builder(HttpMethodEnum::POST,
2184
+ '/api/v1/purchases',
2185
+ Server::SERVER_3)
2186
+ .header_param(new_parameter(accept, key: 'Accept')
2187
+ .is_required(true))
2188
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2189
+ .body_param(new_parameter(body)
2190
+ .is_required(true))
2191
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2192
+ .response(new_response_handler
2193
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2194
+ .deserialize_into(Success38.method(:from_hash))
2195
+ .is_api_response(true))
2196
+ .execute
2197
+ end
2198
+
2199
+ # Required for cases where the Paysecure is handling the scheduling of
2200
+ # recurring payments. Use this API to revoke/cancel an ACTIVE mandate.
2201
+ # Note:
2202
+ # Revoking a mandate should be done at the same instance this API is called.
2203
+ # The mandate status should be updated to “REVOKED” at the same instant.
2204
+ # @param [String] accept Required parameter: TODO: type description here
2205
+ # @param [String] brandid Required parameter: TODO: type description here
2206
+ # @param [RevokeMandateRequest] body Required parameter: TODO: type
2207
+ # description here
2208
+ # @return [ApiResponse] Complete http response with raw body and status code.
2209
+ def revoke_mandate(accept,
2210
+ brandid,
2211
+ body)
2212
+ @api_call
2213
+ .request(new_request_builder(HttpMethodEnum::POST,
2214
+ '/api/v1/mandate',
2215
+ Server::SERVER_3)
2216
+ .header_param(new_parameter(accept, key: 'Accept')
2217
+ .is_required(true))
2218
+ .header_param(new_parameter(brandid, key: 'Brandid')
2219
+ .is_required(true))
2220
+ .body_param(new_parameter(body)
2221
+ .is_required(true))
2222
+ .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
2223
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2224
+ .response(new_response_handler
2225
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2226
+ .deserialize_into(Success39.method(:from_hash))
2227
+ .is_api_response(true))
2228
+ .execute
2229
+ end
2230
+
2231
+ # Required for cases where the Paysecure is handling the scheduling of
2232
+ # recurring payments. Use this API to pause an ACTIVE mandate.
2233
+ # ### Additional **parameters for this usecase:**
2234
+ # | **Parameter** | **Notes** |
2235
+ # | --- | --- |
2236
+ # | command | Mandatory. <br>To be passed as "pause". |
2237
+ # | mandate_id | Mandatory. |
2238
+ # | pause_start_date | Optional <br>Date in UNIX EPOCH timestamp (UTC
2239
+ # timezone) format, when the mandate will be paused. <br>If not passed,
2240
+ # Default value will be the current date. |
2241
+ # | pause_end_date | Mandatory <br>Date in UNIX EPOCH timestamp (UTC
2242
+ # timezone) format, when the mandate status will be automatically changed to
2243
+ # ACTIVE. |
2244
+ # Note:
2245
+ # For pausing a mandate you need to keep the exact timestamp in mind.
2246
+ # If a recurring payment is scheduled between the pause_start_date and
2247
+ # pause_end_date then it will not be executed.
2248
+ # @param [String] accept Required parameter: TODO: type description here
2249
+ # @param [String] brand_id Required parameter: TODO: type description here
2250
+ # @param [PauseMandateRequest] body Required parameter: TODO: type
2251
+ # description here
2252
+ # @return [ApiResponse] Complete http response with raw body and status code.
2253
+ def pause_mandate(accept,
2254
+ brand_id,
2255
+ body)
2256
+ @api_call
2257
+ .request(new_request_builder(HttpMethodEnum::POST,
2258
+ '/api/v1/mandate',
2259
+ Server::SERVER_3)
2260
+ .header_param(new_parameter(accept, key: 'Accept')
2261
+ .is_required(true))
2262
+ .header_param(new_parameter(brand_id, key: 'BrandId')
2263
+ .is_required(true))
2264
+ .body_param(new_parameter(body)
2265
+ .is_required(true))
2266
+ .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
2267
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2268
+ .response(new_response_handler
2269
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2270
+ .deserialize_into(PauseMandate.method(:from_hash))
2271
+ .is_api_response(true))
2272
+ .execute
2273
+ end
2274
+
2275
+ # This endpoint will be used to list all the mandates for a particular
2276
+ # customer of a merchant.
2277
+ # ### Response **parameters:**
2278
+ # 1. **totalDeductedAmount**
2279
+ # This is the total amount which is deducted from the user's account.
2280
+ #
2281
+ # 2. **recurringMandateIds**
2282
+ # This object returns a list of all the MIT transactions done for the
2283
+ # respective mandate.
2284
+ #
2285
+ # 3. **nextMandateDate**
2286
+ # This is the date when the next recurring payment will happen.
2287
+ # @param [String] customer_id Required parameter: TODO: type description
2288
+ # here
2289
+ # @param [String] email Required parameter: TODO: type description here
2290
+ # @param [String] accept Required parameter: TODO: type description here
2291
+ # @param [String] brand_id Required parameter: TODO: type description here
2292
+ # @return [ApiResponse] Complete http response with raw body and status code.
2293
+ def list_mandates(customer_id,
2294
+ email,
2295
+ accept,
2296
+ brand_id)
2297
+ @api_call
2298
+ .request(new_request_builder(HttpMethodEnum::GET,
2299
+ '/api/v1/mandate',
2300
+ Server::SERVER_3)
2301
+ .query_param(new_parameter(customer_id, key: 'customerId')
2302
+ .is_required(true))
2303
+ .query_param(new_parameter(email, key: 'email')
2304
+ .is_required(true))
2305
+ .header_param(new_parameter(accept, key: 'Accept')
2306
+ .is_required(true))
2307
+ .header_param(new_parameter(brand_id, key: 'BrandId')
2308
+ .is_required(true)))
2309
+ .response(new_response_handler
2310
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2311
+ .deserialize_into(Success40.method(:from_hash))
2312
+ .is_api_response(true))
2313
+ .execute
2314
+ end
2315
+
2316
+ # This API tells you about all the details of a recurring payment which
2317
+ # occurred
2318
+ # ### Mandatory
2319
+ # you need to pass the `PurchaseID` in the API URL
2320
+ # ### Possible Value of Status
2321
+ # | **Status** | **Notes** |
2322
+ # | --- | --- |
2323
+ # | paid | Transaction Successful |
2324
+ # | expired | Purchase has Expired. |
2325
+ # | error | Transaction has Failed. |
2326
+ # ### Response Examples
2327
+ # In the response examples you can see instances of both `Paid` and `Error`
2328
+ # Status purchases.
2329
+ # ### Error Details
2330
+ # If there are any issues on the Purchase you can get more details from the
2331
+ # `transaction_data.attempts.error` attribute of the response object
2332
+ # ### Errors
2333
+ # If there are any errors then it'll be in the format of :
2334
+ # ``` json
2335
+ # {
2336
+ # "message": "descriptive error message",
2337
+ # "code": "error_code"
2338
+ # }
2339
+ # ```
2340
+ # Please see the Status Code section for further details.
2341
+ # @param [String] purchase_id Required parameter: TODO: type description
2342
+ # here
2343
+ # @return [ApiResponse] Complete http response with raw body and status code.
2344
+ def get_status4(purchase_id)
2345
+ @api_call
2346
+ .request(new_request_builder(HttpMethodEnum::GET,
2347
+ '/api/v1/purchases/{purchaseId}',
2348
+ Server::SERVER_3)
2349
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2350
+ .template_param(new_parameter(purchase_id, key: 'purchaseId')
2351
+ .is_required(true)
2352
+ .should_encode(true))
2353
+ .header_param(new_parameter('application/json', key: 'accept')))
2354
+ .response(new_response_handler
2355
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2356
+ .deserialize_into(Success41.method(:from_hash))
2357
+ .is_api_response(true))
2358
+ .execute
2359
+ end
2360
+
2361
+ # ## List Saved Cards
2362
+ # Retrieve all saved card tokens for a given customer. Returns the last 4
2363
+ # digits of each card and its associated `token_reference`.
2364
+ # Use this API to display saved cards to the customer for selection before
2365
+ # initiating a payment via the S2S API.
2366
+ # ### Query Parameters
2367
+ # | Parameter | Type | Required | Description |
2368
+ # | --- | --- | --- | --- |
2369
+ # | `customerId` | string | Yes | Unique identifier for the customer. Must
2370
+ # be URL-encoded if it contains special characters. Email addresses are
2371
+ # case-sensitive. |
2372
+ # | `brandId` | string | Yes | Brand id of the merchant |
2373
+ # ### Response Fields
2374
+ # | Field | Type | Description |
2375
+ # | --- | --- | --- |
2376
+ # | `card_last_four` | string | Last 4 digits of the stored card. Display to
2377
+ # the customer for card selection. |
2378
+ # | `token_reference` | string | Unique reference for this saved card. Pass
2379
+ # this in the S2S payment request or Delete Token request. Do not display to
2380
+ # the customer. |
2381
+ # ### Notes
2382
+ # - The `token_reference` does not expire. It remains valid as long as the
2383
+ # saved card has not been deleted.
2384
+ #
2385
+ # - Show saved cards to the customer using `card_last_four` alongside a card
2386
+ # brand icon (Visa / Mastercard).
2387
+ #
2388
+ # - The `token_reference` should only be stored and used server-side.
2389
+ #
2390
+ # ### Display Tip
2391
+ # Show saved cards using cardlast4 alongside a card brand icon (Visa /
2392
+ # Mastercard).
2393
+ # The token_reference should only be stored and used server-side.
2394
+ # @return [ApiResponse] Complete http response with raw body and status code.
2395
+ def list_saved_cards
2396
+ @api_call
2397
+ .request(new_request_builder(HttpMethodEnum::GET,
2398
+ '/listSavedCards',
2399
+ Server::SERVER_3)
2400
+ .header_param(new_parameter('application/json', key: 'accept')))
2401
+ .response(new_response_handler
2402
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2403
+ .deserialize_into(Success46.method(:from_hash))
2404
+ .is_api_response(true)
2405
+ .is_response_array(true))
2406
+ .execute
2407
+ end
2408
+
2409
+ # ## Purchase
2410
+ # Initiate a payment transaction. This is the standard Paysecure Purchase
2411
+ # API.
2412
+ # When a customer completes the purchase on the Paysecure checkout page and
2413
+ # opts to save their card, Paysecure provisions a network token in the
2414
+ # background and generates a `token_reference` linked to the customer.
2415
+ # ### Mandatory Parameters
2416
+ # | Parameter | Type | Description |
2417
+ # | --- | --- | --- |
2418
+ # | `client.email` | string | Customer's email address. <br>Please send it
2419
+ # in smallcase |
2420
+ # | `client.city` | string | Customer's city. |
2421
+ # | `client.country` | string | ISO-3166 Alpha-2 country code, uppercase
2422
+ # (e.g., IN, US, SG). |
2423
+ # | `client.stateCode` | string | State code, uppercase (e.g., RJ, CA, AL).
2424
+ # |
2425
+ # | `client.street_address` | string | Customer's street address. |
2426
+ # | `client.zip_code` | string | Postal / ZIP code. US format: NNNNN or
2427
+ # NNNNN-NNNN. |
2428
+ # | `purchase.currency` | string | ISO 4217 currency code (e.g., USD, EUR).
2429
+ # Must be enabled on your account. |
2430
+ # | `purchase.products` | array | Array of product objects with `name` and
2431
+ # `price`. |
2432
+ # | `brand_id` | string | Your Paysecure Brand ID from Dashboard. |
2433
+ # | `success_redirect` | string | URL to redirect customer after successful
2434
+ # payment. |
2435
+ # | `failure_redirect` | string | URL to redirect customer after failed
2436
+ # payment. |
2437
+ # ### Optional Parameters
2438
+ # | Parameter | Type | Description |
2439
+ # | --- | --- | --- |
2440
+ # | `pending_redirect` | string | URL to redirect when payment is pending. |
2441
+ # | `success_callback` | string | Server-to-server webhook URL for success.
2442
+ # |
2443
+ # | `failure_callback` | string | Server-to-server webhook URL for failure.
2444
+ # |
2445
+ # | `merchantRef` | string | Your internal reference for this transaction. |
2446
+ # | `paymentMethod` | string | Pre-select payment method (e.g., VISA). |
2447
+ # | `client.phone` | string | Customer's phone number. |
2448
+ # ### Key Response Fields
2449
+ # | Field | Description |
2450
+ # | --- | --- |
2451
+ # | `id` | Unique purchase ID. |
2452
+ # | `checkout_url` | Redirect customer here to complete payment. Card saving
2453
+ # happens during this step. |
2454
+ # | `direct_post_url` | URL for S2S payment submission. |
2455
+ # | `status` | Purchase status. Initially "created". |
2456
+ # #### **Network Tokenisation & Card Saving**
2457
+ # When the customer completes payment via `checkout_url` and opts to save
2458
+ # their card, Paysecure provisions a network token. The `token_reference` is
2459
+ # then available via the **List Saved Cards** API.
2460
+ # @param [PurchaseRequest3] body Required parameter: TODO: type description
2461
+ # here
2462
+ # @return [ApiResponse] Complete http response with raw body and status code.
2463
+ def purchase2(body)
2464
+ @api_call
2465
+ .request(new_request_builder(HttpMethodEnum::POST,
2466
+ '/api/v1/api/v1/purchases',
2467
+ Server::SERVER_3)
2468
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2469
+ .body_param(new_parameter(body)
2470
+ .is_required(true))
2471
+ .header_param(new_parameter('application/json', key: 'accept'))
2472
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2473
+ .response(new_response_handler
2474
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2475
+ .deserialize_into(Success47.method(:from_hash))
2476
+ .is_api_response(true))
2477
+ .execute
2478
+ end
2479
+
2480
+ # ## S2S Payment
2481
+ # Process a payment using a saved card's `token_reference`. Paysecure
2482
+ # resolves the token reference to the underlying network token and processes
2483
+ # the payment securely. If the selected MID does not accept tokens,
2484
+ # Paysecure automatically falls back to the card number.
2485
+ # ### S2S Input Scenarios
2486
+ # The S2S API accepts different input types depending on the scenario:
2487
+ # | Scenario | What to Send | What Paysecure Does |
2488
+ # | --- | --- | --- |
2489
+ # | **New card** (first-time customer) | Full card details | Paysecure
2490
+ # tokenises the card. If the MID supports tokens, the transaction uses the
2491
+ # token; otherwise, the card number is used. |
2492
+ # | **Returning customer** (tokenised with Paysecure) | `token_reference`
2493
+ # from List Saved Cards | Paysecure uses the stored token and generates a
2494
+ # new cryptogram. Falls back to card number if MID doesn't accept tokens. |
2495
+ # ### Request Body
2496
+ # | Field | Type | Required | Description |
2497
+ # | --- | --- | --- | --- |
2498
+ # | `token_reference` | string | Conditional | Token reference from List
2499
+ # Saved Cards. Required when paying with a Paysecure-tokenised card. |
2500
+ # | `cvc` | string | Yes | Card CVC/CVV. **Required even when**
2501
+ # **`token_reference`** **is provided**, for 3DS authentication. |
2502
+ # | `remember_card` | string | No | `"on"` to save card, `"off"` to skip.
2503
+ # Use `"off"` with saved tokens. |
2504
+ # | `remote_ip` | string | Yes | Cardholder's IP address. |
2505
+ # | `user_agent` | string | Yes | Browser User-Agent string. |
2506
+ # | `accept_header` | string | Yes | Browser Accept header. |
2507
+ # | `language` | string | Yes | Browser language (e.g., `"en-US"`). |
2508
+ # | `java_enabled` | boolean | Yes | Java enabled in browser. |
2509
+ # | `javascript_enabled` | boolean | Yes | JavaScript enabled in browser. |
2510
+ # | `color_depth` | integer | Yes | Screen colour depth. |
2511
+ # | `utc_offset` | integer | Yes | UTC timezone offset (minutes). |
2512
+ # | `screen_width` | integer | Yes | Screen width (px). |
2513
+ # | `screen_height` | integer | Yes | Screen height (px). |
2514
+ # ### Token Reference in Response
2515
+ # - **Scenario 1** (New card via S2S): `token_reference` returned in Check
2516
+ # Status and Webhook.
2517
+ #
2518
+ # - **Scenario 2** (Existing `token_reference`): `token_reference` returned
2519
+ # in response and Webhook.
2520
+ #
2521
+ # ### Important Notes
2522
+ # - CVC is **required** even when using a `token_reference`.
2523
+ #
2524
+ # - All browser fields are required for 3D Secure authentication.
2525
+ #
2526
+ # - Response follows the standard Paysecure payment response format.
2527
+ # @param [TrueClass | FalseClass] s2s Required parameter: Must be "true" for
2528
+ # server-to-server requests.
2529
+ # @param [S2SPaymentRequest] body Required parameter: TODO: type description
2530
+ # here
2531
+ # @param [String] brand_id Required parameter: TODO: type description here
2532
+ # @return [ApiResponse] Complete http response with raw body and status code.
2533
+ def s2_s_payment(s2s,
2534
+ body,
2535
+ brand_id)
2536
+ @api_call
2537
+ .request(new_request_builder(HttpMethodEnum::POST,
2538
+ '/api/v1/api/v1/p/{brandId}',
2539
+ Server::SERVER_3)
2540
+ .query_param(new_parameter(s2s, key: 's2s')
2541
+ .is_required(true))
2542
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2543
+ .body_param(new_parameter(body)
2544
+ .is_required(true))
2545
+ .template_param(new_parameter(brand_id, key: 'brandId')
2546
+ .is_required(true)
2547
+ .should_encode(true))
2548
+ .header_param(new_parameter('application/json', key: 'accept'))
2549
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2550
+ .response(new_response_handler
2551
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2552
+ .deserialize_into(Success1.method(:from_hash))
2553
+ .is_api_response(true))
2554
+ .execute
2555
+ end
2556
+
2557
+ # ## Delete Token
2558
+ # Permanently delete a saved card and deactivate the associated network
2559
+ # token. **This action is irreversible.**
2560
+ # ### Path Parameters
2561
+ # | Parameter | Type | Required | Description |
2562
+ # | --- | --- | --- | --- |
2563
+ # | `token_reference` | string | Yes | The `token_reference` of the saved
2564
+ # card to delete. Obtained from the List Saved Cards API. |
2565
+ # ### Important Notes
2566
+ # - Deleting a token is **permanent**. The `token_reference` can no longer
2567
+ # be used for payments.
2568
+ #
2569
+ # - The associated network token is deactivated with the card network.
2570
+ #
2571
+ # - If the customer wants to pay with this card again, they will need to
2572
+ # re-enter their card details.
2573
+ #
2574
+ # ### When to Delete
2575
+ # - Customer explicitly requests removal of their saved card.
2576
+ #
2577
+ # - GDPR or data retention compliance when a customer closes their account.
2578
+ #
2579
+ # - Consider implementing a "Remove Card" option in your account management
2580
+ # UI.
2581
+ # @param [String] token_reference Required parameter: TODO: type description
2582
+ # here
2583
+ # @return [ApiResponse] Complete http response with raw body and status code.
2584
+ def delete_token(token_reference)
2585
+ @api_call
2586
+ .request(new_request_builder(HttpMethodEnum::DELETE,
2587
+ '/api/v1/tokens/v1/deleteToken/{token_reference}',
2588
+ Server::SERVER_3)
2589
+ .template_param(new_parameter(token_reference, key: 'token_reference')
2590
+ .is_required(true)
2591
+ .should_encode(true))
2592
+ .header_param(new_parameter('application/json', key: 'accept')))
2593
+ .response(new_response_handler
2594
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2595
+ .deserialize_into(Success49.method(:from_hash))
2596
+ .is_api_response(true)
2597
+ .local_error('400',
2598
+ 'Bad Request',
2599
+ FailureException))
2600
+ .execute
2601
+ end
2602
+
2603
+ # ## Overview
2604
+ # The **Original Credit Transaction (OCT)**, commonly referred to as **Push
2605
+ # to Card**, enables merchants to facilitate near-instantaneous fund
2606
+ # transfers directly to a customer’s eligible Visa or Mastercard debit or
2607
+ # credit card. Unlike traditional refund processes that can only return
2608
+ # funds from a previous purchase, OCT allows for independent disbursements
2609
+ # of funds to a cardholder's account.
2610
+ # This feature is designed for high-velocity industries that require
2611
+ # frictionless, real-time payouts, such as:
2612
+ # - **Gaming & Betting:** Real-time withdrawal of player winnings.
2613
+ #
2614
+ # - **Marketplaces:** Payouts to sellers or service providers.
2615
+ #
2616
+ # - **Corporate Disbursements:** Instant insurance claims, rebates, or
2617
+ # compensation payments.
2618
+ #
2619
+ # - **Merchant Settlements:** Faster access to processed funds for
2620
+ # sub-merchants.
2621
+ #
2622
+ # By utilizing the Paysecure `/payout` API with the `PAYOUT-CARDS` method,
2623
+ # you benefit from a unified orchestration layer that handles the
2624
+ # complexities of card network routing, ensuring high success rates and
2625
+ # global reach while maintaining the same security standards as your
2626
+ # standard payment integrations.
2627
+ # ---
2628
+ # ## Integration Steps
2629
+ # 1. **Enable OCT:** Ensure "Push to Card" permissions are enabled for your
2630
+ # merchant account in the Paysecure Merchant Portal.
2631
+ #
2632
+ # 2. **Collect Card Details:** Use a secure method to collect the
2633
+ # recipient's card number and expiry date or can you Paysecure's cashier to
2634
+ # do that.
2635
+ #
2636
+ # 3. **Execute Payout:** Call the `/payout` endpoint with the OCT-specific
2637
+ # payout method.
2638
+ #
2639
+ # 4. **Handle Webhooks:** Listen for the `paid` or `failure` events to
2640
+ # update your internal records.
2641
+ #
2642
+ # ### **Mandatory parameters in the request body:**
2643
+ # | **Parameter** | **Required** | **Notes** |
2644
+ # | --- | --- | --- |
2645
+ # | client.email | Yes | The customer's email. <br>Please send it in small
2646
+ # case. |
2647
+ # | client.phone | Yes | The customer's phone number along with the country
2648
+ # code. <br>Example: +91 9634088651 |
2649
+ # | client.city | Yes | The customer's city. |
2650
+ # | client.country | Yes | ISO-3166 Country Code. Must be upper case.
2651
+ # Example “SG” (Alpha2) |
2652
+ # | client.stateCode | Optional | Example “AL”, “XZ”. Must be in upper case.
2653
+ # |
2654
+ # | Client.street_address | Optional | The customer's address. |
2655
+ # | client.zip_code | Optional | The customer's ZIP or postal code. If
2656
+ # country=US, zip format must be NNNNN or NNNNN-NNNN. |
2657
+ # | currency | Yes | ISO 4217 code for currency you want to send the
2658
+ # transaction in. <br> <br>Please note, the currency has to be enabled by
2659
+ # the account manager for your account. |
2660
+ # | amount | Yes | amount in decimal format. <br>example 1: <br>EUR 5 ,
2661
+ # should be sent as 5.00 <br> <br>example 2: <br>USD 10 and 37 cents ,
2662
+ # should be sent as 10.37 |
2663
+ # | payoutMethod | Optional | example: PAYOUT-CARDS |
2664
+ # | success_redirect | Yes | URL to send the user if the transactions is
2665
+ # successful. |
2666
+ # | pending_redirect | Yes | URL to send the user if the transactions is in
2667
+ # pending. |
2668
+ # | failure_redirect | Yes | URL to send the user if the transactions is
2669
+ # unsuccessful. |
2670
+ # | Purpose | Optional | The purpose of doing a payout. |
2671
+ # | extraParam.token_reference | Yes | Paysecure Token |
2672
+ # Note:
2673
+ # If the merchant is not PCI DSS compliant then they will need to use our
2674
+ # **cashier** and we will show the user all the saved cards for him/her.
2675
+ # Based on the card chosen, Paysecure will pick up the token_reference from
2676
+ # our Back end.
2677
+ # If the merchant is PCI DSS compliant then they can use the payout API and
2678
+ # send the token reference as shown above.
2679
+ # @param [String] accept Required parameter: TODO: type description here
2680
+ # @param [PayOutRequest3] body Required parameter: TODO: type description
2681
+ # here
2682
+ # @return [ApiResponse] Complete http response with raw body and status code.
2683
+ def pay_out1(accept,
2684
+ body)
2685
+ @api_call
2686
+ .request(new_request_builder(HttpMethodEnum::POST,
2687
+ '/api/v1/payout',
2688
+ Server::SERVER_3)
2689
+ .header_param(new_parameter(accept, key: 'Accept')
2690
+ .is_required(true))
2691
+ .body_param(new_parameter(body)
2692
+ .is_required(true))
2693
+ .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
2694
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2695
+ .response(new_response_handler
2696
+ .is_response_void(true)
2697
+ .is_api_response(true)
2698
+ .local_error('401',
2699
+ 'Unauthorized',
2700
+ APIException))
2701
+ .execute
2702
+ end
2703
+
2704
+ # Use this endpoint to authorise a payment without capturing it. This places
2705
+ # a temporary hold on the customer’s funds for the specified amount.
2706
+ # To Initiate a payment, the very first call to make is `/purchases` with
2707
+ # the required data in the request body.
2708
+ # To generate a Purchase, you are required to provide the `Brand ID` (in the
2709
+ # request body) and `API key` (in the header) Both can be located in the
2710
+ # Dashboard section of your merchant account login.
2711
+ # The request body structure is shown on the request body of the example
2712
+ # request shown here.
2713
+ # The following (see table below) are the mandatory parameters that are
2714
+ # required to create a purchase request.
2715
+ # ### **Mandatory parameters in the request body:**
2716
+ # | **Parameter** | **Notes** |
2717
+ # | --- | --- |
2718
+ # | client.email | The customer's email. |
2719
+ # | client.city | The customer's city. |
2720
+ # | client.country | ISO-3166 Country Code. Must be upper case. Example “SG”
2721
+ # (Alpha2) |
2722
+ # | client.stateCode | Example “AL”, “XZ”. Must be in upper case. |
2723
+ # | Client.street_address | The customer's address. |
2724
+ # | client.zip_code | The customer's ZIP or postal code. If country=US, zip
2725
+ # format must be NNNNN or NNNNN-NNNN. |
2726
+ # | purchase.currency | ISO 4217 code for currency you want to send the
2727
+ # transaction in. <br> <br>Please note, the currency has to be enabled by
2728
+ # the account manager for your account. |
2729
+ # | purchase.products | An object which contains the list of products which
2730
+ # the customer is buying. |
2731
+ # | purchase.products.name | The name of the product. |
2732
+ # | purchase.products.price | Price in decimal format. <br>example 1:
2733
+ # <br>EUR 5 , should be sent as 5.00 <br> <br>example 2: <br>USD 10 and
2734
+ # 37 cents , should be sent as 10.37 |
2735
+ # | brand_id | Obtain from Dashboard section of your merchant account login.
2736
+ # |
2737
+ # | success_redirect | URL to send the user if the transactions is
2738
+ # successful. |
2739
+ # | pending_redirect | URL to send the user if the transactions is in
2740
+ # pending. |
2741
+ # | failure_redirect | URL to send the user if the transactions is
2742
+ # unsuccessful. |
2743
+ # ### **Additional parameters for this usecase:**
2744
+ # | **Parameter** | **Notes** |
2745
+ # | --- | --- |
2746
+ # | skip_capture | true |
2747
+ # ## Essential Optional Parameters
2748
+ # ### merchantRef
2749
+ # The `merchantRef` parameter, although not mandatory, is strongly advised
2750
+ # for merchants to specify. Its inclusion offers two significant advantages
2751
+ # for the merchant:
2752
+ # 1. **Prevention of Duplicate Requests:** When a `merchantRef` is utilized,
2753
+ # it acts as a unique identifier. This means that if a second purchase
2754
+ # request is made using the same `merchantRef` (reference number), the
2755
+ # system will recognize it and prevent duplicate transactions from
2756
+ # occurring. This prevents unintended or duplicate purchases.
2757
+ #
2758
+ # 2. **Facilitation of Transaction Retrieval:** In situations where the
2759
+ # response from the initial purchase request times out or the 'purchaseId'
2760
+ # isn't received, having the `merchantRef` allows the merchant to retrieve
2761
+ # detailed transaction information. This ensures they can track and access
2762
+ # the specific purchase details related to that reference, even if the
2763
+ # immediate response was not received.
2764
+ #
2765
+ # However, if the merchant does not specify the 'merchantRef' parameter, the
2766
+ # platform will automatically assign and use an internal 'purchaseId' as a
2767
+ # reference for that transaction.
2768
+ # Upon successul create on a Purchase you'd get a `"purchaseId"` . Use this
2769
+ # ID for the next step in Server to server call by calling
2770
+ # `p/{purchaseId}/?s2s=true .`
2771
+ # ### paymentMethod
2772
+ # The `paymentMethod` parameter identifies which payment solution merchant
2773
+ # wants to use to perform a transaction. If parameter is provided, than
2774
+ # Paysecure will perform direct payment with the selected payment method
2775
+ # instead of loading Paysecure URL.
2776
+ # ### Errors
2777
+ # If there are any errors then it'll be in the format of :
2778
+ # ``` json
2779
+ # {
2780
+ # "message": "descriptive error message",
2781
+ # "code": "error_code"
2782
+ # }
2783
+ # ```
2784
+ # ### Possible Error Messages
2785
+ # | **Error Messages** |
2786
+ # | --- |
2787
+ # | Allowed Limit for this card for particular time period has been consumed
2788
+ # |
2789
+ # | some Mandatory Parameter are missing |
2790
+ # | Invalid format of Date_of_Birth \[allowed format: yyyy-mm-dd\] |
2791
+ # | Invalid Email Format |
2792
+ # | Please submit Valid Alpha2 Country Code Ex:(AF,IN) in \\"country\\"
2793
+ # parameter |
2794
+ # | Please pass Valid State Code |
2795
+ # | Please pass valid street address in \\"street_address\\" parameter |
2796
+ # | Please pass valid city name in \\"city\\" parameter |
2797
+ # | Please pass valid postal Code name in \\"zip_code\\" parameter |
2798
+ # | You are not Allowed for Live Transaction |
2799
+ # | Merchant Limit is not set |
2800
+ # | Minimum amount is not set for this merchant |
2801
+ # | Brand not found ! |
2802
+ # | Your charges setting is incomplete .Plese Contact to Administrator. |
2803
+ # | Only {{currencyCode}} currency is allowed. |
2804
+ # | Transaction amount must be equal or greater to minimum trans amount |
2805
+ # | Invalid_Parameter <br>You'd usually get it when one or more mandatory
2806
+ # parameters are not present in the request. |
2807
+ # @param [PurchaseRequest4] body Required parameter: TODO: type description
2808
+ # here
2809
+ # @return [ApiResponse] Complete http response with raw body and status code.
2810
+ def purchase3(body)
2811
+ @api_call
2812
+ .request(new_request_builder(HttpMethodEnum::POST,
2813
+ '/api/v1/purchases',
2814
+ Server::SERVER_3)
2815
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2816
+ .body_param(new_parameter(body)
2817
+ .is_required(true))
2818
+ .header_param(new_parameter('application/json', key: 'accept'))
2819
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2820
+ .response(new_response_handler
2821
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2822
+ .deserialize_into(Purchase73.method(:from_hash))
2823
+ .is_api_response(true))
2824
+ .execute
2825
+ end
2826
+
2827
+ # This API would be the 2nd in sequence to call if the call to `/purchases/`
2828
+ # was successful in step 1. and you want to do the transaction via
2829
+ # Server-to-Server mode.
2830
+ # The request body would contain the details of the card that's to be
2831
+ # transacted upon.
2832
+ # ### **Mandatory parameters in request body:**
2833
+ # | Parameter | **Notes** |
2834
+ # | --- | --- |
2835
+ # | remote_ip | IP address of the customer’s device used for transaction.
2836
+ # Helps in fraud checks and risk scoring. Ex- 157.38.242.7 |
2837
+ # | user_agent | Full browser and operating system details captured from
2838
+ # HTTP header. EX- Chrome/5.0 (X11; Linux x86_64) |
2839
+ # | accept_header | Browser’s accepted content types (from HTTP header).
2840
+ # Used for validating request origin and device info. EX- text/html |
2841
+ # **Note:**
2842
+ # If you want to use token_reference for doing a card transaction, please
2843
+ # have a look at Network Tokenisation Section.
2844
+ # ### **Essential parameters in request body:**
2845
+ # | Parameter | **Notes** |
2846
+ # | --- | --- |
2847
+ # | cardholder_name | Name of the cardholder |
2848
+ # | card_number | The card numbers Must be 10-20 characters. |
2849
+ # | expires | must be greater than the current month/year. |
2850
+ # | cvc | 3 or 4 digit |
2851
+ # **
2852
+ # Other optional parameters in request body:**
2853
+ # | Parameter | **Notes** |
2854
+ # | --- | --- |
2855
+ # | language | Preferred language of the user’s browser . EX - en-US |
2856
+ # | java_enabled | Indicates if Java is enabled in the browser. Helps PSPs
2857
+ # in device profiling. Ex- true/false |
2858
+ # | javascript_enabled | Indicates if JavaScript is enabled in the client
2859
+ # browser. Used for 3DS or risk-based checks. Ex- true |
2860
+ # | color_depth | Bit depth of the display screen. Ex- 24 |
2861
+ # | utc_offset | Difference in minutes between local time and UTC. Used for
2862
+ # location and timezone checks. Ex- 330 |
2863
+ # | screen_width | Width of the device screen in pixels. Used in device
2864
+ # profiling. Ex- 1920 |
2865
+ # | screen_height | Height of the device screen in pixels. Ex- 1080 |
2866
+ # ### Successful Response
2867
+ # If all the details are correct you'll get a 202 response with staus as
2868
+ # Pending
2869
+ # ``` json
2870
+ # {
2871
+ # "status": "pending",
2872
+ # "callback_url":
2873
+ # "https://paysecure.net/payment/63bd0bf80fb42a076e8a4dd1/",
2874
+ # "method": "GET"
2875
+ # }
2876
+ # ```
2877
+ # If the response code is 202, after receiving the response body, direct the
2878
+ # customer to the callback_url provided in the response.
2879
+ # ### Errors
2880
+ # If there are any errors then it'll be in the format of :
2881
+ # ``` json
2882
+ # {
2883
+ # "message": "descriptive error message",
2884
+ # "code": "error_code"
2885
+ # }
2886
+ # ```
2887
+ # Please see the Status Code section for further details.
2888
+ # | **Error Messages** |
2889
+ # | --- |
2890
+ # | Client Ip could not be matched with Merchant Ip |
2891
+ # | Invalid Card Information |
2892
+ # | Card is Blocked |
2893
+ # | Different Type of key used to create purchase and payment |
2894
+ # | You charges setting is incomplete .Plese Contact to adminstrartor. |
2895
+ # | Allowed Attempt for this Transaction has been consumed |
2896
+ # | Invalid Card Expiry(Valid Format:MM/YY) must be greator than current
2897
+ # month/year |
2898
+ # | Customer profile is Blocked |
2899
+ # | Customer/Card not allowed for transaction |
2900
+ # @param [TrueClass | FalseClass] s2s Required parameter: TODO: type
2901
+ # description here
2902
+ # @param [S2Srequest] body Required parameter: TODO: type description here
2903
+ # @return [ApiResponse] Complete http response with raw body and status code.
2904
+ def s2_s1(s2s,
2905
+ body)
2906
+ @api_call
2907
+ .request(new_request_builder(HttpMethodEnum::POST,
2908
+ '/api/v1/p/64bff4fff63e36669499e9c8',
2909
+ Server::SERVER_3)
2910
+ .query_param(new_parameter(s2s, key: 's2s')
2911
+ .is_required(true))
2912
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2913
+ .body_param(new_parameter(body)
2914
+ .is_required(true))
2915
+ .header_param(new_parameter('application/json', key: 'accept'))
2916
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2917
+ .response(new_response_handler
2918
+ .deserializer(APIHelper.method(:custom_type_deserializer))
2919
+ .deserialize_into(Success1.method(:from_hash))
2920
+ .is_api_response(true)
2921
+ .local_error('401',
2922
+ 'Unauthorized',
2923
+ FailureException))
2924
+ .execute
2925
+ end
2926
+
2927
+ # After a successful pre-authorisation, use this endpoint to capture
2928
+ # (settle) the held funds. You may capture the full authorised amount or a
2929
+ # partial amount.
2930
+ # @param [CaptureRequest] body Required parameter: TODO: type description
2931
+ # here
2932
+ # @return [ApiResponse] Complete http response with raw body and status code.
2933
+ def capture(body)
2934
+ @api_call
2935
+ .request(new_request_builder(HttpMethodEnum::POST,
2936
+ '/api/v1/purchases/69cd26b053d7b783ebf6b6e9/capture',
2937
+ Server::SERVER_3)
2938
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
2939
+ .body_param(new_parameter(body)
2940
+ .is_required(true))
2941
+ .body_serializer(proc do |param| param.to_json unless param.nil? end))
2942
+ .response(new_response_handler
2943
+ .is_response_void(true)
2944
+ .is_api_response(true)
2945
+ .local_error('500',
2946
+ 'Internal Server Error',
2947
+ CaptureException))
2948
+ .execute
2949
+ end
2950
+
2951
+ # Use this endpoint to cancel an authorised payment before it has been
2952
+ # captured. Voiding releases the held funds back to the customer
2953
+ # immediately.
2954
+ # @return [ApiResponse] Complete http response with raw body and status code.
2955
+ def cancel1
2956
+ @api_call
2957
+ .request(new_request_builder(HttpMethodEnum::POST,
2958
+ '/api/v1/purchases/69ca76dbace4fa4413db928c/cancel',
2959
+ Server::SERVER_3))
2960
+ .response(new_response_handler
2961
+ .is_response_void(true)
2962
+ .is_api_response(true)
2963
+ .local_error('405',
2964
+ 'Method Not Allowed',
2965
+ CancelException))
2966
+ .execute
2967
+ end
2968
+ end
2969
+ end