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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 88bc2301cf2feacf73428ce4707d173897465a7ee792c126a85e47ec7f86593b
4
+ data.tar.gz: 4b1973c0d9b3c6d5f892d40fcfae66bb5008d013ab07423f00a517af78f8aec7
5
+ SHA512:
6
+ metadata.gz: 1a9c5698f9e90c8354e74f3a50ebc061c8e951fb7fee253637282e9fd4a29eca322ec94a612fabbef8a7081649721012cecedbb95a05fcb6b2f189ad246dafcd
7
+ data.tar.gz: '09e499681092bbb92fef9f9806034d3555d1f36455550cc249f2683ec2ef25cbf883b0f33c776cf3d6d425c218176faa8386edfa0913398817e777a00f49c7d6'
data/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ The PayPal Server SDK is released under the following license:
2
+
3
+ Copyright (c) 2024 PAYPAL, INC.
4
+
5
+ SDK LICENSE
6
+
7
+ NOTICE TO USER: PayPal, Inc. is providing the Software and Documentation for use under the terms of this Agreement. Any use, reproduction, modification or distribution of the Software or Documentation, or any derivatives or portions hereof, constitutes your acceptance of this Agreement.
8
+ As used in this Agreement, "PayPal" means PayPal, Inc. "Software" means the software code accompanying this agreement. "Documentation" means the documents, specifications and all other items accompanying this Agreement other than the Software.
9
+
10
+ 1. LICENSE GRANT
11
+ Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, prepare derivative works from, publicly display, publicly perform, distribute and sublicense the Software for any purpose, other than perpetration of any fraud or violation of any law, statute, ordinance, or regulation (for example, those governing financial services, consumer protections, unfair competition, anti-discrimination or false advertising), provided the copyright notice below appears in a conspicuous location within the source code of the distributed Software and this license is distributed in the supporting documentation of the Software you distribute. Furthermore, you must comply with all third party licenses in order to use the third party software contained in the Software.
12
+ Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, publicly display, publicly perform, distribute and sublicense the Documentation for any purpose, other than perpetration of any fraud or violation of any law, statute, ordinance, or regulation (for example, those governing financial services, consumer protections, unfair competition, anti-discrimination or false advertising). You may not modify the Documentation.
13
+ No title to the intellectual property in the Software or Documentation is transferred to you under the terms of this Agreement. You do not acquire any rights to the Software or the Documentation except as expressly set forth in this Agreement.
14
+ Nothing in this Agreement provides you with any right, title, or license to use PayPal’s or any third party’s copyright, patent, trademark, trade secret, or other intellectual property rights, or rights of publicity or privacy, beyond the rights specifically granted herein. You may not infringe PayPal’s or any third party’s copyright, patent, trademark, trade secret, or other intellectual property rights, or rights of publicity or privacy.
15
+ If you choose to distribute the Software in a commercial product, you do so with the understanding that you agree to defend, indemnify and hold harmless PayPal and its suppliers against any losses, damages and costs arising from the claims, lawsuits or other legal actions arising out of such distribution. You may distribute the Software in object code form under your own license, provided that your license agreement:
16
+ (a) complies with the terms and conditions of this license agreement;
17
+ (b) effectively disclaims all warranties and conditions, express or implied, on behalf of PayPal;
18
+ (c) effectively excludes all liability for damages on behalf of PayPal;
19
+ (d) states that any provisions that differ from this Agreement are offered by you alone and not PayPal; and
20
+ (e) states that the Software is available from you or PayPal and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
21
+
22
+ 2. DISCLAIMER OF WARRANTY
23
+ PAYPAL LICENSES THE SOFTWARE AND DOCUMENTATION TO YOU ONLY ON AN "AS IS" BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. Each user of the Software or Documentation is solely responsible for determining the appropriateness of using and distributing the Software and Documentation and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs, or equipment, and unavailability or interruption of operations. Use of the Software and Documentation is made with the understanding that PayPal will not provide you with any technical or customer support or maintenance. Some states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied warranties are limited to ninety (90) days.
24
+
25
+ 3. LIMITATION OF LIABILITY
26
+ PAYPAL AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT WILL PAYPAL OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE (OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. PAYPAL'S AGGREGATE LIABILITY AND THAT OF ITS SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
27
+
28
+ 4. TRADEMARK USAGE
29
+ PayPal is a trademark PayPal, Inc. in the United States and other countries. Such trademarks may not be used to endorse or promote any product unless expressly permitted under separate agreement with PayPal.
30
+
31
+ 5. TERM
32
+ Your rights under this Agreement shall terminate if you fail to comply with any of the material terms or conditions of this Agreement and do not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all your rights under this Agreement terminate, you agree to cease use and distribution of the Software and Documentation as soon as reasonably practicable.
33
+
34
+ 6. GOVERNING LAW AND JURISDICTION.
35
+ This Agreement is governed by the statutes and laws of the State of California, without regard to the conflicts of law principles thereof. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. Any dispute arising out of or related to this Agreement shall be brought in the courts of Santa Clara County, California, USA.
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+
2
+ # Getting Started with Paypal Server SDK
3
+
4
+ ## Introduction
5
+
6
+ An order represents a payment between two or more parties. Use the Orders API to create, update, retrieve, authorize, and capture orders., Call the Payments API to authorize payments, capture authorized payments, refund payments that have already been captured, and show payment information. Use the Payments API in conjunction with the <a href="/docs/api/orders/v2/">Orders API</a>. For more information, see the <a href="/docs/checkout/">PayPal Checkout Overview</a>., The Payment Method Tokens API saves payment methods so payers don't have to enter details for future transactions. Payers can check out faster or pay without being present after they agree to save a payment method.<br><br>The API associates a payment method with a temporary setup token. Pass the setup token to the API to exchange the setup token for a permanent token.<br><br>The permanent token represents a payment method that's saved to the vault. This token can be used repeatedly for checkout or recurring transactions such as subscriptions.<br><br>The Payment Method Tokens API is available in the US only.
7
+
8
+ Find out more here: [https://developer.paypal.com/docs/api/orders/v2/](https://developer.paypal.com/docs/api/orders/v2/)
9
+
10
+ ## Install the Package
11
+
12
+ Install the gem from the command line:
13
+
14
+ ```ruby
15
+ gem install paypal-server-sdk -v 0.5.0
16
+ ```
17
+
18
+ Or add the gem to your Gemfile and run `bundle`:
19
+
20
+ ```ruby
21
+ gem 'paypal-server-sdk', '0.5.0'
22
+ ```
23
+
24
+ For additional gem details, see the [RubyGems page for the paypal-server-sdk gem](https://rubygems.org/gems/paypal-server-sdk/versions/0.5.0).
25
+
26
+ ## Initialize the API Client
27
+
28
+ **_Note:_** Documentation for the client can be found [here.](doc/client.md)
29
+
30
+ The following parameters are configurable for the API Client:
31
+
32
+ | Parameter | Type | Description |
33
+ | --- | --- | --- |
34
+ | `environment` | `Environment` | The API environment. <br> **Default: `Environment.SANDBOX`** |
35
+ | `connection` | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
36
+ | `adapter` | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
37
+ | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
38
+ | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
39
+ | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
40
+ | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
41
+ | `retry_statuses` | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
42
+ | `retry_methods` | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
43
+ | `http_callback` | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
44
+ | `logging_configuration` | [`LoggingConfiguration`](__base_path/logging-configuration.md) | The SDK logging configuration for API calls |
45
+ | `client_credentials_auth_credentials` | [`ClientCredentialsAuthCredentials`](__base_path/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
46
+
47
+ The API client can be initialized as follows:
48
+
49
+ ```ruby
50
+ client = PaypalServerSdk::Client.new(
51
+ client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
52
+ o_auth_client_id: 'OAuthClientId',
53
+ o_auth_client_secret: 'OAuthClientSecret'
54
+ ),
55
+ environment: Environment::SANDBOX,
56
+ logging_configuration: LoggingConfiguration.new(
57
+ log_level: Logger::INFO,
58
+ request_logging_config: RequestLoggingConfiguration.new(
59
+ log_body: true
60
+ ),
61
+ response_logging_config: ResponseLoggingConfiguration.new(
62
+ log_headers: true
63
+ )
64
+ )
65
+ )
66
+ ```
67
+
68
+ API calls return an `ApiResponse` object that includes the following fields:
69
+
70
+ | Field | Description |
71
+ | --- | --- |
72
+ | `status_code` | Status code of the HTTP response |
73
+ | `reason_phrase` | Reason phrase of the HTTP response |
74
+ | `headers` | Headers of the HTTP response as a Hash |
75
+ | `raw_body` | The body of the HTTP response as a String |
76
+ | `request` | HTTP request info |
77
+ | `errors` | Errors, if they exist |
78
+ | `data` | The deserialized body of the HTTP response |
79
+
80
+ ## Environments
81
+
82
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
83
+
84
+ ### Fields
85
+
86
+ | Name | Description |
87
+ | --- | --- |
88
+ | Production | PayPal Live Environment |
89
+ | Sandbox | **Default** PayPal Sandbox Environment |
90
+
91
+ ## Authorization
92
+
93
+ This API uses the following authentication schemes.
94
+
95
+ * [`Oauth2 (OAuth 2 Client Credentials Grant)`](__base_path/auth/oauth-2-client-credentials-grant.md)
96
+
97
+ ## List of APIs
98
+
99
+ * [Orders](doc/controllers/orders.md)
100
+ * [Payments](doc/controllers/payments.md)
101
+ * [Vault](doc/controllers/vault.md)
102
+
103
+ ## Classes Documentation
104
+
105
+ * [Utility Classes](doc/utility-classes.md)
106
+ * [HttpResponse](doc/http-response.md)
107
+ * [HttpRequest](doc/http-request.md)
108
+ * [LoggingConfiguration](doc/logging-configuration.md)
109
+ * [RequestLoggingConfiguration](doc/request-logging-configuration.md)
110
+ * [ResponseLoggingConfiguration](doc/response-logging-configuration.md)
111
+ * [Abstract Logger](doc/abstract-logger.md)
112
+
@@ -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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,85 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # paypal_server_sdk client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ # Returns the configured authentication Oauth2 instance.
13
+ def oauth2
14
+ @auth_managers['Oauth2']
15
+ end
16
+
17
+ # Access to orders controller.
18
+ # @return [OrdersController] Returns the controller instance.
19
+ def orders
20
+ @orders ||= OrdersController.new @global_configuration
21
+ end
22
+
23
+ # Access to payments controller.
24
+ # @return [PaymentsController] Returns the controller instance.
25
+ def payments
26
+ @payments ||= PaymentsController.new @global_configuration
27
+ end
28
+
29
+ # Access to vault controller.
30
+ # @return [VaultController] Returns the controller instance.
31
+ def vault
32
+ @vault ||= VaultController.new @global_configuration
33
+ end
34
+
35
+ # Access to o_auth_authorization controller.
36
+ # @return [OAuthAuthorizationController] Returns the controller instance.
37
+ def o_auth_authorization
38
+ @o_auth_authorization ||= OAuthAuthorizationController.new @global_configuration
39
+ end
40
+
41
+ def initialize(
42
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
43
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
44
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
45
+ retry_methods: %i[get put], http_callback: nil,
46
+ logging_configuration: nil, environment: Environment::SANDBOX,
47
+ client_credentials_auth_credentials: nil, config: nil
48
+ )
49
+ @config = if config.nil?
50
+ Configuration.new(
51
+ connection: connection, adapter: adapter, timeout: timeout,
52
+ max_retries: max_retries, retry_interval: retry_interval,
53
+ backoff_factor: backoff_factor,
54
+ retry_statuses: retry_statuses,
55
+ retry_methods: retry_methods, http_callback: http_callback,
56
+ logging_configuration: logging_configuration,
57
+ environment: environment,
58
+ client_credentials_auth_credentials: client_credentials_auth_credentials
59
+ )
60
+ else
61
+ config
62
+ end
63
+ user_agent_params = BaseController.user_agent_parameters
64
+
65
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
66
+ .base_uri_executor(@config.method(:get_base_uri))
67
+ .global_errors(BaseController::GLOBAL_ERRORS)
68
+ .user_agent(BaseController.user_agent,
69
+ agent_parameters: user_agent_params)
70
+
71
+ initialize_auth_managers(@global_configuration)
72
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
73
+ end
74
+
75
+ # Initializes the auth managers hash used for authenticating API calls.
76
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
77
+ def initialize_auth_managers(global_config)
78
+ @auth_managers = {}
79
+ http_client_config = global_config.client_configuration
80
+ %w[Oauth2].each { |auth| @auth_managers[auth] = nil }
81
+ @auth_managers['Oauth2'] = OAuth2.new(http_client_config.client_credentials_auth_credentials,
82
+ global_config)
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,109 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ # PRODUCTION: PayPal Live Environment
10
+ # SANDBOX: PayPal Sandbox Environment
11
+ ENVIRONMENT = [
12
+ PRODUCTION = 'Production'.freeze,
13
+ SANDBOX = 'Sandbox'.freeze
14
+ ].freeze
15
+ end
16
+
17
+ # An enum for API servers.
18
+ class Server
19
+ SERVER = [
20
+ DEFAULT = 'default'.freeze
21
+ ].freeze
22
+ end
23
+
24
+ # All configuration including auth info and base URI for the API access
25
+ # are configured in this class.
26
+ class Configuration < CoreLibrary::HttpClientConfiguration
27
+ # The attribute readers for properties.
28
+ attr_reader :environment, :client_credentials_auth_credentials
29
+
30
+ class << self
31
+ attr_reader :environments
32
+ end
33
+
34
+ def initialize(
35
+ connection: nil, adapter: :net_http_persistent, timeout: 60,
36
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
37
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
38
+ retry_methods: %i[get put], http_callback: nil,
39
+ logging_configuration: nil, environment: Environment::SANDBOX,
40
+ client_credentials_auth_credentials: nil
41
+ )
42
+
43
+ super connection: connection, adapter: adapter, timeout: timeout,
44
+ max_retries: max_retries, retry_interval: retry_interval,
45
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
46
+ retry_methods: retry_methods, http_callback: http_callback,
47
+ logging_configuration: logging_configuration
48
+
49
+ # Current API environment
50
+ @environment = String(environment)
51
+
52
+ # The object holding OAuth 2 Client Credentials Grant credentials
53
+ @client_credentials_auth_credentials = client_credentials_auth_credentials
54
+
55
+ # Initializing OAuth 2 Client Credentials Grant credentials with the provided auth parameters
56
+ @client_credentials_auth_credentials = client_credentials_auth_credentials
57
+
58
+ # The Http Client to use for making requests.
59
+ set_http_client CoreLibrary::FaradayClient.new(self)
60
+ end
61
+
62
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
63
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
64
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
65
+ logging_configuration: nil, environment: nil,
66
+ client_credentials_auth_credentials: nil)
67
+ connection ||= self.connection
68
+ adapter ||= self.adapter
69
+ timeout ||= self.timeout
70
+ max_retries ||= self.max_retries
71
+ retry_interval ||= self.retry_interval
72
+ backoff_factor ||= self.backoff_factor
73
+ retry_statuses ||= self.retry_statuses
74
+ retry_methods ||= self.retry_methods
75
+ http_callback ||= self.http_callback
76
+ logging_configuration ||= self.logging_configuration
77
+ environment ||= self.environment
78
+ client_credentials_auth_credentials ||= client_credentials_auth_credentials
79
+
80
+ Configuration.new(
81
+ connection: connection, adapter: adapter, timeout: timeout,
82
+ max_retries: max_retries, retry_interval: retry_interval,
83
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
84
+ retry_methods: retry_methods, http_callback: http_callback,
85
+ logging_configuration: logging_configuration, environment: environment,
86
+ client_credentials_auth_credentials: client_credentials_auth_credentials
87
+ )
88
+ end
89
+
90
+
91
+ # All the environments the SDK can run in.
92
+ ENVIRONMENTS = {
93
+ Environment::PRODUCTION => {
94
+ Server::DEFAULT => 'https://api-m.paypal.com'
95
+ },
96
+ Environment::SANDBOX => {
97
+ Server::DEFAULT => 'https://api-m.sandbox.paypal.com'
98
+ }
99
+ }.freeze
100
+
101
+ # Generates the appropriate base URI for the environment and the server.
102
+ # @param [Configuration::Server] server The server enum for which the base URI is
103
+ # required.
104
+ # @return [String] The base URI.
105
+ def get_base_uri(server = Server::DEFAULT)
106
+ ENVIRONMENTS[environment][server].clone
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,71 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # BaseController.
8
+ class BaseController
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'PayPal REST API Ruby SDK, Version: 0.5.0, on OS {os-info}'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
19
+ }
20
+ end
21
+
22
+ GLOBAL_ERRORS = {
23
+ 'default' => ErrorCase.new
24
+ .error_message('HTTP response not OK.')
25
+ .exception_type(APIException)
26
+ }.freeze
27
+
28
+ # Initialization constructor.
29
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
30
+ def initialize(global_configuration)
31
+ @global_configuration = global_configuration
32
+ @config = @global_configuration.client_configuration
33
+ @http_call_back = @config.http_callback
34
+ @api_call = ApiCall.new(@global_configuration)
35
+ end
36
+
37
+ # Creates a new builder for the Api Call instance.
38
+ # @return [ApiCall] The instance of ApiCall.
39
+ def new_api_call_builder
40
+ @api_call.new_builder
41
+ end
42
+
43
+ # Creates a new instance of the request builder.
44
+ # @param [String] http_method The HTTP method to use in the request.
45
+ # @param [String] path The endpoint path to use in the request.
46
+ # @param [String] server The server to extract the base uri for the request.
47
+ # @return [RequestBuilder] The instance of RequestBuilder.
48
+ def new_request_builder(http_method, path, server)
49
+ RequestBuilder.new
50
+ .http_method(http_method)
51
+ .path(path)
52
+ .server(server)
53
+ end
54
+
55
+ # Creates a new instance of the response handler.
56
+ # @return [ResponseHandler] The instance of ResponseHandler.
57
+ def new_response_handler
58
+ ResponseHandler.new
59
+ end
60
+
61
+ # Creates a new instance of the parameter.
62
+ # @param [String|optional] key The key of the parameter.
63
+ # @param [Object] value The value of the parameter.
64
+ # @return [Parameter] The instance of Parameter.
65
+ def new_parameter(value, key: nil)
66
+ Parameter.new
67
+ .key(key)
68
+ .value(value)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,42 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # OAuthAuthorizationController
8
+ class OAuthAuthorizationController < BaseController
9
+ # Create a new OAuth 2 token.
10
+ # @param [String] authorization Required parameter: Authorization header in
11
+ # Basic auth format
12
+ # @param [String] scope Optional parameter: Requested scopes as a
13
+ # space-delimited list.
14
+ # @param [Hash] _field_parameters Additional optional form parameters are
15
+ # supported by this endpoint.
16
+ # @return [ApiResponse] the complete http response with raw body and status code.
17
+ def request_token(options = {},
18
+ _field_parameters: nil)
19
+ new_api_call_builder
20
+ .request(new_request_builder(HttpMethodEnum::POST,
21
+ '/v1/oauth2/token',
22
+ Server::DEFAULT)
23
+ .form_param(new_parameter('client_credentials', key: 'grant_type'))
24
+ .header_param(new_parameter(options['authorization'], key: 'Authorization'))
25
+ .form_param(new_parameter(options['scope'], key: 'scope'))
26
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
27
+ .header_param(new_parameter('application/json', key: 'accept'))
28
+ .additional_form_params(_field_parameters))
29
+ .response(new_response_handler
30
+ .deserializer(APIHelper.method(:custom_type_deserializer))
31
+ .deserialize_into(OAuthToken.method(:from_hash))
32
+ .is_api_response(true)
33
+ .local_error('400',
34
+ 'OAuth 2 provider returned an error.',
35
+ OAuthProviderException)
36
+ .local_error('401',
37
+ 'OAuth 2 provider says client authentication failed.',
38
+ OAuthProviderException))
39
+ .execute
40
+ end
41
+ end
42
+ end