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,479 @@
1
+ # paypal_server_sdk
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module PaypalServerSdk
7
+ # Processor response code for the non-PayPal payment processor errors.
8
+ class ProcessorResponseCode
9
+ PROCESSOR_RESPONSE_CODE = [
10
+ # TODO: Write general description for ENUM_0000
11
+ ENUM_0000 = '0000'.freeze,
12
+
13
+ # TODO: Write general description for ENUM_00N7
14
+ ENUM_00N7 = '00N7'.freeze,
15
+
16
+ # TODO: Write general description for ENUM_0100
17
+ ENUM_0100 = '0100'.freeze,
18
+
19
+ # TODO: Write general description for ENUM_0390
20
+ ENUM_0390 = '0390'.freeze,
21
+
22
+ # TODO: Write general description for ENUM_0500
23
+ ENUM_0500 = '0500'.freeze,
24
+
25
+ # TODO: Write general description for ENUM_0580
26
+ ENUM_0580 = '0580'.freeze,
27
+
28
+ # TODO: Write general description for ENUM_0800
29
+ ENUM_0800 = '0800'.freeze,
30
+
31
+ # TODO: Write general description for ENUM_0880
32
+ ENUM_0880 = '0880'.freeze,
33
+
34
+ # TODO: Write general description for ENUM_0890
35
+ ENUM_0890 = '0890'.freeze,
36
+
37
+ # TODO: Write general description for ENUM_0960
38
+ ENUM_0960 = '0960'.freeze,
39
+
40
+ # TODO: Write general description for ENUM_0R00
41
+ ENUM_0R00 = '0R00'.freeze,
42
+
43
+ # TODO: Write general description for ENUM_1000
44
+ ENUM_1000 = '1000'.freeze,
45
+
46
+ # TODO: Write general description for ENUM_10BR
47
+ ENUM_10BR = '10BR'.freeze,
48
+
49
+ # TODO: Write general description for ENUM_1300
50
+ ENUM_1300 = '1300'.freeze,
51
+
52
+ # TODO: Write general description for ENUM_1310
53
+ ENUM_1310 = '1310'.freeze,
54
+
55
+ # TODO: Write general description for ENUM_1312
56
+ ENUM_1312 = '1312'.freeze,
57
+
58
+ # TODO: Write general description for ENUM_1317
59
+ ENUM_1317 = '1317'.freeze,
60
+
61
+ # TODO: Write general description for ENUM_1320
62
+ ENUM_1320 = '1320'.freeze,
63
+
64
+ # TODO: Write general description for ENUM_1330
65
+ ENUM_1330 = '1330'.freeze,
66
+
67
+ # TODO: Write general description for ENUM_1335
68
+ ENUM_1335 = '1335'.freeze,
69
+
70
+ # TODO: Write general description for ENUM_1340
71
+ ENUM_1340 = '1340'.freeze,
72
+
73
+ # TODO: Write general description for ENUM_1350
74
+ ENUM_1350 = '1350'.freeze,
75
+
76
+ # TODO: Write general description for ENUM_1352
77
+ ENUM_1352 = '1352'.freeze,
78
+
79
+ # TODO: Write general description for ENUM_1360
80
+ ENUM_1360 = '1360'.freeze,
81
+
82
+ # TODO: Write general description for ENUM_1370
83
+ ENUM_1370 = '1370'.freeze,
84
+
85
+ # TODO: Write general description for ENUM_1380
86
+ ENUM_1380 = '1380'.freeze,
87
+
88
+ # TODO: Write general description for ENUM_1382
89
+ ENUM_1382 = '1382'.freeze,
90
+
91
+ # TODO: Write general description for ENUM_1384
92
+ ENUM_1384 = '1384'.freeze,
93
+
94
+ # TODO: Write general description for ENUM_1390
95
+ ENUM_1390 = '1390'.freeze,
96
+
97
+ # TODO: Write general description for ENUM_1393
98
+ ENUM_1393 = '1393'.freeze,
99
+
100
+ # TODO: Write general description for ENUM_5100
101
+ ENUM_5100 = '5100'.freeze,
102
+
103
+ # TODO: Write general description for ENUM_5110
104
+ ENUM_5110 = '5110'.freeze,
105
+
106
+ # TODO: Write general description for ENUM_5120
107
+ ENUM_5120 = '5120'.freeze,
108
+
109
+ # TODO: Write general description for ENUM_5130
110
+ ENUM_5130 = '5130'.freeze,
111
+
112
+ # TODO: Write general description for ENUM_5135
113
+ ENUM_5135 = '5135'.freeze,
114
+
115
+ # TODO: Write general description for ENUM_5140
116
+ ENUM_5140 = '5140'.freeze,
117
+
118
+ # TODO: Write general description for ENUM_5150
119
+ ENUM_5150 = '5150'.freeze,
120
+
121
+ # TODO: Write general description for ENUM_5160
122
+ ENUM_5160 = '5160'.freeze,
123
+
124
+ # TODO: Write general description for ENUM_5170
125
+ ENUM_5170 = '5170'.freeze,
126
+
127
+ # TODO: Write general description for ENUM_5180
128
+ ENUM_5180 = '5180'.freeze,
129
+
130
+ # TODO: Write general description for ENUM_5190
131
+ ENUM_5190 = '5190'.freeze,
132
+
133
+ # TODO: Write general description for ENUM_5200
134
+ ENUM_5200 = '5200'.freeze,
135
+
136
+ # TODO: Write general description for ENUM_5210
137
+ ENUM_5210 = '5210'.freeze,
138
+
139
+ # TODO: Write general description for ENUM_5400
140
+ ENUM_5400 = '5400'.freeze,
141
+
142
+ # TODO: Write general description for ENUM_5500
143
+ ENUM_5500 = '5500'.freeze,
144
+
145
+ # TODO: Write general description for ENUM_5650
146
+ ENUM_5650 = '5650'.freeze,
147
+
148
+ # TODO: Write general description for ENUM_5700
149
+ ENUM_5700 = '5700'.freeze,
150
+
151
+ # TODO: Write general description for ENUM_5710
152
+ ENUM_5710 = '5710'.freeze,
153
+
154
+ # TODO: Write general description for ENUM_5800
155
+ ENUM_5800 = '5800'.freeze,
156
+
157
+ # TODO: Write general description for ENUM_5900
158
+ ENUM_5900 = '5900'.freeze,
159
+
160
+ # TODO: Write general description for ENUM_5910
161
+ ENUM_5910 = '5910'.freeze,
162
+
163
+ # TODO: Write general description for ENUM_5920
164
+ ENUM_5920 = '5920'.freeze,
165
+
166
+ # TODO: Write general description for ENUM_5930
167
+ ENUM_5930 = '5930'.freeze,
168
+
169
+ # TODO: Write general description for ENUM_5950
170
+ ENUM_5950 = '5950'.freeze,
171
+
172
+ # TODO: Write general description for ENUM_6300
173
+ ENUM_6300 = '6300'.freeze,
174
+
175
+ # TODO: Write general description for ENUM_7600
176
+ ENUM_7600 = '7600'.freeze,
177
+
178
+ # TODO: Write general description for ENUM_7700
179
+ ENUM_7700 = '7700'.freeze,
180
+
181
+ # TODO: Write general description for ENUM_7710
182
+ ENUM_7710 = '7710'.freeze,
183
+
184
+ # TODO: Write general description for ENUM_7800
185
+ ENUM_7800 = '7800'.freeze,
186
+
187
+ # TODO: Write general description for ENUM_7900
188
+ ENUM_7900 = '7900'.freeze,
189
+
190
+ # TODO: Write general description for ENUM_8000
191
+ ENUM_8000 = '8000'.freeze,
192
+
193
+ # TODO: Write general description for ENUM_8010
194
+ ENUM_8010 = '8010'.freeze,
195
+
196
+ # TODO: Write general description for ENUM_8020
197
+ ENUM_8020 = '8020'.freeze,
198
+
199
+ # TODO: Write general description for ENUM_8030
200
+ ENUM_8030 = '8030'.freeze,
201
+
202
+ # TODO: Write general description for ENUM_8100
203
+ ENUM_8100 = '8100'.freeze,
204
+
205
+ # TODO: Write general description for ENUM_8110
206
+ ENUM_8110 = '8110'.freeze,
207
+
208
+ # TODO: Write general description for ENUM_8220
209
+ ENUM_8220 = '8220'.freeze,
210
+
211
+ # TODO: Write general description for ENUM_9100
212
+ ENUM_9100 = '9100'.freeze,
213
+
214
+ # TODO: Write general description for ENUM_9500
215
+ ENUM_9500 = '9500'.freeze,
216
+
217
+ # TODO: Write general description for ENUM_9510
218
+ ENUM_9510 = '9510'.freeze,
219
+
220
+ # TODO: Write general description for ENUM_9520
221
+ ENUM_9520 = '9520'.freeze,
222
+
223
+ # TODO: Write general description for ENUM_9530
224
+ ENUM_9530 = '9530'.freeze,
225
+
226
+ # TODO: Write general description for ENUM_9540
227
+ ENUM_9540 = '9540'.freeze,
228
+
229
+ # TODO: Write general description for ENUM_9600
230
+ ENUM_9600 = '9600'.freeze,
231
+
232
+ # TODO: Write general description for PCNR
233
+ PCNR = 'PCNR'.freeze,
234
+
235
+ # TODO: Write general description for PCVV
236
+ PCVV = 'PCVV'.freeze,
237
+
238
+ # TODO: Write general description for PP06
239
+ PP06 = 'PP06'.freeze,
240
+
241
+ # TODO: Write general description for PPRN
242
+ PPRN = 'PPRN'.freeze,
243
+
244
+ # TODO: Write general description for PPAD
245
+ PPAD = 'PPAD'.freeze,
246
+
247
+ # TODO: Write general description for PPAB
248
+ PPAB = 'PPAB'.freeze,
249
+
250
+ # TODO: Write general description for PPAE
251
+ PPAE = 'PPAE'.freeze,
252
+
253
+ # TODO: Write general description for PPAG
254
+ PPAG = 'PPAG'.freeze,
255
+
256
+ # TODO: Write general description for PPAI
257
+ PPAI = 'PPAI'.freeze,
258
+
259
+ # TODO: Write general description for PPAR
260
+ PPAR = 'PPAR'.freeze,
261
+
262
+ # TODO: Write general description for PPAU
263
+ PPAU = 'PPAU'.freeze,
264
+
265
+ # TODO: Write general description for PPAV
266
+ PPAV = 'PPAV'.freeze,
267
+
268
+ # TODO: Write general description for PPAX
269
+ PPAX = 'PPAX'.freeze,
270
+
271
+ # TODO: Write general description for PPBG
272
+ PPBG = 'PPBG'.freeze,
273
+
274
+ # TODO: Write general description for PPC2
275
+ PPC2 = 'PPC2'.freeze,
276
+
277
+ # TODO: Write general description for PPCE
278
+ PPCE = 'PPCE'.freeze,
279
+
280
+ # TODO: Write general description for PPCO
281
+ PPCO = 'PPCO'.freeze,
282
+
283
+ # TODO: Write general description for PPCR
284
+ PPCR = 'PPCR'.freeze,
285
+
286
+ # TODO: Write general description for PPCT
287
+ PPCT = 'PPCT'.freeze,
288
+
289
+ # TODO: Write general description for PPCU
290
+ PPCU = 'PPCU'.freeze,
291
+
292
+ # TODO: Write general description for PPD3
293
+ PPD3 = 'PPD3'.freeze,
294
+
295
+ # TODO: Write general description for PPDC
296
+ PPDC = 'PPDC'.freeze,
297
+
298
+ # TODO: Write general description for PPDI
299
+ PPDI = 'PPDI'.freeze,
300
+
301
+ # TODO: Write general description for PPDV
302
+ PPDV = 'PPDV'.freeze,
303
+
304
+ # TODO: Write general description for PPDT
305
+ PPDT = 'PPDT'.freeze,
306
+
307
+ # TODO: Write general description for PPEF
308
+ PPEF = 'PPEF'.freeze,
309
+
310
+ # TODO: Write general description for PPEL
311
+ PPEL = 'PPEL'.freeze,
312
+
313
+ # TODO: Write general description for PPER
314
+ PPER = 'PPER'.freeze,
315
+
316
+ # TODO: Write general description for PPEX
317
+ PPEX = 'PPEX'.freeze,
318
+
319
+ # TODO: Write general description for PPFE
320
+ PPFE = 'PPFE'.freeze,
321
+
322
+ # TODO: Write general description for PPFI
323
+ PPFI = 'PPFI'.freeze,
324
+
325
+ # TODO: Write general description for PPFR
326
+ PPFR = 'PPFR'.freeze,
327
+
328
+ # TODO: Write general description for PPFV
329
+ PPFV = 'PPFV'.freeze,
330
+
331
+ # TODO: Write general description for PPGR
332
+ PPGR = 'PPGR'.freeze,
333
+
334
+ # TODO: Write general description for PPH1
335
+ PPH1 = 'PPH1'.freeze,
336
+
337
+ # TODO: Write general description for PPIF
338
+ PPIF = 'PPIF'.freeze,
339
+
340
+ # TODO: Write general description for PPII
341
+ PPII = 'PPII'.freeze,
342
+
343
+ # TODO: Write general description for PPIM
344
+ PPIM = 'PPIM'.freeze,
345
+
346
+ # TODO: Write general description for PPIT
347
+ PPIT = 'PPIT'.freeze,
348
+
349
+ # TODO: Write general description for PPLR
350
+ PPLR = 'PPLR'.freeze,
351
+
352
+ # TODO: Write general description for PPLS
353
+ PPLS = 'PPLS'.freeze,
354
+
355
+ # TODO: Write general description for PPMB
356
+ PPMB = 'PPMB'.freeze,
357
+
358
+ # TODO: Write general description for PPMC
359
+ PPMC = 'PPMC'.freeze,
360
+
361
+ # TODO: Write general description for PPMD
362
+ PPMD = 'PPMD'.freeze,
363
+
364
+ # TODO: Write general description for PPNC
365
+ PPNC = 'PPNC'.freeze,
366
+
367
+ # TODO: Write general description for PPNL
368
+ PPNL = 'PPNL'.freeze,
369
+
370
+ # TODO: Write general description for PPNM
371
+ PPNM = 'PPNM'.freeze,
372
+
373
+ # TODO: Write general description for PPNT
374
+ PPNT = 'PPNT'.freeze,
375
+
376
+ # TODO: Write general description for PPPH
377
+ PPPH = 'PPPH'.freeze,
378
+
379
+ # TODO: Write general description for PPPI
380
+ PPPI = 'PPPI'.freeze,
381
+
382
+ # TODO: Write general description for PPPM
383
+ PPPM = 'PPPM'.freeze,
384
+
385
+ # TODO: Write general description for PPQC
386
+ PPQC = 'PPQC'.freeze,
387
+
388
+ # TODO: Write general description for PPRE
389
+ PPRE = 'PPRE'.freeze,
390
+
391
+ # TODO: Write general description for PPRF
392
+ PPRF = 'PPRF'.freeze,
393
+
394
+ # TODO: Write general description for PPRR
395
+ PPRR = 'PPRR'.freeze,
396
+
397
+ # TODO: Write general description for PPS0
398
+ PPS0 = 'PPS0'.freeze,
399
+
400
+ # TODO: Write general description for PPS1
401
+ PPS1 = 'PPS1'.freeze,
402
+
403
+ # TODO: Write general description for PPS2
404
+ PPS2 = 'PPS2'.freeze,
405
+
406
+ # TODO: Write general description for PPS3
407
+ PPS3 = 'PPS3'.freeze,
408
+
409
+ # TODO: Write general description for PPS4
410
+ PPS4 = 'PPS4'.freeze,
411
+
412
+ # TODO: Write general description for PPS5
413
+ PPS5 = 'PPS5'.freeze,
414
+
415
+ # TODO: Write general description for PPS6
416
+ PPS6 = 'PPS6'.freeze,
417
+
418
+ # TODO: Write general description for PPSC
419
+ PPSC = 'PPSC'.freeze,
420
+
421
+ # TODO: Write general description for PPSD
422
+ PPSD = 'PPSD'.freeze,
423
+
424
+ # TODO: Write general description for PPSE
425
+ PPSE = 'PPSE'.freeze,
426
+
427
+ # TODO: Write general description for PPTE
428
+ PPTE = 'PPTE'.freeze,
429
+
430
+ # TODO: Write general description for PPTF
431
+ PPTF = 'PPTF'.freeze,
432
+
433
+ # TODO: Write general description for PPTI
434
+ PPTI = 'PPTI'.freeze,
435
+
436
+ # TODO: Write general description for PPTR
437
+ PPTR = 'PPTR'.freeze,
438
+
439
+ # TODO: Write general description for PPTT
440
+ PPTT = 'PPTT'.freeze,
441
+
442
+ # TODO: Write general description for PPTV
443
+ PPTV = 'PPTV'.freeze,
444
+
445
+ # TODO: Write general description for PPUA
446
+ PPUA = 'PPUA'.freeze,
447
+
448
+ # TODO: Write general description for PPUC
449
+ PPUC = 'PPUC'.freeze,
450
+
451
+ # TODO: Write general description for PPUE
452
+ PPUE = 'PPUE'.freeze,
453
+
454
+ # TODO: Write general description for PPUI
455
+ PPUI = 'PPUI'.freeze,
456
+
457
+ # TODO: Write general description for PPUP
458
+ PPUP = 'PPUP'.freeze,
459
+
460
+ # TODO: Write general description for PPUR
461
+ PPUR = 'PPUR'.freeze,
462
+
463
+ # TODO: Write general description for PPVC
464
+ PPVC = 'PPVC'.freeze,
465
+
466
+ # TODO: Write general description for PPVE
467
+ PPVE = 'PPVE'.freeze,
468
+
469
+ # TODO: Write general description for PPVT
470
+ PPVT = 'PPVT'.freeze
471
+ ].freeze
472
+
473
+ def self.validate(value)
474
+ return false if value.nil?
475
+
476
+ true
477
+ end
478
+ end
479
+ end
@@ -0,0 +1,227 @@
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 details. Used to capture required information for the
8
+ # payment contract.
9
+ class PurchaseUnit < 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`. <blockquote><strong>Note:</strong> If there
17
+ # are multiple purchase units, <code>reference_id</code> is required for
18
+ # each purchase unit.</blockquote>
19
+ # @return [String]
20
+ attr_accessor :reference_id
21
+
22
+ # The total order amount with an optional breakdown that provides details,
23
+ # such as the total item amount, total tax amount, shipping, handling,
24
+ # insurance, and discounts, if any.<br/>If you specify `amount.breakdown`,
25
+ # the amount equals `item_total` plus `tax_total` plus `shipping` plus
26
+ # `handling` plus `insurance` minus `shipping_discount` minus
27
+ # discount.<br/>The amount must be a positive number. For listed of
28
+ # supported currencies and decimal precision, see the PayPal REST APIs <a
29
+ # href="/docs/integration/direct/rest/currency-codes/">Currency Codes</a>.
30
+ # @return [AmountWithBreakdown]
31
+ attr_accessor :amount
32
+
33
+ # The merchant who receives the funds and fulfills the order. The merchant
34
+ # is also known as the payee.
35
+ # @return [Payee]
36
+ attr_accessor :payee
37
+
38
+ # Any additional payment instructions to be consider during payment
39
+ # processing. This processing instruction is applicable for Capturing an
40
+ # order or Authorizing an Order.
41
+ # @return [PaymentInstruction]
42
+ attr_accessor :payment_instruction
43
+
44
+ # The purchase description.
45
+ # @return [String]
46
+ attr_accessor :description
47
+
48
+ # The API caller-provided external ID. Used to reconcile API
49
+ # caller-initiated transactions with PayPal transactions. Appears in
50
+ # transaction and settlement reports.
51
+ # @return [String]
52
+ attr_accessor :custom_id
53
+
54
+ # The API caller-provided external invoice ID for this order.
55
+ # @return [String]
56
+ attr_accessor :invoice_id
57
+
58
+ # The PayPal-generated ID for the purchase unit. This ID appears in both the
59
+ # payer's transaction history and the emails that the payer receives. In
60
+ # addition, this ID is available in transaction and settlement reports that
61
+ # merchants and API callers can use to reconcile transactions. This ID is
62
+ # only available when an order is saved by calling
63
+ # <code>v2/checkout/orders/id/save</code>.
64
+ # @return [String]
65
+ attr_accessor :id
66
+
67
+ # The payment descriptor on account transactions on the customer's credit
68
+ # card statement, that PayPal sends to processors. The maximum length of the
69
+ # soft descriptor information that you can pass in the API field is 22
70
+ # characters, in the following format:<code>22 - len(PAYPAL * (8)) -
71
+ # len(<var>Descriptor in Payment Receiving Preferences of Merchant
72
+ # account</var> + 1)</code>The PAYPAL prefix uses 8 characters.<br/><br/>The
73
+ # soft descriptor supports the following ASCII
74
+ # characters:<ul><li>Alphanumeric
75
+ # characters</li><li>Dashes</li><li>Asterisks</li><li>Periods
76
+ # (.)</li><li>Spaces</li></ul>For Wallet payments marketplace
77
+ # integrations:<ul><li>The merchant descriptor in the Payment Receiving
78
+ # Preferences must be the marketplace name.</li><li>You can't use the
79
+ # remaining space to show the customer service number.</li><li>The remaining
80
+ # spaces can be a combination of seller name and country.</li></ul><br/>For
81
+ # unbranded payments (Direct Card) marketplace integrations, use a
82
+ # combination of the seller name and phone number.
83
+ # @return [String]
84
+ attr_accessor :soft_descriptor
85
+
86
+ # An array of items that the customer purchases from the merchant.
87
+ # @return [Array[Item]]
88
+ attr_accessor :items
89
+
90
+ # The order shipping details.
91
+ # @return [ShippingWithTrackingDetails]
92
+ attr_accessor :shipping
93
+
94
+ # Supplementary data about a payment. This object passes information that
95
+ # can be used to improve risk assessments and processing costs, for example,
96
+ # by providing Level 2 and Level 3 payment data.
97
+ # @return [SupplementaryData]
98
+ attr_accessor :supplementary_data
99
+
100
+ # The collection of payments, or transactions, for a purchase unit in an
101
+ # order. For example, authorized payments, captured payments, and refunds.
102
+ # @return [PaymentCollection]
103
+ attr_accessor :payments
104
+
105
+ # The error reason code and description that are the reason for the most
106
+ # recent order decline.
107
+ # @return [Array[Object]]
108
+ attr_accessor :most_recent_errors
109
+
110
+ # A mapping from model property names to API property names.
111
+ def self.names
112
+ @_hash = {} if @_hash.nil?
113
+ @_hash['reference_id'] = 'reference_id'
114
+ @_hash['amount'] = 'amount'
115
+ @_hash['payee'] = 'payee'
116
+ @_hash['payment_instruction'] = 'payment_instruction'
117
+ @_hash['description'] = 'description'
118
+ @_hash['custom_id'] = 'custom_id'
119
+ @_hash['invoice_id'] = 'invoice_id'
120
+ @_hash['id'] = 'id'
121
+ @_hash['soft_descriptor'] = 'soft_descriptor'
122
+ @_hash['items'] = 'items'
123
+ @_hash['shipping'] = 'shipping'
124
+ @_hash['supplementary_data'] = 'supplementary_data'
125
+ @_hash['payments'] = 'payments'
126
+ @_hash['most_recent_errors'] = 'most_recent_errors'
127
+ @_hash
128
+ end
129
+
130
+ # An array for optional fields
131
+ def self.optionals
132
+ %w[
133
+ reference_id
134
+ amount
135
+ payee
136
+ payment_instruction
137
+ description
138
+ custom_id
139
+ invoice_id
140
+ id
141
+ soft_descriptor
142
+ items
143
+ shipping
144
+ supplementary_data
145
+ payments
146
+ most_recent_errors
147
+ ]
148
+ end
149
+
150
+ # An array for nullable fields
151
+ def self.nullables
152
+ []
153
+ end
154
+
155
+ def initialize(reference_id: SKIP, amount: SKIP, payee: SKIP,
156
+ payment_instruction: SKIP, description: SKIP,
157
+ custom_id: SKIP, invoice_id: SKIP, id: SKIP,
158
+ soft_descriptor: SKIP, items: SKIP, shipping: SKIP,
159
+ supplementary_data: SKIP, payments: SKIP,
160
+ most_recent_errors: SKIP)
161
+ @reference_id = reference_id unless reference_id == SKIP
162
+ @amount = amount unless amount == SKIP
163
+ @payee = payee unless payee == SKIP
164
+ @payment_instruction = payment_instruction unless payment_instruction == SKIP
165
+ @description = description unless description == SKIP
166
+ @custom_id = custom_id unless custom_id == SKIP
167
+ @invoice_id = invoice_id unless invoice_id == SKIP
168
+ @id = id unless id == SKIP
169
+ @soft_descriptor = soft_descriptor unless soft_descriptor == SKIP
170
+ @items = items unless items == SKIP
171
+ @shipping = shipping unless shipping == SKIP
172
+ @supplementary_data = supplementary_data unless supplementary_data == SKIP
173
+ @payments = payments unless payments == SKIP
174
+ @most_recent_errors = most_recent_errors unless most_recent_errors == SKIP
175
+ end
176
+
177
+ # Creates an instance of the object from a hash.
178
+ def self.from_hash(hash)
179
+ return nil unless hash
180
+
181
+ # Extract variables from the hash.
182
+ reference_id = hash.key?('reference_id') ? hash['reference_id'] : SKIP
183
+ amount = AmountWithBreakdown.from_hash(hash['amount']) if hash['amount']
184
+ payee = Payee.from_hash(hash['payee']) if hash['payee']
185
+ payment_instruction = PaymentInstruction.from_hash(hash['payment_instruction']) if
186
+ hash['payment_instruction']
187
+ description = hash.key?('description') ? hash['description'] : SKIP
188
+ custom_id = hash.key?('custom_id') ? hash['custom_id'] : SKIP
189
+ invoice_id = hash.key?('invoice_id') ? hash['invoice_id'] : SKIP
190
+ id = hash.key?('id') ? hash['id'] : SKIP
191
+ soft_descriptor =
192
+ hash.key?('soft_descriptor') ? hash['soft_descriptor'] : SKIP
193
+ # Parameter is an array, so we need to iterate through it
194
+ items = nil
195
+ unless hash['items'].nil?
196
+ items = []
197
+ hash['items'].each do |structure|
198
+ items << (Item.from_hash(structure) if structure)
199
+ end
200
+ end
201
+
202
+ items = SKIP unless hash.key?('items')
203
+ shipping = ShippingWithTrackingDetails.from_hash(hash['shipping']) if hash['shipping']
204
+ supplementary_data = SupplementaryData.from_hash(hash['supplementary_data']) if
205
+ hash['supplementary_data']
206
+ payments = PaymentCollection.from_hash(hash['payments']) if hash['payments']
207
+ most_recent_errors =
208
+ hash.key?('most_recent_errors') ? hash['most_recent_errors'] : SKIP
209
+
210
+ # Create object from extracted values.
211
+ PurchaseUnit.new(reference_id: reference_id,
212
+ amount: amount,
213
+ payee: payee,
214
+ payment_instruction: payment_instruction,
215
+ description: description,
216
+ custom_id: custom_id,
217
+ invoice_id: invoice_id,
218
+ id: id,
219
+ soft_descriptor: soft_descriptor,
220
+ items: items,
221
+ shipping: shipping,
222
+ supplementary_data: supplementary_data,
223
+ payments: payments,
224
+ most_recent_errors: most_recent_errors)
225
+ end
226
+ end
227
+ end