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
@@ -5,10 +5,9 @@
5
5
 
6
6
  module PaypalServerSdk
7
7
  # Customizes the payer experience during the approval process for payment with
8
- # PayPal.<blockquote><strong>Note:</strong> Partners and Marketplaces might
9
- # configure <code>brand_name</code> and <code>shipping_preference</code>
10
- # during partner account setup, which overrides the request
11
- # values.</blockquote>
8
+ # PayPal. Note: Partners and Marketplaces might configure brand_name and
9
+ # shipping_preference during partner account setup, which overrides the
10
+ # request values.
12
11
  class PaypalWalletExperienceContext < BaseModel
13
12
  SKIP = Object.new
14
13
  private_constant :SKIP
@@ -31,7 +30,7 @@ module PaypalServerSdk
31
30
  attr_accessor :locale
32
31
 
33
32
  # The location from which the shipping address is derived.
34
- # @return [ShippingPreference]
33
+ # @return [PaypalWalletContextShippingPreference]
35
34
  attr_accessor :shipping_preference
36
35
 
37
36
  # Describes the URL.
@@ -46,8 +45,7 @@ module PaypalServerSdk
46
45
  # @return [PaypalExperienceLandingPage]
47
46
  attr_accessor :landing_page
48
47
 
49
- # Configures a <strong>Continue</strong> or <strong>Pay Now</strong>
50
- # checkout flow.
48
+ # Configures a Continue or Pay Now checkout flow.
51
49
  # @return [PaypalExperienceUserAction]
52
50
  attr_accessor :user_action
53
51
 
@@ -55,6 +53,10 @@ module PaypalServerSdk
55
53
  # @return [PayeePaymentMethodPreference]
56
54
  attr_accessor :payment_method_preference
57
55
 
56
+ # CallBack Configuration that the merchant can provide to PayPal/Venmo.
57
+ # @return [CallbackConfiguration]
58
+ attr_accessor :order_update_callback_config
59
+
58
60
  # A mapping from model property names to API property names.
59
61
  def self.names
60
62
  @_hash = {} if @_hash.nil?
@@ -66,6 +68,7 @@ module PaypalServerSdk
66
68
  @_hash['landing_page'] = 'landing_page'
67
69
  @_hash['user_action'] = 'user_action'
68
70
  @_hash['payment_method_preference'] = 'payment_method_preference'
71
+ @_hash['order_update_callback_config'] = 'order_update_callback_config'
69
72
  @_hash
70
73
  end
71
74
 
@@ -80,6 +83,7 @@ module PaypalServerSdk
80
83
  landing_page
81
84
  user_action
82
85
  payment_method_preference
86
+ order_update_callback_config
83
87
  ]
84
88
  end
85
89
 
@@ -90,11 +94,12 @@ module PaypalServerSdk
90
94
 
91
95
  def initialize(
92
96
  brand_name: SKIP, locale: SKIP,
93
- shipping_preference: ShippingPreference::GET_FROM_FILE, return_url: SKIP,
94
- cancel_url: SKIP,
97
+ shipping_preference: PaypalWalletContextShippingPreference::GET_FROM_FILE,
98
+ return_url: SKIP, cancel_url: SKIP,
95
99
  landing_page: PaypalExperienceLandingPage::NO_PREFERENCE,
96
100
  user_action: PaypalExperienceUserAction::CONTINUE,
97
- payment_method_preference: PayeePaymentMethodPreference::UNRESTRICTED
101
+ payment_method_preference: PayeePaymentMethodPreference::UNRESTRICTED,
102
+ order_update_callback_config: SKIP
98
103
  )
99
104
  @brand_name = brand_name unless brand_name == SKIP
100
105
  @locale = locale unless locale == SKIP
@@ -107,6 +112,10 @@ module PaypalServerSdk
107
112
  @payment_method_preference =
108
113
  payment_method_preference
109
114
  end
115
+ unless order_update_callback_config == SKIP
116
+ @order_update_callback_config =
117
+ order_update_callback_config
118
+ end
110
119
  end
111
120
 
112
121
  # Creates an instance of the object from a hash.
@@ -117,7 +126,7 @@ module PaypalServerSdk
117
126
  brand_name = hash.key?('brand_name') ? hash['brand_name'] : SKIP
118
127
  locale = hash.key?('locale') ? hash['locale'] : SKIP
119
128
  shipping_preference =
