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
@@ -6,54 +6,53 @@
6
6
  module PaypalServerSdk
7
7
  # OrdersController
8
8
  class OrdersController < BaseController
9
- # Authorizes payment for an order. To successfully authorize payment for an
10
- # order, the buyer must first approve the order or a valid payment_source
11
- # must be provided in the request. A buyer can approve the order upon being
12
- # redirected to the rel:approve URL that was returned in the HATEOAS links
13
- # in the create order response.<blockquote><strong>Note:</strong> For error
14
- # handling and troubleshooting, see <a
15
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#au
16
- # thorize-order">Orders v2 errors</a>.</blockquote>
17
- # @param [String] id Required parameter: The ID of the order for which to
18
- # authorize.
9
+ # Creates an order. Merchants and partners can add Level 2 and 3 data to
10
+ # payments to reduce risk and payment processing costs. For more information
11
+ # about processing payments, see checkout or multiparty checkout. Note: For
12
+ # error handling and troubleshooting, see Orders v2 errors.
13
+ # @param [OrderRequest] body Required parameter: Example:
14
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
15
+ # uses a request header to invoke negative testing in the sandbox. This
16
+ # header configures the sandbox into a negative testing state for
17
+ # transactions that include the merchant.
19
18
  # @param [String] paypal_request_id Optional parameter: The server stores
20
19
  # keys for 6 hours. The API callers can request the times to up to 72 hours
21
- # by speaking to their Account Manager.
22
- # @param [String] prefer Optional parameter: The preferred server response
23
- # upon successful completion of the request. Value
24
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
25
- # response to optimize communication between the API caller and the server.
26
- # A minimal response includes the <code>id</code>, <code>status</code> and
27
- # HATEOAS links.</li><li><code>return=representation</code>. The server
28
- # returns a complete resource representation, including the current state of
29
- # the resource.</li></ul>
20
+ # by speaking to their Account Manager. It is mandatory for all single-step
21
+ # create order calls (E.g. Create Order Request with payment source
22
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
23
+ # etc).
24
+ # @param [String] paypal_partner_attribution_id Optional parameter:
25
+ # Example:
30
26
  # @param [String] paypal_client_metadata_id Optional parameter: Example:
27
+ # @param [String] prefer Optional parameter: The preferred server response
28
+ # upon successful completion of the request. Value is: return=minimal. The
29
+ # server returns a minimal response to optimize communication between the
30
+ # API caller and the server. A minimal response includes the id, status and
31
+ # HATEOAS links. return=representation. The server returns a complete
32
+ # resource representation, including the current state of the resource.
31
33
  # @param [String] paypal_auth_assertion Optional parameter: An
32
34
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
33
- # merchant. For details, see <a
34
- # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
35
- # n">PayPal-Auth-Assertion</a>.
36
- # @param [OrderAuthorizeRequest] body Optional parameter: Example:
35
+ # merchant. For details, see PayPal-Auth-Assertion.
37
36
  # @return [ApiResponse] the complete http response with raw body and status code.
38
- def orders_authorize(options = {})
37
+ def create_order(options = {})
39
38
  new_api_call_builder
40
39
  .request(new_request_builder(HttpMethodEnum::POST,
41
- '/v2/checkout/orders/{id}/authorize',
40
+ '/v2/checkout/orders',
42
41
  Server::DEFAULT)
43
- .template_param(new_parameter(options['id'], key: 'id')
44
- .should_encode(true))
45
42
  .header_param(new_parameter('application/json', key: 'Content-Type'))
43
+ .body_param(new_parameter(options['body']))
44
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
46
45
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
47
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
46
+ .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
48
47
  .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
48
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
49
49
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
50
- .body_param(new_parameter(options['body']))
51
50
  .header_param(new_parameter('application/json', key: 'accept'))
52
51
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
53
52
  .auth(Single.new('Oauth2')))
