paypal-server-sdk 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +34 -34
  3. data/README.md +19 -30
  4. data/lib/paypal_server_sdk/controllers/base_controller.rb +1 -1
  5. data/lib/paypal_server_sdk/controllers/orders_controller.rb +228 -234
  6. data/lib/paypal_server_sdk/controllers/payments_controller.rb +139 -91
  7. data/lib/paypal_server_sdk/controllers/vault_controller.rb +57 -57
  8. data/lib/paypal_server_sdk/exceptions/api_exception.rb +11 -0
  9. data/lib/paypal_server_sdk/exceptions/error_exception.rb +14 -0
  10. data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +14 -0
  11. data/lib/paypal_server_sdk/models/activity_timestamps.rb +17 -6
  12. data/lib/paypal_server_sdk/models/address.rb +24 -9
  13. data/lib/paypal_server_sdk/models/amount_breakdown.rb +17 -0
  14. data/lib/paypal_server_sdk/models/amount_with_breakdown.rb +22 -9
  15. data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +12 -0
  16. data/lib/paypal_server_sdk/models/apple_pay_attributes_response.rb +12 -0
  17. data/lib/paypal_server_sdk/models/apple_pay_card.rb +14 -0
  18. data/lib/paypal_server_sdk/models/apple_pay_card_response.rb +48 -6
  19. data/lib/paypal_server_sdk/models/apple_pay_decrypted_token_data.rb +16 -0
  20. data/lib/paypal_server_sdk/models/apple_pay_payment_data.rb +14 -0
  21. data/lib/paypal_server_sdk/models/apple_pay_payment_data_type.rb +6 -2
  22. data/lib/paypal_server_sdk/models/apple_pay_payment_object.rb +43 -7
  23. data/lib/paypal_server_sdk/models/apple_pay_payment_token.rb +12 -0
  24. data/lib/paypal_server_sdk/models/apple_pay_request.rb +27 -13
  25. data/lib/paypal_server_sdk/models/apple_pay_tokenized_card.rb +15 -0
  26. data/lib/paypal_server_sdk/models/assurance_details.rb +14 -0
  27. data/lib/paypal_server_sdk/models/authentication_response.rb +13 -0
  28. data/lib/paypal_server_sdk/models/authorization.rb +28 -9
  29. data/lib/paypal_server_sdk/models/authorization_incomplete_reason.rb +2 -2
  30. data/lib/paypal_server_sdk/models/authorization_status.rb +12 -6
  31. data/lib/paypal_server_sdk/models/authorization_status_details.rb +12 -0
  32. data/lib/paypal_server_sdk/models/authorization_status_with_details.rb +12 -0
  33. data/lib/paypal_server_sdk/models/authorization_with_additional_data.rb +29 -9
  34. data/lib/paypal_server_sdk/models/avs_code.rb +102 -71
  35. data/lib/paypal_server_sdk/models/bancontact_payment_object.rb +19 -5
  36. data/lib/paypal_server_sdk/models/bancontact_payment_request.rb +18 -5
  37. data/lib/paypal_server_sdk/models/base_model.rb +76 -28
  38. data/lib/paypal_server_sdk/models/billing_cycle.rb +129 -0
  39. data/lib/paypal_server_sdk/models/bin_details.rb +18 -5
  40. data/lib/paypal_server_sdk/models/blik_experience_context.rb +17 -0
  41. data/lib/paypal_server_sdk/models/blik_level0_payment_object.rb +12 -0
  42. data/lib/paypal_server_sdk/models/blik_one_click_payment_object.rb +12 -0
  43. data/lib/paypal_server_sdk/models/blik_one_click_payment_request.rb +15 -0
  44. data/lib/paypal_server_sdk/models/blik_payment_object.rb +22 -10
  45. data/lib/paypal_server_sdk/models/blik_payment_request.rb +24 -10
  46. data/lib/paypal_server_sdk/models/callback_configuration.rb +75 -0
  47. data/lib/paypal_server_sdk/models/callback_events.rb +27 -0
  48. data/lib/paypal_server_sdk/models/capture_incomplete_reason.rb +22 -14
  49. data/lib/paypal_server_sdk/models/capture_payment_instruction.rb +15 -0
  50. data/lib/paypal_server_sdk/models/capture_request.rb +17 -0
  51. data/lib/paypal_server_sdk/models/capture_status.rb +10 -6
  52. data/lib/paypal_server_sdk/models/capture_status_details.rb +12 -0
  53. data/lib/paypal_server_sdk/models/capture_status_with_details.rb +12 -0
  54. data/lib/paypal_server_sdk/models/captured_payment.rb +36 -10
  55. data/lib/paypal_server_sdk/models/card_attributes.rb +13 -0
  56. data/lib/paypal_server_sdk/models/card_attributes_response.rb +12 -0
  57. data/lib/paypal_server_sdk/models/card_authentication_response.rb +14 -2
  58. data/lib/paypal_server_sdk/models/card_brand.rb +29 -25
  59. data/lib/paypal_server_sdk/models/card_customer_information.rb +18 -5
  60. data/lib/paypal_server_sdk/models/card_experience_context.rb +12 -0
  61. data/lib/paypal_server_sdk/models/card_from_request.rb +12 -0
  62. data/lib/paypal_server_sdk/models/{card_response_entity.rb → card_payment_token_entity.rb} +37 -15
  63. data/lib/paypal_server_sdk/models/card_request.rb +32 -17
  64. data/lib/paypal_server_sdk/models/card_response.rb +43 -2
  65. data/lib/paypal_server_sdk/models/{address_details.rb → card_response_address.rb} +33 -57
  66. data/lib/paypal_server_sdk/models/card_stored_credential.rb +23 -7
  67. data/lib/paypal_server_sdk/models/card_supplementary_data.rb +13 -5
  68. data/lib/paypal_server_sdk/models/card_type.rb +5 -5
  69. data/lib/paypal_server_sdk/models/card_vault_response.rb +13 -0
  70. data/lib/paypal_server_sdk/models/card_verification.rb +16 -3
  71. data/lib/paypal_server_sdk/models/card_verification_details.rb +40 -11
  72. data/lib/paypal_server_sdk/models/card_verification_processor_response.rb +12 -0
  73. data/lib/paypal_server_sdk/models/card_verification_status.rb +23 -0
  74. data/lib/paypal_server_sdk/models/checkout_payment_intent.rb +10 -2
  75. data/lib/paypal_server_sdk/models/cobranded_card.rb +13 -0
  76. data/lib/paypal_server_sdk/models/confirm_order_request.rb +15 -15
  77. data/lib/paypal_server_sdk/models/{customer_request.rb → customer.rb} +18 -4
  78. data/lib/paypal_server_sdk/models/customer_information.rb +17 -5
  79. data/lib/paypal_server_sdk/models/customer_response.rb +76 -0
  80. data/lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb +21 -4
  81. data/lib/paypal_server_sdk/models/cvv_code.rb +35 -27
  82. data/lib/paypal_server_sdk/models/disbursement_mode.rb +5 -2
  83. data/lib/paypal_server_sdk/models/dispute_category.rb +2 -2
  84. data/lib/paypal_server_sdk/models/eci_flag.rb +6 -8
  85. data/lib/paypal_server_sdk/models/enrollment_status.rb +11 -8
  86. data/lib/paypal_server_sdk/models/eps_payment_object.rb +17 -5
  87. data/lib/paypal_server_sdk/models/eps_payment_request.rb +18 -5
  88. data/lib/paypal_server_sdk/models/error_details.rb +15 -0
  89. data/lib/paypal_server_sdk/models/exchange_rate.rb +14 -0
  90. data/lib/paypal_server_sdk/models/experience_context.rb +15 -0
  91. data/lib/paypal_server_sdk/models/fulfillment_type.rb +36 -0
  92. data/lib/paypal_server_sdk/models/giropay_payment_object.rb +17 -5
  93. data/lib/paypal_server_sdk/models/giropay_payment_request.rb +18 -5
  94. data/lib/paypal_server_sdk/models/google_pay_authentication_method.rb +8 -2
  95. data/lib/paypal_server_sdk/models/google_pay_card.rb +128 -0
  96. data/lib/paypal_server_sdk/models/google_pay_card_response.rb +16 -0
  97. data/lib/paypal_server_sdk/models/google_pay_decrypted_token_data.rb +28 -2
  98. data/lib/paypal_server_sdk/models/google_pay_payment_method.rb +1 -1
  99. data/lib/paypal_server_sdk/models/google_pay_request.rb +22 -17
  100. data/lib/paypal_server_sdk/models/google_pay_request_card.rb +14 -0
  101. data/lib/paypal_server_sdk/models/google_pay_wallet_response.rb +18 -5
  102. data/lib/paypal_server_sdk/models/ideal_payment_object.rb +18 -5
  103. data/lib/paypal_server_sdk/models/ideal_payment_request.rb +18 -5
  104. data/lib/paypal_server_sdk/models/item.rb +17 -0
  105. data/lib/paypal_server_sdk/models/item_category.rb +6 -3
  106. data/lib/paypal_server_sdk/models/level2_card_processing_data.rb +12 -0
  107. data/lib/paypal_server_sdk/models/level3_card_processing_data.rb +17 -0
  108. data/lib/paypal_server_sdk/models/liability_shift_indicator.rb +3 -3
  109. data/lib/paypal_server_sdk/models/line_item.rb +21 -0
  110. data/lib/paypal_server_sdk/models/link_description.rb +12 -0
  111. data/lib/paypal_server_sdk/models/money.rb +16 -4
  112. data/lib/paypal_server_sdk/models/mybank_payment_object.rb +18 -5
  113. data/lib/paypal_server_sdk/models/mybank_payment_request.rb +18 -5
  114. data/lib/paypal_server_sdk/models/name.rb +12 -0
  115. data/lib/paypal_server_sdk/models/net_amount_breakdown_item.rb +14 -0
  116. data/lib/paypal_server_sdk/models/network_token.rb +15 -0
  117. data/lib/paypal_server_sdk/models/network_transaction_reference.rb +14 -0
  118. data/lib/paypal_server_sdk/models/network_transaction_reference_entity.rb +15 -3
  119. data/lib/paypal_server_sdk/models/one_time_charge.rb +118 -0
  120. data/lib/paypal_server_sdk/models/order.rb +28 -25
  121. data/lib/paypal_server_sdk/models/order_application_context.rb +40 -25
  122. data/lib/paypal_server_sdk/models/order_application_context_landing_page.rb +10 -3
  123. data/lib/paypal_server_sdk/models/order_application_context_shipping_preference.rb +14 -10
  124. data/lib/paypal_server_sdk/models/order_application_context_user_action.rb +11 -6
  125. data/lib/paypal_server_sdk/models/order_authorize_request.rb +12 -0
  126. data/lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb +20 -9
  127. data/lib/paypal_server_sdk/models/order_authorize_response.rb +26 -23
  128. data/lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb +14 -0
  129. data/lib/paypal_server_sdk/models/order_capture_request.rb +12 -0
  130. data/lib/paypal_server_sdk/models/order_capture_request_payment_source.rb +20 -9
  131. data/lib/paypal_server_sdk/models/order_confirm_application_context.rb +21 -8
  132. data/lib/paypal_server_sdk/models/order_request.rb +18 -4
  133. data/lib/paypal_server_sdk/models/order_status.rb +19 -6
  134. data/lib/paypal_server_sdk/models/order_tracker_item.rb +15 -0
  135. data/lib/paypal_server_sdk/models/order_tracker_request.rb +22 -5
  136. data/lib/paypal_server_sdk/models/order_tracker_response.rb +19 -6
  137. data/lib/paypal_server_sdk/models/order_tracker_status.rb +5 -2
  138. data/lib/paypal_server_sdk/models/order_update_callback_error_response.rb +89 -0
  139. data/lib/paypal_server_sdk/models/order_update_callback_error_response_details.rb +81 -0
  140. data/lib/paypal_server_sdk/models/order_update_callback_request.rb +111 -0
  141. data/lib/paypal_server_sdk/models/order_update_callback_response.rb +72 -0
  142. data/lib/paypal_server_sdk/models/order_update_callback_shipping_address.rb +107 -0
  143. data/lib/paypal_server_sdk/models/order_update_callback_shipping_option.rb +93 -0
  144. data/lib/paypal_server_sdk/models/{capture.rb → orders_capture.rb} +46 -22
  145. data/lib/paypal_server_sdk/models/orders_card_verification_method.rb +51 -0
  146. data/lib/paypal_server_sdk/models/p24_payment_object.rb +24 -10
  147. data/lib/paypal_server_sdk/models/p24_payment_request.rb +22 -10
  148. data/lib/paypal_server_sdk/models/pa_res_status.rb +16 -16
  149. data/lib/paypal_server_sdk/models/participant_metadata.rb +64 -0
  150. data/lib/paypal_server_sdk/models/patch.rb +20 -10
  151. data/lib/paypal_server_sdk/models/patch_op.rb +43 -6
  152. data/lib/paypal_server_sdk/models/payee_base.rb +17 -5
  153. data/lib/paypal_server_sdk/models/payee_payment_method_preference.rb +4 -2
  154. data/lib/paypal_server_sdk/models/payer.rb +20 -5
  155. data/lib/paypal_server_sdk/models/payer_base.rb +16 -5
  156. data/lib/paypal_server_sdk/models/payment_advice_code.rb +53 -8
  157. data/lib/paypal_server_sdk/models/payment_authorization.rb +32 -11
  158. data/lib/paypal_server_sdk/models/payment_collection.rb +16 -2
  159. data/lib/paypal_server_sdk/models/payment_initiator.rb +5 -2
  160. data/lib/paypal_server_sdk/models/payment_instruction.rb +16 -0
  161. data/lib/paypal_server_sdk/models/payment_method_preference.rb +14 -0
  162. data/lib/paypal_server_sdk/models/payment_source.rb +25 -9
  163. data/lib/paypal_server_sdk/models/payment_source_response.rb +19 -0
  164. data/lib/paypal_server_sdk/models/payment_supplementary_data.rb +12 -0
  165. data/lib/paypal_server_sdk/models/payment_token_request.rb +17 -3
  166. data/lib/paypal_server_sdk/models/payment_token_request_card.rb +17 -22
  167. data/lib/paypal_server_sdk/models/payment_token_request_payment_source.rb +12 -0
  168. data/lib/paypal_server_sdk/models/payment_token_response.rb +18 -3
  169. data/lib/paypal_server_sdk/models/payment_token_response_payment_source.rb +18 -14
  170. data/lib/paypal_server_sdk/models/payment_token_status.rb +36 -0
  171. data/lib/paypal_server_sdk/models/payments_capture.rb +252 -0
  172. data/lib/paypal_server_sdk/models/payments_payment_advice_code.rb +42 -0
  173. data/lib/paypal_server_sdk/models/payments_processor_response.rb +98 -0
  174. data/lib/paypal_server_sdk/models/paypal_experience_landing_page.rb +11 -3
  175. data/lib/paypal_server_sdk/models/paypal_experience_user_action.rb +9 -4
  176. data/lib/paypal_server_sdk/models/paypal_payment_token.rb +38 -8
  177. data/lib/paypal_server_sdk/models/paypal_payment_token_customer_type.rb +7 -3
  178. data/lib/paypal_server_sdk/models/paypal_payment_token_usage_type.rb +7 -3
  179. data/lib/paypal_server_sdk/models/paypal_wallet.rb +41 -11
  180. data/lib/paypal_server_sdk/models/paypal_wallet_account_verification_status.rb +6 -2
  181. data/lib/paypal_server_sdk/models/paypal_wallet_attributes.rb +12 -0
  182. data/lib/paypal_server_sdk/models/paypal_wallet_attributes_response.rb +12 -0
  183. data/lib/paypal_server_sdk/models/paypal_wallet_context_shipping_preference.rb +31 -0
  184. data/lib/paypal_server_sdk/models/paypal_wallet_customer.rb +18 -5
  185. data/lib/paypal_server_sdk/models/paypal_wallet_customer_request.rb +18 -5
  186. data/lib/paypal_server_sdk/models/paypal_wallet_experience_context.rb +45 -12
  187. data/lib/paypal_server_sdk/models/paypal_wallet_response.rb +39 -7
  188. data/lib/paypal_server_sdk/models/paypal_wallet_stored_credential.rb +98 -0
  189. data/lib/paypal_server_sdk/models/paypal_wallet_vault_instruction.rb +18 -1
  190. data/lib/paypal_server_sdk/models/paypal_wallet_vault_response.rb +13 -0
  191. data/lib/paypal_server_sdk/models/paypal_wallet_vault_status.rb +8 -3
  192. data/lib/paypal_server_sdk/models/phone.rb +14 -0
  193. data/lib/paypal_server_sdk/models/phone_number.rb +12 -0
  194. data/lib/paypal_server_sdk/models/phone_number_with_country_code.rb +15 -0
  195. data/lib/paypal_server_sdk/models/phone_with_type.rb +13 -0
  196. data/lib/paypal_server_sdk/models/plan.rb +102 -0
  197. data/lib/paypal_server_sdk/models/platform_fee.rb +12 -0
  198. data/lib/paypal_server_sdk/models/pricing_model.rb +28 -0
  199. data/lib/paypal_server_sdk/models/pricing_scheme.rb +84 -0
  200. data/lib/paypal_server_sdk/models/processor_response.rb +15 -0
  201. data/lib/paypal_server_sdk/models/processor_response_code.rb +312 -308
  202. data/lib/paypal_server_sdk/models/purchase_unit.rb +43 -25
  203. data/lib/paypal_server_sdk/models/purchase_unit_request.rb +36 -20
  204. data/lib/paypal_server_sdk/models/reauthorize_request.rb +19 -8
  205. data/lib/paypal_server_sdk/models/refund.rb +25 -6
  206. data/lib/paypal_server_sdk/models/refund_incomplete_reason.rb +2 -1
  207. data/lib/paypal_server_sdk/models/refund_payment_instruction.rb +12 -0
  208. data/lib/paypal_server_sdk/models/refund_platform_fee.rb +12 -0
  209. data/lib/paypal_server_sdk/models/refund_request.rb +17 -2
  210. data/lib/paypal_server_sdk/models/refund_status.rb +4 -4
  211. data/lib/paypal_server_sdk/models/refund_status_details.rb +12 -0
  212. data/lib/paypal_server_sdk/models/refund_status_with_details.rb +12 -0
  213. data/lib/paypal_server_sdk/models/related_identifiers.rb +14 -0
  214. data/lib/paypal_server_sdk/models/risk_supplementary_data.rb +63 -0
  215. data/lib/paypal_server_sdk/models/seller_payable_breakdown.rb +21 -0
  216. data/lib/paypal_server_sdk/models/seller_protection.rb +13 -0
  217. data/lib/paypal_server_sdk/models/seller_protection_status.rb +6 -3
  218. data/lib/paypal_server_sdk/models/seller_receivable_breakdown.rb +18 -0
  219. data/lib/paypal_server_sdk/models/setup_token_card_experience_context.rb +21 -5
  220. data/lib/paypal_server_sdk/models/setup_token_request.rb +17 -3
  221. data/lib/paypal_server_sdk/models/setup_token_request_card.rb +20 -18
  222. data/lib/paypal_server_sdk/models/setup_token_request_payment_source.rb +13 -0
  223. data/lib/paypal_server_sdk/models/setup_token_response.rb +23 -16
  224. data/lib/paypal_server_sdk/models/setup_token_response_card.rb +25 -3
  225. data/lib/paypal_server_sdk/models/setup_token_response_payment_source.rb +13 -0
  226. data/lib/paypal_server_sdk/models/shipment_carrier.rb +1594 -1295
  227. data/lib/paypal_server_sdk/models/shipping_details.rb +30 -3
  228. data/lib/paypal_server_sdk/models/shipping_name.rb +12 -0
  229. data/lib/paypal_server_sdk/models/shipping_option.rb +14 -0
  230. data/lib/paypal_server_sdk/models/shipping_options_purchase_unit.rb +102 -0
  231. data/lib/paypal_server_sdk/models/shipping_preference.rb +6 -3
  232. data/lib/paypal_server_sdk/models/shipping_type.rb +12 -4
  233. data/lib/paypal_server_sdk/models/shipping_with_tracking_details.rb +31 -3
  234. data/lib/paypal_server_sdk/models/sofort_payment_object.rb +18 -5
  235. data/lib/paypal_server_sdk/models/sofort_payment_request.rb +18 -5
  236. data/lib/paypal_server_sdk/models/standard_entry_class_code.rb +12 -4
  237. data/lib/paypal_server_sdk/models/store_in_vault_instruction.rb +2 -1
  238. data/lib/paypal_server_sdk/models/stored_payment_source.rb +23 -7
  239. data/lib/paypal_server_sdk/models/stored_payment_source_payment_type.rb +6 -3
  240. data/lib/paypal_server_sdk/models/stored_payment_source_usage_type.rb +6 -3
  241. data/lib/paypal_server_sdk/models/supplementary_data.rb +25 -7
  242. data/lib/paypal_server_sdk/models/supplementary_purchase_data.rb +13 -0
  243. data/lib/paypal_server_sdk/models/tax_id_type.rb +2 -2
  244. data/lib/paypal_server_sdk/models/tax_info.rb +12 -0
  245. data/lib/paypal_server_sdk/models/tenure_type.rb +28 -0
  246. data/lib/paypal_server_sdk/models/three_d_secure_authentication_response.rb +14 -0
  247. data/lib/paypal_server_sdk/models/three_d_secure_card_authentication_response.rb +89 -0
  248. data/lib/paypal_server_sdk/models/token.rb +12 -0
  249. data/lib/paypal_server_sdk/models/token_type.rb +2 -1
  250. data/lib/paypal_server_sdk/models/trustly_payment_object.rb +31 -6
  251. data/lib/paypal_server_sdk/models/trustly_payment_request.rb +30 -6
  252. data/lib/paypal_server_sdk/models/universal_product_code.rb +12 -0
  253. data/lib/paypal_server_sdk/models/upc_type.rb +14 -14
  254. data/lib/paypal_server_sdk/models/usage_pattern.rb +72 -0
  255. data/lib/paypal_server_sdk/models/vault_card_verification_method.rb +39 -0
  256. data/lib/paypal_server_sdk/models/vault_customer.rb +12 -0
  257. data/lib/paypal_server_sdk/models/vault_experience_context.rb +26 -7
  258. data/lib/paypal_server_sdk/models/vault_instruction.rb +12 -0
  259. data/lib/paypal_server_sdk/models/vault_instruction_action.rb +26 -0
  260. data/lib/paypal_server_sdk/models/vault_instruction_base.rb +12 -0
  261. data/lib/paypal_server_sdk/models/vault_paypal_wallet_request.rb +43 -4
  262. data/lib/paypal_server_sdk/models/vault_response.rb +13 -0
  263. data/lib/paypal_server_sdk/models/vault_response_customer.rb +86 -0
  264. data/lib/paypal_server_sdk/models/vault_status.rb +8 -3
  265. data/lib/paypal_server_sdk/models/vault_token_request.rb +13 -1
  266. data/lib/paypal_server_sdk/models/vault_token_request_type.rb +20 -0
  267. data/lib/paypal_server_sdk/models/vault_venmo_experience_context.rb +24 -6
  268. data/lib/paypal_server_sdk/models/vault_venmo_request.rb +31 -3
  269. data/lib/paypal_server_sdk/models/vaulted_digital_wallet.rb +29 -3
  270. data/lib/paypal_server_sdk/models/vaulted_digital_wallet_shipping_details.rb +27 -2
  271. data/lib/paypal_server_sdk/models/venmo_payment_token.rb +37 -8
  272. data/lib/paypal_server_sdk/models/venmo_payment_token_customer_type.rb +4 -2
  273. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_pattern.rb +12 -6
  274. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_type.rb +5 -2
  275. data/lib/paypal_server_sdk/models/venmo_wallet_additional_attributes.rb +12 -0
  276. data/lib/paypal_server_sdk/models/venmo_wallet_attributes_response.rb +12 -0
  277. data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +16 -5
  278. data/lib/paypal_server_sdk/models/venmo_wallet_experience_context.rb +34 -5
  279. data/lib/paypal_server_sdk/models/venmo_wallet_request.rb +21 -8
  280. data/lib/paypal_server_sdk/models/venmo_wallet_response.rb +21 -5
  281. data/lib/paypal_server_sdk/models/venmo_wallet_vault_attributes.rb +17 -0
  282. data/lib/paypal_server_sdk/utilities/file_wrapper.rb +14 -2
  283. data/lib/paypal_server_sdk.rb +183 -152
  284. metadata +42 -16
  285. data/lib/paypal_server_sdk/models/card_payment_token.rb +0 -166
  286. data/lib/paypal_server_sdk/models/card_verification_method.rb +0 -29
  287. data/lib/paypal_server_sdk/models/fullfillment_type.rb +0 -31
  288. data/lib/paypal_server_sdk/models/google_pay_card_attributes.rb +0 -51
  289. data/lib/paypal_server_sdk/models/payee.rb +0 -65
  290. data/lib/paypal_server_sdk/models/paypal_payment_token_usage_pattern.rb +0 -35
  291. data/lib/paypal_server_sdk/models/processing_instruction.rb +0 -23
  292. data/lib/paypal_server_sdk/models/token_request_type.rb +0 -23