120
- hash['shipping_preference'] ||= ShippingPreference::GET_FROM_FILE
129
+ hash['shipping_preference'] ||= PaypalWalletContextShippingPreference::GET_FROM_FILE
121
130
  return_url = hash.key?('return_url') ? hash['return_url'] : SKIP
122
131
  cancel_url = hash.key?('cancel_url') ? hash['cancel_url'] : SKIP
123
132
  landing_page =
@@ -125,6 +134,9 @@ module PaypalServerSdk
125
134
  user_action = hash['user_action'] ||= PaypalExperienceUserAction::CONTINUE
126
135
  payment_method_preference =
127
136
  hash['payment_method_preference'] ||= PayeePaymentMethodPreference::UNRESTRICTED
137
+ if hash['order_update_callback_config']
138
+ order_update_callback_config = CallbackConfiguration.from_hash(hash['order_update_callback_config'])
139
+ end
128
140
 
129
141
  # Create object from extracted values.
130
142
  PaypalWalletExperienceContext.new(brand_name: brand_name,
@@ -134,7 +146,28 @@ module PaypalServerSdk
134
146
  cancel_url: cancel_url,
135
147
  landing_page: landing_page,
136
148
  user_action: user_action,
137
- payment_method_preference: payment_method_preference)
149
+ payment_method_preference: payment_method_preference,
150
+ order_update_callback_config: order_update_callback_config)
151
+ end
152
+
153
+ # Provides a human-readable string representation of the object.
154
+ def to_s
155
+ class_name = self.class.name.split('::').last
156
+ "<#{class_name} brand_name: #{@brand_name}, locale: #{@locale}, shipping_preference:"\
157
+ " #{@shipping_preference}, return_url: #{@return_url}, cancel_url: #{@cancel_url},"\
158
+ " landing_page: #{@landing_page}, user_action: #{@user_action}, payment_method_preference:"\
159
+ " #{@payment_method_preference}, order_update_callback_config:"\
160
+ " #{@order_update_callback_config}>"
161
+ end
162
+
163
+ # Provides a debugging-friendly string with detailed object information.
164
+ def inspect
165
+ class_name = self.class.name.split('::').last
166
+ "<#{class_name} brand_name: #{@brand_name.inspect}, locale: #{@locale.inspect},"\
167
+ " shipping_preference: #{@shipping_preference.inspect}, return_url: #{@return_url.inspect},"\
168
+ " cancel_url: #{@cancel_url.inspect}, landing_page: #{@landing_page.inspect}, user_action:"\
169
+ " #{@user_action.inspect}, payment_method_preference: #{@payment_method_preference.inspect},"\
170
+ " order_update_callback_config: #{@order_update_callback_config.inspect}>"
138
171
  end
139
172
  end
140
173
  end
@@ -9,11 +9,10 @@ module PaypalServerSdk
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # The internationalized email address.<blockquote><strong>Note:</strong> Up
13
- # to 64 characters are allowed before and 255 characters are allowed after
14
- # the <code>@</code> sign. However, the generally accepted maximum length
15
- # for an email address is 254 characters. The pattern verifies that an
16
- # unquoted <code>@</code> sign exists.</blockquote>
12
+ # The internationalized email address. Note: Up to 64 characters are allowed
13
+ # before and 255 characters are allowed after the @ sign. However, the
14
+ # generally accepted maximum length for an email address is 254 characters.
15
+ # The pattern verifies that an unquoted @ sign exists.
17
16
  # @return [String]
18
17
  attr_accessor :email_address
19
18
 
@@ -74,6 +73,12 @@ module PaypalServerSdk
74
73
  # @return [PaypalWalletAttributesResponse]
75
74
  attr_accessor :attributes
76
75
 
76
+ # Provides additional details to process a payment using the PayPal wallet
77
+ # billing agreement or a vaulted payment method that has been stored or is
78
+ # intended to be stored.
79
+ # @return [PaypalWalletStoredCredential]
80
+ attr_accessor :stored_credential
81
+
77
82
  # A mapping from model property names to API property names.
78
83
  def self.names
79
84
  @_hash = {} if @_hash.nil?
@@ -88,6 +93,7 @@ module PaypalServerSdk
88
93
  @_hash['tax_info'] = 'tax_info'
89
94
  @_hash['address'] = 'address'
90
95
  @_hash['attributes'] = 'attributes'
96
+ @_hash['stored_credential'] = 'stored_credential'
91
97
  @_hash
