paypal-server-sdk 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +35 -0
  3. data/README.md +112 -0
  4. data/lib/paypal_server_sdk/api_helper.rb +10 -0
  5. data/lib/paypal_server_sdk/client.rb +85 -0
  6. data/lib/paypal_server_sdk/configuration.rb +109 -0
  7. data/lib/paypal_server_sdk/controllers/base_controller.rb +71 -0
  8. data/lib/paypal_server_sdk/controllers/o_auth_authorization_controller.rb +42 -0
  9. data/lib/paypal_server_sdk/controllers/orders_controller.rb +517 -0
  10. data/lib/paypal_server_sdk/controllers/payments_controller.rb +404 -0
  11. data/lib/paypal_server_sdk/controllers/vault_controller.rb +224 -0
  12. data/lib/paypal_server_sdk/exceptions/api_exception.rb +10 -0
  13. data/lib/paypal_server_sdk/exceptions/error_exception.rb +71 -0
  14. data/lib/paypal_server_sdk/exceptions/o_auth_provider_exception.rb +48 -0
  15. data/lib/paypal_server_sdk/http/api_response.rb +21 -0
  16. data/lib/paypal_server_sdk/http/auth/o_auth2.rb +136 -0
  17. data/lib/paypal_server_sdk/http/http_call_back.rb +10 -0
  18. data/lib/paypal_server_sdk/http/http_method_enum.rb +10 -0
  19. data/lib/paypal_server_sdk/http/http_request.rb +10 -0
  20. data/lib/paypal_server_sdk/http/http_response.rb +10 -0
  21. data/lib/paypal_server_sdk/logging/configuration/api_logging_configuration.rb +114 -0
  22. data/lib/paypal_server_sdk/logging/sdk_logger.rb +17 -0
  23. data/lib/paypal_server_sdk/models/activity_timestamps.rb +68 -0
  24. data/lib/paypal_server_sdk/models/address.rb +116 -0
  25. data/lib/paypal_server_sdk/models/address_details.rb +160 -0
  26. data/lib/paypal_server_sdk/models/amount_breakdown.rb +115 -0
  27. data/lib/paypal_server_sdk/models/amount_with_breakdown.rb +80 -0
  28. data/lib/paypal_server_sdk/models/apple_pay_attributes.rb +60 -0
  29. data/lib/paypal_server_sdk/models/apple_pay_attributes_response.rb +50 -0
  30. data/lib/paypal_server_sdk/models/apple_pay_card.rb +94 -0
  31. data/lib/paypal_server_sdk/models/apple_pay_card_response.rb +167 -0
  32. data/lib/paypal_server_sdk/models/apple_pay_decrypted_token_data.rb +95 -0
  33. data/lib/paypal_server_sdk/models/apple_pay_payment_data.rb +83 -0
  34. data/lib/paypal_server_sdk/models/apple_pay_payment_data_type.rb +24 -0
  35. data/lib/paypal_server_sdk/models/apple_pay_payment_object.rb +114 -0
  36. data/lib/paypal_server_sdk/models/apple_pay_payment_token.rb +51 -0
  37. data/lib/paypal_server_sdk/models/apple_pay_request.rb +137 -0
  38. data/lib/paypal_server_sdk/models/apple_pay_tokenized_card.rb +113 -0
  39. data/lib/paypal_server_sdk/models/assurance_details.rb +68 -0
  40. data/lib/paypal_server_sdk/models/authentication_response.rb +61 -0
  41. data/lib/paypal_server_sdk/models/authorization.rb +192 -0
  42. data/lib/paypal_server_sdk/models/authorization_incomplete_reason.rb +23 -0
  43. data/lib/paypal_server_sdk/models/authorization_status.rb +35 -0
  44. data/lib/paypal_server_sdk/models/authorization_status_details.rb +50 -0
  45. data/lib/paypal_server_sdk/models/authorization_status_with_details.rb +60 -0
  46. data/lib/paypal_server_sdk/models/authorization_with_additional_data.rb +205 -0
  47. data/lib/paypal_server_sdk/models/avs_code.rb +90 -0
  48. data/lib/paypal_server_sdk/models/bancontact_payment_object.rb +95 -0
  49. data/lib/paypal_server_sdk/models/bancontact_payment_request.rb +73 -0
  50. data/lib/paypal_server_sdk/models/base_model.rb +62 -0
  51. data/lib/paypal_server_sdk/models/bin_details.rb +88 -0
  52. data/lib/paypal_server_sdk/models/blik_experience_context.rb +122 -0
  53. data/lib/paypal_server_sdk/models/blik_level0_payment_object.rb +48 -0
  54. data/lib/paypal_server_sdk/models/blik_one_click_payment_object.rb +52 -0
  55. data/lib/paypal_server_sdk/models/blik_one_click_payment_request.rb +82 -0
  56. data/lib/paypal_server_sdk/models/blik_payment_object.rb +86 -0
  57. data/lib/paypal_server_sdk/models/blik_payment_request.rb +105 -0
  58. data/lib/paypal_server_sdk/models/capture.rb +228 -0
  59. data/lib/paypal_server_sdk/models/capture_incomplete_reason.rb +55 -0
  60. data/lib/paypal_server_sdk/models/capture_payment_instruction.rb +89 -0
  61. data/lib/paypal_server_sdk/models/capture_request.rb +108 -0
  62. data/lib/paypal_server_sdk/models/capture_status.rb +35 -0
  63. data/lib/paypal_server_sdk/models/capture_status_details.rb +50 -0
  64. data/lib/paypal_server_sdk/models/capture_status_with_details.rb +60 -0
  65. data/lib/paypal_server_sdk/models/captured_payment.rb +248 -0
  66. data/lib/paypal_server_sdk/models/card_attributes.rb +70 -0
  67. data/lib/paypal_server_sdk/models/card_attributes_response.rb +50 -0
  68. data/lib/paypal_server_sdk/models/card_authentication_response.rb +51 -0
  69. data/lib/paypal_server_sdk/models/card_brand.rb +93 -0
  70. data/lib/paypal_server_sdk/models/card_customer_information.rb +85 -0
  71. data/lib/paypal_server_sdk/models/card_experience_context.rb +59 -0
  72. data/lib/paypal_server_sdk/models/card_from_request.rb +60 -0
  73. data/lib/paypal_server_sdk/models/card_payment_token.rb +166 -0
  74. data/lib/paypal_server_sdk/models/card_request.rb +176 -0
  75. data/lib/paypal_server_sdk/models/card_response.rb +139 -0
  76. data/lib/paypal_server_sdk/models/card_response_entity.rb +156 -0
  77. data/lib/paypal_server_sdk/models/card_stored_credential.rb +95 -0
  78. data/lib/paypal_server_sdk/models/card_supplementary_data.rb +71 -0
  79. data/lib/paypal_server_sdk/models/card_type.rb +32 -0
  80. data/lib/paypal_server_sdk/models/card_vault_response.rb +86 -0
  81. data/lib/paypal_server_sdk/models/card_verification.rb +51 -0
  82. data/lib/paypal_server_sdk/models/card_verification_details.rb +111 -0
  83. data/lib/paypal_server_sdk/models/card_verification_method.rb +29 -0
  84. data/lib/paypal_server_sdk/models/card_verification_processor_response.rb +62 -0
  85. data/lib/paypal_server_sdk/models/checkout_payment_intent.rb +24 -0
  86. data/lib/paypal_server_sdk/models/cobranded_card.rb +70 -0
  87. data/lib/paypal_server_sdk/models/confirm_order_request.rb +74 -0
  88. data/lib/paypal_server_sdk/models/customer_information.rb +72 -0
  89. data/lib/paypal_server_sdk/models/customer_request.rb +62 -0
  90. data/lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb +105 -0
  91. data/lib/paypal_server_sdk/models/cvv_code.rb +60 -0
  92. data/lib/paypal_server_sdk/models/disbursement_mode.rb +23 -0
  93. data/lib/paypal_server_sdk/models/dispute_category.rb +23 -0
  94. data/lib/paypal_server_sdk/models/eci_flag.rb +39 -0
  95. data/lib/paypal_server_sdk/models/enrollment_status.rb +29 -0
  96. data/lib/paypal_server_sdk/models/eps_payment_object.rb +74 -0
  97. data/lib/paypal_server_sdk/models/eps_payment_request.rb +73 -0
  98. data/lib/paypal_server_sdk/models/error_details.rb +110 -0
  99. data/lib/paypal_server_sdk/models/exchange_rate.rb +75 -0
  100. data/lib/paypal_server_sdk/models/experience_context.rb +98 -0
  101. data/lib/paypal_server_sdk/models/fullfillment_type.rb +31 -0
  102. data/lib/paypal_server_sdk/models/giropay_payment_object.rb +74 -0
  103. data/lib/paypal_server_sdk/models/giropay_payment_request.rb +73 -0
  104. data/lib/paypal_server_sdk/models/google_pay_authentication_method.rb +23 -0
  105. data/lib/paypal_server_sdk/models/google_pay_card_attributes.rb +51 -0
  106. data/lib/paypal_server_sdk/models/google_pay_card_response.rb +104 -0
  107. data/lib/paypal_server_sdk/models/google_pay_decrypted_token_data.rb +105 -0
  108. data/lib/paypal_server_sdk/models/google_pay_payment_method.rb +20 -0
  109. data/lib/paypal_server_sdk/models/google_pay_request.rb +118 -0
  110. data/lib/paypal_server_sdk/models/google_pay_request_card.rb +84 -0
  111. data/lib/paypal_server_sdk/models/google_pay_wallet_response.rb +85 -0
  112. data/lib/paypal_server_sdk/models/ideal_payment_object.rb +85 -0
  113. data/lib/paypal_server_sdk/models/ideal_payment_request.rb +83 -0
  114. data/lib/paypal_server_sdk/models/item.rb +134 -0
  115. data/lib/paypal_server_sdk/models/item_category.rb +26 -0
  116. data/lib/paypal_server_sdk/models/level2_card_processing_data.rb +66 -0
  117. data/lib/paypal_server_sdk/models/level3_card_processing_data.rb +120 -0
  118. data/lib/paypal_server_sdk/models/liability_shift_indicator.rb +26 -0
  119. data/lib/paypal_server_sdk/models/line_item.rb +177 -0
  120. data/lib/paypal_server_sdk/models/link_description.rb +75 -0
  121. data/lib/paypal_server_sdk/models/link_http_method.rb +41 -0
  122. data/lib/paypal_server_sdk/models/money.rb +62 -0
  123. data/lib/paypal_server_sdk/models/my_bank_payment_object.rb +85 -0
  124. data/lib/paypal_server_sdk/models/my_bank_payment_request.rb +73 -0
  125. data/lib/paypal_server_sdk/models/name.rb +61 -0
  126. data/lib/paypal_server_sdk/models/net_amount_breakdown_item.rb +73 -0
  127. data/lib/paypal_server_sdk/models/network_token.rb +95 -0
  128. data/lib/paypal_server_sdk/models/network_transaction_reference.rb +90 -0
  129. data/lib/paypal_server_sdk/models/network_transaction_reference_entity.rb +88 -0
  130. data/lib/paypal_server_sdk/models/o_auth_provider_error.rb +45 -0
  131. data/lib/paypal_server_sdk/models/o_auth_token.rb +106 -0
  132. data/lib/paypal_server_sdk/models/order.rb +178 -0
  133. data/lib/paypal_server_sdk/models/order_application_context.rb +193 -0
  134. data/lib/paypal_server_sdk/models/order_application_context_landing_page.rb +32 -0
  135. data/lib/paypal_server_sdk/models/order_application_context_shipping_preference.rb +34 -0
  136. data/lib/paypal_server_sdk/models/order_application_context_user_action.rb +29 -0
  137. data/lib/paypal_server_sdk/models/order_authorize_request.rb +51 -0
  138. data/lib/paypal_server_sdk/models/order_authorize_request_payment_source.rb +104 -0
  139. data/lib/paypal_server_sdk/models/order_authorize_response.rb +171 -0
  140. data/lib/paypal_server_sdk/models/order_authorize_response_payment_source.rb +88 -0
  141. data/lib/paypal_server_sdk/models/order_capture_request.rb +51 -0
  142. data/lib/paypal_server_sdk/models/order_capture_request_payment_source.rb +104 -0
  143. data/lib/paypal_server_sdk/models/order_confirm_application_context.rb +109 -0
  144. data/lib/paypal_server_sdk/models/order_request.rb +103 -0
  145. data/lib/paypal_server_sdk/models/order_status.rb +35 -0
  146. data/lib/paypal_server_sdk/models/order_tracker_item.rb +99 -0
  147. data/lib/paypal_server_sdk/models/order_tracker_request.rb +116 -0
  148. data/lib/paypal_server_sdk/models/order_tracker_response.rb +122 -0
  149. data/lib/paypal_server_sdk/models/order_tracker_status.rb +23 -0
  150. data/lib/paypal_server_sdk/models/p24_payment_object.rb +108 -0
  151. data/lib/paypal_server_sdk/models/p24_payment_request.rb +85 -0
  152. data/lib/paypal_server_sdk/models/pa_res_status.rb +42 -0
  153. data/lib/paypal_server_sdk/models/patch.rb +83 -0
  154. data/lib/paypal_server_sdk/models/patch_op.rb +35 -0
  155. data/lib/paypal_server_sdk/models/pay_pal_experience_landing_page.rb +26 -0
  156. data/lib/paypal_server_sdk/models/pay_pal_experience_user_action.rb +24 -0
  157. data/lib/paypal_server_sdk/models/pay_pal_payment_token.rb +180 -0
  158. data/lib/paypal_server_sdk/models/pay_pal_payment_token_customer_type.rb +25 -0
  159. data/lib/paypal_server_sdk/models/pay_pal_payment_token_usage_pattern.rb +35 -0
  160. data/lib/paypal_server_sdk/models/pay_pal_payment_token_usage_type.rb +23 -0
  161. data/lib/paypal_server_sdk/models/pay_pal_wallet.rb +158 -0
  162. data/lib/paypal_server_sdk/models/pay_pal_wallet_account_verification_status.rb +24 -0
  163. data/lib/paypal_server_sdk/models/pay_pal_wallet_attributes.rb +59 -0
  164. data/lib/paypal_server_sdk/models/pay_pal_wallet_attributes_response.rb +70 -0
  165. data/lib/paypal_server_sdk/models/pay_pal_wallet_customer.rb +85 -0
  166. data/lib/paypal_server_sdk/models/pay_pal_wallet_customer_request.rb +85 -0
  167. data/lib/paypal_server_sdk/models/pay_pal_wallet_experience_context.rb +140 -0
  168. data/lib/paypal_server_sdk/models/pay_pal_wallet_response.rb +166 -0
  169. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_instruction.rb +115 -0
  170. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_response.rb +86 -0
  171. data/lib/paypal_server_sdk/models/pay_pal_wallet_vault_status.rb +26 -0
  172. data/lib/paypal_server_sdk/models/payee.rb +65 -0
  173. data/lib/paypal_server_sdk/models/payee_base.rb +64 -0
  174. data/lib/paypal_server_sdk/models/payee_payment_method_preference.rb +23 -0
  175. data/lib/paypal_server_sdk/models/payer.rb +120 -0
  176. data/lib/paypal_server_sdk/models/payer_base.rb +64 -0
  177. data/lib/paypal_server_sdk/models/payment_advice_code.rb +30 -0
  178. data/lib/paypal_server_sdk/models/payment_authorization.rb +212 -0
  179. data/lib/paypal_server_sdk/models/payment_collection.rb +99 -0
  180. data/lib/paypal_server_sdk/models/payment_initiator.rb +23 -0
  181. data/lib/paypal_server_sdk/models/payment_instruction.rb +105 -0
  182. data/lib/paypal_server_sdk/models/payment_method_preference.rb +72 -0
  183. data/lib/paypal_server_sdk/models/payment_source.rb +187 -0
  184. data/lib/paypal_server_sdk/models/payment_source_response.rb +171 -0
  185. data/lib/paypal_server_sdk/models/payment_supplementary_data.rb +50 -0
  186. data/lib/paypal_server_sdk/models/payment_token_request.rb +60 -0
  187. data/lib/paypal_server_sdk/models/payment_token_request_card.rb +125 -0
  188. data/lib/paypal_server_sdk/models/payment_token_request_payment_source.rb +59 -0
  189. data/lib/paypal_server_sdk/models/payment_token_response.rb +87 -0
  190. data/lib/paypal_server_sdk/models/payment_token_response_payment_source.rb +87 -0
  191. data/lib/paypal_server_sdk/models/phone.rb +77 -0
  192. data/lib/paypal_server_sdk/models/phone_number.rb +54 -0
  193. data/lib/paypal_server_sdk/models/phone_number_with_country_code.rb +66 -0
  194. data/lib/paypal_server_sdk/models/phone_type.rb +32 -0
  195. data/lib/paypal_server_sdk/models/phone_with_type.rb +59 -0
  196. data/lib/paypal_server_sdk/models/platform_fee.rb +63 -0
  197. data/lib/paypal_server_sdk/models/processing_instruction.rb +23 -0
  198. data/lib/paypal_server_sdk/models/processor_response.rb +83 -0
  199. data/lib/paypal_server_sdk/models/processor_response_code.rb +479 -0
  200. data/lib/paypal_server_sdk/models/purchase_unit.rb +227 -0
  201. data/lib/paypal_server_sdk/models/purchase_unit_request.rb +193 -0
  202. data/lib/paypal_server_sdk/models/reauthorize_request.rb +62 -0
  203. data/lib/paypal_server_sdk/models/refund.rb +195 -0
  204. data/lib/paypal_server_sdk/models/refund_incomplete_reason.rb +20 -0
  205. data/lib/paypal_server_sdk/models/refund_payment_instruction.rb +68 -0
  206. data/lib/paypal_server_sdk/models/refund_platform_fee.rb +52 -0
  207. data/lib/paypal_server_sdk/models/refund_request.rb +100 -0
  208. data/lib/paypal_server_sdk/models/refund_status.rb +29 -0
  209. data/lib/paypal_server_sdk/models/refund_status_details.rb +50 -0
  210. data/lib/paypal_server_sdk/models/refund_status_with_details.rb +60 -0
  211. data/lib/paypal_server_sdk/models/related_identifiers.rb +69 -0
  212. data/lib/paypal_server_sdk/models/seller_payable_breakdown.rb +156 -0
  213. data/lib/paypal_server_sdk/models/seller_protection.rb +65 -0
  214. data/lib/paypal_server_sdk/models/seller_protection_status.rb +29 -0
  215. data/lib/paypal_server_sdk/models/seller_receivable_breakdown.rb +129 -0
  216. data/lib/paypal_server_sdk/models/setup_token_card_experience_context.rb +103 -0
  217. data/lib/paypal_server_sdk/models/setup_token_request.rb +60 -0
  218. data/lib/paypal_server_sdk/models/setup_token_request_card.rb +141 -0
  219. data/lib/paypal_server_sdk/models/setup_token_request_payment_source.rb +77 -0
  220. data/lib/paypal_server_sdk/models/setup_token_response.rb +106 -0
  221. data/lib/paypal_server_sdk/models/setup_token_response_card.rb +156 -0
  222. data/lib/paypal_server_sdk/models/setup_token_response_payment_source.rb +68 -0
  223. data/lib/paypal_server_sdk/models/shipment_carrier.rb +3852 -0
  224. data/lib/paypal_server_sdk/models/shipping_details.rb +106 -0
  225. data/lib/paypal_server_sdk/models/shipping_name.rb +50 -0
  226. data/lib/paypal_server_sdk/models/shipping_option.rb +94 -0
  227. data/lib/paypal_server_sdk/models/shipping_preference.rb +26 -0
  228. data/lib/paypal_server_sdk/models/shipping_type.rb +29 -0
  229. data/lib/paypal_server_sdk/models/shipping_with_tracking_details.rb +124 -0
  230. data/lib/paypal_server_sdk/models/sofort_payment_object.rb +85 -0
  231. data/lib/paypal_server_sdk/models/sofort_payment_request.rb +73 -0
  232. data/lib/paypal_server_sdk/models/standard_entry_class_code.rb +36 -0
  233. data/lib/paypal_server_sdk/models/store_in_vault_instruction.rb +20 -0
  234. data/lib/paypal_server_sdk/models/stored_payment_source.rb +95 -0
  235. data/lib/paypal_server_sdk/models/stored_payment_source_payment_type.rb +26 -0
  236. data/lib/paypal_server_sdk/models/stored_payment_source_usage_type.rb +27 -0
  237. data/lib/paypal_server_sdk/models/supplementary_data.rb +58 -0
  238. data/lib/paypal_server_sdk/models/supplementary_purchase_data.rb +63 -0
  239. data/lib/paypal_server_sdk/models/tax_id_type.rb +23 -0
  240. data/lib/paypal_server_sdk/models/tax_info.rb +57 -0
  241. data/lib/paypal_server_sdk/models/three_d_secure_authentication_response.rb +62 -0
  242. data/lib/paypal_server_sdk/models/token.rb +56 -0
  243. data/lib/paypal_server_sdk/models/token_request_type.rb +23 -0
  244. data/lib/paypal_server_sdk/models/token_type.rb +20 -0
  245. data/lib/paypal_server_sdk/models/trustly_payment_object.rb +85 -0
  246. data/lib/paypal_server_sdk/models/trustly_payment_request.rb +73 -0
  247. data/lib/paypal_server_sdk/models/universal_product_code.rb +56 -0
  248. data/lib/paypal_server_sdk/models/upc_type.rb +38 -0
  249. data/lib/paypal_server_sdk/models/vault_customer.rb +50 -0
  250. data/lib/paypal_server_sdk/models/vault_experience_context.rb +112 -0
  251. data/lib/paypal_server_sdk/models/vault_instruction.rb +50 -0
  252. data/lib/paypal_server_sdk/models/vault_instruction_base.rb +52 -0
  253. data/lib/paypal_server_sdk/models/vault_pay_pal_wallet_request.rb +115 -0
  254. data/lib/paypal_server_sdk/models/vault_response.rb +86 -0
  255. data/lib/paypal_server_sdk/models/vault_status.rb +26 -0
  256. data/lib/paypal_server_sdk/models/vault_token_request.rb +56 -0
  257. data/lib/paypal_server_sdk/models/vault_venmo_experience_context.rb +73 -0
  258. data/lib/paypal_server_sdk/models/vault_venmo_request.rb +115 -0
  259. data/lib/paypal_server_sdk/models/vaulted_digital_wallet.rb +106 -0
  260. data/lib/paypal_server_sdk/models/vaulted_digital_wallet_shipping_details.rb +75 -0
  261. data/lib/paypal_server_sdk/models/venmo_payment_token.rb +169 -0
  262. data/lib/paypal_server_sdk/models/venmo_payment_token_customer_type.rb +25 -0
  263. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_pattern.rb +35 -0
  264. data/lib/paypal_server_sdk/models/venmo_payment_token_usage_type.rb +23 -0
  265. data/lib/paypal_server_sdk/models/venmo_wallet_additional_attributes.rb +60 -0
  266. data/lib/paypal_server_sdk/models/venmo_wallet_attributes_response.rb +50 -0
  267. data/lib/paypal_server_sdk/models/venmo_wallet_customer_information.rb +63 -0
  268. data/lib/paypal_server_sdk/models/venmo_wallet_experience_context.rb +65 -0
  269. data/lib/paypal_server_sdk/models/venmo_wallet_request.rb +89 -0
  270. data/lib/paypal_server_sdk/models/venmo_wallet_response.rb +120 -0
  271. data/lib/paypal_server_sdk/models/venmo_wallet_vault_attributes.rb +114 -0
  272. data/lib/paypal_server_sdk/utilities/date_time_helper.rb +11 -0
  273. data/lib/paypal_server_sdk/utilities/file_wrapper.rb +16 -0
  274. data/lib/paypal_server_sdk.rb +306 -0
  275. metadata +357 -0
