apimatic-cp-sdk 0.0.1

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 (271) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +178 -0
  4. data/bin/console +15 -0
  5. data/lib/cell_point_api/api_helper.rb +10 -0
  6. data/lib/cell_point_api/apis/apple_pay_api.rb +51 -0
  7. data/lib/cell_point_api/apis/authentication_api.rb +81 -0
  8. data/lib/cell_point_api/apis/base_api.rb +67 -0
  9. data/lib/cell_point_api/apis/bulk_api.rb +93 -0
  10. data/lib/cell_point_api/apis/cards_api.rb +104 -0
  11. data/lib/cell_point_api/apis/notes_api.rb +66 -0
  12. data/lib/cell_point_api/apis/oauth_authorization_api.rb +44 -0
  13. data/lib/cell_point_api/apis/orders_api.rb +483 -0
  14. data/lib/cell_point_api/apis/payment_methods_api.rb +57 -0
  15. data/lib/cell_point_api/apis/proxy_api.rb +91 -0
  16. data/lib/cell_point_api/apis/transactions_api.rb +546 -0
  17. data/lib/cell_point_api/apis/wallet_api.rb +39 -0
  18. data/lib/cell_point_api/client.rb +145 -0
  19. data/lib/cell_point_api/configuration.rb +180 -0
  20. data/lib/cell_point_api/events/callbacks/callbacks_handler.rb +37 -0
  21. data/lib/cell_point_api/events/unknown_event.rb +32 -0
  22. data/lib/cell_point_api/exceptions/api_exception.rb +21 -0
  23. data/lib/cell_point_api/exceptions/oauth_provider_exception.rb +64 -0
  24. data/lib/cell_point_api/exceptions/problem_exception.rb +75 -0
  25. data/lib/cell_point_api/http/api_response.rb +19 -0
  26. data/lib/cell_point_api/http/auth/cpd_issued_jwt.rb +156 -0
  27. data/lib/cell_point_api/http/auth/merchant_issued_jwt.rb +53 -0
  28. data/lib/cell_point_api/http/http_call_back.rb +10 -0
  29. data/lib/cell_point_api/http/http_method_enum.rb +10 -0
  30. data/lib/cell_point_api/http/http_request.rb +10 -0
  31. data/lib/cell_point_api/http/http_response.rb +10 -0
  32. data/lib/cell_point_api/http/proxy_settings.rb +22 -0
  33. data/lib/cell_point_api/logging/configuration/api_logging_configuration.rb +186 -0
  34. data/lib/cell_point_api/logging/sdk_logger.rb +17 -0
  35. data/lib/cell_point_api/models/account.rb +168 -0
  36. data/lib/cell_point_api/models/account_status.rb +52 -0
  37. data/lib/cell_point_api/models/account_type.rb +44 -0
  38. data/lib/cell_point_api/models/action_base.rb +74 -0
  39. data/lib/cell_point_api/models/action_completion_response.rb +77 -0
  40. data/lib/cell_point_api/models/action_result_status.rb +40 -0
  41. data/lib/cell_point_api/models/action_type.rb +36 -0
  42. data/lib/cell_point_api/models/activity.rb +244 -0
  43. data/lib/cell_point_api/models/activity_data.rb +127 -0
  44. data/lib/cell_point_api/models/address_verification_status.rb +56 -0
  45. data/lib/cell_point_api/models/airline_ancillary.rb +244 -0
  46. data/lib/cell_point_api/models/airline_ancillary_data.rb +120 -0
  47. data/lib/cell_point_api/models/airline_fare.rb +348 -0
  48. data/lib/cell_point_api/models/airline_fare_data.rb +217 -0
  49. data/lib/cell_point_api/models/airline_industry_data.rb +152 -0
  50. data/lib/cell_point_api/models/airport.rb +144 -0
  51. data/lib/cell_point_api/models/amount.rb +105 -0
  52. data/lib/cell_point_api/models/ancillary_details.rb +366 -0
  53. data/lib/cell_point_api/models/apple_pay_config.rb +83 -0
  54. data/lib/cell_point_api/models/apple_pay_instrument_apple_pay_node.rb +119 -0
  55. data/lib/cell_point_api/models/apple_pay_payment_instrument.rb +123 -0
  56. data/lib/cell_point_api/models/apple_tokenized_token.rb +143 -0
  57. data/lib/cell_point_api/models/audience.rb +36 -0
  58. data/lib/cell_point_api/models/authorization.rb +145 -0
  59. data/lib/cell_point_api/models/authorization_group.rb +99 -0
  60. data/lib/cell_point_api/models/authorization_group1.rb +216 -0
  61. data/lib/cell_point_api/models/authorization_group_full.rb +193 -0
  62. data/lib/cell_point_api/models/authorize_order_by_id_post201_response.rb +128 -0
  63. data/lib/cell_point_api/models/auto_rental.rb +195 -0
  64. data/lib/cell_point_api/models/auto_rental_data.rb +76 -0
  65. data/lib/cell_point_api/models/auto_rental_industry_data.rb +182 -0
  66. data/lib/cell_point_api/models/base_model.rb +110 -0
  67. data/lib/cell_point_api/models/bin.rb +73 -0
  68. data/lib/cell_point_api/models/breadcrumb.rb +86 -0
  69. data/lib/cell_point_api/models/browser_info.rb +114 -0
  70. data/lib/cell_point_api/models/bundle.rb +195 -0
  71. data/lib/cell_point_api/models/bundled_activity.rb +229 -0
  72. data/lib/cell_point_api/models/bundled_airline_ancillary.rb +226 -0
  73. data/lib/cell_point_api/models/bundled_airline_fare.rb +330 -0
  74. data/lib/cell_point_api/models/bundled_auto_rental.rb +176 -0
  75. data/lib/cell_point_api/models/bundled_discount.rb +132 -0
  76. data/lib/cell_point_api/models/bundled_item_base.rb +123 -0
  77. data/lib/cell_point_api/models/bundled_lodging_reservation.rb +176 -0
  78. data/lib/cell_point_api/models/bundled_product.rb +161 -0
  79. data/lib/cell_point_api/models/buyer.rb +129 -0
  80. data/lib/cell_point_api/models/buyer_fingerprint.rb +125 -0
  81. data/lib/cell_point_api/models/buyer_history.rb +199 -0
  82. data/lib/cell_point_api/models/cancel.rb +109 -0
  83. data/lib/cell_point_api/models/cancelled_payment_transactions.rb +84 -0
  84. data/lib/cell_point_api/models/capabilities.rb +77 -0
  85. data/lib/cell_point_api/models/capture.rb +84 -0
  86. data/lib/cell_point_api/models/capture_payment_response.rb +159 -0
  87. data/lib/cell_point_api/models/card.rb +131 -0
  88. data/lib/cell_point_api/models/card_config.rb +105 -0
  89. data/lib/cell_point_api/models/card_identification.rb +126 -0
  90. data/lib/cell_point_api/models/card_instrument_card_node.rb +232 -0
  91. data/lib/cell_point_api/models/card_number.rb +122 -0
  92. data/lib/cell_point_api/models/card_payment_instrument.rb +136 -0
  93. data/lib/cell_point_api/models/card_scheme.rb +63 -0
  94. data/lib/cell_point_api/models/card_scheme_configuration.rb +87 -0
  95. data/lib/cell_point_api/models/carrier.rb +82 -0
  96. data/lib/cell_point_api/models/category.rb +36 -0
  97. data/lib/cell_point_api/models/client_assertion.rb +135 -0
  98. data/lib/cell_point_api/models/close.rb +89 -0
  99. data/lib/cell_point_api/models/close_refund_response.rb +73 -0
  100. data/lib/cell_point_api/models/closed_payment_transactions.rb +83 -0
  101. data/lib/cell_point_api/models/codeshare.rb +87 -0
  102. data/lib/cell_point_api/models/complete_person_name.rb +120 -0
  103. data/lib/cell_point_api/models/completion_redirect.rb +93 -0
  104. data/lib/cell_point_api/models/configuration.rb +86 -0
  105. data/lib/cell_point_api/models/contact_data.rb +82 -0
  106. data/lib/cell_point_api/models/cpu.rb +74 -0
  107. data/lib/cell_point_api/models/device_os.rb +60 -0
  108. data/lib/cell_point_api/models/discount.rb +150 -0
  109. data/lib/cell_point_api/models/discount_data.rb +83 -0
  110. data/lib/cell_point_api/models/driver.rb +86 -0
  111. data/lib/cell_point_api/models/external_transaction.rb +227 -0
  112. data/lib/cell_point_api/models/externally_tokenized_card.rb +81 -0
  113. data/lib/cell_point_api/models/failover.rb +105 -0
  114. data/lib/cell_point_api/models/failure_category.rb +62 -0
  115. data/lib/cell_point_api/models/failure_module.rb +58 -0
  116. data/lib/cell_point_api/models/fingerprint.rb +82 -0
  117. data/lib/cell_point_api/models/fraud_assessment.rb +163 -0
  118. data/lib/cell_point_api/models/fulfilled_activity.rb +207 -0
  119. data/lib/cell_point_api/models/fulfilled_airline_ancillary.rb +207 -0
  120. data/lib/cell_point_api/models/fulfilled_airline_fare.rb +207 -0
  121. data/lib/cell_point_api/models/fulfilled_auto_rental.rb +207 -0
  122. data/lib/cell_point_api/models/fulfilled_bundle.rb +207 -0
  123. data/lib/cell_point_api/models/fulfilled_discount.rb +178 -0
  124. data/lib/cell_point_api/models/fulfilled_line_item_base.rb +177 -0
  125. data/lib/cell_point_api/models/fulfilled_lodging_reservation.rb +207 -0
  126. data/lib/cell_point_api/models/fulfilled_order.rb +148 -0
  127. data/lib/cell_point_api/models/fulfilled_product.rb +207 -0
  128. data/lib/cell_point_api/models/fulfilled_tax_line.rb +162 -0
  129. data/lib/cell_point_api/models/fulfillment_data.rb +90 -0
  130. data/lib/cell_point_api/models/fulfillment_status.rb +41 -0
  131. data/lib/cell_point_api/models/funding_type.rb +40 -0
  132. data/lib/cell_point_api/models/gender.rb +40 -0
  133. data/lib/cell_point_api/models/hpp_data.rb +155 -0
  134. data/lib/cell_point_api/models/identifying_document.rb +159 -0
  135. data/lib/cell_point_api/models/identifying_document_type.rb +60 -0
  136. data/lib/cell_point_api/models/industry_data.rb +124 -0
  137. data/lib/cell_point_api/models/informational_price_row.rb +97 -0
  138. data/lib/cell_point_api/models/informational_price_section.rb +104 -0
  139. data/lib/cell_point_api/models/itinerary_type.rb +47 -0
  140. data/lib/cell_point_api/models/journey_segment.rb +83 -0
  141. data/lib/cell_point_api/models/line_item_base.rb +101 -0
  142. data/lib/cell_point_api/models/line_item_type.rb +60 -0
  143. data/lib/cell_point_api/models/links.rb +86 -0
  144. data/lib/cell_point_api/models/location.rb +153 -0
  145. data/lib/cell_point_api/models/lodging_industry_data.rb +216 -0
  146. data/lib/cell_point_api/models/lodging_reservation.rb +195 -0
  147. data/lib/cell_point_api/models/lodging_reservation_data.rb +76 -0
  148. data/lib/cell_point_api/models/loyalty_account.rb +103 -0
  149. data/lib/cell_point_api/models/network_info.rb +76 -0
  150. data/lib/cell_point_api/models/non_negative_amount.rb +105 -0
  151. data/lib/cell_point_api/models/non_positive_amount.rb +105 -0
  152. data/lib/cell_point_api/models/note.rb +139 -0
  153. data/lib/cell_point_api/models/note_request.rb +90 -0
  154. data/lib/cell_point_api/models/oauth_provider_error.rb +62 -0
  155. data/lib/cell_point_api/models/oauth_scope_cpd_issued_jwt.rb +158 -0
  156. data/lib/cell_point_api/models/oauth_token.rb +96 -0
  157. data/lib/cell_point_api/models/order.rb +414 -0
  158. data/lib/cell_point_api/models/order_canceled_reason.rb +56 -0
  159. data/lib/cell_point_api/models/order_core.rb +343 -0
  160. data/lib/cell_point_api/models/order_extended.rb +150 -0
  161. data/lib/cell_point_api/models/order_payment_summary.rb +117 -0
  162. data/lib/cell_point_api/models/order_status.rb +161 -0
  163. data/lib/cell_point_api/models/order_status_type.rb +58 -0
  164. data/lib/cell_point_api/models/order_transactions.rb +88 -0
  165. data/lib/cell_point_api/models/owner.rb +131 -0
  166. data/lib/cell_point_api/models/page_type.rb +26 -0
  167. data/lib/cell_point_api/models/passenger.rb +229 -0
  168. data/lib/cell_point_api/models/password_change_type.rb +41 -0
  169. data/lib/cell_point_api/models/pay_pal_action.rb +129 -0
  170. data/lib/cell_point_api/models/pay_pal_payment_instrument.rb +88 -0
  171. data/lib/cell_point_api/models/payment_data.rb +102 -0
  172. data/lib/cell_point_api/models/payment_data_header.rb +94 -0
  173. data/lib/cell_point_api/models/payment_data_version.rb +26 -0
  174. data/lib/cell_point_api/models/payment_field.rb +68 -0
  175. data/lib/cell_point_api/models/payment_instrument_base.rb +87 -0
  176. data/lib/cell_point_api/models/payment_method.rb +52 -0
  177. data/lib/cell_point_api/models/payment_methods_for_order_get200_response.rb +157 -0
  178. data/lib/cell_point_api/models/payment_methods_search_vouchers_post200_response.rb +82 -0
  179. data/lib/cell_point_api/models/payment_processor.rb +121 -0
  180. data/lib/cell_point_api/models/payment_status.rb +122 -0
  181. data/lib/cell_point_api/models/payment_transaction.rb +605 -0
  182. data/lib/cell_point_api/models/payment_transaction_authorized_amount.rb +105 -0
  183. data/lib/cell_point_api/models/payment_transaction_canceled_amount.rb +105 -0
  184. data/lib/cell_point_api/models/payment_transaction_captured_amount.rb +105 -0
  185. data/lib/cell_point_api/models/payment_transaction_pending_authorize_amount.rb +106 -0
  186. data/lib/cell_point_api/models/payment_transaction_pending_cancel_amount.rb +106 -0
  187. data/lib/cell_point_api/models/payment_transaction_pending_capture_amount.rb +106 -0
  188. data/lib/cell_point_api/models/payment_transaction_processing_fee.rb +106 -0
  189. data/lib/cell_point_api/models/payment_transaction_refunded_amount.rb +105 -0
  190. data/lib/cell_point_api/models/payments_v1_bulks_response.rb +74 -0
  191. data/lib/cell_point_api/models/payments_v1_orders_payments_retry_failed_refunds_request.rb +74 -0
  192. data/lib/cell_point_api/models/payments_v1_refunds_closures_request.rb +74 -0
  193. data/lib/cell_point_api/models/payments_v1_refunds_retry_failed_refunds_request.rb +74 -0
  194. data/lib/cell_point_api/models/payments_v1_schemes_response.rb +76 -0
  195. data/lib/cell_point_api/models/paypal_config.rb +94 -0
  196. data/lib/cell_point_api/models/person.rb +161 -0
  197. data/lib/cell_point_api/models/person_name.rb +89 -0
  198. data/lib/cell_point_api/models/phone.rb +132 -0
  199. data/lib/cell_point_api/models/pk_payment_method.rb +111 -0
  200. data/lib/cell_point_api/models/pk_payment_token.rb +94 -0
  201. data/lib/cell_point_api/models/postal_address.rb +217 -0
  202. data/lib/cell_point_api/models/price_summary.rb +191 -0
  203. data/lib/cell_point_api/models/product.rb +179 -0
  204. data/lib/cell_point_api/models/product_data.rb +104 -0
  205. data/lib/cell_point_api/models/property.rb +110 -0
  206. data/lib/cell_point_api/models/provider.rb +129 -0
  207. data/lib/cell_point_api/models/psp.rb +26 -0
  208. data/lib/cell_point_api/models/redirect_action.rb +116 -0
  209. data/lib/cell_point_api/models/refund_item.rb +310 -0
  210. data/lib/cell_point_api/models/refund_method.rb +36 -0
  211. data/lib/cell_point_api/models/refund_order_group_post201_response.rb +91 -0
  212. data/lib/cell_point_api/models/refund_reason.rb +104 -0
  213. data/lib/cell_point_api/models/refund_request.rb +161 -0
  214. data/lib/cell_point_api/models/refund_status.rb +44 -0
  215. data/lib/cell_point_api/models/refund_transaction.rb +311 -0
  216. data/lib/cell_point_api/models/refund_transaction_amount.rb +105 -0
  217. data/lib/cell_point_api/models/refund_type.rb +38 -0
  218. data/lib/cell_point_api/models/related_payment.rb +106 -0
  219. data/lib/cell_point_api/models/related_refund.rb +106 -0
  220. data/lib/cell_point_api/models/rental_location.rb +226 -0
  221. data/lib/cell_point_api/models/retry_refund_response.rb +73 -0
  222. data/lib/cell_point_api/models/reward.rb +101 -0
  223. data/lib/cell_point_api/models/room.rb +100 -0
  224. data/lib/cell_point_api/models/sales_channel.rb +36 -0
  225. data/lib/cell_point_api/models/save_pk_payment_token_request.rb +83 -0
  226. data/lib/cell_point_api/models/save_wallet_payment_token_request.rb +83 -0
  227. data/lib/cell_point_api/models/screen.rb +97 -0
  228. data/lib/cell_point_api/models/search_vouchers_request.rb +119 -0
  229. data/lib/cell_point_api/models/security_code.rb +83 -0
  230. data/lib/cell_point_api/models/security_code_match_status.rb +50 -0
  231. data/lib/cell_point_api/models/status.rb +43 -0
  232. data/lib/cell_point_api/models/status1.rb +52 -0
  233. data/lib/cell_point_api/models/summary.rb +82 -0
  234. data/lib/cell_point_api/models/tax.rb +134 -0
  235. data/lib/cell_point_api/models/taxes_and_fees_breakdown_page.rb +82 -0
  236. data/lib/cell_point_api/models/token_post200_response.rb +96 -0
  237. data/lib/cell_point_api/models/tokenized_card.rb +229 -0
  238. data/lib/cell_point_api/models/tokenized_card_with_contact_data.rb +247 -0
  239. data/lib/cell_point_api/models/tokenized_data.rb +169 -0
  240. data/lib/cell_point_api/models/total_row.rb +83 -0
  241. data/lib/cell_point_api/models/transaction_action.rb +108 -0
  242. data/lib/cell_point_api/models/transaction_action_result.rb +94 -0
  243. data/lib/cell_point_api/models/transaction_base.rb +132 -0
  244. data/lib/cell_point_api/models/transaction_failure.rb +222 -0
  245. data/lib/cell_point_api/models/travel_journey.rb +139 -0
  246. data/lib/cell_point_api/models/travel_leg.rb +194 -0
  247. data/lib/cell_point_api/models/trigger_bulk_request.rb +83 -0
  248. data/lib/cell_point_api/models/type.rb +67 -0
  249. data/lib/cell_point_api/models/type1.rb +47 -0
  250. data/lib/cell_point_api/models/type2.rb +40 -0
  251. data/lib/cell_point_api/models/type3.rb +41 -0
  252. data/lib/cell_point_api/models/type4.rb +56 -0
  253. data/lib/cell_point_api/models/type5.rb +78 -0
  254. data/lib/cell_point_api/models/uplift_config.rb +73 -0
  255. data/lib/cell_point_api/models/uplift_payment_instrument.rb +102 -0
  256. data/lib/cell_point_api/models/vehicle.rb +139 -0
  257. data/lib/cell_point_api/models/voucher_config.rb +92 -0
  258. data/lib/cell_point_api/models/voucher_issuer.rb +26 -0
  259. data/lib/cell_point_api/models/voucher_payment_instrument.rb +233 -0
  260. data/lib/cell_point_api/models/voucher_payment_instrument_node.rb +198 -0
  261. data/lib/cell_point_api/models/voucher_type.rb +36 -0
  262. data/lib/cell_point_api/models/wallet_instrument_wallet_node.rb +136 -0
  263. data/lib/cell_point_api/models/wallet_payment_instrument.rb +123 -0
  264. data/lib/cell_point_api/models/wallet_tokenized_token.rb +148 -0
  265. data/lib/cell_point_api/models/wallet_tokenized_token_identification.rb +75 -0
  266. data/lib/cell_point_api/models/wallet_type.rb +36 -0
  267. data/lib/cell_point_api/utilities/date_time_helper.rb +11 -0
  268. data/lib/cell_point_api/utilities/file_wrapper.rb +28 -0
  269. data/lib/cell_point_api/utilities/union_type_lookup.rb +260 -0
  270. data/lib/cell_point_api.rb +301 -0
  271. metadata +354 -0