92
98
  end
93
99
 
@@ -105,6 +111,7 @@ module PaypalServerSdk
105
111
  tax_info
106
112
  address
107
113
  attributes
114
+ stored_credential
108
115
  ]
109
116
  end
110
117
 
@@ -116,7 +123,7 @@ module PaypalServerSdk
116
123
  def initialize(email_address: SKIP, account_id: SKIP, account_status: SKIP,
117
124
  name: SKIP, phone_type: SKIP, phone_number: SKIP,
118
125
  birth_date: SKIP, business_name: SKIP, tax_info: SKIP,
119
- address: SKIP, attributes: SKIP)
126
+ address: SKIP, attributes: SKIP, stored_credential: SKIP)
120
127
  @email_address = email_address unless email_address == SKIP
121
128
  @account_id = account_id unless account_id == SKIP
122
129
  @account_status = account_status unless account_status == SKIP
@@ -128,6 +135,7 @@ module PaypalServerSdk
128
135
  @tax_info = tax_info unless tax_info == SKIP
129
136
  @address = address unless address == SKIP
130
137
  @attributes = attributes unless attributes == SKIP
138
+ @stored_credential = stored_credential unless stored_credential == SKIP
131
139
  end
132
140
 
133
141
  # Creates an instance of the object from a hash.
@@ -148,6 +156,8 @@ module PaypalServerSdk
148
156
  address = Address.from_hash(hash['address']) if hash['address']
149
157
  attributes = PaypalWalletAttributesResponse.from_hash(hash['attributes']) if
150
158
  hash['attributes']
159
+ stored_credential = PaypalWalletStoredCredential.from_hash(hash['stored_credential']) if
160
+ hash['stored_credential']
151
161
 
152
162
  # Create object from extracted values.
153
163
  PaypalWalletResponse.new(email_address: email_address,
@@ -160,7 +170,29 @@ module PaypalServerSdk
160
170
  business_name: business_name,
161
171
  tax_info: tax_info,
162
172
  address: address,
163
- attributes: attributes)
173
+ attributes: attributes,
174
+ stored_credential: stored_credential)
175
+ end
176
+
177
+ # Provides a human-readable string representation of the object.
178
+ def to_s
179
+ class_name = self.class.name.split('::').last
180
+ "<#{class_name} email_address: #{@email_address}, account_id: #{@account_id},"\
181
+ " account_status: #{@account_status}, name: #{@name}, phone_type: #{@phone_type},"\
182
+ " phone_number: #{@phone_number}, birth_date: #{@birth_date}, business_name:"\
183
+ " #{@business_name}, tax_info: #{@tax_info}, address: #{@address}, attributes:"\
184
+ " #{@attributes}, stored_credential: #{@stored_credential}>"
185
+ end
186
+
187
+ # Provides a debugging-friendly string with detailed object information.
188
+ def inspect
189
+ class_name = self.class.name.split('::').last
190
+ "<#{class_name} email_address: #{@email_address.inspect}, account_id:"\
191
+ " #{@account_id.inspect}, account_status: #{@account_status.inspect}, name:"\
192
+ " #{@name.inspect}, phone_type: #{@phone_type.inspect}, phone_number:"\
193
+ " #{@phone_number.inspect}, birth_date: #{@birth_date.inspect}, business_name:"\
194
+ " #{@business_name.inspect}, tax_info: #{@tax_info.inspect}, address: #{@address.inspect},"\
195
+ " attributes: #{@attributes.inspect}, stored_credential: #{@stored_credential.inspect}>"
164
196
  end
165
197
  end
166
198
  end