@@ -9,14 +9,28 @@ module PaypalServerSdk
9
9
  # Shows details for an authorized payment, by ID.
10
10
  # @param [String] authorization_id Required parameter: The ID of the
11
11
  # authorized payment for which to show details.
12
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
13
+ # uses a request header to invoke negative testing in the sandbox. This
14
+ # header configures the sandbox into a negative testing state for
15
+ # transactions that include the merchant.
16
+ # @param [String] paypal_auth_assertion Optional parameter: An
17
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
18
+ # merchant. For details, see
19
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
20
+ # rtion). Note:For three party transactions in which a partner is managing
21
+ # the API calls on behalf of a merchant, the partner must identify the
22
+ # merchant using either a PayPal-Auth-Assertion header or an access token
23
+ # with target_subject.
12
24
  # @return [ApiResponse] the complete http response with raw body and status code.
13
- def authorizations_get(authorization_id)
25
+ def get_authorized_payment(options = {})
14
26
  new_api_call_builder
15
27
  .request(new_request_builder(HttpMethodEnum::GET,
16
28
  '/v2/payments/authorizations/{authorization_id}',
17
29
  Server::DEFAULT)
18
- .template_param(new_parameter(authorization_id, key: 'authorization_id')
30
+ .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
19
31
  .should_encode(true))
32
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
33
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
20
34
  .header_param(new_parameter('application/json', key: 'accept'))
21
35
  .auth(Single.new('Oauth2')))