@@ -0,0 +1,311 @@
1
+ # cell_point_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module CellPointApi
8
+ # A Refund Transaction is a transaction that is used to refund funds to a
9
+ # customer.
10
+ class RefundTransaction < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Unique identifier for this transaction.
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # Identifier for an order.
19
+ # @return [String]
20
+ attr_accessor :order_id
21
+
22
+ # Discriminator used to identify the type of transaction.
23
+ # @return [Type2]
24
+ attr_accessor :type
25
+
26
+ # Details about a failure that happened on a transaction.
27
+ # @return [TransactionFailure]
28
+ attr_accessor :failure
29
+
30
+ # When the transaction was created.
31
+ # @return [DateTime]
32
+ attr_accessor :created_at
33
+
34
+ # Acquirer or Payment Service Provider (PSP) that processed the payment.
35
+ # @return [PaymentProcessor]
36
+ attr_accessor :payment_processor
37
+
38
+ # Optional merchant-defined reason for the refund.
39
+ # @return [RefundReason]
40
+ attr_accessor :reason
41
+
42
+ # Status of the refund.
43
+ # @return [RefundStatus]
44
+ attr_accessor :status
45
+
46
+ # When the refund was last processed.
47
+ # A refund can be processed multiple times if it fails initially.
48
+ # Note: this is different from `refundedAt` which is when the refund was
49
+ # successfully completed,
50
+ # whereas `processedAt` is when refund processing started.
51
+ # @return [DateTime]
52
+ attr_accessor :processed_at
53
+
54
+ # When the refund was successfully completed.
55
+ # @return [DateTime]
56
+ attr_accessor :refunded_at
57
+
58
+ # Type of refund to do, either partial or full. The actual refund however
59
+ # can be for any amount regardless of this type.
60
+ # The reason being that there may be fees so the refund can be full even
61
+ # though some amount is kept.
62
+ # @return [RefundType]
63
+ attr_accessor :refund_type
64
+
65
+ # Method of refunding the payment.
66
+ # @return [RefundMethod]
67
+ attr_accessor :refund_method
68
+
69
+ # Amount that was attempted.
70
+ # @return [RefundTransactionAmount]
71
+ attr_accessor :amount
72
+
73
+ # Payment transaction(s) that are being refunded.
74
+ # This will often only be a single transaction,
75
+ # but there are situations depending on merchant configuration
76
+ # where a single refund will be against multiple payments.
77
+ # @return [Array[RelatedPayment]]
78
+ attr_accessor :original_payment_transactions
79
+
80
+ # The payment instrument that is being used in the transaction.
81
+ # @return [Object]
82
+ attr_accessor :refunding_payment_instrument
83
+
84
+ # A mapping from model property names to API property names.
85
+ def self.names
86
+ @_hash = {} if @_hash.nil?
87
+ @_hash['id'] = 'id'
88
+ @_hash['order_id'] = 'orderId'
89
+ @_hash['type'] = 'type'
90
+ @_hash['failure'] = 'failure'
91
+ @_hash['created_at'] = 'createdAt'
92
+ @_hash['payment_processor'] = 'paymentProcessor'
93
+ @_hash['reason'] = 'reason'
94
+ @_hash['status'] = 'status'
95
+ @_hash['processed_at'] = 'processedAt'
96
+ @_hash['refunded_at'] = 'refundedAt'
97
+ @_hash['refund_type'] = 'refundType'
98
+ @_hash['refund_method'] = 'refundMethod'
99
+ @_hash['amount'] = 'amount'
100
+ @_hash['original_payment_transactions'] = 'originalPaymentTransactions'
101
+ @_hash['refunding_payment_instrument'] = 'refundingPaymentInstrument'
102
+ @_hash
103
+ end
104
+
105
+ # An array for optional fields
106
+ def self.optionals
107
+ %w[
108
+ order_id
109
+ failure
110
+ created_at
111
+ payment_processor
112
+ reason
113
+ processed_at
114
+ refunded_at
115
+ ]
116
+ end
117
+
118
+ # An array for nullable fields
119
+ def self.nullables
120
+ []
121
+ end
122
+
123
+ def initialize(id:, type:, status:, refund_type:, refund_method:, amount:,
124
+ original_payment_transactions:,
125
+ refunding_payment_instrument:, order_id: SKIP, failure: SKIP,
126
+ created_at: SKIP, payment_processor: SKIP, reason: SKIP,
127
+ processed_at: SKIP, refunded_at: SKIP,
128
+ additional_properties: nil)
129
+ # Add additional model properties to the instance
130
+ additional_properties = {} if additional_properties.nil?
131
+
132
+ @id = id
133
+ @order_id = order_id unless order_id == SKIP
134
+ @type = type
135
+ @failure = failure unless failure == SKIP
136
+ @created_at = created_at unless created_at == SKIP
137
+ @payment_processor = payment_processor unless payment_processor == SKIP
138
+ @reason = reason unless reason == SKIP
139
+ @status = status
140
+ @processed_at = processed_at unless processed_at == SKIP
141
+ @refunded_at = refunded_at unless refunded_at == SKIP
142
+ @refund_type = refund_type
143
+ @refund_method = refund_method
144
+ @amount = amount
145
+ @original_payment_transactions = original_payment_transactions
146
+ @refunding_payment_instrument = refunding_payment_instrument
147
+ @additional_properties = additional_properties
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
+ id = hash.key?('id') ? hash['id'] : nil
156
+ type = hash.key?('type') ? hash['type'] : nil
157
+ status = hash.key?('status') ? hash['status'] : nil
158
+ refund_type = hash.key?('refundType') ? hash['refundType'] : nil
159
+ refund_method = hash.key?('refundMethod') ? hash['refundMethod'] : nil
160
+ amount = RefundTransactionAmount.from_hash(hash['amount']) if hash['amount']
161
+ # Parameter is an array, so we need to iterate through it
162
+ original_payment_transactions = nil
163
+ unless hash['originalPaymentTransactions'].nil?
164
+ original_payment_transactions = []
165
+ hash['originalPaymentTransactions'].each do |structure|
166
+ original_payment_transactions << (RelatedPayment.from_hash(structure) if structure)
167
+ end
168
+ end
169
+
170
+ original_payment_transactions = nil unless hash.key?('originalPaymentTransactions')
171
+ refunding_payment_instrument = hash.key?('refundingPaymentInstrument') ? APIHelper.deserialize_union_type(
172
+ UnionTypeLookUp.get(:PaymentInstrument), hash['refundingPaymentInstrument']
173
+ ) : nil
174
+ order_id = hash.key?('orderId') ? hash['orderId'] : SKIP
175
+ failure = TransactionFailure.from_hash(hash['failure']) if hash['failure']
176
+ created_at = if hash.key?('createdAt')
177
+ (DateTimeHelper.from_rfc3339(hash['createdAt']) if hash['createdAt'])
178
+ else
179
+ SKIP
180
+ end
181
+ payment_processor = PaymentProcessor.from_hash(hash['paymentProcessor']) if
182
+ hash['paymentProcessor']
183
+ reason = RefundReason.from_hash(hash['reason']) if hash['reason']
184
+ processed_at = if hash.key?('processedAt')
185
+ (DateTimeHelper.from_rfc3339(hash['processedAt']) if hash['processedAt'])
186
+ else
187
+ SKIP
188
+ end
189
+ refunded_at = if hash.key?('refundedAt')
190
+ (DateTimeHelper.from_rfc3339(hash['refundedAt']) if hash['refundedAt'])
191
+ else
192
+ SKIP
193
+ end
194
+
195
+ # Create a new hash for additional properties, removing known properties.
196
+ new_hash = hash.reject { |k, _| names.value?(k) }
197
+
198
+ additional_properties = APIHelper.get_additional_properties(
199
+ new_hash, proc { |value| value }
200
+ )
201
+
202
+ # Create object from extracted values.
203
+ RefundTransaction.new(id: id,
204
+ type: type,
205
+ status: status,
206
+ refund_type: refund_type,
207
+ refund_method: refund_method,
208
+ amount: amount,
209
+ original_payment_transactions: original_payment_transactions,
210
+ refunding_payment_instrument: refunding_payment_instrument,
211
+ order_id: order_id,
212
+ failure: failure,
213
+ created_at: created_at,
214
+ payment_processor: payment_processor,
215
+ reason: reason,
216
+ processed_at: processed_at,
217
+ refunded_at: refunded_at,
218
+ additional_properties: additional_properties)
219
+ end
220
+
221
+ def to_custom_created_at
222
+ DateTimeHelper.to_rfc3339(created_at)
223
+ end
224
+
225
+ def to_custom_processed_at
226
+ DateTimeHelper.to_rfc3339(processed_at)
227
+ end
228
+
229
+ def to_custom_refunded_at
230
+ DateTimeHelper.to_rfc3339(refunded_at)
231
+ end
232
+
233
+ # Validates an instance of the object from a given value.
234
+ # @param [RefundTransaction | Hash] The value against the validation is performed.
235
+ def self.validate(value)
236
+ if value.instance_of? self
237
+ return (
238
+ APIHelper.valid_type?(value.id,
239
+ ->(val) { val.instance_of? String }) and
240
+ APIHelper.valid_type?(value.type,
241
+ ->(val) { Type2.validate(val) }) and
242
+ APIHelper.valid_type?(value.status,
243
+ ->(val) { RefundStatus.validate(val) }) and
244
+ APIHelper.valid_type?(value.refund_type,
245
+ ->(val) { RefundType.validate(val) }) and
246
+ APIHelper.valid_type?(value.refund_method,
247
+ ->(val) { RefundMethod.validate(val) }) and
248
+ APIHelper.valid_type?(value.amount,
249
+ ->(val) { RefundTransactionAmount.validate(val) },
250
+ is_model_hash: true) and
251
+ APIHelper.valid_type?(value.original_payment_transactions,
252
+ ->(val) { RelatedPayment.validate(val) },
253
+ is_model_hash: true,
254
+ is_inner_model_hash: true) and
255
+ UnionTypeLookUp.get(:PaymentInstrument)
256
+ .validate(value.refunding_payment_instrument)
257
+ )
258
+ end
259
+
260
+ return false unless value.instance_of? Hash
261
+
262
+ (
263
+ APIHelper.valid_type?(value['id'],
264
+ ->(val) { val.instance_of? String }) and
265
+ APIHelper.valid_type?(value['type'],
266
+ ->(val) { Type2.validate(val) }) and
267
+ APIHelper.valid_type?(value['status'],
268
+ ->(val) { RefundStatus.validate(val) }) and
269
+ APIHelper.valid_type?(value['refundType'],
270
+ ->(val) { RefundType.validate(val) }) and
271
+ APIHelper.valid_type?(value['refundMethod'],
272
+ ->(val) { RefundMethod.validate(val) }) and
273
+ APIHelper.valid_type?(value['amount'],
274
+ ->(val) { RefundTransactionAmount.validate(val) },
275
+ is_model_hash: true) and
276
+ APIHelper.valid_type?(value['originalPaymentTransactions'],
277
+ ->(val) { RelatedPayment.validate(val) },
278
+ is_model_hash: true,
279
+ is_inner_model_hash: true) and
280
+ UnionTypeLookUp.get(:PaymentInstrument)
281
+ .validate(value['refundingPaymentInstrument'])
282
+ )
283
+ end
284
+
285
+ # Provides a human-readable string representation of the object.
286
+ def to_s
287
+ class_name = self.class.name.split('::').last
288
+ "<#{class_name} id: #{@id}, order_id: #{@order_id}, type: #{@type}, failure: #{@failure},"\
289
+ " created_at: #{@created_at}, payment_processor: #{@payment_processor}, reason: #{@reason},"\
290
+ " status: #{@status}, processed_at: #{@processed_at}, refunded_at: #{@refunded_at},"\
291
+ " refund_type: #{@refund_type}, refund_method: #{@refund_method}, amount: #{@amount},"\
292
+ " original_payment_transactions: #{@original_payment_transactions},"\
293
+ " refunding_payment_instrument: #{@refunding_payment_instrument}, additional_properties:"\
294
+ " #{@additional_properties}>"
295
+ end
296
+
297
+ # Provides a debugging-friendly string with detailed object information.
298
+ def inspect
299
+ class_name = self.class.name.split('::').last
300
+ "<#{class_name} id: #{@id.inspect}, order_id: #{@order_id.inspect}, type: #{@type.inspect},"\
301
+ " failure: #{@failure.inspect}, created_at: #{@created_at.inspect}, payment_processor:"\
302
+ " #{@payment_processor.inspect}, reason: #{@reason.inspect}, status: #{@status.inspect},"\
303
+ " processed_at: #{@processed_at.inspect}, refunded_at: #{@refunded_at.inspect}, refund_type:"\
304
+ " #{@refund_type.inspect}, refund_method: #{@refund_method.inspect}, amount:"\
305
+ " #{@amount.inspect}, original_payment_transactions:"\
306
+ " #{@original_payment_transactions.inspect}, refunding_payment_instrument:"\
307
+ " #{@refunding_payment_instrument.inspect}, additional_properties:"\
308
+ " #{@additional_properties}>"
309
+ end
310
+ end
311
+ end
@@ -0,0 +1,105 @@
1
+ # cell_point_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CellPointApi
7
+ # Amount that was attempted.
8
+ class RefundTransactionAmount < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # ISO 4217 currency code. Must be UPPERCASE.
13
+ # @return [String]
14
+ attr_accessor :currency
15
+
16
+ # Cost in the lowest denominator of the currency.
17
+ # E.g. 101 for £1.01
18
+ # @return [Integer]
19
+ attr_accessor :value
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['currency'] = 'currency'
25
+ @_hash['value'] = 'value'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(currency:, value:, additional_properties: nil)
40
+ # Add additional model properties to the instance
41
+ additional_properties = {} if additional_properties.nil?
42
+
43
+ @currency = currency
44
+ @value = value
45
+ @additional_properties = additional_properties
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
+ currency = hash.key?('currency') ? hash['currency'] : nil
54
+ value = hash.key?('value') ? hash['value'] : nil
55
+
56
+ # Create a new hash for additional properties, removing known properties.
57
+ new_hash = hash.reject { |k, _| names.value?(k) }
58
+
59
+ additional_properties = APIHelper.get_additional_properties(
60
+ new_hash, proc { |value| value }
61
+ )
62
+
63
+ # Create object from extracted values.
64
+ RefundTransactionAmount.new(currency: currency,
65
+ value: value,
66
+ additional_properties: additional_properties)
67
+ end
68
+
69
+ # Validates an instance of the object from a given value.
70
+ # @param [RefundTransactionAmount | Hash] The value against the validation is performed.
71
+ def self.validate(value)
72
+ if value.instance_of? self
73
+ return (
74
+ APIHelper.valid_type?(value.currency,
75
+ ->(val) { val.instance_of? String }) and
76
+ APIHelper.valid_type?(value.value,
77
+ ->(val) { val.instance_of? Integer })
78
+ )
79
+ end
80
+
81
+ return false unless value.instance_of? Hash
82
+
83
+ (
84
+ APIHelper.valid_type?(value['currency'],
85
+ ->(val) { val.instance_of? String }) and
86
+ APIHelper.valid_type?(value['value'],
87
+ ->(val) { val.instance_of? Integer })
88
+ )
89
+ end
90
+
91
+ # Provides a human-readable string representation of the object.
92
+ def to_s
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} currency: #{@currency}, value: #{@value}, additional_properties:"\
95
+ " #{@additional_properties}>"
96
+ end
97
+
98
+ # Provides a debugging-friendly string with detailed object information.
99
+ def inspect
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} currency: #{@currency.inspect}, value: #{@value.inspect},"\
102
+ " additional_properties: #{@additional_properties}>"
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,38 @@
1
+ # cell_point_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CellPointApi
7
+ # Type of refund to do, either partial or full. The actual refund however can
8
+ # be for any amount regardless of this type. The reason being that there may
9
+ # be fees so the refund can be full even though some amount is kept.
10
+ class RefundType
11
+ REFUND_TYPE = [
12
+ # TODO: Write general description for FULL
13
+ FULL = 'FULL'.freeze,
14
+
15
+ # TODO: Write general description for PARTIAL
16
+ PARTIAL = 'PARTIAL'.freeze
17
+ ].freeze
18
+
19
+ def self.validate(value)
20
+ return false if value.nil?
21
+
22
+ REFUND_TYPE.include?(value)
23
+ end
24
+
25
+ def self.from_value(value, default_value = FULL)
26
+ return default_value if value.nil?
27
+
28
+ str = value.to_s.strip
29
+
30
+ case str.downcase
31
+ when 'full' then FULL
32
+ when 'partial' then PARTIAL
33
+ else
34
+ default_value
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,106 @@
1
+ # cell_point_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CellPointApi
7
+ # Contains the payment transaction that is being refunded.
8
+ class RelatedPayment < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique identifier for this transaction.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Amount refunded from a captured transaction.
17
+ # @return [PaymentTransactionRefundedAmount]
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['id'] = 'id'
24
+ @_hash['amount'] = 'amount'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(id:, amount:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @id = id
43
+ @amount = amount
44
+ @additional_properties = additional_properties
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ id = hash.key?('id') ? hash['id'] : nil
53
+ amount = PaymentTransactionRefundedAmount.from_hash(hash['amount']) if hash['amount']
54
+
55
+ # Create a new hash for additional properties, removing known properties.
56
+ new_hash = hash.reject { |k, _| names.value?(k) }
57
+
58
+ additional_properties = APIHelper.get_additional_properties(
59
+ new_hash, proc { |value| value }
60
+ )
61
+
62
+ # Create object from extracted values.
63
+ RelatedPayment.new(id: id,
64
+ amount: amount,
65
+ additional_properties: additional_properties)
66
+ end
67
+
68
+ # Validates an instance of the object from a given value.
69
+ # @param [RelatedPayment | Hash] The value against the validation is performed.
70
+ def self.validate(value)
71
+ if value.instance_of? self
72
+ return (
73
+ APIHelper.valid_type?(value.id,
74
+ ->(val) { val.instance_of? String }) and
75
+ APIHelper.valid_type?(value.amount,
76
+ ->(val) { PaymentTransactionRefundedAmount.validate(val) },
77
+ is_model_hash: true)
78
+ )
79
+ end
80
+
81
+ return false unless value.instance_of? Hash
82
+
83
+ (
84
+ APIHelper.valid_type?(value['id'],
85
+ ->(val) { val.instance_of? String }) and
86
+ APIHelper.valid_type?(value['amount'],
87
+ ->(val) { PaymentTransactionRefundedAmount.validate(val) },
88
+ is_model_hash: true)
89
+ )
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} id: #{@id}, amount: #{@amount}, additional_properties:"\
96
+ " #{@additional_properties}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} id: #{@id.inspect}, amount: #{@amount.inspect}, additional_properties:"\
103
+ " #{@additional_properties}>"
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,106 @@
1
+ # cell_point_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module CellPointApi
7
+ # Contains the refund transaction that is being refunded.
8
+ class RelatedRefund < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique identifier for this transaction.
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Amount that was attempted.
17
+ # @return [RefundTransactionAmount]
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['id'] = 'id'
24
+ @_hash['amount'] = 'amount'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(id:, amount:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @id = id
43
+ @amount = amount
44
+ @additional_properties = additional_properties
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ id = hash.key?('id') ? hash['id'] : nil
53
+ amount = RefundTransactionAmount.from_hash(hash['amount']) if hash['amount']
54
+
55
+ # Create a new hash for additional properties, removing known properties.
56
+ new_hash = hash.reject { |k, _| names.value?(k) }
57
+
58
+ additional_properties = APIHelper.get_additional_properties(
59
+ new_hash, proc { |value| value }
60
+ )
61
+
62
+ # Create object from extracted values.
63
+ RelatedRefund.new(id: id,
64
+ amount: amount,
65
+ additional_properties: additional_properties)
66
+ end
67
+
68
+ # Validates an instance of the object from a given value.
69
+ # @param [RelatedRefund | Hash] The value against the validation is performed.
70
+ def self.validate(value)
71
+ if value.instance_of? self
72
+ return (
73
+ APIHelper.valid_type?(value.id,
74
+ ->(val) { val.instance_of? String }) and
75
+ APIHelper.valid_type?(value.amount,
76
+ ->(val) { RefundTransactionAmount.validate(val) },
77
+ is_model_hash: true)
78
+ )
79
+ end
80
+
81
+ return false unless value.instance_of? Hash
82
+
83
+ (
84
+ APIHelper.valid_type?(value['id'],
85
+ ->(val) { val.instance_of? String }) and
86
+ APIHelper.valid_type?(value['amount'],
87
+ ->(val) { RefundTransactionAmount.validate(val) },
88
+ is_model_hash: true)
89
+ )
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} id: #{@id}, amount: #{@amount}, additional_properties:"\
96
+ " #{@additional_properties}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} id: #{@id.inspect}, amount: #{@amount.inspect}, additional_properties:"\
103
+ " #{@additional_properties}>"
104
+ end
105
+ end
106
+ end