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
@@ -51,9 +51,8 @@ module PaypalServerSdk
51
51
 
52
52
  # The date and time, in [Internet date and time
53
53
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
54
- # required while fractional seconds are
55
- # optional.<blockquote><strong>Note:</strong> The regular expression
56
- # provides guidance but does not reject all invalid dates.</blockquote>
54
+ # required while fractional seconds are optional. Note: The regular
55
+ # expression provides guidance but does not reject all invalid dates.
57
56
  # @return [String]
58
57
  attr_accessor :expiration_time
59
58
 
@@ -64,17 +63,15 @@ module PaypalServerSdk
64
63
 
65
64
  # The date and time, in [Internet date and time
66
65
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
67
- # required while fractional seconds are
68
- # optional.<blockquote><strong>Note:</strong> The regular expression
69
- # provides guidance but does not reject all invalid dates.</blockquote>
66
+ # required while fractional seconds are optional. Note: The regular
67
+ # expression provides guidance but does not reject all invalid dates.
70
68
  # @return [String]
71
69
  attr_accessor :create_time
72
70
 
73
71
  # The date and time, in [Internet date and time
74
72
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
75
- # required while fractional seconds are
76
- # optional.<blockquote><strong>Note:</strong> The regular expression
77
- # provides guidance but does not reject all invalid dates.</blockquote>
73
+ # required while fractional seconds are optional. Note: The regular
74
+ # expression provides guidance but does not reject all invalid dates.
78
75
  # @return [String]
79
76
  attr_accessor :update_time
80
77
 
@@ -188,5 +185,27 @@ module PaypalServerSdk
188
185
  create_time: create_time,
189
186
  update_time: update_time)
190
187
  end
188
+
189
+ # Provides a human-readable string representation of the object.
190
+ def to_s
191
+ class_name = self.class.name.split('::').last
192
+ "<#{class_name} status: #{@status}, status_details: #{@status_details}, id: #{@id}, amount:"\
193
+ " #{@amount}, invoice_id: #{@invoice_id}, custom_id: #{@custom_id},"\
194
+ " network_transaction_reference: #{@network_transaction_reference}, seller_protection:"\
195
+ " #{@seller_protection}, expiration_time: #{@expiration_time}, links: #{@links},"\
196
+ " create_time: #{@create_time}, update_time: #{@update_time}>"
197
+ end
198
+
199
+ # Provides a debugging-friendly string with detailed object information.
200
+ def inspect
201
+ class_name = self.class.name.split('::').last
202
+ "<#{class_name} status: #{@status.inspect}, status_details: #{@status_details.inspect}, id:"\
203
+ " #{@id.inspect}, amount: #{@amount.inspect}, invoice_id: #{@invoice_id.inspect}, custom_id:"\
204
+ " #{@custom_id.inspect}, network_transaction_reference:"\
205
+ " #{@network_transaction_reference.inspect}, seller_protection:"\
206
+ " #{@seller_protection.inspect}, expiration_time: #{@expiration_time.inspect}, links:"\
207
+ " #{@links.inspect}, create_time: #{@create_time.inspect}, update_time:"\
208
+ " #{@update_time.inspect}>"
209
+ end
191
210
  end
192
211
  end
@@ -7,10 +7,10 @@ module PaypalServerSdk
7
7
  # The reason why the authorized status is `PENDING`.
8
8
  class AuthorizationIncompleteReason
9
9
  AUTHORIZATION_INCOMPLETE_REASON = [
10
- # TODO: Write general description for PENDING_REVIEW
10
+ # Authorization is pending manual review.
11
11
  PENDING_REVIEW = 'PENDING_REVIEW'.freeze,
12
12
 
13
- # TODO: Write general description for DECLINED_BY_RISK_FRAUD_FILTERS
13
+ # Risk Filter set by the payee failed for the transaction.
14
14
  DECLINED_BY_RISK_FRAUD_FILTERS = 'DECLINED_BY_RISK_FRAUD_FILTERS'.freeze
15
15
  ].freeze
16
16
 
@@ -7,22 +7,28 @@ module PaypalServerSdk
7
7
  # The status for the authorized payment.
8
8
  class AuthorizationStatus