54
53
  .response(new_response_handler
55
54
  .deserializer(APIHelper.method(:custom_type_deserializer))
56
- .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
55
+ .deserialize_into(Order.method(:from_hash))
57
56
  .is_api_response(true)
58
57
  .local_error('400',
59
58
  'Request is not well-formed, syntactically incorrect, or'\
@@ -63,119 +62,116 @@ module PaypalServerSdk
63
62
  'Authentication failed due to missing authorization header, or'\
64
63
  ' invalid authentication credentials.',
65
64
  ErrorException)
66
- .local_error('403',
67
- 'The authorized payment failed due to insufficient permissions'\
68
- '.',
69
- ErrorException)
70
- .local_error('404',
71
- 'The specified resource does not exist.',
72
- ErrorException)
73
65
  .local_error('422',
74
66
  'The requested action could not be performed, semantically'\
75
67
  ' incorrect, or failed business validation.',
76
68
  ErrorException)
77
- .local_error('500',
78
- 'An internal server error has occurred.',
79
- ErrorException)
80
69
  .local_error('default',
81
70
  'The error response.',
82
71
  ErrorException))
83
72
  .execute
84
73
  end
85
74
 
86
- # Adds tracking information for an Order.
87
- # @param [String] id Required parameter: The ID of the order that the
88
- # tracking information is associated with.
89
- # @param [OrderTrackerRequest] body Required parameter: Example:
75
+ # Shows details for an order, by ID. Note: For error handling and
76
+ # troubleshooting, see Orders v2 errors.
77
+ # @param [String] id Required parameter: The ID of the order for which to
78
+ # show details.
79
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
80
+ # uses a request header to invoke negative testing in the sandbox. This
81
+ # header configures the sandbox into a negative testing state for
82
+ # transactions that include the merchant.
90
83
  # @param [String] paypal_auth_assertion Optional parameter: An
91
84
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
92
- # merchant. For details, see <a
93
- # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
94
- # n">PayPal-Auth-Assertion</a>.
85
+ # merchant. For details, see PayPal-Auth-Assertion.
86
+ # @param [String] fields Optional parameter: A comma-separated list of
87
+ # fields that should be returned for the order. Valid filter field is
88
+ # `payment_source`.
95
89
  # @return [ApiResponse] the complete http response with raw body and status code.
96
- def orders_track_create(options = {})
90
+ def get_order(options = {})
97
91
  new_api_call_builder
