onlinepayments-sdk-python3 7.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. onlinepayments/__init__.py +0 -0
  2. onlinepayments/sdk/__init__.py +4 -0
  3. onlinepayments/sdk/api_exception.py +60 -0
  4. onlinepayments/sdk/api_resource.py +57 -0
  5. onlinepayments/sdk/authentication/__init__.py +0 -0
  6. onlinepayments/sdk/authentication/authenticator.py +24 -0
  7. onlinepayments/sdk/authentication/authorization_type.py +10 -0
  8. onlinepayments/sdk/authentication/v1hmac_authenticator.py +122 -0
  9. onlinepayments/sdk/authorization_exception.py +19 -0
  10. onlinepayments/sdk/call_context.py +72 -0
  11. onlinepayments/sdk/client.py +107 -0
  12. onlinepayments/sdk/communication/__init__.py +0 -0
  13. onlinepayments/sdk/communication/communication_exception.py +8 -0
  14. onlinepayments/sdk/communication/connection.py +84 -0
  15. onlinepayments/sdk/communication/default_connection.py +313 -0
  16. onlinepayments/sdk/communication/i_metadata_provider.py +19 -0
  17. onlinepayments/sdk/communication/metadata_provider.py +132 -0
  18. onlinepayments/sdk/communication/multipart_form_data_object.py +51 -0
  19. onlinepayments/sdk/communication/multipart_form_data_request.py +16 -0
  20. onlinepayments/sdk/communication/not_found_exception.py +10 -0
  21. onlinepayments/sdk/communication/param_request.py +17 -0
  22. onlinepayments/sdk/communication/pooled_connection.py +29 -0
  23. onlinepayments/sdk/communication/request_header.py +60 -0
  24. onlinepayments/sdk/communication/request_param.py +30 -0
  25. onlinepayments/sdk/communication/response_exception.py +58 -0
  26. onlinepayments/sdk/communication/response_header.py +50 -0
  27. onlinepayments/sdk/communicator.py +465 -0
  28. onlinepayments/sdk/communicator_configuration.py +264 -0
  29. onlinepayments/sdk/declined_payment_exception.py +46 -0
  30. onlinepayments/sdk/declined_payout_exception.py +46 -0
  31. onlinepayments/sdk/declined_refund_exception.py +46 -0
  32. onlinepayments/sdk/declined_transaction_exception.py +22 -0
  33. onlinepayments/sdk/domain/__init__.py +4 -0
  34. onlinepayments/sdk/domain/acceptance.py +56 -0
  35. onlinepayments/sdk/domain/account_on_file.py +102 -0
  36. onlinepayments/sdk/domain/account_on_file_attribute.py +97 -0
  37. onlinepayments/sdk/domain/account_on_file_display_hints.py +64 -0
  38. onlinepayments/sdk/domain/acquirer_information.py +59 -0
  39. onlinepayments/sdk/domain/acquirer_selection_information.py +73 -0
  40. onlinepayments/sdk/domain/additional_order_input.py +107 -0
  41. onlinepayments/sdk/domain/address.py +145 -0
  42. onlinepayments/sdk/domain/address_personal.py +185 -0
  43. onlinepayments/sdk/domain/airline_data.py +519 -0
  44. onlinepayments/sdk/domain/airline_flight_leg.py +386 -0
  45. onlinepayments/sdk/domain/airline_passenger.py +129 -0
  46. onlinepayments/sdk/domain/amount_breakdown.py +63 -0
  47. onlinepayments/sdk/domain/amount_of_money.py +59 -0
  48. onlinepayments/sdk/domain/api_error.py +177 -0
  49. onlinepayments/sdk/domain/apple_pay_line_item.py +145 -0
  50. onlinepayments/sdk/domain/apple_pay_recurring_payment_request.py +116 -0
  51. onlinepayments/sdk/domain/bank_account_iban.py +37 -0
  52. onlinepayments/sdk/domain/batch_metadata.py +73 -0
  53. onlinepayments/sdk/domain/browser_data.py +130 -0
  54. onlinepayments/sdk/domain/calculate_surcharge_request.py +63 -0
  55. onlinepayments/sdk/domain/calculate_surcharge_response.py +44 -0
  56. onlinepayments/sdk/domain/cancel_payment_batch_request.py +57 -0
  57. onlinepayments/sdk/domain/cancel_payment_request.py +130 -0
  58. onlinepayments/sdk/domain/cancel_payment_response.py +41 -0
  59. onlinepayments/sdk/domain/capture.py +97 -0
  60. onlinepayments/sdk/domain/capture_output.py +272 -0
  61. onlinepayments/sdk/domain/capture_payment_batch_request.py +57 -0
  62. onlinepayments/sdk/domain/capture_payment_request.py +148 -0
  63. onlinepayments/sdk/domain/capture_response.py +99 -0
  64. onlinepayments/sdk/domain/capture_status_output.py +37 -0
  65. onlinepayments/sdk/domain/captures_response.py +46 -0
  66. onlinepayments/sdk/domain/card.py +91 -0
  67. onlinepayments/sdk/domain/card_bin_details.py +384 -0
  68. onlinepayments/sdk/domain/card_data_without_cvv.py +73 -0
  69. onlinepayments/sdk/domain/card_essentials.py +438 -0
  70. onlinepayments/sdk/domain/card_fraud_results.py +112 -0
  71. onlinepayments/sdk/domain/card_info.py +55 -0
  72. onlinepayments/sdk/domain/card_payment_method_specific_input.py +608 -0
  73. onlinepayments/sdk/domain/card_payment_method_specific_input_base.py +441 -0
  74. onlinepayments/sdk/domain/card_payment_method_specific_input_for_hosted_checkout.py +105 -0
  75. onlinepayments/sdk/domain/card_payment_method_specific_output.py +467 -0
  76. onlinepayments/sdk/domain/card_payout_method_specific_input.py +99 -0
  77. onlinepayments/sdk/domain/card_recurrence_details.py +40 -0
  78. onlinepayments/sdk/domain/card_source.py +95 -0
  79. onlinepayments/sdk/domain/card_without_cvv.py +73 -0
  80. onlinepayments/sdk/domain/click_to_pay.py +37 -0
  81. onlinepayments/sdk/domain/company_information.py +37 -0
  82. onlinepayments/sdk/domain/complete_payment_card_payment_method_specific_input.py +39 -0
  83. onlinepayments/sdk/domain/complete_payment_request.py +61 -0
  84. onlinepayments/sdk/domain/complete_payment_response.py +85 -0
  85. onlinepayments/sdk/domain/contact_details.py +109 -0
  86. onlinepayments/sdk/domain/create_certificate_response.py +55 -0
  87. onlinepayments/sdk/domain/create_hosted_checkout_request.py +195 -0
  88. onlinepayments/sdk/domain/create_hosted_checkout_response.py +132 -0
  89. onlinepayments/sdk/domain/create_hosted_fields_session_request.py +37 -0
  90. onlinepayments/sdk/domain/create_hosted_fields_session_response.py +102 -0
  91. onlinepayments/sdk/domain/create_hosted_tokenization_request.py +133 -0
  92. onlinepayments/sdk/domain/create_hosted_tokenization_response.py +127 -0
  93. onlinepayments/sdk/domain/create_mandate_request.py +187 -0
  94. onlinepayments/sdk/domain/create_mandate_response.py +63 -0
  95. onlinepayments/sdk/domain/create_mandate_with_return_url.py +187 -0
  96. onlinepayments/sdk/domain/create_payment_link_request.py +344 -0
  97. onlinepayments/sdk/domain/create_payment_request.py +249 -0
  98. onlinepayments/sdk/domain/create_payment_response.py +85 -0
  99. onlinepayments/sdk/domain/create_payout_request.py +176 -0
  100. onlinepayments/sdk/domain/create_token_request.py +77 -0
  101. onlinepayments/sdk/domain/created_payment_output.py +57 -0
  102. onlinepayments/sdk/domain/created_token_response.py +142 -0
  103. onlinepayments/sdk/domain/credit_card_specific_input_hosted_tokenization.py +66 -0
  104. onlinepayments/sdk/domain/credit_card_validation_rules.py +55 -0
  105. onlinepayments/sdk/domain/credit_card_validation_rules_hosted_tokenization.py +55 -0
  106. onlinepayments/sdk/domain/crm_token.py +55 -0
  107. onlinepayments/sdk/domain/csr_request.py +37 -0
  108. onlinepayments/sdk/domain/currency_conversion.py +59 -0
  109. onlinepayments/sdk/domain/currency_conversion_input.py +55 -0
  110. onlinepayments/sdk/domain/currency_conversion_request.py +59 -0
  111. onlinepayments/sdk/domain/currency_conversion_response.py +81 -0
  112. onlinepayments/sdk/domain/currency_conversion_result.py +61 -0
  113. onlinepayments/sdk/domain/currency_conversion_specific_input.py +40 -0
  114. onlinepayments/sdk/domain/customer.py +234 -0
  115. onlinepayments/sdk/domain/customer_account.py +204 -0
  116. onlinepayments/sdk/domain/customer_account_authentication.py +81 -0
  117. onlinepayments/sdk/domain/customer_bank_account.py +73 -0
  118. onlinepayments/sdk/domain/customer_device.py +155 -0
  119. onlinepayments/sdk/domain/customer_device_output.py +37 -0
  120. onlinepayments/sdk/domain/customer_output.py +41 -0
  121. onlinepayments/sdk/domain/customer_payment_activity.py +73 -0
  122. onlinepayments/sdk/domain/customer_token.py +83 -0
  123. onlinepayments/sdk/domain/data_object.py +47 -0
  124. onlinepayments/sdk/domain/dcc_card_source.py +93 -0
  125. onlinepayments/sdk/domain/dcc_proposal.py +118 -0
  126. onlinepayments/sdk/domain/decrypted_payment_data.py +120 -0
  127. onlinepayments/sdk/domain/detokenization_response.py +46 -0
  128. onlinepayments/sdk/domain/detokenized_token_response.py +145 -0
  129. onlinepayments/sdk/domain/directory_entry.py +73 -0
  130. onlinepayments/sdk/domain/discount.py +41 -0
  131. onlinepayments/sdk/domain/empty_validator.py +16 -0
  132. onlinepayments/sdk/domain/error_response.py +64 -0
  133. onlinepayments/sdk/domain/external_cardholder_authentication_data.py +216 -0
  134. onlinepayments/sdk/domain/external_token_linked.py +75 -0
  135. onlinepayments/sdk/domain/feedbacks.py +64 -0
  136. onlinepayments/sdk/domain/fixed_list_validator.py +42 -0
  137. onlinepayments/sdk/domain/fraud_fields.py +84 -0
  138. onlinepayments/sdk/domain/fraud_results.py +43 -0
  139. onlinepayments/sdk/domain/g_pay_three_d_secure.py +159 -0
  140. onlinepayments/sdk/domain/get_batch_status_response.py +91 -0
  141. onlinepayments/sdk/domain/get_hosted_checkout_response.py +63 -0
  142. onlinepayments/sdk/domain/get_hosted_tokenization_response.py +61 -0
  143. onlinepayments/sdk/domain/get_iin_details_request.py +57 -0
  144. onlinepayments/sdk/domain/get_iin_details_response.py +450 -0
  145. onlinepayments/sdk/domain/get_mandate_response.py +41 -0
  146. onlinepayments/sdk/domain/get_payment_product_groups_response.py +44 -0
  147. onlinepayments/sdk/domain/get_payment_products_response.py +44 -0
  148. onlinepayments/sdk/domain/get_privacy_policy_response.py +37 -0
  149. onlinepayments/sdk/domain/gift_card_purchase.py +59 -0
  150. onlinepayments/sdk/domain/hosted_checkout_specific_input.py +250 -0
  151. onlinepayments/sdk/domain/hosted_checkout_specific_output.py +55 -0
  152. onlinepayments/sdk/domain/iin_detail.py +423 -0
  153. onlinepayments/sdk/domain/import_cof_series_request.py +113 -0
  154. onlinepayments/sdk/domain/import_cof_series_response.py +37 -0
  155. onlinepayments/sdk/domain/label_template_element.py +55 -0
  156. onlinepayments/sdk/domain/length_validator.py +51 -0
  157. onlinepayments/sdk/domain/line_item.py +107 -0
  158. onlinepayments/sdk/domain/line_item_detail.py +99 -0
  159. onlinepayments/sdk/domain/line_item_invoice_data.py +37 -0
  160. onlinepayments/sdk/domain/loan_recipient.py +109 -0
  161. onlinepayments/sdk/domain/lodging_data.py +37 -0
  162. onlinepayments/sdk/domain/mandate_address.py +109 -0
  163. onlinepayments/sdk/domain/mandate_address_response.py +109 -0
  164. onlinepayments/sdk/domain/mandate_contact_details.py +37 -0
  165. onlinepayments/sdk/domain/mandate_customer.py +125 -0
  166. onlinepayments/sdk/domain/mandate_customer_response.py +125 -0
  167. onlinepayments/sdk/domain/mandate_merchant_action.py +61 -0
  168. onlinepayments/sdk/domain/mandate_personal_information.py +59 -0
  169. onlinepayments/sdk/domain/mandate_personal_information_response.py +59 -0
  170. onlinepayments/sdk/domain/mandate_personal_name.py +55 -0
  171. onlinepayments/sdk/domain/mandate_personal_name_response.py +55 -0
  172. onlinepayments/sdk/domain/mandate_redirect_data.py +55 -0
  173. onlinepayments/sdk/domain/mandate_response.py +150 -0
  174. onlinepayments/sdk/domain/market_place.py +55 -0
  175. onlinepayments/sdk/domain/merchant_action.py +132 -0
  176. onlinepayments/sdk/domain/mobile_payment_data.py +55 -0
  177. onlinepayments/sdk/domain/mobile_payment_method_hosted_checkout_specific_input.py +105 -0
  178. onlinepayments/sdk/domain/mobile_payment_method_specific_input.py +202 -0
  179. onlinepayments/sdk/domain/mobile_payment_method_specific_output.py +139 -0
  180. onlinepayments/sdk/domain/mobile_payment_product302_specific_input.py +103 -0
  181. onlinepayments/sdk/domain/mobile_payment_product320_specific_input.py +103 -0
  182. onlinepayments/sdk/domain/mobile_three_d_secure_challenge_parameters.py +91 -0
  183. onlinepayments/sdk/domain/multiple_payment_information.py +57 -0
  184. onlinepayments/sdk/domain/network_token_data.py +127 -0
  185. onlinepayments/sdk/domain/network_token_essentials.py +134 -0
  186. onlinepayments/sdk/domain/network_token_linked.py +80 -0
  187. onlinepayments/sdk/domain/omnichannel_payment_specific_input.py +37 -0
  188. onlinepayments/sdk/domain/omnichannel_payout_specific_input.py +55 -0
  189. onlinepayments/sdk/domain/omnichannel_refund_specific_input.py +37 -0
  190. onlinepayments/sdk/domain/omnichannel_subsequent_specific_input.py +37 -0
  191. onlinepayments/sdk/domain/operation_output.py +161 -0
  192. onlinepayments/sdk/domain/operation_payment_references.py +55 -0
  193. onlinepayments/sdk/domain/order.py +213 -0
  194. onlinepayments/sdk/domain/order_line_details.py +189 -0
  195. onlinepayments/sdk/domain/order_references.py +120 -0
  196. onlinepayments/sdk/domain/order_status_output.py +119 -0
  197. onlinepayments/sdk/domain/order_type_information.py +64 -0
  198. onlinepayments/sdk/domain/other_details.py +55 -0
  199. onlinepayments/sdk/domain/payment_account_on_file.py +57 -0
  200. onlinepayments/sdk/domain/payment_context.py +77 -0
  201. onlinepayments/sdk/domain/payment_creation_output.py +94 -0
  202. onlinepayments/sdk/domain/payment_details_response.py +148 -0
  203. onlinepayments/sdk/domain/payment_error_response.py +84 -0
  204. onlinepayments/sdk/domain/payment_link_event.py +73 -0
  205. onlinepayments/sdk/domain/payment_link_order_input.py +84 -0
  206. onlinepayments/sdk/domain/payment_link_order_output.py +81 -0
  207. onlinepayments/sdk/domain/payment_link_response.py +216 -0
  208. onlinepayments/sdk/domain/payment_link_specific_input.py +74 -0
  209. onlinepayments/sdk/domain/payment_links_response.py +44 -0
  210. onlinepayments/sdk/domain/payment_output.py +335 -0
  211. onlinepayments/sdk/domain/payment_product.py +296 -0
  212. onlinepayments/sdk/domain/payment_product130_specific_input.py +41 -0
  213. onlinepayments/sdk/domain/payment_product130_specific_three_d_secure.py +91 -0
  214. onlinepayments/sdk/domain/payment_product3012.py +55 -0
  215. onlinepayments/sdk/domain/payment_product3012_specific_input.py +100 -0
  216. onlinepayments/sdk/domain/payment_product3013_specific_input.py +73 -0
  217. onlinepayments/sdk/domain/payment_product302_specific_data.py +44 -0
  218. onlinepayments/sdk/domain/payment_product3203_specific_output.py +62 -0
  219. onlinepayments/sdk/domain/payment_product3204_specific_output.py +37 -0
  220. onlinepayments/sdk/domain/payment_product3208_specific_input.py +37 -0
  221. onlinepayments/sdk/domain/payment_product3208_specific_output.py +37 -0
  222. onlinepayments/sdk/domain/payment_product3209_specific_input.py +37 -0
  223. onlinepayments/sdk/domain/payment_product3209_specific_output.py +37 -0
  224. onlinepayments/sdk/domain/payment_product320_specific_data.py +62 -0
  225. onlinepayments/sdk/domain/payment_product350.py +55 -0
  226. onlinepayments/sdk/domain/payment_product5001.py +58 -0
  227. onlinepayments/sdk/domain/payment_product5001_specific_output.py +112 -0
  228. onlinepayments/sdk/domain/payment_product5100_specific_input.py +37 -0
  229. onlinepayments/sdk/domain/payment_product5402_specific_output.py +37 -0
  230. onlinepayments/sdk/domain/payment_product5404.py +55 -0
  231. onlinepayments/sdk/domain/payment_product5407.py +55 -0
  232. onlinepayments/sdk/domain/payment_product5500_specific_output.py +91 -0
  233. onlinepayments/sdk/domain/payment_product771_specific_output.py +37 -0
  234. onlinepayments/sdk/domain/payment_product840.py +37 -0
  235. onlinepayments/sdk/domain/payment_product840_customer_account.py +170 -0
  236. onlinepayments/sdk/domain/payment_product840_specific_output.py +167 -0
  237. onlinepayments/sdk/domain/payment_product_display_hints.py +73 -0
  238. onlinepayments/sdk/domain/payment_product_field.py +95 -0
  239. onlinepayments/sdk/domain/payment_product_field_data_restrictions.py +60 -0
  240. onlinepayments/sdk/domain/payment_product_field_display_element.py +97 -0
  241. onlinepayments/sdk/domain/payment_product_field_display_hints.py +218 -0
  242. onlinepayments/sdk/domain/payment_product_field_form_element.py +72 -0
  243. onlinepayments/sdk/domain/payment_product_field_tooltip.py +57 -0
  244. onlinepayments/sdk/domain/payment_product_field_validators.py +195 -0
  245. onlinepayments/sdk/domain/payment_product_filter.py +67 -0
  246. onlinepayments/sdk/domain/payment_product_filter_hosted_tokenization.py +42 -0
  247. onlinepayments/sdk/domain/payment_product_filters_hosted_checkout.py +62 -0
  248. onlinepayments/sdk/domain/payment_product_filters_hosted_tokenization.py +62 -0
  249. onlinepayments/sdk/domain/payment_product_group.py +103 -0
  250. onlinepayments/sdk/domain/payment_product_networks_response.py +42 -0
  251. onlinepayments/sdk/domain/payment_references.py +73 -0
  252. onlinepayments/sdk/domain/payment_response.py +143 -0
  253. onlinepayments/sdk/domain/payment_status_output.py +152 -0
  254. onlinepayments/sdk/domain/payout_error_response.py +80 -0
  255. onlinepayments/sdk/domain/payout_output.py +63 -0
  256. onlinepayments/sdk/domain/payout_response.py +93 -0
  257. onlinepayments/sdk/domain/payout_result.py +93 -0
  258. onlinepayments/sdk/domain/payout_status_output.py +76 -0
  259. onlinepayments/sdk/domain/pending_authentication.py +37 -0
  260. onlinepayments/sdk/domain/personal_information.py +77 -0
  261. onlinepayments/sdk/domain/personal_information_token.py +39 -0
  262. onlinepayments/sdk/domain/personal_name.py +73 -0
  263. onlinepayments/sdk/domain/personal_name_token.py +51 -0
  264. onlinepayments/sdk/domain/product302_recurring.py +37 -0
  265. onlinepayments/sdk/domain/product320_recurring.py +37 -0
  266. onlinepayments/sdk/domain/product_directory.py +46 -0
  267. onlinepayments/sdk/domain/protection_eligibility.py +59 -0
  268. onlinepayments/sdk/domain/range_validator.py +51 -0
  269. onlinepayments/sdk/domain/rate_details.py +109 -0
  270. onlinepayments/sdk/domain/reattempt_instructions.py +82 -0
  271. onlinepayments/sdk/domain/reattempt_instructions_conditions.py +55 -0
  272. onlinepayments/sdk/domain/redirect_data.py +55 -0
  273. onlinepayments/sdk/domain/redirect_payment_method_specific_input.py +575 -0
  274. onlinepayments/sdk/domain/redirect_payment_method_specific_output.py +267 -0
  275. onlinepayments/sdk/domain/redirect_payment_product11_specific_input.py +38 -0
  276. onlinepayments/sdk/domain/redirect_payment_product3103_specific_input.py +40 -0
  277. onlinepayments/sdk/domain/redirect_payment_product3112_specific_input.py +40 -0
  278. onlinepayments/sdk/domain/redirect_payment_product3116_specific_input.py +40 -0
  279. onlinepayments/sdk/domain/redirect_payment_product3203_specific_input.py +40 -0
  280. onlinepayments/sdk/domain/redirect_payment_product3204_specific_input.py +55 -0
  281. onlinepayments/sdk/domain/redirect_payment_product3302_specific_input.py +73 -0
  282. onlinepayments/sdk/domain/redirect_payment_product3306_specific_input.py +37 -0
  283. onlinepayments/sdk/domain/redirect_payment_product3307_specific_input.py +16 -0
  284. onlinepayments/sdk/domain/redirect_payment_product5001_specific_input.py +62 -0
  285. onlinepayments/sdk/domain/redirect_payment_product5300_specific_input.py +163 -0
  286. onlinepayments/sdk/domain/redirect_payment_product5402_specific_input.py +40 -0
  287. onlinepayments/sdk/domain/redirect_payment_product5403_specific_input.py +40 -0
  288. onlinepayments/sdk/domain/redirect_payment_product5406_specific_input.py +41 -0
  289. onlinepayments/sdk/domain/redirect_payment_product5408_specific_input.py +60 -0
  290. onlinepayments/sdk/domain/redirect_payment_product5410_specific_input.py +38 -0
  291. onlinepayments/sdk/domain/redirect_payment_product5412_specific_input.py +55 -0
  292. onlinepayments/sdk/domain/redirect_payment_product5601_specific_input.py +40 -0
  293. onlinepayments/sdk/domain/redirect_payment_product809_specific_input.py +40 -0
  294. onlinepayments/sdk/domain/redirect_payment_product840_specific_input.py +100 -0
  295. onlinepayments/sdk/domain/redirection_data.py +37 -0
  296. onlinepayments/sdk/domain/refund_card_method_specific_output.py +71 -0
  297. onlinepayments/sdk/domain/refund_e_wallet_method_specific_output.py +71 -0
  298. onlinepayments/sdk/domain/refund_error_response.py +82 -0
  299. onlinepayments/sdk/domain/refund_mobile_method_specific_output.py +69 -0
  300. onlinepayments/sdk/domain/refund_output.py +217 -0
  301. onlinepayments/sdk/domain/refund_payment_batch_request.py +57 -0
  302. onlinepayments/sdk/domain/refund_payment_product840_customer_account.py +69 -0
  303. onlinepayments/sdk/domain/refund_payment_product840_specific_output.py +39 -0
  304. onlinepayments/sdk/domain/refund_redirect_method_specific_output.py +51 -0
  305. onlinepayments/sdk/domain/refund_redirect_payment_method_specific_input.py +41 -0
  306. onlinepayments/sdk/domain/refund_redirect_payment_product900_specific_input.py +37 -0
  307. onlinepayments/sdk/domain/refund_request.py +210 -0
  308. onlinepayments/sdk/domain/refund_response.py +97 -0
  309. onlinepayments/sdk/domain/refunds_response.py +46 -0
  310. onlinepayments/sdk/domain/regular_expression_validator.py +35 -0
  311. onlinepayments/sdk/domain/revoke_mandate_request.py +48 -0
  312. onlinepayments/sdk/domain/send_test_request.py +37 -0
  313. onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input.py +59 -0
  314. onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_input_base.py +59 -0
  315. onlinepayments/sdk/domain/sepa_direct_debit_payment_method_specific_output.py +81 -0
  316. onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input.py +59 -0
  317. onlinepayments/sdk/domain/sepa_direct_debit_payment_product771_specific_input_base.py +59 -0
  318. onlinepayments/sdk/domain/session_data.py +116 -0
  319. onlinepayments/sdk/domain/session_details.py +55 -0
  320. onlinepayments/sdk/domain/session_request.py +44 -0
  321. onlinepayments/sdk/domain/session_response.py +114 -0
  322. onlinepayments/sdk/domain/shipping.py +214 -0
  323. onlinepayments/sdk/domain/shipping_detail.py +63 -0
  324. onlinepayments/sdk/domain/shipping_method.py +91 -0
  325. onlinepayments/sdk/domain/shopping_cart.py +155 -0
  326. onlinepayments/sdk/domain/shopping_cart_extension.py +77 -0
  327. onlinepayments/sdk/domain/shopping_cart_output.py +46 -0
  328. onlinepayments/sdk/domain/show_form_data.py +173 -0
  329. onlinepayments/sdk/domain/show_instructions_data.py +37 -0
  330. onlinepayments/sdk/domain/split_payment_product_filter.py +42 -0
  331. onlinepayments/sdk/domain/split_payment_product_filters_hosted_checkout.py +62 -0
  332. onlinepayments/sdk/domain/submit_batch_request_body.py +230 -0
  333. onlinepayments/sdk/domain/submit_batch_response.py +55 -0
  334. onlinepayments/sdk/domain/subsequent_card_payment_method_specific_input.py +175 -0
  335. onlinepayments/sdk/domain/subsequent_payment_batch_request.py +57 -0
  336. onlinepayments/sdk/domain/subsequent_payment_product5001_specific_input.py +41 -0
  337. onlinepayments/sdk/domain/subsequent_payment_request.py +107 -0
  338. onlinepayments/sdk/domain/subsequent_payment_response.py +41 -0
  339. onlinepayments/sdk/domain/surcharge.py +141 -0
  340. onlinepayments/sdk/domain/surcharge_calculation_card.py +55 -0
  341. onlinepayments/sdk/domain/surcharge_for_payment_link.py +40 -0
  342. onlinepayments/sdk/domain/surcharge_rate.py +91 -0
  343. onlinepayments/sdk/domain/surcharge_specific_input.py +62 -0
  344. onlinepayments/sdk/domain/surcharge_specific_output.py +84 -0
  345. onlinepayments/sdk/domain/test_connection.py +35 -0
  346. onlinepayments/sdk/domain/three_d_secure.py +281 -0
  347. onlinepayments/sdk/domain/three_d_secure_base.py +219 -0
  348. onlinepayments/sdk/domain/three_d_secure_data.py +78 -0
  349. onlinepayments/sdk/domain/three_d_secure_results.py +266 -0
  350. onlinepayments/sdk/domain/token_card.py +57 -0
  351. onlinepayments/sdk/domain/token_card_data.py +83 -0
  352. onlinepayments/sdk/domain/token_card_specific_input.py +41 -0
  353. onlinepayments/sdk/domain/token_data.py +63 -0
  354. onlinepayments/sdk/domain/token_e_wallet.py +59 -0
  355. onlinepayments/sdk/domain/token_response.py +181 -0
  356. onlinepayments/sdk/domain/transaction.py +41 -0
  357. onlinepayments/sdk/domain/uploadable_file.py +51 -0
  358. onlinepayments/sdk/domain/validate_credentials_request.py +55 -0
  359. onlinepayments/sdk/domain/validate_credentials_response.py +37 -0
  360. onlinepayments/sdk/domain/value_mapping_element.py +62 -0
  361. onlinepayments/sdk/domain/web_hooks_event.py +214 -0
  362. onlinepayments/sdk/exception_factory.py +75 -0
  363. onlinepayments/sdk/factory.py +127 -0
  364. onlinepayments/sdk/i_client.py +78 -0
  365. onlinepayments/sdk/i_communicator.py +180 -0
  366. onlinepayments/sdk/idempotence_exception.py +36 -0
  367. onlinepayments/sdk/json/__init__.py +0 -0
  368. onlinepayments/sdk/json/default_marshaller.py +60 -0
  369. onlinepayments/sdk/json/marshaller.py +32 -0
  370. onlinepayments/sdk/json/marshaller_syntax_exception.py +13 -0
  371. onlinepayments/sdk/log/__init__.py +0 -0
  372. onlinepayments/sdk/log/body_obfuscator.py +113 -0
  373. onlinepayments/sdk/log/communicator_logger.py +35 -0
  374. onlinepayments/sdk/log/header_obfuscator.py +49 -0
  375. onlinepayments/sdk/log/log_message.py +94 -0
  376. onlinepayments/sdk/log/logging_capable.py +26 -0
  377. onlinepayments/sdk/log/obfuscation_capable.py +24 -0
  378. onlinepayments/sdk/log/obfuscation_rule.py +50 -0
  379. onlinepayments/sdk/log/python_communicator_logger.py +54 -0
  380. onlinepayments/sdk/log/request_log_message.py +28 -0
  381. onlinepayments/sdk/log/response_log_message.py +37 -0
  382. onlinepayments/sdk/log/sys_out_communicator_logger.py +36 -0
  383. onlinepayments/sdk/merchant/__init__.py +4 -0
  384. onlinepayments/sdk/merchant/captures/__init__.py +4 -0
  385. onlinepayments/sdk/merchant/captures/captures_client.py +63 -0
  386. onlinepayments/sdk/merchant/captures/i_captures_client.py +34 -0
  387. onlinepayments/sdk/merchant/cofseries/__init__.py +4 -0
  388. onlinepayments/sdk/merchant/cofseries/cof_series_client.py +62 -0
  389. onlinepayments/sdk/merchant/cofseries/i_cof_series_client.py +35 -0
  390. onlinepayments/sdk/merchant/complete/__init__.py +4 -0
  391. onlinepayments/sdk/merchant/complete/complete_client.py +67 -0
  392. onlinepayments/sdk/merchant/complete/i_complete_client.py +37 -0
  393. onlinepayments/sdk/merchant/hostedcheckout/__init__.py +4 -0
  394. onlinepayments/sdk/merchant/hostedcheckout/hosted_checkout_client.py +99 -0
  395. onlinepayments/sdk/merchant/hostedcheckout/i_hosted_checkout_client.py +55 -0
  396. onlinepayments/sdk/merchant/hostedfields/__init__.py +4 -0
  397. onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.py +62 -0
  398. onlinepayments/sdk/merchant/hostedfields/i_hosted_fields_client.py +35 -0
  399. onlinepayments/sdk/merchant/hostedtokenization/__init__.py +4 -0
  400. onlinepayments/sdk/merchant/hostedtokenization/hosted_tokenization_client.py +99 -0
  401. onlinepayments/sdk/merchant/hostedtokenization/i_hosted_tokenization_client.py +55 -0
  402. onlinepayments/sdk/merchant/i_merchant_client.py +202 -0
  403. onlinepayments/sdk/merchant/mandates/__init__.py +4 -0
  404. onlinepayments/sdk/merchant/mandates/i_mandates_client.py +114 -0
  405. onlinepayments/sdk/merchant/mandates/mandates_client.py +212 -0
  406. onlinepayments/sdk/merchant/merchant_client.py +232 -0
  407. onlinepayments/sdk/merchant/merchantbatch/__init__.py +4 -0
  408. onlinepayments/sdk/merchant/merchantbatch/i_merchant_batch_client.py +74 -0
  409. onlinepayments/sdk/merchant/merchantbatch/merchant_batch_client.py +138 -0
  410. onlinepayments/sdk/merchant/paymentlinks/__init__.py +4 -0
  411. onlinepayments/sdk/merchant/paymentlinks/get_payment_links_in_bulk_params.py +36 -0
  412. onlinepayments/sdk/merchant/paymentlinks/i_payment_links_client.py +73 -0
  413. onlinepayments/sdk/merchant/paymentlinks/payment_links_client.py +135 -0
  414. onlinepayments/sdk/merchant/payments/__init__.py +4 -0
  415. onlinepayments/sdk/merchant/payments/i_payments_client.py +143 -0
  416. onlinepayments/sdk/merchant/payments/payments_client.py +260 -0
  417. onlinepayments/sdk/merchant/payouts/__init__.py +4 -0
  418. onlinepayments/sdk/merchant/payouts/i_payouts_client.py +55 -0
  419. onlinepayments/sdk/merchant/payouts/payouts_client.py +100 -0
  420. onlinepayments/sdk/merchant/privacypolicy/__init__.py +4 -0
  421. onlinepayments/sdk/merchant/privacypolicy/get_privacy_policy_params.py +54 -0
  422. onlinepayments/sdk/merchant/privacypolicy/i_privacy_policy_client.py +36 -0
  423. onlinepayments/sdk/merchant/privacypolicy/privacy_policy_client.py +61 -0
  424. onlinepayments/sdk/merchant/productgroups/__init__.py +4 -0
  425. onlinepayments/sdk/merchant/productgroups/get_product_group_params.py +140 -0
  426. onlinepayments/sdk/merchant/productgroups/get_product_groups_params.py +140 -0
  427. onlinepayments/sdk/merchant/productgroups/i_product_groups_client.py +58 -0
  428. onlinepayments/sdk/merchant/productgroups/product_groups_client.py +100 -0
  429. onlinepayments/sdk/merchant/products/__init__.py +4 -0
  430. onlinepayments/sdk/merchant/products/get_payment_product_networks_params.py +89 -0
  431. onlinepayments/sdk/merchant/products/get_payment_product_params.py +138 -0
  432. onlinepayments/sdk/merchant/products/get_payment_products_params.py +138 -0
  433. onlinepayments/sdk/merchant/products/get_product_directory_params.py +54 -0
  434. onlinepayments/sdk/merchant/products/i_products_client.py +102 -0
  435. onlinepayments/sdk/merchant/products/products_client.py +178 -0
  436. onlinepayments/sdk/merchant/refunds/__init__.py +4 -0
  437. onlinepayments/sdk/merchant/refunds/i_refunds_client.py +34 -0
  438. onlinepayments/sdk/merchant/refunds/refunds_client.py +63 -0
  439. onlinepayments/sdk/merchant/services/__init__.py +4 -0
  440. onlinepayments/sdk/merchant/services/i_services_client.py +96 -0
  441. onlinepayments/sdk/merchant/services/services_client.py +167 -0
  442. onlinepayments/sdk/merchant/sessions/__init__.py +4 -0
  443. onlinepayments/sdk/merchant/sessions/i_sessions_client.py +35 -0
  444. onlinepayments/sdk/merchant/sessions/sessions_client.py +62 -0
  445. onlinepayments/sdk/merchant/subsequent/__init__.py +4 -0
  446. onlinepayments/sdk/merchant/subsequent/i_subsequent_client.py +37 -0
  447. onlinepayments/sdk/merchant/subsequent/subsequent_client.py +67 -0
  448. onlinepayments/sdk/merchant/tokenization/__init__.py +4 -0
  449. onlinepayments/sdk/merchant/tokenization/get_card_data_by_payments_params.py +48 -0
  450. onlinepayments/sdk/merchant/tokenization/get_card_data_by_tokens_params.py +48 -0
  451. onlinepayments/sdk/merchant/tokenization/i_tokenization_client.py +77 -0
  452. onlinepayments/sdk/merchant/tokenization/tokenization_client.py +131 -0
  453. onlinepayments/sdk/merchant/tokens/__init__.py +4 -0
  454. onlinepayments/sdk/merchant/tokens/i_tokens_client.py +74 -0
  455. onlinepayments/sdk/merchant/tokens/tokens_client.py +135 -0
  456. onlinepayments/sdk/merchant/webhooks/__init__.py +4 -0
  457. onlinepayments/sdk/merchant/webhooks/i_webhooks_client.py +55 -0
  458. onlinepayments/sdk/merchant/webhooks/webhooks_client.py +97 -0
  459. onlinepayments/sdk/platform_exception.py +19 -0
  460. onlinepayments/sdk/proxy_configuration.py +102 -0
  461. onlinepayments/sdk/reference_exception.py +19 -0
  462. onlinepayments/sdk/validation_exception.py +19 -0
  463. onlinepayments/sdk/webhooks/__init__.py +0 -0
  464. onlinepayments/sdk/webhooks/api_version_mismatch_exception.py +24 -0
  465. onlinepayments/sdk/webhooks/in_memory_secret_key_store.py +48 -0
  466. onlinepayments/sdk/webhooks/secret_key_not_available_exception.py +18 -0
  467. onlinepayments/sdk/webhooks/secret_key_store.py +15 -0
  468. onlinepayments/sdk/webhooks/signature_validation_exception.py +17 -0
  469. onlinepayments/sdk/webhooks/signature_validator.py +56 -0
  470. onlinepayments/sdk/webhooks/webhooks_helper.py +52 -0
  471. onlinepayments_sdk_python3-7.4.1.dist-info/METADATA +154 -0
  472. onlinepayments_sdk_python3-7.4.1.dist-info/RECORD +475 -0
  473. onlinepayments_sdk_python3-7.4.1.dist-info/WHEEL +5 -0
  474. onlinepayments_sdk_python3-7.4.1.dist-info/licenses/LICENSE.txt +52 -0
  475. onlinepayments_sdk_python3-7.4.1.dist-info/top_level.txt +1 -0