9
9
  AUTHORIZATION_STATUS = [
10
- # TODO: Write general description for CREATED
10
+ # The authorized payment is created. No captured payments have been made
11
+ # for this authorized payment.
11
12
  CREATED = 'CREATED'.freeze,
12
13
 
13
- # TODO: Write general description for CAPTURED
14
+ # The authorized payment has one or more captures against it. The sum of
15
+ # these captured payments is greater than the amount of the original
16
+ # authorized payment.
14
17
  CAPTURED = 'CAPTURED'.freeze,
15
18
 
16
- # TODO: Write general description for DENIED
19
+ # PayPal cannot authorize funds for this authorized payment.
17
20
  DENIED = 'DENIED'.freeze,
18
21
 
19
- # TODO: Write general description for PARTIALLY_CAPTURED
22
+ # A captured payment was made for the authorized payment for an amount
23
+ # that is less than the amount of the original authorized payment.
20
24
  PARTIALLY_CAPTURED = 'PARTIALLY_CAPTURED'.freeze,
21
25
 
22
- # TODO: Write general description for VOIDED
26
+ # The authorized payment was voided. No more captured payments can be made
27
+ # against this authorized payment.
23
28
  VOIDED = 'VOIDED'.freeze,
24
29
 
25
- # TODO: Write general description for PENDING
30
+ # The created authorization is in pending state. For more information, see
31
+ # status.details.
26
32
  PENDING = 'PENDING'.freeze
27
33
  ].freeze
28
34
 
@@ -46,5 +46,17 @@ module PaypalServerSdk
46
46
  # Create object from extracted values.
47
47
  AuthorizationStatusDetails.new(reason: reason)
48
48
  end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} reason: #{@reason}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} reason: #{@reason.inspect}>"
60
+ end
49
61
  end
50
62
  end
@@ -56,5 +56,17 @@ module PaypalServerSdk
56
56
  AuthorizationStatusWithDetails.new(status: status,
57
57
  status_details: status_details)
58
58
  end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} status: #{@status}, status_details: #{@status_details}>"
64
+ end
65
+
66
+ # Provides a debugging-friendly string with detailed object information.
67
+ def inspect
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} status: #{@status.inspect}, status_details: #{@status_details.inspect}>"
70
+ end
59
71
  end
60
72
  end
@@ -53,9 +53,8 @@ module PaypalServerSdk
53
53
 
54
54
  # The date and time, in [Internet date and time
55
55
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
56
- # required while fractional seconds are
57
- # optional.<blockquote><strong>Note:</strong> The regular expression
58
- # provides guidance but does not reject all invalid dates.</blockquote>
56
+ # required while fractional seconds are optional. Note: The regular
57
+ # expression provides guidance but does not reject all invalid dates.
59
58
  # @return [String]
60
59
  attr_accessor :expiration_time
61
60
 
@@ -66,17 +65,15 @@ module PaypalServerSdk
66
65
 
67
66
  # The date and time, in [Internet date and time
68
67
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
69
- # required while fractional seconds are
70
- # optional.<blockquote><strong>Note:</strong> The regular expression
71
- # provides guidance but does not reject all invalid dates.</blockquote>
68
+ # required while fractional seconds are optional. Note: The regular
69
+ # expression provides guidance but does not reject all invalid dates.
72
70
  # @return [String]
73
71
  attr_accessor :create_time
74
72
 
75
73
  # The date and time, in [Internet date and time
76
74
  # format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are
77
- # required while fractional seconds are
78
- # optional.<blockquote><strong>Note:</strong> The regular expression
79
- # provides guidance but does not reject all invalid dates.</blockquote>
75
+ # required while fractional seconds are optional. Note: The regular
76
+ # expression provides guidance but does not reject all invalid dates.
80
77
  # @return [String]
81
78
  attr_accessor :update_time
82
79
 
@@ -201,5 +198,28 @@ module PaypalServerSdk
201
198
  update_time: update_time,
202
199
  processor_response: processor_response)
203
200
  end