98
- .request(new_request_builder(HttpMethodEnum::POST,
99
- '/v2/checkout/orders/{id}/track',
92
+ .request(new_request_builder(HttpMethodEnum::GET,
93
+ '/v2/checkout/orders/{id}',
100
94
  Server::DEFAULT)
101
95
  .template_param(new_parameter(options['id'], key: 'id')
102
96
  .should_encode(true))
103
- .header_param(new_parameter('application/json', key: 'Content-Type'))
104
- .body_param(new_parameter(options['body']))
97
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
105
98
  .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
99
+ .query_param(new_parameter(options['fields'], key: 'fields'))
106
100
  .header_param(new_parameter('application/json', key: 'accept'))
107
- .body_serializer(proc do |param| param.to_json unless param.nil? end)
108
101
  .auth(Single.new('Oauth2')))
109
102
  .response(new_response_handler
110
103
  .deserializer(APIHelper.method(:custom_type_deserializer))
111
104
  .deserialize_into(Order.method(:from_hash))
112
105
  .is_api_response(true)
113
- .local_error('400',
114
- 'Request is not well-formed, syntactically incorrect, or'\
115
- ' violates schema.',
116
- ErrorException)
117
- .local_error('403',
118
- 'Authorization failed due to insufficient permissions.',
106
+ .local_error('401',
107
+ 'Authentication failed due to missing authorization header, or'\
108
+ ' invalid authentication credentials.',
119
109
  ErrorException)
120
110
  .local_error('404',
121
111
  'The specified resource does not exist.',
122
112
  ErrorException)
123
- .local_error('422',
124
- 'The requested action could not be performed, semantically'\
125
- ' incorrect, or failed business validation.',
126
- ErrorException)
127
- .local_error('500',
128
- 'An internal server error has occurred.',
129
- ErrorException)
130
113
  .local_error('default',
131
114
  'The error response.',
132
115
  ErrorException))
133
116
  .execute
134
117
  end
135
118
 
136
- # Creates an order. Merchants and partners can add Level 2 and 3 data to
137
- # payments to reduce risk and payment processing costs. For more information
138
- # about processing payments, see <a
139
- # href="https://developer.paypal.com/docs/checkout/advanced/processing/">che
140
- # ckout</a> or <a
141
- # href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce
142
- # ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For
143
- # error handling and troubleshooting, see <a
144
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#cr
145
- # eate-order">Orders v2 errors</a>.</blockquote>
146
- # @param [OrderRequest] body Required parameter: Example:
147
- # @param [String] paypal_request_id Optional parameter: The server stores
148
- # keys for 6 hours. The API callers can request the times to up to 72 hours
149
- # by speaking to their Account Manager.
150
- # @param [String] paypal_partner_attribution_id Optional parameter:
151
- # Example:
152
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
153
- # @param [String] prefer Optional parameter: The preferred server response
154
- # upon successful completion of the request. Value
155
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
156
- # response to optimize communication between the API caller and the server.
157
- # A minimal response includes the <code>id</code>, <code>status</code> and
158
- # HATEOAS links.</li><li><code>return=representation</code>. The server
159
- # returns a complete resource representation, including the current state of
160
- # the resource.</li></ul>
119
+ # Updates an order with a `CREATED` or `APPROVED` status. You cannot update
120
+ # an order with the `COMPLETED` status. To make an update, you must provide
121
+ # a `reference_id`. If you omit this value with an order that contains only
122
+ # one purchase unit, PayPal sets the value to `default` which enables you to
123
+ # use the path:
124
+ # \"/purchase_units/@reference_id=='default'/{attribute-or-object}\".
125
+ # Merchants and partners can add Level 2 and 3 data to payments to reduce
126
+ # risk and payment processing costs. For more information about processing
127
+ # payments, see checkout or multiparty checkout. Note: For error handling
128
+ # and troubleshooting, see Orders v2 errors. Patchable attributes or
129
+ # objects: Attribute Op Notes intent replace payer replace, add Using
130
+ # replace op for payer will replace the whole payer object with the value
131
+ # sent in request. purchase_units replace, add purchase_units[].custom_id
132
+ # replace, add, remove purchase_units[].description replace, add, remove
133
+ # purchase_units[].payee.email replace purchase_units[].shipping.name
134
+ # replace, add purchase_units[].shipping.email_address replace, add
135
+ # purchase_units[].shipping.phone_number replace, add
136
+ # purchase_units[].shipping.options replace, add
137
+ # purchase_units[].shipping.address replace, add
138
+ # purchase_units[].shipping.type replace, add
139
+ # purchase_units[].soft_descriptor replace, remove purchase_units[].amount
140
+ # replace purchase_units[].items replace, add, remove
141
+ # purchase_units[].invoice_id replace, add, remove
142
+ # purchase_units[].payment_instruction replace
143
+ # purchase_units[].payment_instruction.disbursement_mode replace By default,
144
+ # disbursement_mode is INSTANT.
145
+ # purchase_units[].payment_instruction.payee_receivable_fx_rate_id replace,
146
+ # add, remove purchase_units[].payment_instruction.platform_fees replace,
147
+ # add, remove purchase_units[].supplementary_data.airline replace, add,
148
+ # remove purchase_units[].supplementary_data.card replace, add, remove
149
+ # application_context.client_configuration replace, add
150
+ # @param [String] id Required parameter: The ID of the order to update.
151
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
152
+ # uses a request header to invoke negative testing in the sandbox. This
153
+ # header configures the sandbox into a negative testing state for
154
+ # transactions that include the merchant.
155
+ # @param [String] paypal_auth_assertion Optional parameter: An
156
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
157
+ # merchant. For details, see PayPal-Auth-Assertion.
158
+ # @param [Array[Patch]] body Optional parameter: Example:
161
159
  # @return [ApiResponse] the complete http response with raw body and status code.
162
- def orders_create(options = {})
160
+ def patch_order(options = {})
163
161
  new_api_call_builder
164
- .request(new_request_builder(HttpMethodEnum::POST,
165
- '/v2/checkout/orders',
162
+ .request(new_request_builder(HttpMethodEnum::PATCH,
163
+ '/v2/checkout/orders/{id}',
166
164
  Server::DEFAULT)
165
+ .template_param(new_parameter(options['id'], key: 'id')
166
+ .should_encode(true))
167
167
  .header_param(new_parameter('application/json', key: 'Content-Type'))
168
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
169
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
168
170
  .body_param(new_parameter(options['body']))
169
- .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
170
- .header_param(new_parameter(options['paypal_partner_attribution_id'], key: 'PayPal-Partner-Attribution-Id'))
171
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
172
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
173
- .header_param(new_parameter('application/json', key: 'accept'))
174
171
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
175
172
  .auth(Single.new('Oauth2')))
176
173
  .response(new_response_handler
177
- .deserializer(APIHelper.method(:custom_type_deserializer))
178
- .deserialize_into(Order.method(:from_hash))
174
+ .is_response_void(true)
179
175
  .is_api_response(true)
180
176
  .local_error('400',
181
177
  'Request is not well-formed, syntactically incorrect, or'\
@@ -185,6 +181,9 @@ module PaypalServerSdk
185
181
  'Authentication failed due to missing authorization header, or'\
186
182
  ' invalid authentication credentials.',
187
183
  ErrorException)
184
+ .local_error('404',
185
+ 'The specified resource does not exist.',
186
+ ErrorException)
188
187
  .local_error('422',
189
188
  'The requested action could not be performed, semantically'\
190
189
  ' incorrect, or failed business validation.',
@@ -195,141 +194,100 @@ module PaypalServerSdk
195
194
  .execute
196
195
  end
197
196
 
198
- # Updates an order with a `CREATED` or `APPROVED` status. You cannot update
199
- # an order with the `COMPLETED` status.<br/><br/>To make an update, you must
200
- # provide a `reference_id`. If you omit this value with an order that
201
- # contains only one purchase unit, PayPal sets the value to `default` which
202
- # enables you to use the path:
203
- # <code>\"/purchase_units/@reference_id=='default'/{attribute-or-object}\"</
204
- # code>. Merchants and partners can add Level 2 and 3 data to payments to
205
- # reduce risk and payment processing costs. For more information about
206
- # processing payments, see <a
207
- # href="https://developer.paypal.com/docs/checkout/advanced/processing/">che
208
- # ckout</a> or <a
209
- # href="https://developer.paypal.com/docs/multiparty/checkout/advanced/proce
210
- # ssing/">multiparty checkout</a>.<blockquote><strong>Note:</strong> For
211
- # error handling and troubleshooting, see <a
212
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#pa
213
- # tch-order">Orders v2 errors</a>.</blockquote>Patchable attributes or
214
- # objects:<br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th
215
- # ></thead><tbody><tr><td><code>intent</code></td><td>replace</td><td></td><
216
- # /tr><tr><td><code>payer</code></td><td>replace, add</td><td>Using replace
217
- # op for <code>payer</code> will replace the whole <code>payer</code> object
218
- # with the value sent in
219
- # request.</td></tr><tr><td><code>purchase_units</code></td><td>replace,
220
- # add</td><td></td></tr><tr><td><code>purchase_units[].custom_id</code></td>
221
- # <td>replace, add,
222
- # remove</td><td></td></tr><tr><td><code>purchase_units[].description</code>
223
- # </td><td>replace, add,
224
- # remove</td><td></td></tr><tr><td><code>purchase_units[].payee.email</code>
225
- # </td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].shipping
226
- # .name</code></td><td>replace,
227
- # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.email_addres
228
- # s</code></td><td>replace,
229
- # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.phone_number
230
- # </code></td><td>replace,
231
- # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.options</cod
232
- # e></td><td>replace,
233
- # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.address</cod
234
- # e></td><td>replace,
235
- # add</td><td></td></tr><tr><td><code>purchase_units[].shipping.type</code><
236
- # /td><td>replace,
237
- # add</td><td></td></tr><tr><td><code>purchase_units[].soft_descriptor</code
238
- # ></td><td>replace,
239
- # remove</td><td></td></tr><tr><td><code>purchase_units[].amount</code></td>
240
- # <td>replace</td><td></td></tr><tr><td><code>purchase_units[].items</code><
241
- # /td><td>replace, add,
242
- # remove</td><td></td></tr><tr><td><code>purchase_units[].invoice_id</code><
243
- # /td><td>replace, add,
244
- # remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instructio
245
- # n</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
246
- # payment_instruction.disbursement_mode</code></td><td>replace</td><td>By
247
- # default, <code>disbursement_mode</code> is
248
- # <code>INSTANT</code>.</td></tr><tr><td><code>purchase_units[].payment_inst
249
- # ruction.payee_receivable_fx_rate_id</code></td><td>replace, add,
250
- # remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instructio
251
- # n.platform_fees</code></td><td>replace, add,
252
- # remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data
253
- # .airline</code></td><td>replace, add,
254
- # remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data
255
- # .card</code></td><td>replace, add,
256
- # remove</td><td></td></tr><tr><td><code>application_context.client_configur
257
- # ation</code></td><td>replace, add</td><td></td></tr></tbody></table>
258
- # @param [String] id Required parameter: The ID of the order to update.
259
- # @param [Array[Patch]] body Optional parameter: Example:
197
+ # Payer confirms their intent to pay for the the Order with the given
198
+ # payment source.
199
+ # @param [String] id Required parameter: The ID of the order for which the
200
+ # payer confirms their intent to pay.
201
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
202
+ # @param [String] paypal_auth_assertion Optional parameter: An
203
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
204
+ # merchant. For details, see PayPal-Auth-Assertion.
205
+ # @param [String] prefer Optional parameter: The preferred server response
206
+ # upon successful completion of the request. Value is: return=minimal. The
207
+ # server returns a minimal response to optimize communication between the
208
+ # API caller and the server. A minimal response includes the id, status and
209
+ # HATEOAS links. return=representation. The server returns a complete
210
+ # resource representation, including the current state of the resource.
211
+ # @param [ConfirmOrderRequest] body Optional parameter: Example:
260
212
  # @return [ApiResponse] the complete http response with raw body and status code.
261
- def orders_patch(options = {})
213
+ def confirm_order(options = {})
262
214
  new_api_call_builder
263
- .request(new_request_builder(HttpMethodEnum::PATCH,
264
- '/v2/checkout/orders/{id}',
215
+ .request(new_request_builder(HttpMethodEnum::POST,
216
+ '/v2/checkout/orders/{id}/confirm-payment-source',
265
217
  Server::DEFAULT)
266
218
  .template_param(new_parameter(options['id'], key: 'id')
267
219
  .should_encode(true))
268
220
  .header_param(new_parameter('application/json', key: 'Content-Type'))
221
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
222
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
223
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
269
224
  .body_param(new_parameter(options['body']))
225
+ .header_param(new_parameter('application/json', key: 'accept'))
270
226
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
271
227
  .auth(Single.new('Oauth2')))
272
228
  .response(new_response_handler
273
- .is_response_void(true)
229
+ .deserializer(APIHelper.method(:custom_type_deserializer))
230
+ .deserialize_into(Order.method(:from_hash))
274
231
  .is_api_response(true)
275
232
  .local_error('400',
276
233
  'Request is not well-formed, syntactically incorrect, or'\
277
234
  ' violates schema.',
278
235
  ErrorException)
279
- .local_error('401',
280
- 'Authentication failed due to missing authorization header, or'\
281
- ' invalid authentication credentials.',
282
- ErrorException)
283
- .local_error('404',
284
- 'The specified resource does not exist.',
236
+ .local_error('403',
237
+ 'Authorization failed due to insufficient permissions.',
285
238
  ErrorException)
286
239
  .local_error('422',
287
240
  'The requested action could not be performed, semantically'\
288
241
  ' incorrect, or failed business validation.',
289
242
  ErrorException)
243
+ .local_error('500',
244
+ 'An internal server error has occurred.',
245
+ ErrorException)
290
246
  .local_error('default',
291
247
  'The error response.',
292
248
  ErrorException))
293
249
  .execute
294
250
  end
295
251
 
296
- # Captures payment for an order. To successfully capture payment for an
252
+ # Authorizes payment for an order. To successfully authorize payment for an
297
253
  # order, the buyer must first approve the order or a valid payment_source
298
254
  # must be provided in the request. A buyer can approve the order upon being
299
255
  # redirected to the rel:approve URL that was returned in the HATEOAS links
300
- # in the create order response.<blockquote><strong>Note:</strong> For error
301
- # handling and troubleshooting, see <a
302
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ca
303
- # pture-order">Orders v2 errors</a>.</blockquote>
256
+ # in the create order response. Note: For error handling and
257
+ # troubleshooting, see Orders v2 errors.
304
258
  # @param [String] id Required parameter: The ID of the order for which to
305
- # capture a payment.
259
+ # authorize.
260
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
261
+ # uses a request header to invoke negative testing in the sandbox. This
262
+ # header configures the sandbox into a negative testing state for
263
+ # transactions that include the merchant.
306
264
  # @param [String] paypal_request_id Optional parameter: The server stores
307
265
  # keys for 6 hours. The API callers can request the times to up to 72 hours
308
- # by speaking to their Account Manager.
266
+ # by speaking to their Account Manager. It is mandatory for all single-step
267
+ # create order calls (E.g. Create Order Request with payment source
268
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
269
+ # etc).
309
270
  # @param [String] prefer Optional parameter: The preferred server response
310
- # upon successful completion of the request. Value
311
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
312
- # response to optimize communication between the API caller and the server.
313
- # A minimal response includes the <code>id</code>, <code>status</code> and
314
- # HATEOAS links.</li><li><code>return=representation</code>. The server
315
- # returns a complete resource representation, including the current state of
316
- # the resource.</li></ul>
271
+ # upon successful completion of the request. Value is: return=minimal. The
272
+ # server returns a minimal response to optimize communication between the
273
+ # API caller and the server. A minimal response includes the id, status and
274
+ # HATEOAS links. return=representation. The server returns a complete
275
+ # resource representation, including the current state of the resource.
317
276
  # @param [String] paypal_client_metadata_id Optional parameter: Example:
318
277
  # @param [String] paypal_auth_assertion Optional parameter: An
319
278
  # API-caller-provided JSON Web Token (JWT) assertion that identifies the
320
- # merchant. For details, see <a
321
- # href="https://developer.paypal.com/api/rest/requests/#paypal-auth-assertio
322
- # n">PayPal-Auth-Assertion</a>.
323
- # @param [OrderCaptureRequest] body Optional parameter: Example:
279
+ # merchant. For details, see PayPal-Auth-Assertion.
280
+ # @param [OrderAuthorizeRequest] body Optional parameter: Example:
324
281
  # @return [ApiResponse] the complete http response with raw body and status code.
325
- def orders_capture(options = {})
282
+ def authorize_order(options = {})
326
283
  new_api_call_builder
327
284
  .request(new_request_builder(HttpMethodEnum::POST,
328
- '/v2/checkout/orders/{id}/capture',
285
+ '/v2/checkout/orders/{id}/authorize',
329
286
  Server::DEFAULT)
330
287
  .template_param(new_parameter(options['id'], key: 'id')
331
288
  .should_encode(true))
332
289
  .header_param(new_parameter('application/json', key: 'Content-Type'))
290
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
333
291
  .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
334
292
  .header_param(new_parameter(options['prefer'], key: 'Prefer'))
335
293
  .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
@@ -340,7 +298,7 @@ module PaypalServerSdk
340
298
  .auth(Single.new('Oauth2')))
341
299
  .response(new_response_handler
342
300
  .deserializer(APIHelper.method(:custom_type_deserializer))
343
- .deserialize_into(Order.method(:from_hash))
301
+ .deserialize_into(OrderAuthorizeResponse.method(:from_hash))
344
302
  .is_api_response(true)
345
303
  .local_error('400',
346
304
  'Request is not well-formed, syntactically incorrect, or'\
@@ -370,69 +328,103 @@ module PaypalServerSdk
370
328
  .execute
371
329
  end
372
330
 
373
- # Shows details for an order, by ID.<blockquote><strong>Note:</strong> For
374
- # error handling and troubleshooting, see <a
375
- # href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#ge
376
- # t-order">Orders v2 errors</a>.</blockquote>
331
+ # Captures payment for an order. To successfully capture payment for an
332
+ # order, the buyer must first approve the order or a valid payment_source
333
+ # must be provided in the request. A buyer can approve the order upon being
334
+ # redirected to the rel:approve URL that was returned in the HATEOAS links
335
+ # in the create order response. Note: For error handling and
336
+ # troubleshooting, see Orders v2 errors.
377
337
  # @param [String] id Required parameter: The ID of the order for which to
378
- # show details.
379
- # @param [String] fields Optional parameter: A comma-separated list of
380
- # fields that should be returned for the order. Valid filter field is
381
- # `payment_source`.
338
+ # capture a payment.
339
+ # @param [String] paypal_mock_response Optional parameter: PayPal's REST API
340
+ # uses a request header to invoke negative testing in the sandbox. This
341
+ # header configures the sandbox into a negative testing state for
342
+ # transactions that include the merchant.
343
+ # @param [String] paypal_request_id Optional parameter: The server stores
344
+ # keys for 6 hours. The API callers can request the times to up to 72 hours
345
+ # by speaking to their Account Manager. It is mandatory for all single-step
346
+ # create order calls (E.g. Create Order Request with payment source
347
+ # information like Card, PayPal.vault_id, PayPal.billing_agreement_id,
348
+ # etc).
349
+ # @param [String] prefer Optional parameter: The preferred server response
350
+ # upon successful completion of the request. Value is: return=minimal. The
351
+ # server returns a minimal response to optimize communication between the
352
+ # API caller and the server. A minimal response includes the id, status and
353
+ # HATEOAS links. return=representation. The server returns a complete
354
+ # resource representation, including the current state of the resource.
355
+ # @param [String] paypal_client_metadata_id Optional parameter: Example:
356
+ # @param [String] paypal_auth_assertion Optional parameter: An
357
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
358
+ # merchant. For details, see PayPal-Auth-Assertion.
359
+ # @param [OrderCaptureRequest] body Optional parameter: Example:
382
360
  # @return [ApiResponse] the complete http response with raw body and status code.
383
- def orders_get(options = {})
361
+ def capture_order(options = {})
384
362
  new_api_call_builder
385
- .request(new_request_builder(HttpMethodEnum::GET,
386
- '/v2/checkout/orders/{id}',
363
+ .request(new_request_builder(HttpMethodEnum::POST,
364
+ '/v2/checkout/orders/{id}/capture',
387
365
  Server::DEFAULT)
388
366
  .template_param(new_parameter(options['id'], key: 'id')
389
367
  .should_encode(true))
390
- .query_param(new_parameter(options['fields'], key: 'fields'))
368
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
369
+ .header_param(new_parameter(options['paypal_mock_response'], key: 'PayPal-Mock-Response'))
370
+ .header_param(new_parameter(options['paypal_request_id'], key: 'PayPal-Request-Id'))
371
+ .header_param(new_parameter(options['prefer'], key: 'Prefer'))
372
+ .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
373
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
374
+ .body_param(new_parameter(options['body']))
391
375
  .header_param(new_parameter('application/json', key: 'accept'))
376
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
392
377
  .auth(Single.new('Oauth2')))
393
378
  .response(new_response_handler
394
379
  .deserializer(APIHelper.method(:custom_type_deserializer))
395
380
  .deserialize_into(Order.method(:from_hash))
396
381
  .is_api_response(true)
382
+ .local_error('400',
383
+ 'Request is not well-formed, syntactically incorrect, or'\
384
+ ' violates schema.',
385
+ ErrorException)
397
386
  .local_error('401',
398
387
  'Authentication failed due to missing authorization header, or'\
399
388
  ' invalid authentication credentials.',
400
389
  ErrorException)
390
+ .local_error('403',
391
+ 'The authorized payment failed due to insufficient permissions'\
392
+ '.',
393
+ ErrorException)
401
394
  .local_error('404',
402
395
  'The specified resource does not exist.',
403
396
  ErrorException)
397
+ .local_error('422',
398
+ 'The requested action could not be performed, semantically'\
399
+ ' incorrect, or failed business validation.',
400
+ ErrorException)
401
+ .local_error('500',
402
+ 'An internal server error has occurred.',
403
+ ErrorException)
404
404
  .local_error('default',
405
405
  'The error response.',
406
406
  ErrorException))
407
407
  .execute
408
408
  end
409
409
 
410
- # Payer confirms their intent to pay for the the Order with the given
411
- # payment source.
412
- # @param [String] id Required parameter: The ID of the order for which the
413
- # payer confirms their intent to pay.
414
- # @param [String] paypal_client_metadata_id Optional parameter: Example:
415
- # @param [String] prefer Optional parameter: The preferred server response
416
- # upon successful completion of the request. Value
417
- # is:<ul><li><code>return=minimal</code>. The server returns a minimal
418
- # response to optimize communication between the API caller and the server.
419
- # A minimal response includes the <code>id</code>, <code>status</code> and
420
- # HATEOAS links.</li><li><code>return=representation</code>. The server
421
- # returns a complete resource representation, including the current state of
422
- # the resource.</li></ul>
423
- # @param [ConfirmOrderRequest] body Optional parameter: Example:
410
+ # Adds tracking information for an Order.
411
+ # @param [String] id Required parameter: The ID of the order that the
412
+ # tracking information is associated with.
413
+ # @param [OrderTrackerRequest] body Required parameter: Example:
414
+ # @param [String] paypal_auth_assertion Optional parameter: An
415
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
416
+ # merchant. For details, see PayPal-Auth-Assertion.
424
417
  # @return [ApiResponse] the complete http response with raw body and status code.
425
- def orders_confirm(options = {})
418
+ def create_order_tracking(options = {})
426
419
  new_api_call_builder
427
420
  .request(new_request_builder(HttpMethodEnum::POST,
428
- '/v2/checkout/orders/{id}/confirm-payment-source',
421
+ '/v2/checkout/orders/{id}/track',
429
422
  Server::DEFAULT)
430
423
  .template_param(new_parameter(options['id'], key: 'id')
431
424
  .should_encode(true))
432
425
  .header_param(new_parameter('application/json', key: 'Content-Type'))
433
- .header_param(new_parameter(options['paypal_client_metadata_id'], key: 'PayPal-Client-Metadata-Id'))
434
- .header_param(new_parameter(options['prefer'], key: 'Prefer'))
435
426
  .body_param(new_parameter(options['body']))
427
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
436
428
  .header_param(new_parameter('application/json', key: 'accept'))
437
429
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
438
430
  .auth(Single.new('Oauth2')))
@@ -447,6 +439,9 @@ module PaypalServerSdk
447
439
  .local_error('403',
448
440
  'Authorization failed due to insufficient permissions.',
449
441
  ErrorException)
442
+ .local_error('404',
443
+ 'The specified resource does not exist.',
444
+ ErrorException)
450
445
  .local_error('422',
451
446
  'The requested action could not be performed, semantically'\
452
447
  ' incorrect, or failed business validation.',
@@ -461,21 +456,19 @@ module PaypalServerSdk
461
456
  end
462
457
 
463
458
  # Updates or cancels the tracking information for a PayPal order, by ID.
464
- # Updatable attributes or
465
- # objects:<br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th
466
- # ></thead><tbody></tr><tr><td><code>items</code></td><td>replace</td><td>Us
467
- # ing replace op for <code>items</code> will replace the entire
468
- # <code>items</code> object with the value sent in
469
- # request.</td></tr><tr><td><code>notify_payer</code></td><td>replace,
470
- # add</td><td></td></tr><tr><td><code>status</code></td><td>replace</td><td>
471
- # Only patching status to CANCELLED is currently
472
- # supported.</td></tr></tbody></table>
459
+ # Updatable attributes or objects: Attribute Op Notes items replace Using
460
+ # replace op for items will replace the entire items object with the value
461
+ # sent in request. notify_payer replace, add status replace Only patching
462
+ # status to CANCELLED is currently supported.
473
463
  # @param [String] id Required parameter: The ID of the order that the
474
464
  # tracking information is associated with.
475
465
  # @param [String] tracker_id Required parameter: The order tracking ID.
466
+ # @param [String] paypal_auth_assertion Optional parameter: An
467
+ # API-caller-provided JSON Web Token (JWT) assertion that identifies the
468
+ # merchant. For details, see PayPal-Auth-Assertion.
476
469
  # @param [Array[Patch]] body Optional parameter: Example:
477
470
  # @return [ApiResponse] the complete http response with raw body and status code.
478
- def orders_trackers_patch(options = {})
471
+ def update_order_tracking(options = {})
479
472
  new_api_call_builder
480
473
  .request(new_request_builder(HttpMethodEnum::PATCH,
481
474
  '/v2/checkout/orders/{id}/trackers/{tracker_id}',
@@ -485,6 +478,7 @@ module PaypalServerSdk
485
478
  .template_param(new_parameter(options['tracker_id'], key: 'tracker_id')
486
479
  .should_encode(true))
487
480
  .header_param(new_parameter('application/json', key: 'Content-Type'))
481
+ .header_param(new_parameter(options['paypal_auth_assertion'], key: 'PayPal-Auth-Assertion'))
488
482
  .body_param(new_parameter(options['body']))
489
483
  .body_serializer(proc do |param| param.to_json unless param.nil? end)
490
484
  .auth(Single.new('Oauth2')))