22
36
  .response(new_response_handler
@@ -27,10 +41,6 @@ module PaypalServerSdk
27
41
  'Authentication failed due to missing authorization header, or'\
28
42
  ' invalid authentication credentials.',
29
43
  ErrorException)
30
- .local_error('403',
31
- 'The request failed because the caller has insufficient'\
32
- ' permissions.',
33
- ErrorException)
34
44
  .local_error('404',
35
45
  'The request failed because the resource does not exist.',
36
46
  ErrorException)
@@ -46,19 +56,29 @@ module PaypalServerSdk
46
56
  # Captures an authorized payment, by ID.
47
57
  # @param [String] authorization_id Required parameter: The PayPal-generated
48
58
  # ID for the authorized payment to capture.
59
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
60
+ # uses a request header to invoke negative testing in the sandbox. This
61
+ # header configures the sandbox into a negative testing state for
62
+ # transactions that include the merchant.
49
63
  # @param [String] paypal_request_id Optional parameter: The server stores
50
64
  # keys for 45 days.
51
65
  # @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>
66
+ # upon successful completion of the request. Value is: return=minimal. The
67
+ # server returns a minimal response to optimize communication between the
68
+ # API caller and the server. A minimal response includes the id, status and
69
+ # HATEOAS links. return=representation. The server returns a complete
70
+ # resource representation, including the current state of the resource.
71
+ # @param [String] paypal_auth_assertion Optional parameter: An
72
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
73
+ # merchant. For details, see
74
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
75
+ # rtion). Note:For three party transactions in which a partner is managing
76
+ # the API calls on behalf of a merchant, the partner must identify the
77
+ # merchant using either a PayPal-Auth-Assertion header or an access token
78
+ # with target_subject.
59
79
  # @param [CaptureRequest] body Optional parameter: Example:
60
80
  # @return [ApiResponse] the complete http response with raw body and status code.
61
- def authorizations_capture(options = {})
81
+ def capture_authorized_payment(options = {})
62
82
  new_api_call_builder
63
83
  .request(new_request_builder(HttpMethodEnum::POST,
64
84
  '/v2/payments/authorizations/{authorization_id}/capture',
@@ -66,8 +86,10 @@ module PaypalServerSdk
66
86
  .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
67
87
  .should_encode(true))
68
88
  .header_param(new_parameter('application/json', key: 'Content-Type'))
89
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
69
90
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
70
91
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
92
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
71
93
  .body_param(new_parameter(options['body']))
72
94
  .header_param(new_parameter('application/json', key: 'accept'))
73
95
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
@@ -108,40 +130,55 @@ module PaypalServerSdk
108
130
  .execute
109
131
  end
110
132
 
111
- # Voids, or cancels, an authorized payment, by ID. You cannot void an
112
- # authorized payment that has been fully captured.
133
+ # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
134
+ # funds are still available, reauthorize a payment after its initial
135
+ # three-day honor period expires. Within the 29-day authorization period,
136
+ # you can issue multiple re-authorizations after the honor period expires.
137
+ # If 30 days have transpired since the date of the original authorization,
138
+ # you must create an authorized payment instead of reauthorizing the
139
+ # original authorized payment. A reauthorized payment itself has a new honor
140
+ # period of three days. You can reauthorize an authorized payment from 4 to
141
+ # 29 days after the 3-day honor period. The allowed amount depends on
142
+ # context and geography, for example in US it is up to 115% of the original
143
+ # authorized amount, not to exceed an increase of $75 USD. Supports only the
144
+ # `amount` request parameter. Note: This request is currently not supported
145
+ # for Partner use cases.
113
146
  # @param [String] authorization_id Required parameter: The PayPal-generated
114
- # ID for the authorized payment to void.
147
+ # ID for the authorized payment to reauthorize.
148
+ # @param [String] paypal_request_id Optional parameter: The server stores
149
+ # keys for 45 days.
150
+ # @param [String] prefer Optional parameter: The preferred server response
151
+ # upon successful completion of the request. Value is: return=minimal. The
152
+ # server returns a minimal response to optimize communication between the
153
+ # API caller and the server. A minimal response includes the id, status and
154
+ # HATEOAS links. return=representation. The server returns a complete
155
+ # resource representation, including the current state of the resource.
115
156
  # @param [String] paypal_auth_assertion Optional parameter: An
116
157
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
117
158
  # merchant. For details, see
118
159
  # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
119
- # rtion).<blockquote><strong>Note:</strong>For three party transactions in
120
- # which a partner is managing the API calls on behalf of a merchant, the
121
- # partner must identify the merchant using either a PayPal-Auth-Assertion
122
- # header or an access token with target_subject.</blockquote>
123
- # @param [String] prefer Optional parameter: The preferred server response
124
- # upon successful completion of the request. Value
125
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
126
- # response to optimize communication between the API caller and the server.
127
- # A minimal response includes the <code>id</code>, <code>status</code> and
128
- # HATEOAS links.</li><li><code>return=representation</code>. The server
129
- # returns a complete resource representation, including the current state of
130
- # the resource.</li></ul>
160
+ # rtion). Note:For three party transactions in which a partner is managing
161
+ # the API calls on behalf of a merchant, the partner must identify the
162
+ # merchant using either a PayPal-Auth-Assertion header or an access token
163
+ # with target_subject.
164
+ # @param [ReauthorizeRequest] body Optional parameter: Example:
131
165
  # @return [ApiResponse] the complete http response with raw body and status code.
132
- def authorizations_void(options = {})
166
+ def reauthorize_payment(options = {})
133
167
  new_api_call_builder
134
168
  .request(new_request_builder(HttpMethodEnum::POST,
135
- '/v2/payments/authorizations/{authorization_id}/void',
169
+ '/v2/payments/authorizations/{authorization_id}/reauthorize',
136
170
  Server::DEFAULT)
137
171
  .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
138
172
  .should_encode(true))
139
- .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
173
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
174
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
140
175
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
176
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
177
+ .body_param(new_parameter(options['body']))
141
178
  .header_param(new_parameter('application/json', key: 'accept'))
179
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
142
180
  .auth(Single.new('Oauth2')))