201
+
202
+ # Provides a human-readable string representation of the object.
203
+ def to_s
204
+ class_name = self.class.name.split('::').last
205
+ "<#{class_name} status: #{@status}, status_details: #{@status_details}, id: #{@id}, amount:"\
206
+ " #{@amount}, invoice_id: #{@invoice_id}, custom_id: #{@custom_id},"\
207
+ " network_transaction_reference: #{@network_transaction_reference}, seller_protection:"\
208
+ " #{@seller_protection}, expiration_time: #{@expiration_time}, links: #{@links},"\
209
+ " create_time: #{@create_time}, update_time: #{@update_time}, processor_response:"\
210
+ " #{@processor_response}>"
211
+ end
212
+
213
+ # Provides a debugging-friendly string with detailed object information.
214
+ def inspect
215
+ class_name = self.class.name.split('::').last
216
+ "<#{class_name} status: #{@status.inspect}, status_details: #{@status_details.inspect}, id:"\
217
+ " #{@id.inspect}, amount: #{@amount.inspect}, invoice_id: #{@invoice_id.inspect}, custom_id:"\
218
+ " #{@custom_id.inspect}, network_transaction_reference:"\
219
+ " #{@network_transaction_reference.inspect}, seller_protection:"\
220
+ " #{@seller_protection.inspect}, expiration_time: #{@expiration_time.inspect}, links:"\
221
+ " #{@links.inspect}, create_time: #{@create_time.inspect}, update_time:"\
222
+ " #{@update_time.inspect}, processor_response: #{@processor_response.inspect}>"
223
+ end
204
224
  end
205
225
  end
@@ -8,77 +8,108 @@ module PaypalServerSdk
8
8
  # Express transactions.
9
9
  class AvsCode
10
10
  AVS_CODE = [
11
- # TODO: Write general description for A
12
- A = 'A'.freeze,
13
-
14
- # TODO: Write general description for B
15
- B = 'B'.freeze,
16
-
17
- # TODO: Write general description for C
18
- C = 'C'.freeze,
19
-
20
- # TODO: Write general description for D
21
- D = 'D'.freeze,
22
-
23
- # TODO: Write general description for E
24
- E = 'E'.freeze,
25
-
26
- # TODO: Write general description for F
27
- F = 'F'.freeze,
28
-
29
- # TODO: Write general description for G
30
- G = 'G'.freeze,
31
-
32
- # TODO: Write general description for I
33
- I = 'I'.freeze,
34
-
35
- # TODO: Write general description for M
36
- M = 'M'.freeze,
37
-
38
- # TODO: Write general description for N
39
- N = 'N'.freeze,
40
-
41
- # TODO: Write general description for P
42
- P = 'P'.freeze,
43
-
44
- # TODO: Write general description for R
45
- R = 'R'.freeze,
46
-
47
- # TODO: Write general description for S
48
- S = 'S'.freeze,
49
-
50
- # TODO: Write general description for U
51
- U = 'U'.freeze,
52
-
53
- # TODO: Write general description for W
54
- W = 'W'.freeze,
55
-
56
- # TODO: Write general description for X
57
- X = 'X'.freeze,
58
-
59
- # TODO: Write general description for Y
60
- Y = 'Y'.freeze,
61
-
62
- # TODO: Write general description for Z
63
- Z = 'Z'.freeze,
64
-
65
- # TODO: Write general description for NULL
66
- NULL = 'Null'.freeze,
67
-
68
- # TODO: Write general description for ENUM_0
69
- ENUM_0 = '0'.freeze,
70
-
71
- # TODO: Write general description for ENUM_1
72
- ENUM_1 = '1'.freeze,
73
-
74
- # TODO: Write general description for ENUM_2
75
- ENUM_2 = '2'.freeze,
76
-
77
- # TODO: Write general description for ENUM_3
78
- ENUM_3 = '3'.freeze,
79
-
80
- # TODO: Write general description for ENUM_4
81
- ENUM_4 = '4'.freeze
11
+ # For Visa, Mastercard, or Discover transactions, the address matches but
12
+ # the zip code does not match. For American Express transactions, the card
13
+ # holder address is correct.
14
+ AVS_A = 'A'.freeze,
15
+
16
+ # For Visa, Mastercard, or Discover transactions, the address matches.
17
+ # International A.
18
+ AVS_B = 'B'.freeze,
19
+
20
+ # For Visa, Mastercard, or Discover transactions, no values match.
21
+ # International N.
22
+ AVS_C = 'C'.freeze,
23
+
24
+ # For Visa, Mastercard, or Discover transactions, the address and postal
25
+ # code match. International X.
26
+ AVS_D = 'D'.freeze,
27
+
28
+ # For Visa, Mastercard, or Discover transactions, not allowed for Internet
29
+ # or phone transactions. For American Express card holder, the name is
30
+ # incorrect but the address and postal code match.
31
+ AVS_E = 'E'.freeze,
32
+
33
+ # For Visa, Mastercard, or Discover transactions, the address and postal
34
+ # code match. UK-specific X. For American Express card holder, the name is
35
+ # incorrect but the address matches.
36
+ AVS_F = 'F'.freeze,
37
+
38
+ # For Visa, Mastercard, or Discover transactions, global is unavailable.
39
+ # Nothing matches.
40
+ AVS_G = 'G'.freeze,
41
+
42
+ # For Visa, Mastercard, or Discover transactions, international is
43
+ # unavailable. Not applicable.
44
+ AVS_I = 'I'.freeze,
45
+
46
+ # For Visa, Mastercard, or Discover transactions, the address and postal
47
+ # code match. For American Express card holder, the name, address, and
48
+ # postal code match.
49
+ AVS_M = 'M'.freeze,
50
+
51
+ # For Visa, Mastercard, or Discover transactions, nothing matches. For
52
+ # American Express card holder, the address and postal code are both
53
+ # incorrect.
54
+ AVS_N = 'N'.freeze,
55
+
56
+ # For Visa, Mastercard, or Discover transactions, postal international Z.
57
+ # Postal code only.
58
+ AVS_P = 'P'.freeze,
59
+
60
+ # For Visa, Mastercard, or Discover transactions, re-try the request. For
61
+ # American Express, the system is unavailable.
62
+ AVS_R = 'R'.freeze,
63
+
64
+ # For Visa, Mastercard, Discover, or American Express, the service is not
65
+ # supported.
66
+ AVS_S = 'S'.freeze,
67
+
68
+ # For Visa, Mastercard, or Discover transactions, the service is
69
+ # unavailable. For American Express, information is not available. For
70
+ # Maestro, the address is not checked or the acquirer had no response. The
71
+ # service is not available.
72
+ AVS_U = 'U'.freeze,
73
+
74
+ # For Visa, Mastercard, or Discover transactions, whole ZIP code. For
75
+ # American Express, the card holder name, address, and postal code are all
76
+ # incorrect.
77
+ AVS_W = 'W'.freeze,
78
+
79
+ # For Visa, Mastercard, or Discover transactions, exact match of the
80
+ # address and the nine-digit ZIP code. For American Express, the card
81
+ # holder name, address, and postal code are all incorrect.
82
+ AVS_X = 'X'.freeze,
83
+
84
+ # For Visa, Mastercard, or Discover transactions, the address and
85
+ # five-digit ZIP code match. For American Express, the card holder address
86
+ # and postal code are both correct.
87
+ AVS_Y = 'Y'.freeze,
88
+
89
+ # For Visa, Mastercard, or Discover transactions, the five-digit ZIP code
90
+ # matches but no address. For American Express, only the card holder
91
+ # postal code is correct.
92
+ AVS_Z = 'Z'.freeze,
93
+
94
+ # For Maestro, no AVS response was obtained.
95
+ AVS_NULL = 'Null'.freeze,
96
+
97
+ # For Maestro, all address information matches.
98
+ AVS_0 = '0'.freeze,
99
+
100
+ # For Maestro, none of the address information matches.
101
+ AVS_1 = '1'.freeze,
102
+
103
+ # For Maestro, part of the address information matches.
104
+ AVS_2 = '2'.freeze,
105
+
106
+ # For Maestro, the merchant did not provide AVS information. It was not
107
+ # processed.
108
+ AVS_3 = '3'.freeze,
109
+
110
+ # For Maestro, the address was not checked or the acquirer had no
111
+ # response. The service is not available.
112
+ AVS_4 = '4'.freeze
82
113
  ].freeze