@@ -0,0 +1,98 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Provides additional details to process a payment using the PayPal wallet
8
+ # billing agreement or a vaulted payment method that has been stored or is
9
+ # intended to be stored.
10
+ class PaypalWalletStoredCredential < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # The person or party who initiated or triggered the payment.
15
+ # @return [PaymentInitiator]
16
+ attr_accessor :payment_initiator
17
+
18
+ # Expected business/pricing model for the billing agreement.
19
+ # @return [UsagePattern]
20
+ attr_accessor :charge_pattern
21
+
22
+ # Expected business/pricing model for the billing agreement.
23
+ # @return [UsagePattern]
24
+ attr_accessor :usage_pattern
25
+
26
+ # Indicates if this is a `first` or `subsequent` payment using a stored
27
+ # payment source (also referred to as stored credential or card on file).
28
+ # @return [StoredPaymentSourceUsageType]
29
+ attr_accessor :usage
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ @_hash = {} if @_hash.nil?
34
+ @_hash['payment_initiator'] = 'payment_initiator'
35
+ @_hash['charge_pattern'] = 'charge_pattern'
36
+ @_hash['usage_pattern'] = 'usage_pattern'
37
+ @_hash['usage'] = 'usage'
38
+ @_hash
39
+ end
40
+
41
+ # An array for optional fields
42
+ def self.optionals
43
+ %w[
44
+ charge_pattern
45
+ usage_pattern
46
+ usage
47
+ ]
48
+ end
49
+
50
+ # An array for nullable fields
51
+ def self.nullables
52
+ []
53
+ end
54
+
55
+ def initialize(payment_initiator:, charge_pattern: SKIP,
56
+ usage_pattern: SKIP,
57
+ usage: StoredPaymentSourceUsageType::DERIVED)
58
+ @payment_initiator = payment_initiator
59
+ @charge_pattern = charge_pattern unless charge_pattern == SKIP
60
+ @usage_pattern = usage_pattern unless usage_pattern == SKIP
61
+ @usage = usage unless usage == SKIP
62
+ end
63
+
64
+ # Creates an instance of the object from a hash.
65
+ def self.from_hash(hash)
66
+ return nil unless hash
67
+
68
+ # Extract variables from the hash.
69
+ payment_initiator =
70
+ hash.key?('payment_initiator') ? hash['payment_initiator'] : nil
71
+ charge_pattern =
72
+ hash.key?('charge_pattern') ? hash['charge_pattern'] : SKIP
73
+ usage_pattern = hash.key?('usage_pattern') ? hash['usage_pattern'] : SKIP
74
+ usage = hash['usage'] ||= StoredPaymentSourceUsageType::DERIVED
75
+
76
+ # Create object from extracted values.
77
+ PaypalWalletStoredCredential.new(payment_initiator: payment_initiator,
78
+ charge_pattern: charge_pattern,
79
+ usage_pattern: usage_pattern,
80
+ usage: usage)
81
+ end
82
+
83
+ # Provides a human-readable string representation of the object.
84
+ def to_s
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} payment_initiator: #{@payment_initiator}, charge_pattern:"\
87
+ " #{@charge_pattern}, usage_pattern: #{@usage_pattern}, usage: #{@usage}>"
88
+ end
89
+
90
+ # Provides a debugging-friendly string with detailed object information.
91
+ def inspect
92
+ class_name = self.class.name.split('::').last
93
+ "<#{class_name} payment_initiator: #{@payment_initiator.inspect}, charge_pattern:"\
94
+ " #{@charge_pattern.inspect}, usage_pattern: #{@usage_pattern.inspect}, usage:"\
95
+ " #{@usage.inspect}>"
96
+ end
97
+ end
98
+ end
@@ -20,7 +20,7 @@ module PaypalServerSdk
20
20
  attr_accessor :description
21
21
 
22
22
  # Expected business/pricing model for the billing agreement.
23
- # @return [PaypalPaymentTokenUsagePattern]
23
+ # @return [UsagePattern]
24
24
  attr_accessor :usage_pattern
25
25
 
26
26
  # The usage type associated with the PayPal payment token.
@@ -111,5 +111,22 @@ module PaypalServerSdk
111
111
  customer_type: customer_type,
112
112
  permit_multiple_payment_tokens: permit_multiple_payment_tokens)
113
113
  end
114
+
115
+ # Provides a human-readable string representation of the object.
116
+ def to_s
117
+ class_name = self.class.name.split('::').last
118
+ "<#{class_name} store_in_vault: #{@store_in_vault}, description: #{@description},"\
119
+ " usage_pattern: #{@usage_pattern}, usage_type: #{@usage_type}, customer_type:"\
120
+ " #{@customer_type}, permit_multiple_payment_tokens: #{@permit_multiple_payment_tokens}>"
121
+ end
122
+
123
+ # Provides a debugging-friendly string with detailed object information.
124
+ def inspect
125
+ class_name = self.class.name.split('::').last
126
+ "<#{class_name} store_in_vault: #{@store_in_vault.inspect}, description:"\
127
+ " #{@description.inspect}, usage_pattern: #{@usage_pattern.inspect}, usage_type:"\
128
+ " #{@usage_type.inspect}, customer_type: #{@customer_type.inspect},"\
129
+ " permit_multiple_payment_tokens: #{@permit_multiple_payment_tokens.inspect}>"
130
+ end
114
131
  end