File without changes
@@ -0,0 +1,4 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file was automatically generated.
4
+ #
@@ -0,0 +1,60 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file was automatically generated.
4
+ #
5
+ from typing import List, Optional, Sequence
6
+
7
+ from onlinepayments.sdk.domain.api_error import APIError
8
+
9
+
10
+ class ApiException(RuntimeError):
11
+ """
12
+ Represents an error response from the payment platform which contains an ID and a list of errors.
13
+ """
14
+
15
+ def __init__(self, status_code: int, response_body: str, error_id: Optional[str], errors: Optional[List[APIError]],
16
+ message: str = "the payment platform returned an error response"):
17
+ super(ApiException, self).__init__(message)
18
+ self.__status_code = status_code
19
+ self.__response_body = response_body
20
+ self.__error_id = error_id
21
+ if errors is None:
22
+ self.__errors = ()
23
+ else:
24
+ self.__errors = errors
25
+
26
+ @property
27
+ def status_code(self) -> int:
28
+ """
29
+ :return: The HTTP status code that was returned by the Payment platform.
30
+ """
31
+ return self.__status_code
32
+
33
+ @property
34
+ def response_body(self) -> str:
35
+ """
36
+ :return: The raw response body that was returned by the Payment platform.
37
+ """
38
+ return self.__response_body
39
+
40
+ @property
41
+ def error_id(self) -> Optional[str]:
42
+ """
43
+ :return: The errorId received from the Payment platform if available.
44
+ """
45
+ return self.__error_id
46
+
47
+ @property
48
+ def errors(self) -> Sequence[APIError]:
49
+ """
50
+ :return: The errors received from the Payment platform if available. Never None.
51
+ """
52
+ return self.__errors
53
+
54
+ def __str__(self):
55
+ string = super(ApiException, self).__str__()
56
+ if self.__status_code > 0:
57
+ string += "; status_code=" + str(self.__status_code)
58
+ if self.__response_body:
59
+ string += "; response_body='" + self.__response_body + "'"
60
+ return str(string)
@@ -0,0 +1,57 @@
1
+ from typing import Mapping, Sequence, Optional
2
+
3
+ from .i_communicator import ICommunicator
4
+
5
+ from onlinepayments.sdk.communication.request_header import RequestHeader
6
+
7
+
8
+ class ApiResource(object):
9
+ """
10
+ Base class of all Online Payments platform API resources.
11
+ """
12
+
13
+ def __init__(self, parent: Optional['ApiResource'] = None, communicator: Optional[ICommunicator] = None,
14
+ path_context: Optional[Mapping[str, str]] = None, client_meta_info: Optional[str] = None):
15
+ """
16
+ The parent and/or communicator must be given.
17
+ """
18
+ if not parent and not communicator:
19
+ raise ValueError("parent and/or communicator is required")
20
+ self.__parent = parent
21
+ self.__communicator = communicator if communicator else parent._communicator
22
+ self.__path_context = path_context
23
+ self.__client_meta_info = client_meta_info if client_meta_info or not parent else parent._client_meta_info
24
+
25
+ @property
26
+ def _communicator(self) -> ICommunicator:
27
+ return self.__communicator
28
+
29
+ @property
30
+ def _client_meta_info(self) -> str:
31
+ return self.__client_meta_info
32
+
33
+ @property
34
+ def _client_headers(self) -> Optional[Sequence[RequestHeader]]:
35
+ if self._client_meta_info is not None:
36
+ client_headers = [RequestHeader("X-GCS-ClientMetaInfo", self._client_meta_info)]
37
+ return client_headers
38
+ else:
39
+ return None
40
+
41
+ def _instantiate_uri(self, uri: str, path_context: Optional[Mapping[str, str]]) -> str:
42
+ uri = self.__replace_all(uri, path_context)
43
+ uri = self.__instantiate_uri(uri)
44
+ return uri
45
+
46
+ def __instantiate_uri(self, uri: str) -> str:
47
+ uri = self.__replace_all(uri, self.__path_context)
48
+ if self.__parent is not None:
49
+ uri = self.__parent.__instantiate_uri(uri)
50
+ return uri
51
+
52
+ @staticmethod
53
+ def __replace_all(uri: str, path_context: Optional[Mapping[str, str]]) -> str:
54
+ if path_context:
55
+ for key, value in path_context.items():
56
+ uri = uri.replace("{" + key + "}", value)
57
+ return uri
File without changes
@@ -0,0 +1,24 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Optional, Sequence
3
+ from urllib.parse import ParseResult
4
+
5
+ from onlinepayments.sdk.communication.request_header import RequestHeader
6
+
7
+
8
+ class Authenticator(ABC):
9
+ """
10
+ Used to authenticate requests to the Online Payments platform.
11
+ """
12
+
13
+ @abstractmethod
14
+ def get_authorization(self, http_method: str, resource_uri: ParseResult,
15
+ request_headers: Optional[Sequence[RequestHeader]]) -> str:
16
+ """
17
+ Returns a value that can be used for the "Authorization" header.
18
+
19
+ :param http_method: The HTTP method.
20
+ :param resource_uri: The URI of the resource.
21
+ :param request_headers: A sequence of RequestHeaders.
22
+ This sequence may not be modified and may not contain headers with the same name.
23
+ """
24
+ raise NotImplementedError
@@ -0,0 +1,10 @@
1
+ class AuthorizationType:
2
+ V1HMAC = "v1HMAC"
3
+ AUTHORIZATION_TYPES = [V1HMAC]
4
+
5
+ @staticmethod
6
+ def get_authorization(name: str) -> str:
7
+ if name in AuthorizationType.AUTHORIZATION_TYPES:
8
+ return name
9
+ else:
10
+ raise ValueError("Authorization '{}' not found".format(name))
@@ -0,0 +1,122 @@
1
+ import hashlib
2
+ import hmac
3
+ from base64 import b64encode
4
+ from operator import attrgetter
5
+ from re import sub
6
+ from typing import Optional, Sequence
7
+ from urllib.parse import ParseResult
8
+
9
+ from .authenticator import Authenticator
10
+
11
+ from onlinepayments.sdk.authentication.authorization_type import AuthorizationType
12
+ from onlinepayments.sdk.communicator_configuration import CommunicatorConfiguration
13
+ from onlinepayments.sdk.communication.request_header import RequestHeader
14
+
15
+
16
+ class V1HmacAuthenticator(Authenticator):
17
+ """
18
+ V1Hmac Authenticator implementation.
19
+ """
20
+
21
+ def __init__(self, communicator_configuration: CommunicatorConfiguration):
22
+ """
23
+ Constructs a new V1HmacAuthenticator instance using the provided CommunicatorConfiguration.
24
+
25
+ :param communicator_configuration: The configuration object containing the v1Hmac api key and api key secret
26
+ , connection timeout, and socket timeout. None of these can be None or empty,
27
+ and the timeout values must be positive.
28
+ """
29
+ Authenticator.__init__(self)
30
+
31
+ if not communicator_configuration.api_key_id:
32
+ raise ValueError("api_key_id is required")
33
+ if not communicator_configuration.secret_api_key:
34
+ raise ValueError("secret_api_key is required")
35
+ if communicator_configuration.authorization_type is None:
36
+ raise ValueError("authorization_type is required")
37
+ if communicator_configuration.connect_timeout <= 0:
38
+ raise ValueError("connect_timeout must be positive")
39
+ if communicator_configuration.socket_timeout <= 0:
40
+ raise ValueError("socket_timeout must be positive")
41
+
42
+ self.__api_id_key = communicator_configuration.api_key_id
43
+ self.__secret_api_key = communicator_configuration.secret_api_key
44
+ self.__authorization_type = AuthorizationType.get_authorization(communicator_configuration.authorization_type)
45
+ self.__connect_timeout = communicator_configuration.connect_timeout
46
+ self.__socket_timeout = communicator_configuration.socket_timeout
47
+ self.__proxy_configuration = communicator_configuration.proxy_configuration
48
+
49
+ def get_authorization(self, http_method: Optional[str], resource_uri: Optional[ParseResult],
50
+ request_headers: Optional[Sequence[RequestHeader]]) -> str:
51
+ """Returns a v1HMAC authentication signature header"""
52
+ if http_method is None or not http_method.strip():
53
+ raise ValueError("http_method is required")
54
+ if resource_uri is None:
55
+ raise ValueError("resource_uri is required")
56
+ data_to_sign = self.to_data_to_sign(http_method, resource_uri, request_headers)
57
+ return "GCS " + self.__authorization_type + ":" + self.__api_id_key + \
58
+ ":" + self.create_authentication_signature(data_to_sign)
59
+
60
+ def to_data_to_sign(self, http_method, resource_uri, http_headers):
61
+ content_type = None
62
+ date = None
63
+ canonicalized_headers = ""
64
+ canonicalized_resource = self.__to_canonicalized_resource(resource_uri)
65
+ xgcs_http_headers = []
66
+ if http_headers is not None:
67
+ for http_header in http_headers:
68
+ if "Content-Type".lower() == http_header.name.lower():
69
+ content_type = http_header.value
70
+ elif "Date".lower() == http_header.name.lower():
71
+ date = http_header.value
72
+ else:
73
+ name = self.__to_canonicalize_header_name(http_header.name)
74
+ if name.startswith("x-gcs"):
75
+ value = self.to_canonicalize_header_value(
76
+ http_header.value)
77
+ xgcs_http_header = RequestHeader(name, value)
78
+ xgcs_http_headers.append(xgcs_http_header)
79
+ xgcs_http_headers.sort(key=attrgetter('name'))
80
+ for xgcs_http_header in xgcs_http_headers:
81
+ canonicalized_headers += xgcs_http_header.name + ":" + xgcs_http_header.value + "\n"
82
+ string = http_method.upper() + "\n"
83
+ if content_type is not None:
84
+ string += content_type + "\n"
85
+ else:
86
+ string += "\n"
87
+ string += date + "\n"
88
+ string += str(canonicalized_headers)
89
+ string += canonicalized_resource + "\n"
90
+ return str(string)
91
+
92
+ @staticmethod
93
+ def __to_canonicalized_resource(resource_uri):
94
+ """
95
+ Returns the URI path without the HTTP method and including all
96
+ decoded query parameters.
97
+ """
98
+ string = ""
99
+ string += resource_uri.path
100
+ if resource_uri.query:
101
+ string += "?" + resource_uri.query
102
+ return str(string)
103
+
104
+ @staticmethod
105
+ def __to_canonicalize_header_name(original_name):
106
+ if original_name is None:
107
+ return None
108
+ else:
109
+ return original_name.lower()
110
+
111
+ @staticmethod
112
+ def to_canonicalize_header_value(original_value):
113
+ # For now V1HMAC is the only supported AuthorizationType so always use
114
+ # the same logic.
115
+ if original_value is None:
116
+ return ""
117
+ return sub(r"\r?\n(?:(?![\r\n])\s)*", " ", original_value).strip()
118
+
119
+ def create_authentication_signature(self, data_to_sign):
120
+ sig = hmac.new(self.__secret_api_key.encode("utf-8"), data_to_sign.encode("utf-8"),
121
+ hashlib.sha256)
122
+ return b64encode(sig.digest()).decode("utf-8").rstrip('\n')
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file was automatically generated.
4
+ #
5
+ from typing import List, Optional
6
+
7
+ from .api_exception import ApiException
8
+
9
+ from onlinepayments.sdk.domain.api_error import APIError
10
+
11
+
12
+ class AuthorizationException(ApiException):
13
+ """
14
+ Represents an error response from the payment platform when authorization failed.
15
+ """
16
+
17
+ def __init__(self, status_code: int, response_body: str, error_id: Optional[str], errors: Optional[List[APIError]],
18
+ message: str = "the payment platform returned an authorization error response"):
19
+ super(AuthorizationException, self).__init__(status_code, response_body, error_id, errors, message)
@@ -0,0 +1,72 @@
1
+ from typing import Optional
2
+ from datetime import datetime
3
+
4
+ class CallContext(object):
5
+ """
6
+ A call context can be used to send extra information with a request, and to receive extra information from a response.
7
+
8
+ Please note that this class is not thread-safe. Each request should get its own call context instance.
9
+ """
10
+ __idempotence_key: Optional[str] = None
11
+ __idempotence_request_timestamp: Optional[int] = None
12
+ __idempotence_response_date_time: Optional[datetime] = None
13
+ __gzip: Optional[bool] = None
14
+
15
+ def __init__(self, idempotence_key: Optional[str] = None, gzip: Optional[bool] = None):
16
+ self.__idempotence_key = idempotence_key
17
+ self.__gzip = gzip
18
+
19
+ @property
20
+ def idempotence_key(self) -> Optional[str]:
21
+ """
22
+ :return: The idempotence key.
23
+ """
24
+ return self.__idempotence_key
25
+
26
+ @property
27
+ def idempotence_request_timestamp(self) -> Optional[int]:
28
+ """
29
+ :return: The idempotence request timestamp from the response to the last
30
+ request for which this call context was used, or None if no idempotence
31
+ request timestamp was present.
32
+ """
33
+ return self.__idempotence_request_timestamp
34
+
35
+ @idempotence_request_timestamp.setter
36
+ def idempotence_request_timestamp(self, idempotence_request_timestamp: int) -> None:
37
+ """
38
+ Sets the idempotence request timestamp.
39
+ This method should only be called by Communicator objects based on the
40
+ response to the request for which this call context was used.
41
+ """
42
+ self.__idempotence_request_timestamp = idempotence_request_timestamp
43
+
44
+ @property
45
+ def idempotence_response_date_time(self) -> Optional[datetime]:
46
+ """
47
+ :return: The idempotence response date/time from the response to the
48
+ last request for which this call context was used, or None if no idempotence
49
+ response date/time was present.
50
+ """
51
+ return self.__idempotence_response_date_time
52
+
53
+ @idempotence_response_date_time.setter
54
+ def idempotence_response_date_time(self, idempotence_response_date_time: datetime) -> None:
55
+ """
56
+ Sets the idempotence response date/time.
57
+ This method should only be called by Communicator objects based on the
58
+ response to the request for which this call context was used.
59
+ """
60
+ self.__idempotence_response_date_time = idempotence_response_date_time
61
+
62
+ @property
63
+ def gzip(self) -> Optional[bool]:
64
+ """Per-request gzip toggle."""
65
+ return self.__gzip
66
+
67
+ @gzip.setter
68
+ def gzip(self, enabled: Optional[bool]) -> None:
69
+ """
70
+ Sets the gzip field true/false.
71
+ """
72
+ self.__gzip = enabled
@@ -0,0 +1,107 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # This file was automatically generated.
4
+ #
5
+ from base64 import b64encode
6
+ from datetime import timedelta
7
+ from typing import Optional
8
+
9
+ from .api_resource import ApiResource
10
+ from .i_client import IClient
11
+ from .i_communicator import ICommunicator
12
+
13
+ from onlinepayments.sdk.log.body_obfuscator import BodyObfuscator
14
+ from onlinepayments.sdk.log.communicator_logger import CommunicatorLogger
15
+ from onlinepayments.sdk.log.header_obfuscator import HeaderObfuscator
16
+ from onlinepayments.sdk.merchant.i_merchant_client import IMerchantClient
17
+ from onlinepayments.sdk.merchant.merchant_client import MerchantClient
18
+
19
+
20
+ class Client(ApiResource, IClient):
21
+ """
22
+ Payment platform client.
23
+
24
+ This client and all its child clients are bound to one specific value for the X-GCS-ClientMetaInfo header.
25
+ To get a new client with a different header value, use with_client_meta_info.
26
+
27
+ Thread-safe.
28
+ """
29
+
30
+ def __init__(self, communicator: ICommunicator, client_meta_info: Optional[str] = None):
31
+ """
32
+ :param communicator: :class:`onlinepayments.sdk.i_communicator.ICommunicator`
33
+ :param client_meta_info: str
34
+ """
35
+ super(Client, self).__init__(communicator=communicator,
36
+ client_meta_info=client_meta_info)
37
+
38
+ def with_client_meta_info(self, client_meta_info: Optional[str]) -> 'Client':
39
+ """
40
+ :param client_meta_info: JSON string containing the metadata for the client
41
+ :return: a new Client which uses the passed metadata for the X-GCS-ClientMetaInfo header.
42
+ :raise MarshallerSyntaxException: if the given clientMetaInfo is not a valid JSON string
43
+ """
44
+ if self._client_meta_info is None and client_meta_info is None:
45
+ return self
46
+ if client_meta_info is None:
47
+ return Client(self._communicator, None)
48
+ # Checking to see if this is valid JSON (no JSON parse exceptions)
49
+ self._communicator.marshaller.unmarshal(client_meta_info, object)
50
+ client_meta_info = b64encode(client_meta_info.encode('utf-8')).decode('utf-8')
51
+ if client_meta_info == self._client_meta_info:
52
+ return self
53
+ return Client(self._communicator, client_meta_info)
54
+
55
+ def close_idle_connections(self, idle_time: timedelta) -> None:
56
+ """
57
+ Utility method that delegates the call to this client's communicator.
58
+
59
+ :param idle_time: a datetime.timedelta object indicating the idle time
60
+ """
61
+ self._communicator.close_idle_connections(idle_time)
62
+
63
+ def close_expired_connections(self) -> None:
64
+ """
65
+ Utility method that delegates the call to this client's communicator.
66
+ """
67
+ self._communicator.close_expired_connections()
68
+
69
+ def set_body_obfuscator(self, body_obfuscator: BodyObfuscator) -> None:
70
+ # delegate to the communicator
71
+ self._communicator.set_body_obfuscator(body_obfuscator)
72
+
73
+ def set_header_obfuscator(self, header_obfuscator: HeaderObfuscator) -> None:
74
+ # delegate to the communicator
75
+ self._communicator.set_header_obfuscator(header_obfuscator)
76
+
77
+ def enable_logging(self, communicator_logger: CommunicatorLogger) -> None:
78
+ # delegate to the communicator
79
+ self._communicator.enable_logging(communicator_logger)
80
+
81
+ def disable_logging(self) -> None:
82
+ # delegate to the communicator
83
+ self._communicator.disable_logging()
84
+
85
+ def close(self) -> None:
86
+ """
87
+ Releases any system resources associated with this object.
88
+ """
89
+ self._communicator.close()
90
+
91
+ def __enter__(self):
92
+ return self
93
+
94
+ def __exit__(self, exc_type, exc_val, exc_tb):
95
+ self.close()
96
+
97
+ def merchant(self, merchant_id: str) -> IMerchantClient:
98
+ """
99
+ Resource /v2/{merchantId}
100
+
101
+ :param merchant_id: str
102
+ :return: :class:`onlinepayments.sdk.merchant.i_merchant_client.IMerchantClient`
103
+ """
104
+ sub_context = {
105
+ "merchantId": merchant_id,
106
+ }
107
+ return MerchantClient(self, sub_context)
File without changes
@@ -0,0 +1,8 @@
1
+ class CommunicationException(RuntimeError):
2
+ """
3
+ Indicates an exception regarding the communication with the Online Payments platform such as a connection exception.
4
+ """
5
+
6
+ def __init__(self, exception: Exception):
7
+ super(CommunicationException, self).__init__(exception)
8
+ self.cause = exception
@@ -0,0 +1,84 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Iterable, Mapping, Sequence, Tuple, Union
3
+ from urllib.parse import ParseResult
4
+
5
+ from .multipart_form_data_object import MultipartFormDataObject
6
+ from .request_header import RequestHeader
7
+
8
+ from onlinepayments.sdk.log.logging_capable import LoggingCapable
9
+ from onlinepayments.sdk.log.obfuscation_capable import ObfuscationCapable
10
+
11
+
12
+ URI = Union[str, ParseResult]
13
+ RequestBody = Union[str, bytes, MultipartFormDataObject, None]
14
+ Response = Tuple[int, Mapping[str, str], Iterable[bytes]]
15
+
16
+
17
+ class Connection(LoggingCapable, ObfuscationCapable, ABC):
18
+ """
19
+ Represents a connection to the Online Payments platform server.
20
+ """
21
+
22
+ @abstractmethod
23
+ def get(self, url: URI, request_headers: Sequence[RequestHeader]) -> Response:
24
+ """
25
+ Send a GET request to the Online Payments platform and return the response.
26
+
27
+ :param url: The URI to call, including any necessary query parameters.
28
+ :param request_headers: An optional sequence of request headers.
29
+ :return: The response from the Online Payments platform as a tuple with
30
+ the status code, headers and a generator of body chunks
31
+ :raise CommunicationException: when an exception occurred communicating
32
+ with the Online Payments platform
33
+ """
34
+ raise NotImplementedError
35
+
36
+ @abstractmethod
37
+ def delete(self, url: URI, request_headers: Sequence[RequestHeader]) -> Response:
38
+ """
39
+ Send a DELETE request to the Online Payments platform and return the response.
40
+
41
+ :param url: The URI to call, including any necessary query parameters.
42
+ :param request_headers: An optional sequence of request headers.
43
+ :return: The response from the Online Payments platform as a tuple with
44
+ the status code, headers and a generator of body chunks
45
+ :raise CommunicationException: when an exception occurred communicating
46
+ with the Online Payments platform
47
+ """
48
+ raise NotImplementedError
49
+
50
+ @abstractmethod
51
+ def post(self, url: URI, request_headers: Sequence[RequestHeader], body: RequestBody) -> Response:
52
+ """
53
+ Send a POST request to the Online Payments platform and return the response.
54
+
55
+ :param url: The URI to call, including any necessary query parameters.
56
+ :param request_headers: An optional sequence of request headers.
57
+ :param body: The optional body to send.
58
+ :return: The response from the Online Payments platform as a tuple with
59
+ the status code, headers and a generator of body chunks
60
+ :raise CommunicationException: when an exception occurred communicating
61
+ with the Online Payments platform
62
+ """
63
+ raise NotImplementedError
64
+
65
+ @abstractmethod
66
+ def put(self, url: URI, request_headers: Sequence[RequestHeader], body: RequestBody) -> Response:
67
+ """
68
+ Send a PUT request to the Online Payments platform and return the response.
69
+
70
+ :param url: The URI to call, including any necessary query parameters.
71
+ :param request_headers: An optional sequence of request headers.
72
+ :param body: The optional body to send.
73
+ :return: The response from the Online Payments platform as a tuple with
74
+ the status code, headers and a generator of body chunks
75
+ :raise CommunicationException: when an exception occurred communicating
76
+ with the Online Payments platform
77
+ """
78
+ raise NotImplementedError
79
+
80
+ def close(self) -> None:
81
+ """
82
+ Releases any system resources associated with this object.
83
+ """
84
+ pass