@@ -0,0 +1,193 @@
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 purchase unit request. Includes required information for the payment
8
+ # contract.
9
+ class PurchaseUnitRequest < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The API caller-provided external ID for the purchase unit. Required for
14
+ # multiple purchase units when you must update the order through `PATCH`. If
15
+ # you omit this value and the order contains only one purchase unit, PayPal
16
+ # sets this value to `default`.
17
+ # @return [String]
18
+ attr_accessor :reference_id
19
+
20
+ # The total order amount with an optional breakdown that provides details,
21
+ # such as the total item amount, total tax amount, shipping, handling,
22
+ # insurance, and discounts, if any.<br/>If you specify `amount.breakdown`,
23
+ # the amount equals `item_total` plus `tax_total` plus `shipping` plus
24
+ # `handling` plus `insurance` minus `shipping_discount` minus
25
+ # discount.<br/>The amount must be a positive number. For listed of
26
+ # supported currencies and decimal precision, see the PayPal REST APIs <a
27
+ # href="/docs/integration/direct/rest/currency-codes/">Currency Codes</a>.
28
+ # @return [AmountWithBreakdown]
29
+ attr_accessor :amount
30
+
31
+ # The merchant who receives the funds and fulfills the order. The merchant
32
+ # is also known as the payee.
33
+ # @return [Payee]
34
+ attr_accessor :payee
35
+
36
+ # Any additional payment instructions to be consider during payment
37
+ # processing. This processing instruction is applicable for Capturing an
38
+ # order or Authorizing an Order.
39
+ # @return [PaymentInstruction]
40
+ attr_accessor :payment_instruction
41
+
42
+ # The purchase description. The maximum length of the character is dependent
43
+ # on the type of characters used. The character length is specified assuming
44
+ # a US ASCII character. Depending on type of character; (e.g. accented
45
+ # character, Japanese characters) the number of characters that that can be
46
+ # specified as input might not equal the permissible max length.
47
+ # @return [String]
48
+ attr_accessor :description
49
+
50
+ # The API caller-provided external ID. Used to reconcile client transactions
51
+ # with PayPal transactions. Appears in transaction and settlement reports
52
+ # but is not visible to the payer.
53
+ # @return [String]
54
+ attr_accessor :custom_id
55
+
56
+ # The API caller-provided external invoice number for this order. Appears in
57
+ # both the payer's transaction history and the emails that the payer
58
+ # receives.
59
+ # @return [String]
60
+ attr_accessor :invoice_id
61
+
62
+ # The soft descriptor is the dynamic text used to construct the statement
63
+ # descriptor that appears on a payer's card statement.<br><br>If an Order is
64
+ # paid using the "PayPal Wallet", the statement descriptor will appear in
65
+ # following format on the payer's card statement:
66
+ # <code><var>PAYPAL_prefix</var>+(space)+<var>merchant_descriptor</var>+(spa
67
+ # ce)+ <var>soft_descriptor</var></code><blockquote><strong>Note:</strong>
68
+ # The merchant descriptor is the descriptor of the merchant’s payment
69
+ # receiving preferences which can be seen by logging into the merchant
70
+ # account
71
+ # https://www.sandbox.paypal.com/businessprofile/settings/info/edit</blockqu
72
+ # ote>The <code>PAYPAL</code> prefix uses 8 characters. Only the first 22
73
+ # characters will be displayed in the statement. <br>For example,
74
+ # if:<ul><li>The PayPal prefix toggle is <code>PAYPAL *</code>.</li><li>The
75
+ # merchant descriptor in the profile is <code>Janes Gift</code>.</li><li>The
76
+ # soft descriptor is <code>800-123-1234</code>.</li></ul>Then, the statement
77
+ # descriptor on the card is <code>PAYPAL * Janes Gift 80</code>.
78
+ # @return [String]
79
+ attr_accessor :soft_descriptor
80
+
81
+ # An array of items that the customer purchases from the merchant.
82
+ # @return [Array[Item]]
83
+ attr_accessor :items
84
+
85
+ # The shipping details.
86
+ # @return [ShippingDetails]
87
+ attr_accessor :shipping
88
+
89
+ # Supplementary data about a payment. This object passes information that
90
+ # can be used to improve risk assessments and processing costs, for example,
91
+ # by providing Level 2 and Level 3 payment data.
92
+ # @return [SupplementaryData]
93
+ attr_accessor :supplementary_data
94
+
95
+ # A mapping from model property names to API property names.
96
+ def self.names
97
+ @_hash = {} if @_hash.nil?
98
+ @_hash['reference_id'] = 'reference_id'
99
+ @_hash['amount'] = 'amount'
100
+ @_hash['payee'] = 'payee'
101
+ @_hash['payment_instruction'] = 'payment_instruction'
102
+ @_hash['description'] = 'description'
103
+ @_hash['custom_id'] = 'custom_id'
104
+ @_hash['invoice_id'] = 'invoice_id'
105
+ @_hash['soft_descriptor'] = 'soft_descriptor'
106
+ @_hash['items'] = 'items'
107
+ @_hash['shipping'] = 'shipping'
108
+ @_hash['supplementary_data'] = 'supplementary_data'
109
+ @_hash
110
+ end
111
+
112
+ # An array for optional fields
113
+ def self.optionals
114
+ %w[
115
+ reference_id
116
+ payee
117
+ payment_instruction
118
+ description
119
+ custom_id
120
+ invoice_id
121
+ soft_descriptor
122
+ items
123
+ shipping
124
+ supplementary_data
125
+ ]
126
+ end
127
+
128
+ # An array for nullable fields
129
+ def self.nullables
130
+ []
131
+ end
132
+
133
+ def initialize(amount:, reference_id: SKIP, payee: SKIP,
134
+ payment_instruction: SKIP, description: SKIP,
135
+ custom_id: SKIP, invoice_id: SKIP, soft_descriptor: SKIP,
136
+ items: SKIP, shipping: SKIP, supplementary_data: SKIP)
137
+ @reference_id = reference_id unless reference_id == SKIP
138
+ @amount = amount
139
+ @payee = payee unless payee == SKIP
140
+ @payment_instruction = payment_instruction unless payment_instruction == SKIP
141
+ @description = description unless description == SKIP
142
+ @custom_id = custom_id unless custom_id == SKIP
143
+ @invoice_id = invoice_id unless invoice_id == SKIP
144
+ @soft_descriptor = soft_descriptor unless soft_descriptor == SKIP
145
+ @items = items unless items == SKIP
146
+ @shipping = shipping unless shipping == SKIP
147
+ @supplementary_data = supplementary_data unless supplementary_data == SKIP
148
+ end
149
+
150
+ # Creates an instance of the object from a hash.
151
+ def self.from_hash(hash)
152
+ return nil unless hash
153
+
154
+ # Extract variables from the hash.
155
+ amount = AmountWithBreakdown.from_hash(hash['amount']) if hash['amount']
156
+ reference_id = hash.key?('reference_id') ? hash['reference_id'] : SKIP
157
+ payee = Payee.from_hash(hash['payee']) if hash['payee']
158
+ payment_instruction = PaymentInstruction.from_hash(hash['payment_instruction']) if
159
+ hash['payment_instruction']
160
+ description = hash.key?('description') ? hash['description'] : SKIP
161
+ custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP
162
+ invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
163
+ soft_descriptor =
164
+ hash.key?('soft_descriptor') ? hash['soft_descriptor'] : SKIP
165
+ # Parameter is an array, so we need to iterate through it
166
+ items = nil
167
+ unless hash['items'].nil?
168
+ items = []
169
+ hash['items'].each do |structure|
170
+ items << (Item.from_hash(structure) if structure)
171
+ end
172
+ end
173
+
174
+ items = SKIP unless hash.key?('items')
175
+ shipping = ShippingDetails.from_hash(hash['shipping']) if hash['shipping']
176
+ supplementary_data = SupplementaryData.from_hash(hash['supplementary_data']) if
177
+ hash['supplementary_data']
178
+
179
+ # Create object from extracted values.
180
+ PurchaseUnitRequest.new(amount: amount,
181
+ reference_id: reference_id,
182
+ payee: payee,
183
+ payment_instruction: payment_instruction,
184
+ description: description,
185
+ custom_id: custom_id,
186
+ invoice_id: invoice_id,
187
+ soft_descriptor: soft_descriptor,
188
+ items: items,
189
+ shipping: shipping,
190
+ supplementary_data: supplementary_data)
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,62 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Reauthorizes an authorized PayPal account payment, by ID. To ensure that
8
+ # funds are still available, reauthorize a payment after its initial three-day
9
+ # honor period expires. You can reauthorize a payment only once from days four
10
+ # to 29.<br/><br/>If 30 days have transpired since the date of the original
11
+ # authorization, you must create an authorized payment instead of
12
+ # reauthorizing the original authorized payment.<br/><br/>A reauthorized
13
+ # payment itself has a new honor period of three days.<br/><br/>You can
14
+ # reauthorize an authorized payment once. The allowed amount depends on
15
+ # context and geography, for example in US it is up to 115% of the original
16
+ # authorized amount, not to exceed an increase of $75 USD.<br/><br/>Supports
17
+ # only the `amount` request parameter.<blockquote><strong>Note:</strong> This
18
+ # request is currently not supported for Partner use cases.</blockquote>
19
+ class ReauthorizeRequest < BaseModel
20
+ SKIP = Object.new
21
+ private_constant :SKIP
22
+
23
+ # The currency and amount for a financial transaction, such as a balance or
24
+ # payment due.
25
+ # @return [Money]
26
+ attr_accessor :amount
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['amount'] = 'amount'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ %w[
38
+ amount
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(amount: SKIP)
48
+ @amount = amount unless amount == SKIP
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ amount = Money.from_hash(hash['amount']) if hash['amount']
57
+
58
+ # Create object from extracted values.
59
+ ReauthorizeRequest.new(amount: amount)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,195 @@
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 refund information.
8
+ class Refund < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The status of the refund.
13
+ # @return [RefundStatus]
14
+ attr_accessor :status
15
+
16
+ # The details of the refund status.
17
+ # @return [RefundStatusDetails]
18
+ attr_accessor :status_details
19
+
20
+ # The PayPal-generated ID for the refund.
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # The currency and amount for a financial transaction, such as a balance or
25
+ # payment due.
26
+ # @return [Money]
27
+ attr_accessor :amount
28
+
29
+ # The API caller-provided external invoice number for this order. Appears in
30
+ # both the payer's transaction history and the emails that the payer
31
+ # receives.
32
+ # @return [String]
33
+ attr_accessor :invoice_id
34
+
35
+ # The API caller-provided external ID. Used to reconcile API
36
+ # caller-initiated transactions with PayPal transactions. Appears in
37
+ # transaction and settlement reports.
38
+ # @return [String]
39
+ attr_accessor :custom_id
40
+
41
+ # Reference ID issued for the card transaction. This ID can be used to track
42
+ # the transaction across processors, card brands and issuing banks.
43
+ # @return [String]
44
+ attr_accessor :acquirer_reference_number
45
+
46
+ # The reason for the refund. Appears in both the payer's transaction history
47
+ # and the emails that the payer receives.
48
+ # @return [String]
49
+ attr_accessor :note_to_payer
50
+
51
+ # The breakdown of the refund.
52
+ # @return [SellerPayableBreakdown]
53
+ attr_accessor :seller_payable_breakdown
54
+
55
+ # The details for the merchant who receives the funds and fulfills the
56
+ # order. The merchant is also known as the payee.
57
+ # @return [PayeeBase]
58
+ attr_accessor :payer
59
+
60
+ # An array of related [HATEOAS
61
+ # links](/docs/api/reference/api-responses/#hateoas-links).
62
+ # @return [Array[LinkDescription]]
63
+ attr_accessor :links
64
+
65
+ # The date and time, in [Internet date and time
66
+ # 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>
70
+ # @return [String]
71
+ attr_accessor :create_time
72
+
73
+ # The date and time, in [Internet date and time
74
+ # 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>
78
+ # @return [String]
79
+ attr_accessor :update_time
80
+
81
+ # A mapping from model property names to API property names.
82
+ def self.names
83
+ @_hash = {} if @_hash.nil?
84
+ @_hash['status'] = 'status'
85
+ @_hash['status_details'] = 'status_details'
86
+ @_hash['id'] = 'id'
87
+ @_hash['amount'] = 'amount'
88
+ @_hash['invoice_id'] = 'invoice_id'
89
+ @_hash['custom_id'] = 'custom_id'
90
+ @_hash['acquirer_reference_number'] = 'acquirer_reference_number'
91
+ @_hash['note_to_payer'] = 'note_to_payer'
92
+ @_hash['seller_payable_breakdown'] = 'seller_payable_breakdown'
93
+ @_hash['payer'] = 'payer'
94
+ @_hash['links'] = 'links'
95
+ @_hash['create_time'] = 'create_time'
96
+ @_hash['update_time'] = 'update_time'
97
+ @_hash
98
+ end
99
+
100
+ # An array for optional fields
101
+ def self.optionals
102
+ %w[
103
+ status
104
+ status_details
105
+ id
106
+ amount
107
+ invoice_id
108
+ custom_id
109
+ acquirer_reference_number
110
+ note_to_payer
111
+ seller_payable_breakdown
112
+ payer
113
+ links
114
+ create_time
115
+ update_time
116
+ ]
117
+ end
118
+
119
+ # An array for nullable fields
120
+ def self.nullables
121
+ []
122
+ end
123
+
124
+ def initialize(status: SKIP, status_details: SKIP, id: SKIP, amount: SKIP,
125
+ invoice_id: SKIP, custom_id: SKIP,
126
+ acquirer_reference_number: SKIP, note_to_payer: SKIP,
127
+ seller_payable_breakdown: SKIP, payer: SKIP, links: SKIP,
128
+ create_time: SKIP, update_time: SKIP)
129
+ @status = status unless status == SKIP
130
+ @status_details = status_details unless status_details == SKIP
131
+ @id = id unless id == SKIP
132
+ @amount = amount unless amount == SKIP
133
+ @invoice_id = invoice_id unless invoice_id == SKIP
134
+ @custom_id = custom_id unless custom_id == SKIP
135
+ unless acquirer_reference_number == SKIP
136
+ @acquirer_reference_number =
137
+ acquirer_reference_number
138
+ end
139
+ @note_to_payer = note_to_payer unless note_to_payer == SKIP
140
+ @seller_payable_breakdown = seller_payable_breakdown unless seller_payable_breakdown == SKIP
141
+ @payer = payer unless payer == SKIP
142
+ @links = links unless links == SKIP
143
+ @create_time = create_time unless create_time == SKIP
144
+ @update_time = update_time unless update_time == SKIP
145
+ end
146
+
147
+ # Creates an instance of the object from a hash.
148
+ def self.from_hash(hash)
149
+ return nil unless hash
150
+
151
+ # Extract variables from the hash.
152
+ status = hash.key?('status') ? hash['status'] : SKIP
153
+ status_details = RefundStatusDetails.from_hash(hash['status_details']) if
154
+ hash['status_details']
155
+ id = hash.key?('id') ? hash['id'] : SKIP
156
+ amount = Money.from_hash(hash['amount']) if hash['amount']
157
+ invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
158
+ custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP
159
+ acquirer_reference_number =
160
+ hash.key?('acquirer_reference_number') ? hash['acquirer_reference_number'] : SKIP
161
+ note_to_payer = hash.key?('note_to_payer') ? hash['note_to_payer'] : SKIP
162
+ if hash['seller_payable_breakdown']
163
+ seller_payable_breakdown = SellerPayableBreakdown.from_hash(hash['seller_payable_breakdown'])
164
+ end
165
+ payer = PayeeBase.from_hash(hash['payer']) if hash['payer']
166
+ # Parameter is an array, so we need to iterate through it
167
+ links = nil
168
+ unless hash['links'].nil?
169
+ links = []
170
+ hash['links'].each do |structure|
171
+ links << (LinkDescription.from_hash(structure) if structure)
172
+ end
173
+ end
174
+
175
+ links = SKIP unless hash.key?('links')
176
+ create_time = hash.key?('create_time') ? hash['create_time'] : SKIP
177
+ update_time = hash.key?('update_time') ? hash['update_time'] : SKIP
178
+
179
+ # Create object from extracted values.
180
+ Refund.new(status: status,
181
+ status_details: status_details,
182
+ id: id,
183
+ amount: amount,
184
+ invoice_id: invoice_id,
185
+ custom_id: custom_id,
186
+ acquirer_reference_number: acquirer_reference_number,
187
+ note_to_payer: note_to_payer,
188
+ seller_payable_breakdown: seller_payable_breakdown,
189
+ payer: payer,
190
+ links: links,
191
+ create_time: create_time,
192
+ update_time: update_time)
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,20 @@
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 reason why the refund has the `PENDING` or `FAILED` status.
8
+ class RefundIncompleteReason
9
+ REFUND_INCOMPLETE_REASON = [
10
+ # TODO: Write general description for ECHECK
11
+ ECHECK = 'ECHECK'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ true
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,68 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Any additional payments instructions during refund payment processing. This
8
+ # object is only applicable to merchants that have been enabled for PayPal
9
+ # Commerce Platform for Marketplaces and Platforms capability. Please speak to
10
+ # your account manager if you want to use this capability.
11
+ class RefundPaymentInstruction < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # Specifies the amount that the API caller will contribute to the refund
16
+ # being processed. The amount needs to be lower than platform_fees amount
17
+ # originally captured or the amount that is remaining if multiple refunds
18
+ # have been processed. This field is only applicable to merchants that have
19
+ # been enabled for PayPal Commerce Platform for Marketplaces and Platforms
20
+ # capability. Please speak to your account manager if you want to use this
21
+ # capability.
22
+ # @return [Array[RefundPlatformFee]]
23
+ attr_accessor :platform_fees
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['platform_fees'] = 'platform_fees'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ %w[
35
+ platform_fees
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(platform_fees: SKIP)
45
+ @platform_fees = platform_fees unless platform_fees == SKIP
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ # Parameter is an array, so we need to iterate through it
54
+ platform_fees = nil
55
+ unless hash['platform_fees'].nil?
56
+ platform_fees = []
57
+ hash['platform_fees'].each do |structure|
58
+ platform_fees << (RefundPlatformFee.from_hash(structure) if structure)
59
+ end
60
+ end
61
+
62
+ platform_fees = SKIP unless hash.key?('platform_fees')
63
+
64
+ # Create object from extracted values.
65
+ RefundPaymentInstruction.new(platform_fees: platform_fees)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,52 @@
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 platform or partner fee, commission, or brokerage fee that is associated
8
+ # with the transaction. Not a separate or isolated transaction leg from the
9
+ # external perspective. The platform fee is limited in scope and is always
10
+ # associated with the original payment for the purchase unit.
11
+ class RefundPlatformFee < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # The currency and amount for a financial transaction, such as a balance or
16
+ # payment due.
17
+ # @return [Money]
18
+ attr_accessor :amount
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['amount'] = 'amount'
24
+ @_hash
25
+ end
26
+
27
+ # An array for optional fields
28
+ def self.optionals
29
+ []
30
+ end
31
+
32
+ # An array for nullable fields
33
+ def self.nullables
34
+ []
35
+ end
36
+
37
+ def initialize(amount:)
38
+ @amount = amount
39
+ end
40
+
41
+ # Creates an instance of the object from a hash.
42
+ def self.from_hash(hash)
43
+ return nil unless hash
44
+
45
+ # Extract variables from the hash.
46
+ amount = Money.from_hash(hash['amount']) if hash['amount']
47
+
48
+ # Create object from extracted values.
49
+ RefundPlatformFee.new(amount: amount)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,100 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Refunds a captured payment, by ID. For a full refund, include an empty
8
+ # request body. For a partial refund, include an <code>amount</code> object in
9
+ # the request body.
10
+ class RefundRequest < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # The currency and amount for a financial transaction, such as a balance or
15
+ # payment due.
16
+ # @return [Money]
17
+ attr_accessor :amount
18
+
19
+ # The API caller-provided external ID. Used to reconcile API
20
+ # caller-initiated transactions with PayPal transactions. Appears in
21
+ # transaction and settlement reports. The pattern is defined by an external
22
+ # party and supports Unicode.
23
+ # @return [String]
24
+ attr_accessor :custom_id
25
+
26
+ # The API caller-provided external invoice ID for this order. The pattern is
27
+ # defined by an external party and supports Unicode.
28
+ # @return [String]
29
+ attr_accessor :invoice_id
30
+
31
+ # The reason for the refund. Appears in both the payer's transaction history
32
+ # and the emails that the payer receives. The pattern is defined by an
33
+ # external party and supports Unicode.
34
+ # @return [String]
35
+ attr_accessor :note_to_payer
36
+
37
+ # Any additional payments instructions during refund payment processing.
38
+ # This object is only applicable to merchants that have been enabled for
39
+ # PayPal Commerce Platform for Marketplaces and Platforms capability. Please
40
+ # speak to your account manager if you want to use this capability.
41
+ # @return [RefundPaymentInstruction]
42
+ attr_accessor :payment_instruction
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['amount'] = 'amount'
48
+ @_hash['custom_id'] = 'custom_id'
49
+ @_hash['invoice_id'] = 'invoice_id'
50
+ @_hash['note_to_payer'] = 'note_to_payer'
51
+ @_hash['payment_instruction'] = 'payment_instruction'
52
+ @_hash
53
+ end
54
+
55
+ # An array for optional fields
56
+ def self.optionals
57
+ %w[
58
+ amount
59
+ custom_id
60
+ invoice_id
61
+ note_to_payer
62
+ payment_instruction
63
+ ]
64
+ end
65
+
66
+ # An array for nullable fields
67
+ def self.nullables
68
+ []
69
+ end
70
+
71
+ def initialize(amount: SKIP, custom_id: SKIP, invoice_id: SKIP,
72
+ note_to_payer: SKIP, payment_instruction: SKIP)
73
+ @amount = amount unless amount == SKIP
74
+ @custom_id = custom_id unless custom_id == SKIP
75
+ @invoice_id = invoice_id unless invoice_id == SKIP
76
+ @note_to_payer = note_to_payer unless note_to_payer == SKIP
77
+ @payment_instruction = payment_instruction unless payment_instruction == SKIP
78
+ end
79
+
80
+ # Creates an instance of the object from a hash.
81
+ def self.from_hash(hash)
82
+ return nil unless hash
83
+
84
+ # Extract variables from the hash.
85
+ amount = Money.from_hash(hash['amount']) if hash['amount']
86
+ custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP
87
+ invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
88
+ note_to_payer = hash.key?('note_to_payer') ? hash['note_to_payer'] : SKIP
89
+ payment_instruction = RefundPaymentInstruction.from_hash(hash['payment_instruction']) if
90
+ hash['payment_instruction']
91
+
92
+ # Create object from extracted values.
93
+ RefundRequest.new(amount: amount,
94
+ custom_id: custom_id,
95
+ invoice_id: invoice_id,
96
+ note_to_payer: note_to_payer,
97
+ payment_instruction: payment_instruction)
98
+ end
99
+ end
100
+ end