paypal-server-sdk 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +35 -0
  3. data/README.md +112 -0
  4. data/lib/paypal_server_sdk/api_helper.rb +10 -0
  5. data/lib/paypal_server_sdk/client.rb +85 -0
  6. data/lib/paypal_server_sdk/configuration.rb +109 -0
  7. data/lib/paypal_server_sdk/controllers/base_controller.rb +71 -0
  8. data/lib/paypal_server_sdk/controllers/o_auth_authorization_controller.rb +42 -0
  9. data/lib/paypal_server_sdk/controllers/orders_controller.rb +517 -0
  10. data/lib/paypal_server_sdk/controllers/payments_controller.rb +404 -0
  11. data/lib/paypal_server_sdk/controllers/vault_controller.rb +224 -0
  12. data/lib/paypal_server_sdk/exceptions/api_exception.rb +10 -0
  13. data/lib/paypal_server_sdk/exceptions/error_exception.rb +71 -0
  14. data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +48 -0
  15. data/lib/paypal_server_sdk/http/api_response.rb +21 -0
  16. data/lib/paypal_server_sdk/http/auth/o_auth2.rb +136 -0
  17. data/lib/paypal_server_sdk/http/http_call_back.rb +10 -0
  18. data/lib/paypal_server_sdk/http/http_method_enum.rb +10 -0
  19. data/lib/paypal_server_sdk/http/http_request.rb +10 -0
  20. data/lib/paypal_server_sdk/http/http_response.rb +10 -0
  21. data/lib/paypal_server_sdk/logging/configuration/api_logging_configuration.rb +114 -0
  22. data/lib/paypal_server_sdk/logging/sdk_logger.rb +17 -0
  23. data/lib/paypal_server_sdk/models/activity_timestamps.rb +68 -0
  24. data/lib/paypal_server_sdk/models/address.rb +116 -0
  25. data/lib/paypal_server_sdk/models/address_details.rb +160 -0
  26. data/lib/paypal_server_sdk/models/amount_breakdown.rb +115 -0
  27. data/lib/paypal_server_sdk/models/amount_with_breakdown.rb +80 -0
  28. data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +60 -0
  29. data/lib/paypal_server_sdk/models/apple_pay_attributes_response.rb +50 -0
  30. data/lib/paypal_server_sdk/models/apple_pay_card.rb +94 -0
  31. data/lib/paypal_server_sdk/models/apple_pay_card_response.rb +167 -0
  32. data/lib/paypal_server_sdk/models/apple_pay_decrypted_token_data.rb +95 -0
  33. data/lib/paypal_server_sdk/models/apple_pay_payment_data.rb +83 -0
  34. data/lib/paypal_server_sdk/models/apple_pay_payment_data_type.rb +24 -0
  35. data/lib/paypal_server_sdk/models/apple_pay_payment_object.rb +114 -0
  36. data/lib/paypal_server_sdk/models/apple_pay_payment_token.rb +51 -0
  37. data/lib/paypal_server_sdk/models/apple_pay_request.rb +137 -0
  38. data/lib/paypal_server_sdk/models/apple_pay_tokenized_card.rb +113 -0
  39. data/lib/paypal_server_sdk/models/assurance_details.rb +68 -0
  40. data/lib/paypal_server_sdk/models/authentication_response.rb +61 -0
  41. data/lib/paypal_server_sdk/models/authorization.rb +192 -0
  42. data/lib/paypal_server_sdk/models/authorization_incomplete_reason.rb +23 -0
  43. data/lib/paypal_server_sdk/models/authorization_status.rb +35 -0
  44. data/lib/paypal_server_sdk/models/authorization_status_details.rb +50 -0
  45. data/lib/paypal_server_sdk/models/authorization_status_with_details.rb +60 -0
  46. data/lib/paypal_server_sdk/models/authorization_with_additional_data.rb +205 -0
  47. data/lib/paypal_server_sdk/models/avs_code.rb +90 -0
  48. data/lib/paypal_server_sdk/models/bancontact_payment_object.rb +95 -0
  49. data/lib/paypal_server_sdk/models/bancontact_payment_request.rb +73 -0
  50. data/lib/paypal_server_sdk/models/base_model.rb +62 -0
  51. data/lib/paypal_server_sdk/models/bin_details.rb +88 -0
  52. data/lib/paypal_server_sdk/models/blik_experience_context.rb +122 -0
  53. data/lib/paypal_server_sdk/models/blik_level0_payment_object.rb +48 -0
  54. data/lib/paypal_server_sdk/models/blik_one_click_payment_object.rb +52 -0
  55. data/lib/paypal_server_sdk/models/blik_one_click_payment_request.rb +82 -0
  56. data/lib/paypal_server_sdk/models/blik_payment_object.rb +86 -0
  57. data/lib/paypal_server_sdk/models/blik_payment_request.rb +105 -0
  58. data/lib/paypal_server_sdk/models/capture.rb +228 -0
  59. data/lib/paypal_server_sdk/models/capture_incomplete_reason.rb +55 -0
  60. data/lib/paypal_server_sdk/models/capture_payment_instruction.rb +89 -0
  61. data/lib/paypal_server_sdk/models/capture_request.rb +108 -0
  62. data/lib/paypal_server_sdk/models/capture_status.rb +35 -0
  63. data/lib/paypal_server_sdk/models/capture_status_details.rb +50 -0
  64. data/lib/paypal_server_sdk/models/capture_status_with_details.rb +60 -0
  65. data/lib/paypal_server_sdk/models/captured_payment.rb +248 -0
  66. data/lib/paypal_server_sdk/models/card_attributes.rb +70 -0
  67. data/lib/paypal_server_sdk/models/card_attributes_response.rb +50 -0
  68. data/lib/paypal_server_sdk/models/card_authentication_response.rb +51 -0
  69. data/lib/paypal_server_sdk/models/card_brand.rb +93 -0
  70. data/lib/paypal_server_sdk/models/card_customer_information.rb +85 -0
  71. data/lib/paypal_server_sdk/models/card_experience_context.rb +59 -0
  72. data/lib/paypal_server_sdk/models/card_from_request.rb +60 -0
  73. data/lib/paypal_server_sdk/models/card_payment_token.rb +166 -0
  74. data/lib/paypal_server_sdk/models/card_request.rb +176 -0
  75. data/lib/paypal_server_sdk/models/card_response.rb +139 -0
  76. data/lib/paypal_server_sdk/models/card_response_entity.rb +156 -0
  77. data/lib/paypal_server_sdk/models/card_stored_credential.rb +95 -0
  78. data/lib/paypal_server_sdk/models/card_supplementary_data.rb +71 -0
  79. data/lib/paypal_server_sdk/models/card_type.rb +32 -0
  80. data/lib/paypal_server_sdk/models/card_vault_response.rb +86 -0
  81. data/lib/paypal_server_sdk/models/card_verification.rb +51 -0
  82. data/lib/paypal_server_sdk/models/card_verification_details.rb +111 -0
  83. data/lib/paypal_server_sdk/models/card_verification_method.rb +29 -0
  84. data/lib/paypal_server_sdk/models/card_verification_processor_response.rb +62 -0
  85. data/lib/paypal_server_sdk/models/checkout_payment_intent.rb +24 -0
  86. data/lib/paypal_server_sdk/models/cobranded_card.rb +70 -0
  87. data/lib/paypal_server_sdk/models/confirm_order_request.rb +74 -0
  88. data/lib/paypal_server_sdk/models/customer_information.rb +72 -0
  89. data/lib/paypal_server_sdk/models/customer_request.rb +62 -0
  90. data/lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb +105 -0
  91. data/lib/paypal_server_sdk/models/cvv_code.rb +60 -0
  92. data/lib/paypal_server_sdk/models/disbursement_mode.rb +23 -0
  93. data/lib/paypal_server_sdk/models/dispute_category.rb +23 -0
  94. data/lib/paypal_server_sdk/models/eci_flag.rb +39 -0
  95. data/lib/paypal_server_sdk/models/enrollment_status.rb +29 -0
  96. data/lib/paypal_server_sdk/models/eps_payment_object.rb +74 -0
  97. data/lib/paypal_server_sdk/models/eps_payment_request.rb +73 -0
  98. data/lib/paypal_server_sdk/models/error_details.rb +110 -0
  99. data/lib/paypal_server_sdk/models/exchange_rate.rb +75 -0
  100. data/lib/paypal_server_sdk/models/experience_context.rb +98 -0
  101. data/lib/paypal_server_sdk/models/fullfillment_type.rb +31 -0
  102. data/lib/paypal_server_sdk/models/giropay_payment_object.rb +74 -0
  103. data/lib/paypal_server_sdk/models/giropay_payment_request.rb +73 -0
  104. data/lib/paypal_server_sdk/models/google_pay_authentication_method.rb +23 -0
  105. data/lib/paypal_server_sdk/models/google_pay_card_attributes.rb +51 -0
  106. data/lib/paypal_server_sdk/models/google_pay_card_response.rb +104 -0
  107. data/lib/paypal_server_sdk/models/google_pay_decrypted_token_data.rb +105 -0
  108. data/lib/paypal_server_sdk/models/google_pay_payment_method.rb +20 -0
  109. data/lib/paypal_server_sdk/models/google_pay_request.rb +118 -0
  110. data/lib/paypal_server_sdk/models/google_pay_request_card.rb +84 -0
  111. data/lib/paypal_server_sdk/models/google_pay_wallet_response.rb +85 -0
  112. data/lib/paypal_server_sdk/models/ideal_payment_object.rb +85 -0
  113. data/lib/paypal_server_sdk/models/ideal_payment_request.rb +83 -0
  114. data/lib/paypal_server_sdk/models/item.rb +134 -0
  115. data/lib/paypal_server_sdk/models/item_category.rb +26 -0
  116. data/lib/paypal_server_sdk/models/level2_card_processing_data.rb +66 -0
  117. data/lib/paypal_server_sdk/models/level3_card_processing_data.rb +120 -0
  118. data/lib/paypal_server_sdk/models/liability_shift_indicator.rb +26 -0
  119. data/lib/paypal_server_sdk/models/line_item.rb +177 -0
  120. data/lib/paypal_server_sdk/models/link_description.rb +75 -0
  121. data/lib/paypal_server_sdk/models/link_http_method.rb +41 -0
  122. data/lib/paypal_server_sdk/models/money.rb +62 -0
  123. data/lib/paypal_server_sdk/models/my_bank_payment_object.rb +85 -0
  124. data/lib/paypal_server_sdk/models/my_bank_payment_request.rb +73 -0
  125. data/lib/paypal_server_sdk/models/name.rb +61 -0
  126. data/lib/paypal_server_sdk/models/net_amount_breakdown_item.rb +73 -0
  127. data/lib/paypal_server_sdk/models/network_token.rb +95 -0
  128. data/lib/paypal_server_sdk/models/network_transaction_reference.rb +90 -0
  129. data/lib/paypal_server_sdk/models/network_transaction_reference_entity.rb +88 -0
  130. data/lib/paypal_server_sdk/models/o_auth_provider_error.rb +45 -0
  131. data/lib/paypal_server_sdk/models/o_auth_token.rb +106 -0
  132. data/lib/paypal_server_sdk/models/order.rb +178 -0
  133. data/lib/paypal_server_sdk/models/order_application_context.rb +193 -0
  134. data/lib/paypal_server_sdk/models/order_application_context_landing_page.rb +32 -0
  135. data/lib/paypal_server_sdk/models/order_application_context_shipping_preference.rb +34 -0
  136. data/lib/paypal_server_sdk/models/order_application_context_user_action.rb +29 -0
  137. data/lib/paypal_server_sdk/models/order_authorize_request.rb +51 -0
  138. data/lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb +104 -0
  139. data/lib/paypal_server_sdk/models/order_authorize_response.rb +171 -0
  140. data/lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb +88 -0
  141. data/lib/paypal_server_sdk/models/order_capture_request.rb +51 -0
  142. data/lib/paypal_server_sdk/models/order_capture_request_payment_source.rb +104 -0
  143. data/lib/paypal_server_sdk/models/order_confirm_application_context.rb +109 -0
  144. data/lib/paypal_server_sdk/models/order_request.rb +103 -0
  145. data/lib/paypal_server_sdk/models/order_status.rb +35 -0
  146. data/lib/paypal_server_sdk/models/order_tracker_item.rb +99 -0
  147. data/lib/paypal_server_sdk/models/order_tracker_request.rb +116 -0
  148. data/lib/paypal_server_sdk/models/order_tracker_response.rb +122 -0
  149. data/lib/paypal_server_sdk/models/order_tracker_status.rb +23 -0
  150. data/lib/paypal_server_sdk/models/p24_payment_object.rb +108 -0
  151. data/lib/paypal_server_sdk/models/p24_payment_request.rb +85 -0
  152. data/lib/paypal_server_sdk/models/pa_res_status.rb +42 -0
  153. data/lib/paypal_server_sdk/models/patch.rb +83 -0
  154. data/lib/paypal_server_sdk/models/patch_op.rb +35 -0
  155. data/lib/paypal_server_sdk/models/pay_pal_experience_landing_page.rb +26 -0
  156. data/lib/paypal_server_sdk/models/pay_pal_experience_user_action.rb +24 -0
  157. data/lib/paypal_server_sdk/models/pay_pal_payment_token.rb +180 -0
  158. data/lib/paypal_server_sdk/models/pay_pal_payment_token_customer_type.rb +25 -0
  159. data/lib/paypal_server_sdk/models/pay_pal_payment_token_usage_pattern.rb +35 -0
  160. data/lib/paypal_server_sdk/models/pay_pal_payment_token_usage_type.rb +23 -0
  161. data/lib/paypal_server_sdk/models/pay_pal_wallet.rb +158 -0
  162. data/lib/paypal_server_sdk/models/pay_pal_wallet_account_verification_status.rb +24 -0
  163. data/lib/paypal_server_sdk/models/pay_pal_wallet_attributes.rb +59 -0
  164. data/lib/paypal_server_sdk/models/pay_pal_wallet_attributes_response.rb +70 -0
  165. data/lib/paypal_server_sdk/models/pay_pal_wallet_customer.rb +85 -0
  166. data/lib/paypal_server_sdk/models/pay_pal_wallet_customer_request.rb +85 -0
  167. data/lib/paypal_server_sdk/models/pay_pal_wallet_experience_context.rb +140 -0
  168. data/lib/paypal_server_sdk/models/pay_pal_wallet_response.rb +166 -0
  169. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_instruction.rb +115 -0
  170. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_response.rb +86 -0
  171. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_status.rb +26 -0
  172. data/lib/paypal_server_sdk/models/payee.rb +65 -0
  173. data/lib/paypal_server_sdk/models/payee_base.rb +64 -0
  174. data/lib/paypal_server_sdk/models/payee_payment_method_preference.rb +23 -0
  175. data/lib/paypal_server_sdk/models/payer.rb +120 -0
  176. data/lib/paypal_server_sdk/models/payer_base.rb +64 -0
  177. data/lib/paypal_server_sdk/models/payment_advice_code.rb +30 -0
  178. data/lib/paypal_server_sdk/models/payment_authorization.rb +212 -0
  179. data/lib/paypal_server_sdk/models/payment_collection.rb +99 -0
  180. data/lib/paypal_server_sdk/models/payment_initiator.rb +23 -0
  181. data/lib/paypal_server_sdk/models/payment_instruction.rb +105 -0
  182. data/lib/paypal_server_sdk/models/payment_method_preference.rb +72 -0
  183. data/lib/paypal_server_sdk/models/payment_source.rb +187 -0
  184. data/lib/paypal_server_sdk/models/payment_source_response.rb +171 -0
  185. data/lib/paypal_server_sdk/models/payment_supplementary_data.rb +50 -0
  186. data/lib/paypal_server_sdk/models/payment_token_request.rb +60 -0
  187. data/lib/paypal_server_sdk/models/payment_token_request_card.rb +125 -0
  188. data/lib/paypal_server_sdk/models/payment_token_request_payment_source.rb +59 -0
  189. data/lib/paypal_server_sdk/models/payment_token_response.rb +87 -0
  190. data/lib/paypal_server_sdk/models/payment_token_response_payment_source.rb +87 -0
  191. data/lib/paypal_server_sdk/models/phone.rb +77 -0
  192. data/lib/paypal_server_sdk/models/phone_number.rb +54 -0
  193. data/lib/paypal_server_sdk/models/phone_number_with_country_code.rb +66 -0
  194. data/lib/paypal_server_sdk/models/phone_type.rb +32 -0
  195. data/lib/paypal_server_sdk/models/phone_with_type.rb +59 -0
  196. data/lib/paypal_server_sdk/models/platform_fee.rb +63 -0
  197. data/lib/paypal_server_sdk/models/processing_instruction.rb +23 -0
  198. data/lib/paypal_server_sdk/models/processor_response.rb +83 -0
  199. data/lib/paypal_server_sdk/models/processor_response_code.rb +479 -0
  200. data/lib/paypal_server_sdk/models/purchase_unit.rb +227 -0
  201. data/lib/paypal_server_sdk/models/purchase_unit_request.rb +193 -0
  202. data/lib/paypal_server_sdk/models/reauthorize_request.rb +62 -0
  203. data/lib/paypal_server_sdk/models/refund.rb +195 -0
  204. data/lib/paypal_server_sdk/models/refund_incomplete_reason.rb +20 -0
  205. data/lib/paypal_server_sdk/models/refund_payment_instruction.rb +68 -0
  206. data/lib/paypal_server_sdk/models/refund_platform_fee.rb +52 -0
  207. data/lib/paypal_server_sdk/models/refund_request.rb +100 -0
  208. data/lib/paypal_server_sdk/models/refund_status.rb +29 -0
  209. data/lib/paypal_server_sdk/models/refund_status_details.rb +50 -0
  210. data/lib/paypal_server_sdk/models/refund_status_with_details.rb +60 -0
  211. data/lib/paypal_server_sdk/models/related_identifiers.rb +69 -0
  212. data/lib/paypal_server_sdk/models/seller_payable_breakdown.rb +156 -0
  213. data/lib/paypal_server_sdk/models/seller_protection.rb +65 -0
  214. data/lib/paypal_server_sdk/models/seller_protection_status.rb +29 -0
  215. data/lib/paypal_server_sdk/models/seller_receivable_breakdown.rb +129 -0
  216. data/lib/paypal_server_sdk/models/setup_token_card_experience_context.rb +103 -0
  217. data/lib/paypal_server_sdk/models/setup_token_request.rb +60 -0
  218. data/lib/paypal_server_sdk/models/setup_token_request_card.rb +141 -0
  219. data/lib/paypal_server_sdk/models/setup_token_request_payment_source.rb +77 -0
  220. data/lib/paypal_server_sdk/models/setup_token_response.rb +106 -0
  221. data/lib/paypal_server_sdk/models/setup_token_response_card.rb +156 -0
  222. data/lib/paypal_server_sdk/models/setup_token_response_payment_source.rb +68 -0
  223. data/lib/paypal_server_sdk/models/shipment_carrier.rb +3852 -0
  224. data/lib/paypal_server_sdk/models/shipping_details.rb +106 -0
  225. data/lib/paypal_server_sdk/models/shipping_name.rb +50 -0
  226. data/lib/paypal_server_sdk/models/shipping_option.rb +94 -0
  227. data/lib/paypal_server_sdk/models/shipping_preference.rb +26 -0
  228. data/lib/paypal_server_sdk/models/shipping_type.rb +29 -0
  229. data/lib/paypal_server_sdk/models/shipping_with_tracking_details.rb +124 -0
  230. data/lib/paypal_server_sdk/models/sofort_payment_object.rb +85 -0
  231. data/lib/paypal_server_sdk/models/sofort_payment_request.rb +73 -0
  232. data/lib/paypal_server_sdk/models/standard_entry_class_code.rb +36 -0
  233. data/lib/paypal_server_sdk/models/store_in_vault_instruction.rb +20 -0
  234. data/lib/paypal_server_sdk/models/stored_payment_source.rb +95 -0
  235. data/lib/paypal_server_sdk/models/stored_payment_source_payment_type.rb +26 -0
  236. data/lib/paypal_server_sdk/models/stored_payment_source_usage_type.rb +27 -0
  237. data/lib/paypal_server_sdk/models/supplementary_data.rb +58 -0
  238. data/lib/paypal_server_sdk/models/supplementary_purchase_data.rb +63 -0
  239. data/lib/paypal_server_sdk/models/tax_id_type.rb +23 -0
  240. data/lib/paypal_server_sdk/models/tax_info.rb +57 -0
  241. data/lib/paypal_server_sdk/models/three_d_secure_authentication_response.rb +62 -0
  242. data/lib/paypal_server_sdk/models/token.rb +56 -0
  243. data/lib/paypal_server_sdk/models/token_request_type.rb +23 -0
  244. data/lib/paypal_server_sdk/models/token_type.rb +20 -0
  245. data/lib/paypal_server_sdk/models/trustly_payment_object.rb +85 -0
  246. data/lib/paypal_server_sdk/models/trustly_payment_request.rb +73 -0
  247. data/lib/paypal_server_sdk/models/universal_product_code.rb +56 -0
  248. data/lib/paypal_server_sdk/models/upc_type.rb +38 -0
  249. data/lib/paypal_server_sdk/models/vault_customer.rb +50 -0
  250. data/lib/paypal_server_sdk/models/vault_experience_context.rb +112 -0
  251. data/lib/paypal_server_sdk/models/vault_instruction.rb +50 -0
  252. data/lib/paypal_server_sdk/models/vault_instruction_base.rb +52 -0
  253. data/lib/paypal_server_sdk/models/vault_pay_pal_wallet_request.rb +115 -0
  254. data/lib/paypal_server_sdk/models/vault_response.rb +86 -0
  255. data/lib/paypal_server_sdk/models/vault_status.rb +26 -0
  256. data/lib/paypal_server_sdk/models/vault_token_request.rb +56 -0
  257. data/lib/paypal_server_sdk/models/vault_venmo_experience_context.rb +73 -0
  258. data/lib/paypal_server_sdk/models/vault_venmo_request.rb +115 -0
  259. data/lib/paypal_server_sdk/models/vaulted_digital_wallet.rb +106 -0
  260. data/lib/paypal_server_sdk/models/vaulted_digital_wallet_shipping_details.rb +75 -0
  261. data/lib/paypal_server_sdk/models/venmo_payment_token.rb +169 -0
  262. data/lib/paypal_server_sdk/models/venmo_payment_token_customer_type.rb +25 -0
  263. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_pattern.rb +35 -0
  264. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_type.rb +23 -0
  265. data/lib/paypal_server_sdk/models/venmo_wallet_additional_attributes.rb +60 -0
  266. data/lib/paypal_server_sdk/models/venmo_wallet_attributes_response.rb +50 -0
  267. data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +63 -0
  268. data/lib/paypal_server_sdk/models/venmo_wallet_experience_context.rb +65 -0
  269. data/lib/paypal_server_sdk/models/venmo_wallet_request.rb +89 -0
  270. data/lib/paypal_server_sdk/models/venmo_wallet_response.rb +120 -0
  271. data/lib/paypal_server_sdk/models/venmo_wallet_vault_attributes.rb +114 -0
  272. data/lib/paypal_server_sdk/utilities/date_time_helper.rb +11 -0
  273. data/lib/paypal_server_sdk/utilities/file_wrapper.rb +16 -0
  274. data/lib/paypal_server_sdk.rb +306 -0
  275. metadata +357 -0