143
181
  .response(new_response_handler
144
- .is_nullable_response(true)
145
182
  .deserializer(APIHelper.method(:custom_type_deserializer))
146
183
  .deserialize_into(PaymentAuthorization.method(:from_hash))
147
184
  .is_api_response(true)
@@ -153,17 +190,9 @@ module PaypalServerSdk
153
190
  'Authentication failed due to missing authorization header, or'\
154
191
  ' invalid authentication credentials.',
155
192
  ErrorException)
156
- .local_error('403',
157
- 'The request failed because the caller has insufficient'\
158
- ' permissions.',
159
- ErrorException)
160
193
  .local_error('404',
161
194
  'The request failed because the resource does not exist.',
162
195
  ErrorException)
163
- .local_error('409',
164
- 'The request failed because a previous call for the given'\
165
- ' resource is in progress.',
166
- ErrorException)
167
196
  .local_error('422',
168
197
  'The request failed because it either is semantically incorrect'\
169
198
  ' or failed business validation.',
@@ -177,56 +206,49 @@ module PaypalServerSdk
177
206
  .execute
178
207
  end
179
208
 
180
- # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
181
- # funds are still available, reauthorize a payment after its initial
182
- # three-day honor period expires. Within the 29-day authorization period,
183
- # you can issue multiple re-authorizations after the honor period
184
- # expires.<br/><br/>If 30 days have transpired since the date of the
185
- # original authorization, you must create an authorized payment instead of
186
- # reauthorizing the original authorized payment.<br/><br/>A reauthorized
187
- # payment itself has a new honor period of three days.<br/><br/>You can
188
- # reauthorize an authorized payment from 4 to 29 days after the 3-day honor
189
- # period. The allowed amount depends on context and geography, for example
190
- # in US it is up to 115% of the original authorized amount, not to exceed an
191
- # increase of $75 USD.<br/><br/>Supports only the `amount` request
192
- # parameter.<blockquote><strong>Note:</strong> This request is currently not
193
- # supported for Partner use cases.</blockquote>
209
+ # Voids, or cancels, an authorized payment, by ID. You cannot void an
210
+ # authorized payment that has been fully captured.
194
211
  # @param [String] authorization_id Required parameter: The PayPal-generated
195
- # ID for the authorized payment to reauthorize.
212
+ # ID for the authorized payment to void.
213
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
214
+ # uses a request header to invoke negative testing in the sandbox. This
215
+ # header configures the sandbox into a negative testing state for
216
+ # transactions that include the merchant.
217
+ # @param [String] paypal_auth_assertion Optional parameter: An
218
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
219
+ # merchant. For details, see
220
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
221
+ # rtion). Note:For three party transactions in which a partner is managing
222
+ # the API calls on behalf of a merchant, the partner must identify the
223
+ # merchant using either a PayPal-Auth-Assertion header or an access token
224
+ # with target_subject.
196
225
  # @param [String] paypal_request_id Optional parameter: The server stores
197
226
  # keys for 45 days.
198
227
  # @param [String] prefer Optional parameter: The preferred server response
199
- # upon successful completion of the request. Value
200
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
201
- # response to optimize communication between the API caller and the server.
202
- # A minimal response includes the <code>id</code>, <code>status</code> and
203
- # HATEOAS links.</li><li><code>return=representation</code>. The server
204
- # returns a complete resource representation, including the current state of
205
- # the resource.</li></ul>
206
- # @param [ReauthorizeRequest] body Optional parameter: Example:
228
+ # upon successful completion of the request. Value is: return=minimal. The
229
+ # server returns a minimal response to optimize communication between the
230
+ # API caller and the server. A minimal response includes the id, status and
231
+ # HATEOAS links. return=representation. The server returns a complete
232
+ # resource representation, including the current state of the resource.
207
233
  # @return [ApiResponse] the complete http response with raw body and status code.
208
- def authorizations_reauthorize(options = {})
234
+ def void_payment(options = {})
209
235
  new_api_call_builder
210
236
  .request(new_request_builder(HttpMethodEnum::POST,
211
- '/v2/payments/authorizations/{authorization_id}/reauthorize',
237
+ '/v2/payments/authorizations/{authorization_id}/void',
212
238
  Server::DEFAULT)
213
239
  .template_param(new_parameter(options['authorization_id'], key: 'authorization_id')
214
240
  .should_encode(true))
215
- .header_param(new_parameter('application/json', key: 'Content-Type'))
241
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
242
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
216
243
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
217
244
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
218
- .body_param(new_parameter(options['body']))
219
245
  .header_param(new_parameter('application/json', key: 'accept'))
220
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
221
246
  .auth(Single.new('Oauth2')))
222
247
  .response(new_response_handler
248
+ .is_nullable_response(true)
223
249
  .deserializer(APIHelper.method(:custom_type_deserializer))
224
250
  .deserialize_into(PaymentAuthorization.method(:from_hash))
225
251
  .is_api_response(true)
226
- .local_error('400',
227
- 'The request failed because it is not well-formed or is'\
228
- ' syntactically incorrect or violates schema.',
229
- ErrorException)
230
252
  .local_error('401',
231
253
  'Authentication failed due to missing authorization header, or'\
232
254
  ' invalid authentication credentials.',
@@ -238,6 +260,10 @@ module PaypalServerSdk
238
260
  .local_error('404',
239
261
  'The request failed because the resource does not exist.',
240
262
  ErrorException)
263
+ .local_error('409',
264
+ 'The request failed because a previous call for the given'\
265
+ ' resource is in progress.',
266
+ ErrorException)
241
267
  .local_error('422',
242
268
  'The request failed because it either is semantically incorrect'\
243
269
  ' or failed business validation.',
@@ -254,14 +280,19 @@ module PaypalServerSdk
254
280
  # Shows details for a captured payment, by ID.
255
281
  # @param [String] capture_id Required parameter: The PayPal-generated ID for
256
282
  # the captured payment for which to show details.
283
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
284
+ # uses a request header to invoke negative testing in the sandbox. This
285
+ # header configures the sandbox into a negative testing state for
286
+ # transactions that include the merchant.
257
287
  # @return [ApiResponse] the complete http response with raw body and status code.
258
- def captures_get(capture_id)
288
+ def get_captured_payment(options = {})
259
289
  new_api_call_builder
260
290
  .request(new_request_builder(HttpMethodEnum::GET,
261
291
  '/v2/payments/captures/{capture_id}',
262
292
  Server::DEFAULT)
263
- .template_param(new_parameter(capture_id, key: 'capture_id')
293
+ .template_param(new_parameter(options['capture_id'], key: 'capture_id')
264
294
  .should_encode(true))
295
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
265
296
  .header_param(new_parameter('application/json', key: 'accept'))
266
297
  .auth(Single.new('Oauth2')))
267
298
  .response(new_response_handler
@@ -289,31 +320,33 @@ module PaypalServerSdk
289
320
  end
290
321
 
291
322
  # 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.
323
+ # payload in the JSON request body. For a partial refund, include an amount
324
+ # object in the JSON request body.
294
325
  # @param [String] capture_id Required parameter: The PayPal-generated ID for
295
326
  # the captured payment to refund.
327
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
328
+ # uses a request header to invoke negative testing in the sandbox. This
329
+ # header configures the sandbox into a negative testing state for
330
+ # transactions that include the merchant.
296
331
  # @param [String] paypal_request_id Optional parameter: The server stores
297
332
  # keys for 45 days.
298
333
  # @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>
334
+ # upon successful completion of the request. Value is: return=minimal. The
335
+ # server returns a minimal response to optimize communication between the
336
+ # API caller and the server. A minimal response includes the id, status and
337
+ # HATEOAS links. return=representation. The server returns a complete
338
+ # resource representation, including the current state of the resource.
306
339
  # @param [String] paypal_auth_assertion Optional parameter: An
307
340
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
308
341
  # merchant. For details, see
309
342
  # [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>
343
+ # rtion). Note:For three party transactions in which a partner is managing
344
+ # the API calls on behalf of a merchant, the partner must identify the
345
+ # merchant using either a PayPal-Auth-Assertion header or an access token
346
+ # with target_subject.
314
347
  # @param [RefundRequest] body Optional parameter: Example:
315
348
  # @return [ApiResponse] the complete http response with raw body and status code.
316
- def captures_refund(options = {})
349
+ def refund_captured_payment(options = {})
317
350
  new_api_call_builder
318
351
  .request(new_request_builder(HttpMethodEnum::POST,
319
352
  '/v2/payments/captures/{capture_id}/refund',
@@ -321,6 +354,7 @@ module PaypalServerSdk
321
354
  .template_param(new_parameter(options['capture_id'], key: 'capture_id')
322
355
  .should_encode(true))
323
356
  .header_param(new_parameter('application/json', key: 'Content-Type'))
357
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
324
358
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
325
359
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
326
360
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
@@ -367,14 +401,28 @@ module PaypalServerSdk
367
401
  # Shows details for a refund, by ID.
368
402
  # @param [String] refund_id Required parameter: The PayPal-generated ID for
369
403
  # the refund for which to show details.
404
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
405
+ # uses a request header to invoke negative testing in the sandbox. This
406
+ # header configures the sandbox into a negative testing state for
407
+ # transactions that include the merchant.
408
+ # @param [String] paypal_auth_assertion Optional parameter: An
409
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
410
+ # merchant. For details, see
411
+ # [PayPal-Auth-Assertion](/docs/api/reference/api-requests/#paypal-auth-asse
412
+ # rtion). Note:For three party transactions in which a partner is managing
413
+ # the API calls on behalf of a merchant, the partner must identify the
414
+ # merchant using either a PayPal-Auth-Assertion header or an access token
415
+ # with target_subject.
370
416
  # @return [ApiResponse] the complete http response with raw body and status code.
371
- def refunds_get(refund_id)
417
+ def get_refund(options = {})
372
418
  new_api_call_builder
373
419
  .request(new_request_builder(HttpMethodEnum::GET,
374
420
  '/v2/payments/refunds/{refund_id}',
375
421
  Server::DEFAULT)
376
- .template_param(new_parameter(refund_id, key: 'refund_id')
422
+ .template_param(new_parameter(options['refund_id'], key: 'refund_id')
377
423
  .should_encode(true))
424
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
425
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
378
426
  .header_param(new_parameter('application/json', key: 'accept'))
379
427
  .auth(Single.new('Oauth2')))
380
428
  .response(new_response_handler
@@ -6,6 +6,48 @@
6
6
  module PaypalServerSdk
7
7
  # VaultController
8
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 [PaymentTokenRequest] body Required parameter: Payment Token
12
+ # creation with a financial instrument and an optional customer_id.
13
+ # @param [String] paypal_request_id Optional parameter: The server stores
14
+ # keys for 3 hours.
15
+ # @return [ApiResponse] the complete http response with raw body and status code.
16
+ def create_payment_token(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('application/json', key: 'Content-Type'))
22
+ .body_param(new_parameter(options['body']))
23
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
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
+
9
51
  # Returns all payment tokens for a customer.
10
52
  # @param [String] customer_id Required parameter: A unique identifier
11
53
  # representing a specific customer in merchant's/partner's system or
@@ -18,7 +60,7 @@ module PaypalServerSdk
18
60
  # boolean indicating total number of items (total_items) and pages
19
61
  # (total_pages) are expected to be returned in the response.
20
62
  # @return [ApiResponse] the complete http response with raw body and status code.
21
- def customer_payment_tokens_get(options = {})
63
+ def list_customer_payment_tokens(options = {})
22
64
  new_api_call_builder
23
65
  .request(new_request_builder(HttpMethodEnum::GET,
24
66
  '/v3/vault/payment-tokens',
@@ -50,7 +92,7 @@ module PaypalServerSdk
50
92
  # with the payment token id.
51
93
  # @param [String] id Required parameter: ID of the payment token.
52
94
  # @return [ApiResponse] the complete http response with raw body and status code.
53
- def payment_tokens_get(id)
95
+ def get_payment_token(id)
54
96
  new_api_call_builder
55
97
  .request(new_request_builder(HttpMethodEnum::GET,
56
98
  '/v3/vault/payment-tokens/{id}',
@@ -79,27 +121,19 @@ module PaypalServerSdk
79
121
  .execute
80
122
  end
81
123
 
82
- # Creates a Payment Token from the given payment source and adds it to the
83
- # Vault of the associated customer.
84
- # @param [String] paypal_request_id Required parameter: The server stores
85
- # keys for 3 hours.
86
- # @param [PaymentTokenRequest] body Required parameter: Payment Token
87
- # creation with a financial instrument and an optional customer_id.
124
+ # Delete the payment token associated with the payment token id.
125
+ # @param [String] id Required parameter: ID of the payment token.
88
126
  # @return [ApiResponse] the complete http response with raw body and status code.
89
- def payment_tokens_create(options = {})
127
+ def delete_payment_token(id)
90
128
  new_api_call_builder
91
- .request(new_request_builder(HttpMethodEnum::POST,
92
- '/v3/vault/payment-tokens',
129
+ .request(new_request_builder(HttpMethodEnum::DELETE,
130
+ '/v3/vault/payment-tokens/{id}',
93
131
  Server::DEFAULT)
94
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
95
- .header_param(new_parameter('application/json', key: 'Content-Type'))
96
- .body_param(new_parameter(options['body']))
97
- .header_param(new_parameter('application/json', key: 'accept'))
98
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
132
+ .template_param(new_parameter(id, key: 'id')
133
+ .should_encode(true))
99
134
  .auth(Single.new('Oauth2')))
100
135
  .response(new_response_handler
101
- .deserializer(APIHelper.method(:custom_type_deserializer))
102
- .deserialize_into(PaymentTokenResponse.method(:from_hash))
136
+ .is_response_void(true)
103
137
  .is_api_response(true)
104
138
  .local_error('400',
105
139
  'Request is not well-formed, syntactically incorrect, or'\
@@ -108,13 +142,6 @@ module PaypalServerSdk
108
142
  .local_error('403',
109
143
  'Authorization failed due to insufficient permissions.',
110
144
  ErrorException)
111
- .local_error('404',
112
- 'Request contains reference to resources that do 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
145
  .local_error('500',
119
146
  'An internal server error has occurred.',
120
147
  ErrorException))
@@ -123,20 +150,20 @@ module PaypalServerSdk
123
150
 
124
151
  # Creates a Setup Token from the given payment source and adds it to the
125
152
  # Vault of the associated customer.
126
- # @param [String] paypal_request_id Required parameter: The server stores
127
- # keys for 3 hours.
128
153
  # @param [SetupTokenRequest] body Required parameter: Setup Token creation
129
154
  # with a instrument type optional financial instrument details and
130
155
  # customer_id.
156
+ # @param [String] paypal_request_id Optional parameter: The server stores
157
+ # keys for 3 hours.
131
158
  # @return [ApiResponse] the complete http response with raw body and status code.
132
- def setup_tokens_create(options = {})
159
+ def create_setup_token(options = {})
133
160
  new_api_call_builder
134
161
  .request(new_request_builder(HttpMethodEnum::POST,
135
162
  '/v3/vault/setup-tokens',
136
163
  Server::DEFAULT)
137
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
138
164
  .header_param(new_parameter('application/json', key: 'Content-Type'))
139
165
  .body_param(new_parameter(options['body']))
166
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
140
167
  .header_param(new_parameter('application/json', key: 'accept'))
141
168
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
142
169
  .auth(Single.new('Oauth2')))
@@ -161,38 +188,11 @@ module PaypalServerSdk
161
188
  .execute
162
189
  end
163
190
 
164
- # Delete the payment token associated with the payment token id.
165
- # @param [String] id Required parameter: ID of the payment token.
166
- # @return [ApiResponse] the complete http response with raw body and status code.
167
- def payment_tokens_delete(id)
168
- new_api_call_builder
169
- .request(new_request_builder(HttpMethodEnum::DELETE,
170
- '/v3/vault/payment-tokens/{id}',
171
- Server::DEFAULT)
172
- .template_param(new_parameter(id, key: 'id')
173
- .should_encode(true))
174
- .auth(Single.new('Oauth2')))
175
- .response(new_response_handler
176
- .is_response_void(true)
177
- .is_api_response(true)
178
- .local_error('400',
179
- 'Request is not well-formed, syntactically incorrect, or'\
180
- ' violates schema.',
181
- ErrorException)
182
- .local_error('403',
183
- 'Authorization failed due to insufficient permissions.',
184
- ErrorException)
185
- .local_error('500',
186
- 'An internal server error has occurred.',
187
- ErrorException))
188
- .execute
189
- end
190
-
191
191
  # Returns a readable representation of temporarily vaulted payment source
192
192
  # associated with the setup token id.
193
193
  # @param [String] id Required parameter: ID of the setup token.
194
194
  # @return [ApiResponse] the complete http response with raw body and status code.
195
- def setup_tokens_get(id)
195
+ def get_setup_token(id)
196
196
  new_api_call_builder
197
197
  .request(new_request_builder(HttpMethodEnum::GET,
198
198
  '/v3/vault/setup-tokens/{id}',
@@ -6,5 +6,16 @@
6
6
  module PaypalServerSdk
7
7
  # Class for exceptions when there is a network error, status code error, etc.
8
8
  class APIException < CoreLibrary::ApiException
9
+ # Provides a human-readable string representation of the object.
10
+ def to_s
11
+ class_name = self.class.name.split('::').last
12
+ "<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
13
+ end
14
+
15
+ # Provides a debugging-friendly string with detailed object information.
16
+ def inspect
17
+ class_name = self.class.name.split('::').last
18
+ "<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
19
+ end
9
20
  end
10
21
  end
@@ -67,5 +67,19 @@ module PaypalServerSdk
67
67
 
68
68
  @links = SKIP unless hash.key?('links')
69
69
  end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} name: #{@name}, message: #{@message}, debug_id: #{@debug_id}, details:"\
75
+ " #{@details}, links: #{@links}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} name: #{@name.inspect}, message: #{@message.inspect}, debug_id:"\
82
+ " #{@debug_id.inspect}, details: #{@details.inspect}, links: #{@links.inspect}>"
83
+ end
70
84
  end
71
85
  end
@@ -44,5 +44,19 @@ module PaypalServerSdk
44
44
  hash.key?('error_description') ? hash['error_description'] : SKIP
45
45
  @error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
46
46
  end
47
+
48
+ # Provides a human-readable string representation of the object.
49
+ def to_s
50
+ class_name = self.class.name.split('::').last
51
+ "<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
52
+ " #{@error_uri}>"
53
+ end
54
+
55
+ # Provides a debugging-friendly string with detailed object information.
56
+ def inspect
57
+ class_name = self.class.name.split('::').last
58
+ "<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
59
+ " error_uri: #{@error_uri.inspect}>"
60
+ end
47
61
  end
48
62
  end