115
132
  end
@@ -82,5 +82,18 @@ module PaypalServerSdk
82
82
  links: links,
83
83
  customer: customer)
84
84
  end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} id: #{@id}, status: #{@status}, links: #{@links}, customer: #{@customer}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, links: #{@links.inspect},"\
96
+ " customer: #{@customer.inspect}>"
97
+ end
85
98
  end
86
99
  end
@@ -7,13 +7,18 @@ module PaypalServerSdk
7
7
  # The vault status.
8
8
  class PaypalWalletVaultStatus
9
9
  PAYPAL_WALLET_VAULT_STATUS = [
10
- # TODO: Write general description for VAULTED
10
+ # The payment source has been saved in your customer's vault. This vault
11
+ # status reflects `/v3/vault` status.
11
12
  VAULTED = 'VAULTED'.freeze,
12
13
 
13
- # TODO: Write general description for CREATED
14
+ # DEPRECATED. The payment source has been saved in your customer's vault.
15
+ # This status applies to deprecated integration patterns and will not be
16
+ # returned for v3/vault integrations.
14
17
  CREATED = 'CREATED'.freeze,
15
18
 
16
- # TODO: Write general description for APPROVED
19
+ # Customer has approved the action of saving the specified payment_source
20
+ # into their vault. Use v3/vault/payment-tokens with given setup_token to
21
+ # save the payment source in the vault
17
22
  APPROVED = 'APPROVED'.freeze
18
23
  ].freeze
19
24
 
@@ -73,5 +73,19 @@ module PaypalServerSdk
73
73
  national_number: national_number,
74
74
  extension_number: extension_number)
75
75
  end
76
+
77
+ # Provides a human-readable string representation of the object.
78
+ def to_s
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} country_code: #{@country_code}, national_number: #{@national_number},"\
81
+ " extension_number: #{@extension_number}>"
82
+ end
83
+
84
+ # Provides a debugging-friendly string with detailed object information.
85
+ def inspect
86
+ class_name = self.class.name.split('::').last
87
+ "<#{class_name} country_code: #{@country_code.inspect}, national_number:"\
88
+ " #{@national_number.inspect}, extension_number: #{@extension_number.inspect}>"
89
+ end
76
90
  end
77
91
  end
@@ -50,5 +50,17 @@ module PaypalServerSdk
50
50
  # Create object from extracted values.
51
51
  PhoneNumber.new(national_number: national_number)
52
52
  end
53
+
54
+ # Provides a human-readable string representation of the object.
55
+ def to_s
56
+ class_name = self.class.name.split('::').last
57
+ "<#{class_name} national_number: #{@national_number}>"
58
+ end
59
+
60
+ # Provides a debugging-friendly string with detailed object information.
61
+ def inspect
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} national_number: #{@national_number.inspect}>"
64
+ end
53
65
  end
54
66
  end
@@ -5,6 +5,8 @@
5
5
 
6
6
  module PaypalServerSdk
7
7
  # The phone number in its canonical international [E.164 numbering plan
8
+ # format](https://www.itu.int/rec/T-REC-E.164/en)., The phone number, in its
9
+ # canonical international [E.164 numbering plan
8
10
  # format](https://www.itu.int/rec/T-REC-E.164/en).
9
11
  class PhoneNumberWithCountryCode < BaseModel
10
12
  SKIP = Object.new
@@ -62,5 +64,18 @@ module PaypalServerSdk
62
64
  PhoneNumberWithCountryCode.new(country_code: country_code,
63
65
  national_number: national_number)
64
66
  end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} country_code: #{@country_code}, national_number: #{@national_number}>"
72
+ end
73
+
74
+ # Provides a debugging-friendly string with detailed object information.
75
+ def inspect
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} country_code: #{@country_code.inspect}, national_number:"\
78
+ " #{@national_number.inspect}>"
79
+ end
65
80
  end
66
81
  end
@@ -55,5 +55,18 @@ module PaypalServerSdk
55
55
  PhoneWithType.new(phone_number: phone_number,
56
56
  phone_type: phone_type)
57
57
  end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} phone_type: #{@phone_type}, phone_number: #{@phone_number}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} phone_type: #{@phone_type.inspect}, phone_number:"\