@@ -0,0 +1,404 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # PaymentsController
8
+ class PaymentsController < BaseController
9
+ # Shows details for an authorized payment, by ID.
10
+ # @param [String] authorization_id Required parameter: The ID of the
11
+ # authorized payment for which to show details.
12
+ # @return [ApiResponse] the complete http response with raw body and status code.
13
+ def authorizations_get(authorization_id)
14
+ new_api_call_builder
15
+ .request(new_request_builder(HttpMethodEnum::GET,
16
+ '/v2/payments/authorizations/{authorization_id}',
17
+ Server::DEFAULT)
18
+ .template_param(new_parameter(authorization_id, key: 'authorization_id')
19
+ .should_encode(true))
20
+ .header_param(new_parameter('application/json', key: 'accept'))
21
+ .auth(Single.new('Oauth2')))
22
+ .response(new_response_handler
23
+ .deserializer(APIHelper.method(:custom_type_deserializer))
24
+ .deserialize_into(PaymentAuthorization.method(:from_hash))
25
+ .is_api_response(true)
26
+ .local_error('401',
27
+ 'Authentication failed due to missing authorization header, or'\
28
+ ' invalid authentication credentials.',
29
+ ErrorException)
30
+ .local_error('403',
31
+ 'The request failed because the caller has insufficient'\
32
+ ' permissions.',
33
+ ErrorException)
34
+ .local_error('404',
35
+ 'The request failed because the resource does not exist.',
36
+ ErrorException)
37
+ .local_error('500',
38
+ 'The request failed because an internal server error occurred.',
39
+ APIException)
40
+ .local_error('default',
41
+ 'The error response.',
42
+ ErrorException))
43
+ .execute
44
+ end
45
+
46
+ # Captures an authorized payment, by ID.
47
+ # @param [String] authorization_id Required parameter: The PayPal-generated
48
+ # ID for the authorized payment to capture.
49
+ # @param [String] pay_pal_request_id Optional parameter: The server stores
50
+ # keys for 45 days.
51
+ # @param [String] prefer Optional parameter: The preferred server response
52
+ # upon successful completion of the request. Value
53
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
54
+ # response to optimize communication between the API caller and the server.
55
+ # A minimal response includes the <code>id</code>, <code>status</code> and
56
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
57
+ # returns a complete resource representation, including the current state of
58
+ # the resource.</li></ul>
59
+ # @param [CaptureRequest] body Optional parameter: Example:
60
+ # @return [ApiResponse] the complete http response with raw body and status code.
61
+ def authorizations_capture(options = {})
62
+ new_api_call_builder
63
+ .request(new_request_builder(HttpMethodEnum::POST,
64
+ '/v2/payments/authorizations/{authorization_id}/capture',
65
+ Server::DEFAULT)
66
+ .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
67
+ .should_encode(true))
68
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
69
+ .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
70
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
71
+ .body_param(new_parameter(options['body']))
72
+ .header_param(new_parameter('application/json', key: 'accept'))
73
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
74
+ .auth(Single.new('Oauth2')))
75
+ .response(new_response_handler
76
+ .deserializer(APIHelper.method(:custom_type_deserializer))
77
+ .deserialize_into(CapturedPayment.method(:from_hash))
78
+ .is_api_response(true)
79
+ .local_error('400',
80
+ 'The request failed because it is not well-formed or is'\
81
+ ' syntactically incorrect or violates schema.',
82
+ ErrorException)
83
+ .local_error('401',
84
+ 'Authentication failed due to missing authorization header, or'\
85
+ ' invalid authentication credentials.',
86
+ ErrorException)
87
+ .local_error('403',
88
+ 'The request failed because the caller has insufficient'\
89
+ ' permissions.',
90
+ ErrorException)
91
+ .local_error('404',
92
+ 'The request failed because the resource does not exist.',
93
+ ErrorException)
94
+ .local_error('409',
95
+ 'The server has detected a conflict while processing this'\
96
+ ' request.',
97
+ ErrorException)
98
+ .local_error('422',
99
+ 'The request failed because it is semantically incorrect or'\
100
+ ' failed business validation.',
101
+ ErrorException)
102
+ .local_error('500',
103
+ 'The request failed because an internal server error occurred.',
104
+ APIException)
105
+ .local_error('default',
106
+ 'The error response.',
107
+ ErrorException))
108
+ .execute
109
+ end
110
+
111
+ # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
112
+ # funds are still available, reauthorize a payment after its initial
113
+ # three-day honor period expires. Within the 29-day authorization period,
114
+ # you can issue multiple re-authorizations after the honor period
115
+ # expires.<br/><br/>If 30 days have transpired since the date of the
116
+ # original authorization, you must create an authorized payment instead of
117
+ # reauthorizing the original authorized payment.<br/><br/>A reauthorized
118
+ # payment itself has a new honor period of three days.<br/><br/>You can
119
+ # reauthorize an authorized payment from 4 to 29 days after the 3-day honor
120
+ # period. The allowed amount depends on context and geography, for example
121
+ # in US it is up to 115% of the original authorized amount, not to exceed an
122
+ # increase of $75 USD.<br/><br/>Supports only the `amount` request
123
+ # parameter.<blockquote><strong>Note:</strong> This request is currently not
124
+ # supported for Partner use cases.</blockquote>
125
+ # @param [String] authorization_id Required parameter: The PayPal-generated
126
+ # ID for the authorized payment to reauthorize.
127
+ # @param [String] pay_pal_request_id Optional parameter: The server stores
128
+ # keys for 45 days.
129
+ # @param [String] prefer Optional parameter: The preferred server response
130
+ # upon successful completion of the request. Value
131
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
132
+ # response to optimize communication between the API caller and the server.
133
+ # A minimal response includes the <code>id</code>, <code>status</code> and
134
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
135
+ # returns a complete resource representation, including the current state of
136
+ # the resource.</li></ul>
137
+ # @param [ReauthorizeRequest] body Optional parameter: Example:
138
+ # @return [ApiResponse] the complete http response with raw body and status code.
139
+ def authorizations_reauthorize(options = {})
140
+ new_api_call_builder
141
+ .request(new_request_builder(HttpMethodEnum::POST,
142
+ '/v2/payments/authorizations/{authorization_id}/reauthorize',
143
+ Server::DEFAULT)
144
+ .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
145
+ .should_encode(true))
146
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
147
+ .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
148
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
149
+ .body_param(new_parameter(options['body']))
150
+ .header_param(new_parameter('application/json', key: 'accept'))
151
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
152
+ .auth(Single.new('Oauth2')))
153
+ .response(new_response_handler
154
+ .deserializer(APIHelper.method(:custom_type_deserializer))
155
+ .deserialize_into(PaymentAuthorization.method(:from_hash))
156
+ .is_api_response(true)
157
+ .local_error('400',
158
+ 'The request failed because it is not well-formed or is'\
159
+ ' syntactically incorrect or violates schema.',
160
+ ErrorException)
161
+ .local_error('401',
162
+ 'Authentication failed due to missing authorization header, or'\
163
+ ' invalid authentication credentials.',
164
+ ErrorException)
165
+ .local_error('403',
166
+ 'The request failed because the caller has insufficient'\
167
+ ' permissions.',
168
+ ErrorException)
169
+ .local_error('404',
170
+ 'The request failed because the resource does not exist.',
171
+ ErrorException)
172
+ .local_error('422',
173
+ 'The request failed because it either is semantically incorrect'\
174
+ ' or failed business validation.',
175
+ ErrorException)
176
+ .local_error('500',
177
+ 'The request failed because an internal server error occurred.',
178
+ APIException)
179
+ .local_error('default',
180
+ 'The error response.',
181
+ ErrorException))
182
+ .execute
183
+ end
184
+
185
+ # Voids, or cancels, an authorized payment, by ID. You cannot void an
186
+ # authorized payment that has been fully captured.
187
+ # @param [String] authorization_id Required parameter: The PayPal-generated
188
+ # ID for the authorized payment to void.
189
+ # @param [String] pay_pal_auth_assertion Optional parameter: An
190
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
191
+ # merchant. For details, see
192
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
193
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
194
+ # which a partner is managing the API calls on behalf of a merchant, the
195
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
196
+ # header or an access token with target_subject.</blockquote>
197
+ # @param [String] prefer Optional parameter: The preferred server response
198
+ # upon successful completion of the request. Value
199
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
200
+ # response to optimize communication between the API caller and the server.
201
+ # A minimal response includes the <code>id</code>, <code>status</code> and
202
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
203
+ # returns a complete resource representation, including the current state of
204
+ # the resource.</li></ul>
205
+ # @return [ApiResponse] the complete http response with raw body and status code.
206
+ def authorizations_void(options = {})
207
+ new_api_call_builder
208
+ .request(new_request_builder(HttpMethodEnum::POST,
209
+ '/v2/payments/authorizations/{authorization_id}/void',
210
+ Server::DEFAULT)
211
+ .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
212
+ .should_encode(true))
213
+ .header_param(new_parameter(options['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
214
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
215
+ .header_param(new_parameter('application/json', key: 'accept'))
216
+ .auth(Single.new('Oauth2')))
217
+ .response(new_response_handler
218
+ .is_nullable_response(true)
219
+ .deserializer(APIHelper.method(:custom_type_deserializer))
220
+ .deserialize_into(PaymentAuthorization.method(:from_hash))
221
+ .is_api_response(true)
222
+ .local_error('400',
223
+ 'The request failed because it is not well-formed or is'\
224
+ ' syntactically incorrect or violates schema.',
225
+ ErrorException)
226
+ .local_error('401',
227
+ 'Authentication failed due to missing authorization header, or'\
228
+ ' invalid authentication credentials.',
229
+ ErrorException)
230
+ .local_error('403',
231
+ 'The request failed because the caller has insufficient'\
232
+ ' permissions.',
233
+ ErrorException)
234
+ .local_error('404',
235
+ 'The request failed because the resource does not exist.',
236
+ ErrorException)
237
+ .local_error('409',
238
+ 'The request failed because a previous call for the given'\
239
+ ' resource is in progress.',
240
+ ErrorException)
241
+ .local_error('422',
242
+ 'The request failed because it either is semantically incorrect'\
243
+ ' or failed business validation.',
244
+ ErrorException)
245
+ .local_error('500',
246
+ 'The request failed because an internal server error occurred.',
247
+ APIException)
248
+ .local_error('default',
249
+ 'The error response.',
250
+ ErrorException))
251
+ .execute
252
+ end
253
+
254
+ # Shows details for a captured payment, by ID.
255
+ # @param [String] capture_id Required parameter: The PayPal-generated ID for
256
+ # the captured payment for which to show details.
257
+ # @return [ApiResponse] the complete http response with raw body and status code.
258
+ def captures_get(capture_id)
259
+ new_api_call_builder
260
+ .request(new_request_builder(HttpMethodEnum::GET,
261
+ '/v2/payments/captures/{capture_id}',
262
+ Server::DEFAULT)
263
+ .template_param(new_parameter(capture_id, key: 'capture_id')
264
+ .should_encode(true))
265
+ .header_param(new_parameter('application/json', key: 'accept'))
266
+ .auth(Single.new('Oauth2')))
267
+ .response(new_response_handler
268
+ .deserializer(APIHelper.method(:custom_type_deserializer))
269
+ .deserialize_into(CapturedPayment.method(:from_hash))
270
+ .is_api_response(true)
271
+ .local_error('401',
272
+ 'Authentication failed due to missing authorization header, or'\
273
+ ' invalid authentication credentials.',
274
+ ErrorException)
275
+ .local_error('403',
276
+ 'The request failed because the caller has insufficient'\
277
+ ' permissions.',
278
+ ErrorException)
279
+ .local_error('404',
280
+ 'The request failed because the resource does not exist.',
281
+ ErrorException)
282
+ .local_error('500',
283
+ 'The request failed because an internal server error occurred.',
284
+ APIException)
285
+ .local_error('default',
286
+ 'The error response.',
287
+ ErrorException))
288
+ .execute
289
+ end
290
+
291
+ # Refunds a captured payment, by ID. For a full refund, include an empty
292
+ # payload in the JSON request body. For a partial refund, include an
293
+ # <code>amount</code> object in the JSON request body.
294
+ # @param [String] capture_id Required parameter: The PayPal-generated ID for
295
+ # the captured payment to refund.
296
+ # @param [String] pay_pal_request_id Optional parameter: The server stores
297
+ # keys for 45 days.
298
+ # @param [String] prefer Optional parameter: The preferred server response
299
+ # upon successful completion of the request. Value
300
+ # is:<ul><li><code>return=minimal</code>. The server returns a minimal
301
+ # response to optimize communication between the API caller and the server.
302
+ # A minimal response includes the <code>id</code>, <code>status</code> and
303
+ # HATEOAS links.</li><li><code>return=representation</code>. The server
304
+ # returns a complete resource representation, including the current state of
305
+ # the resource.</li></ul>
306
+ # @param [String] pay_pal_auth_assertion Optional parameter: An
307
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
308
+ # merchant. For details, see
309
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
310
+ # rtion).<blockquote><strong>Note:</strong>For three party transactions in
311
+ # which a partner is managing the API calls on behalf of a merchant, the
312
+ # partner must identify the merchant using either a PayPal-Auth-Assertion
313
+ # header or an access token with target_subject.</blockquote>
314
+ # @param [RefundRequest] body Optional parameter: Example:
315
+ # @return [ApiResponse] the complete http response with raw body and status code.
316
+ def captures_refund(options = {})
317
+ new_api_call_builder
318
+ .request(new_request_builder(HttpMethodEnum::POST,
319
+ '/v2/payments/captures/{capture_id}/refund',
320
+ Server::DEFAULT)
321
+ .template_param(new_parameter(options['capture_id'], key: 'capture_id')
322
+ .should_encode(true))
323
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
324
+ .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
325
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
326
+ .header_param(new_parameter(options['pay_pal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
327
+ .body_param(new_parameter(options['body']))
328
+ .header_param(new_parameter('application/json', key: 'accept'))
329
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
330
+ .auth(Single.new('Oauth2')))
331
+ .response(new_response_handler
332
+ .deserializer(APIHelper.method(:custom_type_deserializer))
333
+ .deserialize_into(Refund.method(:from_hash))
334
+ .is_api_response(true)
335
+ .local_error('400',
336
+ 'The request failed because it is not well-formed or is'\
337
+ ' syntactically incorrect or violates schema.',
338
+ ErrorException)
339
+ .local_error('401',
340
+ 'Authentication failed due to missing authorization header, or'\
341
+ ' invalid authentication credentials.',
342
+ ErrorException)
343
+ .local_error('403',
344
+ 'The request failed because the caller has insufficient'\
345
+ ' permissions.',
346
+ ErrorException)
347
+ .local_error('404',
348
+ 'The request failed because the resource does not exist.',
349
+ ErrorException)
350
+ .local_error('409',
351
+ 'The request failed because a previous call for the given'\
352
+ ' resource is in progress.',
353
+ ErrorException)
354
+ .local_error('422',
355
+ 'The request failed because it either is semantically incorrect'\
356
+ ' or failed business validation.',
357
+ ErrorException)
358
+ .local_error('500',
359
+ 'The request failed because an internal server error occurred.',
360
+ APIException)
361
+ .local_error('default',
362
+ 'The error response.',
363
+ ErrorException))
364
+ .execute
365
+ end
366
+
367
+ # Shows details for a refund, by ID.
368
+ # @param [String] refund_id Required parameter: The PayPal-generated ID for
369
+ # the refund for which to show details.
370
+ # @return [ApiResponse] the complete http response with raw body and status code.
371
+ def refunds_get(refund_id)
372
+ new_api_call_builder
373
+ .request(new_request_builder(HttpMethodEnum::GET,
374
+ '/v2/payments/refunds/{refund_id}',
375
+ Server::DEFAULT)
376
+ .template_param(new_parameter(refund_id, key: 'refund_id')
377
+ .should_encode(true))
378
+ .header_param(new_parameter('application/json', key: 'accept'))
379
+ .auth(Single.new('Oauth2')))
380
+ .response(new_response_handler
381
+ .deserializer(APIHelper.method(:custom_type_deserializer))
382
+ .deserialize_into(Refund.method(:from_hash))
383
+ .is_api_response(true)
384
+ .local_error('401',
385
+ 'Authentication failed due to missing authorization header, or'\
386
+ ' invalid authentication credentials.',
387
+ ErrorException)
388
+ .local_error('403',
389
+ 'The request failed because the caller has insufficient'\
390
+ ' permissions.',
391
+ ErrorException)
392
+ .local_error('404',
393
+ 'The request failed because the resource does not exist.',
394
+ ErrorException)
395
+ .local_error('500',
396
+ 'The request failed because an internal server error occurred.',
397
+ APIException)
398
+ .local_error('default',
399
+ 'The error response.',
400
+ ErrorException))
401
+ .execute
402
+ end
403
+ end
404
+ end
@@ -0,0 +1,224 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # VaultController
8
+ class VaultController < BaseController
9
+ # Creates a Payment Token from the given payment source and adds it to the
10
+ # Vault of the associated customer.
11
+ # @param [String] pay_pal_request_id Required parameter: The server stores
12
+ # keys for 3 hours.
13
+ # @param [PaymentTokenRequest] body Required parameter: Payment Token
14
+ # creation with a financial instrument and an optional customer_id.
15
+ # @return [ApiResponse] the complete http response with raw body and status code.
16
+ def payment_tokens_create(options = {})
17
+ new_api_call_builder
18
+ .request(new_request_builder(HttpMethodEnum::POST,
19
+ '/v3/vault/payment-tokens',
20
+ Server::DEFAULT)
21
+ .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
22
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
23
+ .body_param(new_parameter(options['body']))
24
+ .header_param(new_parameter('application/json', key: 'accept'))
25
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
26
+ .auth(Single.new('Oauth2')))
27
+ .response(new_response_handler
28
+ .deserializer(APIHelper.method(:custom_type_deserializer))
29
+ .deserialize_into(PaymentTokenResponse.method(:from_hash))
30
+ .is_api_response(true)
31
+ .local_error('400',
32
+ 'Request is not well-formed, syntactically incorrect, or'\
33
+ ' violates schema.',
34
+ ErrorException)
35
+ .local_error('403',
36
+ 'Authorization failed due to insufficient permissions.',
37
+ ErrorException)
38
+ .local_error('404',
39
+ 'Request contains reference to resources that do not exist.',
40
+ ErrorException)
41
+ .local_error('422',
42
+ 'The requested action could not be performed, semantically'\
43
+ ' incorrect, or failed business validation.',
44
+ ErrorException)
45
+ .local_error('500',
46
+ 'An internal server error has occurred.',
47
+ ErrorException))
48
+ .execute
49
+ end
50
+
51
+ # Returns all payment tokens for a customer.
52
+ # @param [String] customer_id Required parameter: A unique identifier
53
+ # representing a specific customer in merchant's/partner's system or
54
+ # records.
55
+ # @param [Integer] page_size Optional parameter: A non-negative, non-zero
56
+ # integer indicating the maximum number of results to return at one time.
57
+ # @param [Integer] page Optional parameter: A non-negative, non-zero integer
58
+ # representing the page of the results.
59
+ # @param [TrueClass | FalseClass] total_required Optional parameter: A
60
+ # boolean indicating total number of items (total_items) and pages
61
+ # (total_pages) are expected to be returned in the response.
62
+ # @return [ApiResponse] the complete http response with raw body and status code.
63
+ def customer_payment_tokens_get(options = {})
64
+ new_api_call_builder
65
+ .request(new_request_builder(HttpMethodEnum::GET,
66
+ '/v3/vault/payment-tokens',
67
+ Server::DEFAULT)
68
+ .query_param(new_parameter(options['customer_id'], key: 'customer_id'))
69
+ .query_param(new_parameter(options['page_size'], key: 'page_size'))
70
+ .query_param(new_parameter(options['page'], key: 'page'))
71
+ .query_param(new_parameter(options['total_required'], key: 'total_required'))
72
+ .header_param(new_parameter('application/json', key: 'accept'))
73
+ .auth(Single.new('Oauth2')))
74
+ .response(new_response_handler
75
+ .deserializer(APIHelper.method(:custom_type_deserializer))
76
+ .deserialize_into(CustomerVaultPaymentTokensResponse.method(:from_hash))
77
+ .is_api_response(true)
78
+ .local_error('400',
79
+ 'Request is not well-formed, syntactically incorrect, or'\
80
+ ' violates schema.',
81
+ ErrorException)
82
+ .local_error('403',
83
+ 'Authorization failed due to insufficient permissions.',
84
+ ErrorException)
85
+ .local_error('500',
86
+ 'An internal server error has occurred.',
87
+ ErrorException))
88
+ .execute
89
+ end
90
+
91
+ # Returns a readable representation of vaulted payment source associated
92
+ # with the payment token id.
93
+ # @param [String] id Required parameter: ID of the payment token.
94
+ # @return [ApiResponse] the complete http response with raw body and status code.
95
+ def payment_tokens_get(id)
96
+ new_api_call_builder
97
+ .request(new_request_builder(HttpMethodEnum::GET,
98
+ '/v3/vault/payment-tokens/{id}',
99
+ Server::DEFAULT)
100
+ .template_param(new_parameter(id, key: 'id')
101
+ .should_encode(true))
102
+ .header_param(new_parameter('application/json', key: 'accept'))
103
+ .auth(Single.new('Oauth2')))
104
+ .response(new_response_handler
105
+ .deserializer(APIHelper.method(:custom_type_deserializer))
106
+ .deserialize_into(PaymentTokenResponse.method(:from_hash))
107
+ .is_api_response(true)
108
+ .local_error('403',
109
+ 'Authorization failed due to insufficient permissions.',
110
+ ErrorException)
111
+ .local_error('404',
112
+ 'The specified resource does not exist.',
113
+ ErrorException)
114
+ .local_error('422',
115
+ 'The requested action could not be performed, semantically'\
116
+ ' incorrect, or failed business validation.',
117
+ ErrorException)
118
+ .local_error('500',
119
+ 'An internal server error has occurred.',
120
+ ErrorException))
121
+ .execute
122
+ end
123
+
124
+ # Delete the payment token associated with the payment token id.
125
+ # @param [String] id Required parameter: ID of the payment token.
126
+ # @return [ApiResponse] the complete http response with raw body and status code.
127
+ def payment_tokens_delete(id)
128
+ new_api_call_builder
129
+ .request(new_request_builder(HttpMethodEnum::DELETE,
130
+ '/v3/vault/payment-tokens/{id}',
131
+ Server::DEFAULT)
132
+ .template_param(new_parameter(id, key: 'id')
133
+ .should_encode(true))
134
+ .auth(Single.new('Oauth2')))
135
+ .response(new_response_handler
136
+ .is_response_void(true)
137
+ .is_api_response(true)
138
+ .local_error('400',
139
+ 'Request is not well-formed, syntactically incorrect, or'\
140
+ ' violates schema.',
141
+ ErrorException)
142
+ .local_error('403',
143
+ 'Authorization failed due to insufficient permissions.',
144
+ ErrorException)
145
+ .local_error('500',
146
+ 'An internal server error has occurred.',
147
+ ErrorException))
148
+ .execute
149
+ end
150
+
151
+ # Creates a Setup Token from the given payment source and adds it to the
152
+ # Vault of the associated customer.
153
+ # @param [String] pay_pal_request_id Required parameter: The server stores
154
+ # keys for 3 hours.
155
+ # @param [SetupTokenRequest] body Required parameter: Setup Token creation
156
+ # with a instrument type optional financial instrument details and
157
+ # customer_id.
158
+ # @return [ApiResponse] the complete http response with raw body and status code.
159
+ def setup_tokens_create(options = {})
160
+ new_api_call_builder
161
+ .request(new_request_builder(HttpMethodEnum::POST,
162
+ '/v3/vault/setup-tokens',
163
+ Server::DEFAULT)
164
+ .header_param(new_parameter(options['pay_pal_request_id'], key: 'PayPal-Request-Id'))
165
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
166
+ .body_param(new_parameter(options['body']))
167
+ .header_param(new_parameter('application/json', key: 'accept'))
168
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
169
+ .auth(Single.new('Oauth2')))
170
+ .response(new_response_handler
171
+ .deserializer(APIHelper.method(:custom_type_deserializer))
172
+ .deserialize_into(SetupTokenResponse.method(:from_hash))
173
+ .is_api_response(true)
174
+ .local_error('400',
175
+ 'Request is not well-formed, syntactically incorrect, or'\
176
+ ' violates schema.',
177
+ ErrorException)
178
+ .local_error('403',
179
+ 'Authorization failed due to insufficient permissions.',
180
+ ErrorException)
181
+ .local_error('422',
182
+ 'The requested action could not be performed, semantically'\
183
+ ' incorrect, or failed business validation.',
184
+ ErrorException)
185
+ .local_error('500',
186
+ 'An internal server error has occurred.',
187
+ ErrorException))
188
+ .execute
189
+ end
190
+
191
+ # Returns a readable representation of temporarily vaulted payment source
192
+ # associated with the setup token id.
193
+ # @param [String] id Required parameter: ID of the setup token.
194
+ # @return [ApiResponse] the complete http response with raw body and status code.
195
+ def setup_tokens_get(id)
196
+ new_api_call_builder
197
+ .request(new_request_builder(HttpMethodEnum::GET,
198
+ '/v3/vault/setup-tokens/{id}',
199
+ Server::DEFAULT)
200
+ .template_param(new_parameter(id, key: 'id')
201
+ .should_encode(true))
202
+ .header_param(new_parameter('application/json', key: 'accept'))
203
+ .auth(Single.new('Oauth2')))
204
+ .response(new_response_handler
205
+ .deserializer(APIHelper.method(:custom_type_deserializer))
206
+ .deserialize_into(SetupTokenResponse.method(:from_hash))
207
+ .is_api_response(true)
208
+ .local_error('403',
209
+ 'Authorization failed due to insufficient permissions.',
210
+ ErrorException)
211
+ .local_error('404',
212
+ 'The specified resource does not exist.',
213
+ ErrorException)
214
+ .local_error('422',
215
+ 'The requested action could not be performed, semantically'\
216
+ ' incorrect, or failed business validation.',
217
+ ErrorException)
218
+ .local_error('500',
219
+ 'An internal server error has occurred.',
220
+ ErrorException))
221
+ .execute
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,10 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ end
10
+ end