83
114
 
84
115
  def self.validate(value)
@@ -14,11 +14,10 @@ module PaypalServerSdk
14
14
  attr_accessor :name
15
15
 
16
16
  # The [two-character ISO 3166-1 code](/api/rest/reference/country-codes/)
17
- # that identifies the country or region.<blockquote><strong>Note:</strong>
18
- # The country code for Great Britain is <code>GB</code> and not
19
- # <code>UK</code> as used in the top-level domain names for that country.
20
- # Use the `C2` country code for China worldwide for comparable uncontrolled
21
- # price (CUP) method, bank card, and cross-border transactions.</blockquote>
17
+ # that identifies the country or region. Note: The country code for Great
18
+ # Britain is GB and not UK as used in the top-level domain names for that
19
+ # country. Use the `C2` country code for China worldwide for comparable
20
+ # uncontrolled price (CUP) method, bank card, and cross-border transactions.
22
21
  # @return [String]
23
22
  attr_accessor :country_code
24
23
 
@@ -91,5 +90,20 @@ module PaypalServerSdk
91
90
  iban_last_chars: iban_last_chars,
92
91
  card_last_digits: card_last_digits)
93
92
  end
93
+
94
+ # Provides a human-readable string representation of the object.
95
+ def to_s
96
+ class_name = self.class.name.split('::').last
97
+ "<#{class_name} name: #{@name}, country_code: #{@country_code}, bic: #{@bic},"\
98
+ " iban_last_chars: #{@iban_last_chars}, card_last_digits: #{@card_last_digits}>"
99
+ end
100
+
101
+ # Provides a debugging-friendly string with detailed object information.
102
+ def inspect
103
+ class_name = self.class.name.split('::').last
104
+ "<#{class_name} name: #{@name.inspect}, country_code: #{@country_code.inspect}, bic:"\
105
+ " #{@bic.inspect}, iban_last_chars: #{@iban_last_chars.inspect}, card_last_digits:"\
106
+ " #{@card_last_digits.inspect}>"
107
+ end
94
108
  end