69
+ " #{@phone_number.inspect}>"
70
+ end
58
71
  end
59
72
  end
@@ -0,0 +1,102 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # The merchant level Recurring Billing plan metadata for the Billing
8
+ # Agreement.
9
+ class Plan < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # An array of billing cycles for trial billing and regular billing. A plan
14
+ # can have at most two trial cycles and only one regular cycle.
15
+ # @return [Array[BillingCycle]]
16
+ attr_accessor :billing_cycles
17
+
18
+ # Product details associated with any one-time product purchase.
19
+ # @return [Object]
20
+ attr_accessor :product
21
+
22
+ # The one-time charge info at the time of checkout.
23
+ # @return [OneTimeCharge]
24
+ attr_accessor :one_time_charges
25
+
26
+ # Name of the recurring plan.
27
+ # @return [String]
28
+ attr_accessor :name
29
+
30
+ # A mapping from model property names to API property names.
31
+ def self.names
32
+ @_hash = {} if @_hash.nil?
33
+ @_hash['billing_cycles'] = 'billing_cycles'
34
+ @_hash['product'] = 'product'
35
+ @_hash['one_time_charges'] = 'one_time_charges'
36
+ @_hash['name'] = 'name'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ %w[
43
+ product
44
+ name
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(billing_cycles:, one_time_charges:, product: SKIP,
54
+ name: SKIP)
55
+ @billing_cycles = billing_cycles
56
+ @product = product unless product == SKIP
57
+ @one_time_charges = one_time_charges
58
+ @name = name unless name == SKIP
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ # Parameter is an array, so we need to iterate through it
67
+ billing_cycles = nil
68
+ unless hash['billing_cycles'].nil?
69
+ billing_cycles = []
70
+ hash['billing_cycles'].each do |structure|
71
+ billing_cycles << (BillingCycle.from_hash(structure) if structure)
72
+ end
73
+ end
74
+
75
+ billing_cycles = nil unless hash.key?('billing_cycles')
76
+ one_time_charges = OneTimeCharge.from_hash(hash['one_time_charges']) if
77
+ hash['one_time_charges']
78
+ product = hash.key?('product') ? hash['product'] : SKIP
79
+ name = hash.key?('name') ? hash['name'] : SKIP
80
+
81
+ # Create object from extracted values.
82
+ Plan.new(billing_cycles: billing_cycles,
83
+ one_time_charges: one_time_charges,
84
+ product: product,
85
+ name: name)
86
+ end
87
+
88
+ # Provides a human-readable string representation of the object.
89
+ def to_s
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} billing_cycles: #{@billing_cycles}, product: #{@product}, one_time_charges:"\
92
+ " #{@one_time_charges}, name: #{@name}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} billing_cycles: #{@billing_cycles.inspect}, product: #{@product.inspect},"\
99
+ " one_time_charges: #{@one_time_charges.inspect}, name: #{@name.inspect}>"
100
+ end
101
+ end
102
+ end
@@ -59,5 +59,17 @@ module PaypalServerSdk
59
59
  PlatformFee.new(amount: amount,
60
60
  payee: payee)
61
61
  end
62
+
63
+ # Provides a human-readable string representation of the object.
64
+ def to_s
65
+ class_name = self.class.name.split('::').last
66
+ "<#{class_name} amount: #{@amount}, payee: #{@payee}>"
67
+ end
68
+
69
+ # Provides a debugging-friendly string with detailed object information.
70
+ def inspect
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} amount: #{@amount.inspect}, payee: #{@payee.inspect}>"
73
+ end
62
74
  end
63
75
  end
@@ -0,0 +1,28 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # The pricing model for the billing cycle.
8
+ class PricingModel
9
+ PRICING_MODEL = [
10
+ # A fixed pricing scheme where the customer is charged a fixed amount.
11
+ FIXED = 'FIXED'.freeze,
12
+
13
+ # A variable pricing scheme where the customer is charged a variable
14
+ # amount.
15
+ VARIABLE = 'VARIABLE'.freeze,
16
+
17
+ # A auto-reload pricing scheme where the customer is charged a fixed
18
+ # amount for reload.
19
+ AUTO_RELOAD = 'AUTO_RELOAD'.freeze
20
+ ].freeze
21
+
22
+ def self.validate(value)
23
+ return false if value.nil?
24
+
25
+ true
26
+ end
27
+ end
28
+ end