95
109
  end
@@ -14,11 +14,10 @@ module PaypalServerSdk
14
14
  attr_accessor :name
15
15
 
16
16
  # The [two-character ISO 3166-1 code](/api/rest/reference/country-codes/)
17
- # that identifies the country or region.<blockquote><strong>Note:</strong>
18
- # The country code for Great Britain is <code>GB</code> and not
19
- # <code>UK</code> as used in the top-level domain names for that country.
20
- # Use the `C2` country code for China worldwide for comparable uncontrolled
21
- # price (CUP) method, bank card, and cross-border transactions.</blockquote>
17
+ # that identifies the country or region. Note: The country code for Great
18
+ # Britain is GB and not UK as used in the top-level domain names for that
19
+ # country. Use the `C2` country code for China worldwide for comparable
20
+ # uncontrolled price (CUP) method, bank card, and cross-border transactions.
22
21
  # @return [String]
23
22
  attr_accessor :country_code
24
23
 
@@ -69,5 +68,19 @@ module PaypalServerSdk
69
68
  country_code: country_code,
70
69
  experience_context: experience_context)
71
70
  end
71
+
72
+ # Provides a human-readable string representation of the object.
73
+ def to_s
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} name: #{@name}, country_code: #{@country_code}, experience_context:"\
76
+ " #{@experience_context}>"
77
+ end
78
+
79
+ # Provides a debugging-friendly string with detailed object information.
80
+ def inspect
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} name: #{@name.inspect}, country_code: #{@country_code.inspect},"\
83
+ " experience_context: #{@experience_context.inspect}>"
84
+ end
72
85
  end
73
86
  end
@@ -5,6 +5,7 @@
5
5
 
6
6
  module PaypalServerSdk
7
7
  # Base model.
8
+ # rubocop:disable all
8
9
  class BaseModel < CoreLibrary::BaseModel
9
10
  # Returns a Hash representation of the current object.
10
11
  def to_hash
@@ -15,48 +16,95 @@ module PaypalServerSdk
15
16
  instance_variables.each do |name|
16
17
  value = instance_variable_get(name)
17
18
  name = name[1..]
18
- key = self.class.names.key?(name) ? self.class.names[name] : name
19
- optional_fields = self.class.optionals
20
- nullable_fields = self.class.nullables
21
- if value.nil?
22
- next unless nullable_fields.include?(name)
23
-
24
- if !optional_fields.include?(name) && !nullable_fields.include?(name)
25
- raise ArgumentError,
26
- "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
27
33
  end
28
- end
29
34
 
30
- hash[key] = nil
31
- unless value.nil?
32
- if respond_to?("to_custom_#{name}")
33
- if (value.instance_of? Array) || (value.instance_of? Hash)
34
- params = [hash, key]
35
- hash[key] = send("to_custom_#{name}", *params)
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
36
53
  else
37
- hash[key] = send("to_custom_#{name}")
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
38
55
  end
39
- elsif respond_to?("to_union_type_#{name}")
40
- hash[key] = send("to_union_type_#{name}")
41
- elsif value.instance_of? Array
42
- hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
43
- elsif value.instance_of? Hash
44
- hash[key] = {}
45
- value.each do |k, v|
46
- hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
47
- end
48
- else
49
- hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
50
56
  end
51
57
  end
52
58
  end
53
59
  hash
54
60
  end
55
61
 
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
56
103
  # Returns a JSON representation of the curent object.
57
104
  def to_json(options = {})
58
105
  hash = to_hash
59
106
  hash.to_json(options)
60
107
  end
61
108
  end
109
+ # rubocop:enable all
62
110
  end