hamza-payments-query-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +136 -0
  4. data/lib/payments/api_helper.rb +10 -0
  5. data/lib/payments/client.rb +78 -0
  6. data/lib/payments/configuration.rb +145 -0
  7. data/lib/payments/controllers/base_controller.rb +60 -0
  8. data/lib/payments/controllers/m3_ds_actions_controller.rb +97 -0
  9. data/lib/payments/controllers/manage_payments_controller.rb +272 -0
  10. data/lib/payments/controllers/payment_controller.rb +51 -0
  11. data/lib/payments/controllers/payment_queries_controller.rb +134 -0
  12. data/lib/payments/exceptions/api_exception.rb +21 -0
  13. data/lib/payments/exceptions/error_response_exception.rb +51 -0
  14. data/lib/payments/exceptions/header_error_response_exception.rb +58 -0
  15. data/lib/payments/exceptions/pq_querybydaterange400_response_exception.rb +51 -0
  16. data/lib/payments/exceptions/pq_querybypaymentid404_response_error_exception.rb +51 -0
  17. data/lib/payments/exceptions/pq_queryhistoricalpayments400_response_exception.rb +51 -0
  18. data/lib/payments/exceptions/validation_error_response_exception.rb +58 -0
  19. data/lib/payments/http/auth/basic_auth.rb +50 -0
  20. data/lib/payments/http/http_call_back.rb +10 -0
  21. data/lib/payments/http/http_method_enum.rb +10 -0
  22. data/lib/payments/http/http_request.rb +10 -0
  23. data/lib/payments/http/http_response.rb +10 -0
  24. data/lib/payments/http/proxy_settings.rb +13 -0
  25. data/lib/payments/models/accept_enum.rb +21 -0
  26. data/lib/payments/models/account_history.rb +110 -0
  27. data/lib/payments/models/account_updater_message1_enum.rb +44 -0
  28. data/lib/payments/models/account_updater_message_enum.rb +41 -0
  29. data/lib/payments/models/advice.rb +62 -0
  30. data/lib/payments/models/applepay_payments_instruction.rb +151 -0
  31. data/lib/payments/models/authentication.rb +161 -0
  32. data/lib/payments/models/authorization_action_list.rb +90 -0
  33. data/lib/payments/models/authorization_failed.rb +103 -0
  34. data/lib/payments/models/authorization_refused.rb +124 -0
  35. data/lib/payments/models/authorization_requested.rb +94 -0
  36. data/lib/payments/models/authorization_succeeded.rb +104 -0
  37. data/lib/payments/models/authorization_timed_out.rb +94 -0
  38. data/lib/payments/models/authorization_type1_enum.rb +23 -0
  39. data/lib/payments/models/authorization_type_enum.rb +23 -0
  40. data/lib/payments/models/avs_not_matched_enum.rb +25 -0
  41. data/lib/payments/models/base_model.rb +110 -0
  42. data/lib/payments/models/billing_address.rb +147 -0
  43. data/lib/payments/models/browser_color_depth_enum.rb +41 -0
  44. data/lib/payments/models/cancel_response.rb +71 -0
  45. data/lib/payments/models/cancellation.rb +88 -0
  46. data/lib/payments/models/cancellation_failed.rb +94 -0
  47. data/lib/payments/models/cancellation_request_submitted.rb +94 -0
  48. data/lib/payments/models/cancellation_requested.rb +94 -0
  49. data/lib/payments/models/cancellation_timed_out.rb +94 -0
  50. data/lib/payments/models/card.rb +159 -0
  51. data/lib/payments/models/card1.rb +106 -0
  52. data/lib/payments/models/card3.rb +72 -0
  53. data/lib/payments/models/card_authorized_payment_response.rb +195 -0
  54. data/lib/payments/models/card_payment_instrument.rb +76 -0
  55. data/lib/payments/models/card_payments_instruction.rb +164 -0
  56. data/lib/payments/models/category_enum.rb +23 -0
  57. data/lib/payments/models/challenge.rb +100 -0
  58. data/lib/payments/models/challenge_info.rb +91 -0
  59. data/lib/payments/models/challenge_response201.rb +75 -0
  60. data/lib/payments/models/challenge_response202.rb +62 -0
  61. data/lib/payments/models/challenged_action_list.rb +65 -0
  62. data/lib/payments/models/challenged_response.rb +96 -0
  63. data/lib/payments/models/channel1_enum.rb +27 -0
  64. data/lib/payments/models/channel_enum.rb +24 -0
  65. data/lib/payments/models/conflict_payment_instrument.rb +104 -0
  66. data/lib/payments/models/content_type_enum.rb +20 -0
  67. data/lib/payments/models/custom.rb +241 -0
  68. data/lib/payments/models/customer.rb +146 -0
  69. data/lib/payments/models/customer_agreement.rb +120 -0
  70. data/lib/payments/models/cvc_not_matched_enum.rb +24 -0
  71. data/lib/payments/models/detail_enum.rb +23 -0
  72. data/lib/payments/models/device_data.rb +200 -0
  73. data/lib/payments/models/device_data_collection.rb +79 -0
  74. data/lib/payments/models/device_data_request.rb +71 -0
  75. data/lib/payments/models/device_data_required_action_list.rb +66 -0
  76. data/lib/payments/models/device_data_required_response.rb +89 -0
  77. data/lib/payments/models/device_data_response201.rb +95 -0
  78. data/lib/payments/models/embedded.rb +71 -0
  79. data/lib/payments/models/embedded1.rb +71 -0
  80. data/lib/payments/models/error.rb +81 -0
  81. data/lib/payments/models/exemption.rb +106 -0
  82. data/lib/payments/models/expiry_date.rb +90 -0
  83. data/lib/payments/models/expiry_date1.rb +84 -0
  84. data/lib/payments/models/fraud.rb +73 -0
  85. data/lib/payments/models/fraud_high_risk_response.rb +88 -0
  86. data/lib/payments/models/funding_type_enum.rb +32 -0
  87. data/lib/payments/models/googlepay_payments_instruction.rb +151 -0
  88. data/lib/payments/models/identifier_type_enum.rb +26 -0
  89. data/lib/payments/models/installment_plan.rb +76 -0
  90. data/lib/payments/models/installment_type_enum.rb +26 -0
  91. data/lib/payments/models/issuer.rb +63 -0
  92. data/lib/payments/models/issuer1.rb +76 -0
  93. data/lib/payments/models/issuer_response_enum.rb +23 -0
  94. data/lib/payments/models/last_event_enum.rb +95 -0
  95. data/lib/payments/models/links.rb +123 -0
  96. data/lib/payments/models/links1.rb +70 -0
  97. data/lib/payments/models/links2.rb +60 -0
  98. data/lib/payments/models/links3.rb +97 -0
  99. data/lib/payments/models/merchant.rb +88 -0
  100. data/lib/payments/models/message_enum.rb +34 -0
  101. data/lib/payments/models/method_enum.rb +38 -0
  102. data/lib/payments/models/mnext.rb +62 -0
  103. data/lib/payments/models/mself.rb +62 -0
  104. data/lib/payments/models/name_enum.rb +51 -0
  105. data/lib/payments/models/narrative.rb +86 -0
  106. data/lib/payments/models/narrative1.rb +87 -0
  107. data/lib/payments/models/narrative2.rb +71 -0
  108. data/lib/payments/models/number.rb +85 -0
  109. data/lib/payments/models/number3.rb +62 -0
  110. data/lib/payments/models/outcome16_enum.rb +21 -0
  111. data/lib/payments/models/outcome17_enum.rb +21 -0
  112. data/lib/payments/models/outcome6_enum.rb +42 -0
  113. data/lib/payments/models/outcome7_enum.rb +26 -0
  114. data/lib/payments/models/outcome_enum.rb +50 -0
  115. data/lib/payments/models/partial_refund_action_list.rb +64 -0
  116. data/lib/payments/models/partial_refund_response.rb +81 -0
  117. data/lib/payments/models/partial_settle_action_list.rb +102 -0
  118. data/lib/payments/models/partial_settle_response.rb +81 -0
  119. data/lib/payments/models/payment.rb +192 -0
  120. data/lib/payments/models/payment1.rb +86 -0
  121. data/lib/payments/models/payment_instrument.rb +62 -0
  122. data/lib/payments/models/payment_instrument4.rb +81 -0
  123. data/lib/payments/models/payment_instrument6.rb +71 -0
  124. data/lib/payments/models/payment_instrument7.rb +171 -0
  125. data/lib/payments/models/payment_refused_response.rb +187 -0
  126. data/lib/payments/models/payment_request.rb +96 -0
  127. data/lib/payments/models/payments_action_cancel.rb +71 -0
  128. data/lib/payments/models/payments_action_complete3ds_challenge.rb +72 -0
  129. data/lib/payments/models/payments_action_partial_refund.rb +71 -0
  130. data/lib/payments/models/payments_action_partial_settle.rb +73 -0
  131. data/lib/payments/models/payments_action_refund.rb +71 -0
  132. data/lib/payments/models/payments_action_settle.rb +71 -0
  133. data/lib/payments/models/payments_action_supply3ds_device_data.rb +73 -0
  134. data/lib/payments/models/payments_bank_account.rb +119 -0
  135. data/lib/payments/models/payments_cancel.rb +72 -0
  136. data/lib/payments/models/payments_card_account.rb +69 -0
  137. data/lib/payments/models/payments_card_on_file_customer_agreement.rb +85 -0
  138. data/lib/payments/models/payments_card_plain_payment_instrument.rb +149 -0
  139. data/lib/payments/models/payments_customer_agreement.rb +79 -0
  140. data/lib/payments/models/payments_email_account.rb +69 -0
  141. data/lib/payments/models/payments_events.rb +72 -0
  142. data/lib/payments/models/payments_exemption.rb +102 -0
  143. data/lib/payments/models/payments_fraud.rb +107 -0
  144. data/lib/payments/models/payments_funds_recipient.rb +139 -0
  145. data/lib/payments/models/payments_funds_sender.rb +120 -0
  146. data/lib/payments/models/payments_funds_transfer.rb +108 -0
  147. data/lib/payments/models/payments_gift_cards_purchase.rb +81 -0
  148. data/lib/payments/models/payments_installment_customer_agreement.rb +133 -0
  149. data/lib/payments/models/payments_instruction.rb +309 -0
  150. data/lib/payments/models/payments_link.rb +62 -0
  151. data/lib/payments/models/payments_network_token_payment_instrument.rb +126 -0
  152. data/lib/payments/models/payments_partial_refund_request.rb +68 -0
  153. data/lib/payments/models/payments_partial_settle.rb +72 -0
  154. data/lib/payments/models/payments_partial_settle_request.rb +81 -0
  155. data/lib/payments/models/payments_payment_facilitator.rb +88 -0
  156. data/lib/payments/models/payments_payment_instrument.rb +78 -0
  157. data/lib/payments/models/payments_phone_account.rb +69 -0
  158. data/lib/payments/models/payments_recipient.rb +110 -0
  159. data/lib/payments/models/payments_recipient_account.rb +81 -0
  160. data/lib/payments/models/payments_recipient_address.rb +72 -0
  161. data/lib/payments/models/payments_response.rb +69 -0
  162. data/lib/payments/models/payments_response202.rb +90 -0
  163. data/lib/payments/models/payments_response_payment_instrument.rb +158 -0
  164. data/lib/payments/models/payments_sequence.rb +69 -0
  165. data/lib/payments/models/payments_settle.rb +72 -0
  166. data/lib/payments/models/payments_shipping_address.rb +148 -0
  167. data/lib/payments/models/payments_social_network_account.rb +71 -0
  168. data/lib/payments/models/payments_sub_merchant.rb +108 -0
  169. data/lib/payments/models/payments_sub_merchant_address.rb +99 -0
  170. data/lib/payments/models/payments_subscription_customer_agreement.rb +106 -0
  171. data/lib/payments/models/payments_three_ds.rb +217 -0
  172. data/lib/payments/models/payments_transfer_address.rb +112 -0
  173. data/lib/payments/models/payments_unscheduled_customer_agreement.rb +87 -0
  174. data/lib/payments/models/payments_wallet_account.rb +70 -0
  175. data/lib/payments/models/placement_enum.rb +21 -0
  176. data/lib/payments/models/pq_querybydaterange200_response.rb +68 -0
  177. data/lib/payments/models/pq_querybypaymentid200_response.rb +230 -0
  178. data/lib/payments/models/pq_queryhistoricalpayments200_response.rb +72 -0
  179. data/lib/payments/models/preference_enum.rb +29 -0
  180. data/lib/payments/models/preferred_card_brand_enum.rb +51 -0
  181. data/lib/payments/models/purpose_enum.rb +78 -0
  182. data/lib/payments/models/query_action_list.rb +114 -0
  183. data/lib/payments/models/query_events_response.rb +71 -0
  184. data/lib/payments/models/reason_enum.rb +50 -0
  185. data/lib/payments/models/refund_failed.rb +94 -0
  186. data/lib/payments/models/refund_request_submitted.rb +94 -0
  187. data/lib/payments/models/refund_requested.rb +124 -0
  188. data/lib/payments/models/refund_response.rb +71 -0
  189. data/lib/payments/models/refund_timed_out.rb +94 -0
  190. data/lib/payments/models/result_enum.rb +29 -0
  191. data/lib/payments/models/reversal_failed.rb +94 -0
  192. data/lib/payments/models/reversal_request_submitted.rb +94 -0
  193. data/lib/payments/models/reversal_requested.rb +103 -0
  194. data/lib/payments/models/reversal_timed_out.rb +94 -0
  195. data/lib/payments/models/risk_enum.rb +29 -0
  196. data/lib/payments/models/risk_factor.rb +82 -0
  197. data/lib/payments/models/routing.rb +74 -0
  198. data/lib/payments/models/sale_failed.rb +103 -0
  199. data/lib/payments/models/sale_refused.rb +124 -0
  200. data/lib/payments/models/sale_requested.rb +94 -0
  201. data/lib/payments/models/sale_succeeded.rb +104 -0
  202. data/lib/payments/models/sale_timed_out.rb +94 -0
  203. data/lib/payments/models/scheme.rb +75 -0
  204. data/lib/payments/models/self1.rb +72 -0
  205. data/lib/payments/models/self2.rb +62 -0
  206. data/lib/payments/models/self3.rb +62 -0
  207. data/lib/payments/models/sent_for_cancellation_response.rb +185 -0
  208. data/lib/payments/models/sent_for_settlement_action_list.rb +76 -0
  209. data/lib/payments/models/sent_for_settlement_response.rb +195 -0
  210. data/lib/payments/models/session_payment_instrument.rb +119 -0
  211. data/lib/payments/models/settle_action_list.rb +76 -0
  212. data/lib/payments/models/settle_response.rb +81 -0
  213. data/lib/payments/models/settlement.rb +88 -0
  214. data/lib/payments/models/settlement_failed.rb +94 -0
  215. data/lib/payments/models/settlement_request_submitted.rb +94 -0
  216. data/lib/payments/models/settlement_requested.rb +125 -0
  217. data/lib/payments/models/settlement_timed_out.rb +94 -0
  218. data/lib/payments/models/shipping.rb +130 -0
  219. data/lib/payments/models/stored_card_usage1_enum.rb +24 -0
  220. data/lib/payments/models/stored_card_usage_enum.rb +24 -0
  221. data/lib/payments/models/time_frame_enum.rb +29 -0
  222. data/lib/payments/models/token.rb +168 -0
  223. data/lib/payments/models/token_creation.rb +95 -0
  224. data/lib/payments/models/token_payment_instrument.rb +118 -0
  225. data/lib/payments/models/token_response_conflicts.rb +90 -0
  226. data/lib/payments/models/transaction_history.rb +127 -0
  227. data/lib/payments/models/transaction_type1_enum.rb +26 -0
  228. data/lib/payments/models/transaction_type_enum.rb +26 -0
  229. data/lib/payments/models/type10_enum.rb +23 -0
  230. data/lib/payments/models/type12_enum.rb +35 -0
  231. data/lib/payments/models/type1_enum.rb +26 -0
  232. data/lib/payments/models/type2_enum.rb +23 -0
  233. data/lib/payments/models/type3_enum.rb +20 -0
  234. data/lib/payments/models/type4_enum.rb +20 -0
  235. data/lib/payments/models/type5_enum.rb +41 -0
  236. data/lib/payments/models/type6_enum.rb +29 -0
  237. data/lib/payments/models/type7_enum.rb +23 -0
  238. data/lib/payments/models/type8_enum.rb +23 -0
  239. data/lib/payments/models/type9_enum.rb +35 -0
  240. data/lib/payments/models/type_enum.rb +23 -0
  241. data/lib/payments/models/unsuccessful_authentication_response.rb +76 -0
  242. data/lib/payments/models/updated_payment_instrument.rb +159 -0
  243. data/lib/payments/models/updated_payment_instrument1.rb +93 -0
  244. data/lib/payments/models/user_type_enum.rb +35 -0
  245. data/lib/payments/models/value.rb +94 -0
  246. data/lib/payments/models/value1.rb +91 -0
  247. data/lib/payments/models/value2.rb +91 -0
  248. data/lib/payments/models/value3.rb +91 -0
  249. data/lib/payments/models/value4.rb +91 -0
  250. data/lib/payments/models/verification.rb +173 -0
  251. data/lib/payments/models/wallet_payment_instrument.rb +100 -0
  252. data/lib/payments/models/window_size_enum.rb +34 -0
  253. data/lib/payments/models/wp_api_version_enum.rb +20 -0
  254. data/lib/payments/utilities/date_time_helper.rb +11 -0
  255. data/lib/payments/utilities/file_wrapper.rb +28 -0
  256. data/lib/payments/utilities/union_type_lookup.rb +78 -0
  257. data/lib/payments.rb +280 -0
  258. data/test/controllers/controller_test_base.rb +29 -0
  259. data/test/controllers/test_payment_controller.rb +161 -0
  260. data/test/controllers/test_payment_queries_controller.rb +68 -0
  261. data/test/http_response_catcher.rb +19 -0
  262. metadata +374 -0
@@ -0,0 +1,71 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # CancelResponse Model.
8
+ class CancelResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [OutcomeEnum]
14
+ attr_accessor :outcome
15
+
16
+ # Return details about the status of the payment
17
+ # @return [PaymentsLink]
18
+ attr_accessor :links
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['outcome'] = 'outcome'
24
+ @_hash['links'] = '_links'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ outcome
32
+ links
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(outcome = SKIP, links = SKIP)
42
+ @outcome = outcome unless outcome == SKIP
43
+ @links = links unless links == SKIP
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ outcome = hash.key?('outcome') ? hash['outcome'] : SKIP
52
+ links = PaymentsLink.from_hash(hash['_links']) if hash['_links']
53
+
54
+ # Create object from extracted values.
55
+ CancelResponse.new(outcome,
56
+ links)
57
+ end
58
+
59
+ # Provides a human-readable string representation of the object.
60
+ def to_s
61
+ class_name = self.class.name.split('::').last
62
+ "<#{class_name} outcome: #{@outcome}, links: #{@links}>"
63
+ end
64
+
65
+ # Provides a debugging-friendly string with detailed object information.
66
+ def inspect
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} outcome: #{@outcome.inspect}, links: #{@links.inspect}>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,88 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # Configuration for when a payment is `sentForCancellation` automatically.
8
+ class Cancellation < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # By default a payment will be `sentForCancellation` if the CVC is
13
+ # `notMatched`, set `disabled` to continue with `sentForSettlement`.
14
+ # @return [CvcNotMatchedEnum]
15
+ attr_accessor :cvc_not_matched
16
+
17
+ # By default a payment will be `sentForCancellation` if the `address` or
18
+ # `postcode` AVS is `notMatched`, set `disabled` to continue with
19
+ # `sentForSettlement`.
20
+ # @return [AvsNotMatchedEnum]
21
+ attr_accessor :avs_not_matched
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ @_hash = {} if @_hash.nil?
26
+ @_hash['cvc_not_matched'] = 'cvcNotMatched'
27
+ @_hash['avs_not_matched'] = 'avsNotMatched'
28
+ @_hash
29
+ end
30
+
31
+ # An array for optional fields
32
+ def self.optionals
33
+ %w[
34
+ cvc_not_matched
35
+ avs_not_matched
36
+ ]
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(cvc_not_matched = SKIP, avs_not_matched = SKIP)
45
+ @cvc_not_matched = cvc_not_matched unless cvc_not_matched == SKIP
46
+ @avs_not_matched = avs_not_matched unless avs_not_matched == SKIP
47
+ end
48
+
49
+ # Creates an instance of the object from a hash.
50
+ def self.from_hash(hash)
51
+ return nil unless hash
52
+
53
+ # Extract variables from the hash.
54
+ cvc_not_matched =
55
+ hash.key?('cvcNotMatched') ? hash['cvcNotMatched'] : SKIP
56
+ avs_not_matched =
57
+ hash.key?('avsNotMatched') ? hash['avsNotMatched'] : SKIP
58
+
59
+ # Create object from extracted values.
60
+ Cancellation.new(cvc_not_matched,
61
+ avs_not_matched)
62
+ end
63
+
64
+ # Validates an instance of the object from a given value.
65
+ # @param [Cancellation | Hash] The value against the validation is performed.
66
+ def self.validate(value)
67
+ return true if value.instance_of? self
68
+
69
+ return false unless value.instance_of? Hash
70
+
71
+ true
72
+ end
73
+
74
+ # Provides a human-readable string representation of the object.
75
+ def to_s
76
+ class_name = self.class.name.split('::').last
77
+ "<#{class_name} cvc_not_matched: #{@cvc_not_matched}, avs_not_matched:"\
78
+ " #{@avs_not_matched}>"
79
+ end
80
+
81
+ # Provides a debugging-friendly string with detailed object information.
82
+ def inspect
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} cvc_not_matched: #{@cvc_not_matched.inspect}, avs_not_matched:"\
85
+ " #{@avs_not_matched.inspect}>"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,94 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # CancellationFailed Model.
8
+ class CancellationFailed < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Your cancellation request failed.
13
+ # @return [String]
14
+ attr_reader :event_name
15
+
16
+ # The ISO 8601 date-time at which the event was created.
17
+ # @return [String]
18
+ attr_accessor :timestamp
19
+
20
+ # Unique identifier generated by us for a single instance of an interaction
21
+ # (command) with the Worldpay API.
22
+ # @return [String]
23
+ attr_accessor :command_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['event_name'] = 'eventName'
29
+ @_hash['timestamp'] = 'timestamp'
30
+ @_hash['command_id'] = 'commandId'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ timestamp
38
+ command_id
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(timestamp = SKIP, command_id = SKIP)
48
+ @event_name = 'cancellationFailed'
49
+ @timestamp = timestamp unless timestamp == SKIP
50
+ @command_id = command_id unless command_id == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
59
+ command_id = hash.key?('commandId') ? hash['commandId'] : SKIP
60
+
61
+ # Create object from extracted values.
62
+ CancellationFailed.new(timestamp,
63
+ command_id)
64
+ end
65
+
66
+ # Validates an instance of the object from a given value.
67
+ # @param [CancellationFailed | Hash] The value against the validation is performed.
68
+ def self.validate(value)
69
+ if value.instance_of? self
70
+ return APIHelper.valid_type?(value.event_name,
71
+ ->(val) { val.instance_of? String })
72
+ end
73
+
74
+ return false unless value.instance_of? Hash
75
+
76
+ APIHelper.valid_type?(value['eventName'],
77
+ ->(val) { val.instance_of? String })
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} event_name: #{@event_name}, timestamp: #{@timestamp}, command_id:"\
84
+ " #{@command_id}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} event_name: #{@event_name.inspect}, timestamp: #{@timestamp.inspect},"\
91
+ " command_id: #{@command_id.inspect}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,94 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # CancellationRequestSubmitted Model.
8
+ class CancellationRequestSubmitted < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Your cancellation request was successfully sent for processing.
13
+ # @return [String]
14
+ attr_reader :event_name
15
+
16
+ # The ISO 8601 date-time at which the event was created.
17
+ # @return [String]
18
+ attr_accessor :timestamp
19
+
20
+ # Unique identifier generated by us for a single instance of an interaction
21
+ # (command) with the Worldpay API.
22
+ # @return [String]
23
+ attr_accessor :command_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['event_name'] = 'eventName'
29
+ @_hash['timestamp'] = 'timestamp'
30
+ @_hash['command_id'] = 'commandId'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ timestamp
38
+ command_id
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(timestamp = SKIP, command_id = SKIP)
48
+ @event_name = 'cancellationRequestSubmitted'
49
+ @timestamp = timestamp unless timestamp == SKIP
50
+ @command_id = command_id unless command_id == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
59
+ command_id = hash.key?('commandId') ? hash['commandId'] : SKIP
60
+
61
+ # Create object from extracted values.
62
+ CancellationRequestSubmitted.new(timestamp,
63
+ command_id)
64
+ end
65
+
66
+ # Validates an instance of the object from a given value.
67
+ # @param [CancellationRequestSubmitted | Hash] The value against the validation is performed.
68
+ def self.validate(value)
69
+ if value.instance_of? self
70
+ return APIHelper.valid_type?(value.event_name,
71
+ ->(val) { val.instance_of? String })
72
+ end
73
+
74
+ return false unless value.instance_of? Hash
75
+
76
+ APIHelper.valid_type?(value['eventName'],
77
+ ->(val) { val.instance_of? String })
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} event_name: #{@event_name}, timestamp: #{@timestamp}, command_id:"\
84
+ " #{@command_id}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} event_name: #{@event_name.inspect}, timestamp: #{@timestamp.inspect},"\
91
+ " command_id: #{@command_id.inspect}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,94 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # CancellationRequested Model.
8
+ class CancellationRequested < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Worldpay has received your cancellation request.
13
+ # @return [String]
14
+ attr_reader :event_name
15
+
16
+ # The ISO 8601 date-time at which the event was created.
17
+ # @return [String]
18
+ attr_accessor :timestamp
19
+
20
+ # Unique identifier generated by us for a single instance of an interaction
21
+ # (command) with the Worldpay API.
22
+ # @return [String]
23
+ attr_accessor :command_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['event_name'] = 'eventName'
29
+ @_hash['timestamp'] = 'timestamp'
30
+ @_hash['command_id'] = 'commandId'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ timestamp
38
+ command_id
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(timestamp = SKIP, command_id = SKIP)
48
+ @event_name = 'cancellationRequested'
49
+ @timestamp = timestamp unless timestamp == SKIP
50
+ @command_id = command_id unless command_id == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
59
+ command_id = hash.key?('commandId') ? hash['commandId'] : SKIP
60
+
61
+ # Create object from extracted values.
62
+ CancellationRequested.new(timestamp,
63
+ command_id)
64
+ end
65
+
66
+ # Validates an instance of the object from a given value.
67
+ # @param [CancellationRequested | Hash] The value against the validation is performed.
68
+ def self.validate(value)
69
+ if value.instance_of? self
70
+ return APIHelper.valid_type?(value.event_name,
71
+ ->(val) { val.instance_of? String })
72
+ end
73
+
74
+ return false unless value.instance_of? Hash
75
+
76
+ APIHelper.valid_type?(value['eventName'],
77
+ ->(val) { val.instance_of? String })
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} event_name: #{@event_name}, timestamp: #{@timestamp}, command_id:"\
84
+ " #{@command_id}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} event_name: #{@event_name.inspect}, timestamp: #{@timestamp.inspect},"\
91
+ " command_id: #{@command_id.inspect}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,94 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # CancellationTimedOut Model.
8
+ class CancellationTimedOut < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Your cancellation request timed out.
13
+ # @return [String]
14
+ attr_reader :event_name
15
+
16
+ # The ISO 8601 date-time at which the event was created.
17
+ # @return [String]
18
+ attr_accessor :timestamp
19
+
20
+ # Unique identifier generated by us for a single instance of an interaction
21
+ # (command) with the Worldpay API.
22
+ # @return [String]
23
+ attr_accessor :command_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['event_name'] = 'eventName'
29
+ @_hash['timestamp'] = 'timestamp'
30
+ @_hash['command_id'] = 'commandId'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ timestamp
38
+ command_id
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(timestamp = SKIP, command_id = SKIP)
48
+ @event_name = 'cancellationTimedOut'
49
+ @timestamp = timestamp unless timestamp == SKIP
50
+ @command_id = command_id unless command_id == SKIP
51
+ end
52
+
53
+ # Creates an instance of the object from a hash.
54
+ def self.from_hash(hash)
55
+ return nil unless hash
56
+
57
+ # Extract variables from the hash.
58
+ timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
59
+ command_id = hash.key?('commandId') ? hash['commandId'] : SKIP
60
+
61
+ # Create object from extracted values.
62
+ CancellationTimedOut.new(timestamp,
63
+ command_id)
64
+ end
65
+
66
+ # Validates an instance of the object from a given value.
67
+ # @param [CancellationTimedOut | Hash] The value against the validation is performed.
68
+ def self.validate(value)
69
+ if value.instance_of? self
70
+ return APIHelper.valid_type?(value.event_name,
71
+ ->(val) { val.instance_of? String })
72
+ end
73
+
74
+ return false unless value.instance_of? Hash
75
+
76
+ APIHelper.valid_type?(value['eventName'],
77
+ ->(val) { val.instance_of? String })
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} event_name: #{@event_name}, timestamp: #{@timestamp}, command_id:"\
84
+ " #{@command_id}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} event_name: #{@event_name.inspect}, timestamp: #{@timestamp.inspect},"\
91
+ " command_id: #{@command_id.inspect}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,159 @@
1
+ # payments
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Payments
7
+ # An object that contains information about the card used.
8
+ class Card < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # An object that contains information about the card number.
13
+ # @return [Number]
14
+ attr_accessor :number
15
+
16
+ # Whether the card is classed as a consumer card or a card for commercial
17
+ # use.
18
+ # @return [CategoryEnum]
19
+ attr_accessor :category
20
+
21
+ # The [ISO 3166-1 Alpha-2
22
+ # format](/products/reference/supported-countries-currencies#iso-country-cod
23
+ # es) country code that the card was issued in. May return `N/A` where the
24
+ # country is unknown.
25
+ # @return [String]
26
+ attr_accessor :country_code
27
+
28
+ # The expiry date of the card or network token (where the supplied
29
+ # paymentInstrument was `card/wallet+applepay`, `card/wallet+googlepay`,
30
+ # `card/networkToken`, `card/networkToken+applepay` or
31
+ # `card/networkToken+googlepay`).
32
+ # @return [ExpiryDate1]
33
+ attr_accessor :expiry_date
34
+
35
+ # The name of the card issuer.
36
+ # @return [String]
37
+ attr_accessor :issuer_name
38
+
39
+ # How the card is funded.
40
+ # @return [FundingTypeEnum]
41
+ attr_accessor :funding_type
42
+
43
+ # The card brand that the transaction was processed with. Sometimes referred
44
+ # to as the network or scheme.
45
+ # @return [String]
46
+ attr_accessor :brand
47
+
48
+ # The payment account reference (PAR) is a non-financial reference that
49
+ # uniquely identifies the underlying cardholder account. This allows you to
50
+ # correlate payments made from the same account with differing instruments
51
+ # (e.g. `card/plain` and `card/wallet+applepay`), where the same account
52
+ # funds the transaction. A PAR cannot be used to initiate a payment.
53
+ # @return [String]
54
+ attr_accessor :payment_account_reference
55
+
56
+ # A mapping from model property names to API property names.
57
+ def self.names
58
+ @_hash = {} if @_hash.nil?
59
+ @_hash['number'] = 'number'
60
+ @_hash['category'] = 'category'
61
+ @_hash['country_code'] = 'countryCode'
62
+ @_hash['expiry_date'] = 'expiryDate'
63
+ @_hash['issuer_name'] = 'issuerName'
64
+ @_hash['funding_type'] = 'fundingType'
65
+ @_hash['brand'] = 'brand'
66
+ @_hash['payment_account_reference'] = 'paymentAccountReference'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ number
74
+ category
75
+ country_code
76
+ expiry_date
77
+ issuer_name
78
+ funding_type
79
+ brand
80
+ payment_account_reference
81
+ ]
82
+ end
83
+
84
+ # An array for nullable fields
85
+ def self.nullables
86
+ []
87
+ end
88
+
89
+ def initialize(number = SKIP, category = SKIP, country_code = SKIP,
90
+ expiry_date = SKIP, issuer_name = SKIP, funding_type = SKIP,
91
+ brand = SKIP, payment_account_reference = SKIP)
92
+ @number = number unless number == SKIP
93
+ @category = category unless category == SKIP
94
+ @country_code = country_code unless country_code == SKIP
95
+ @expiry_date = expiry_date unless expiry_date == SKIP
96
+ @issuer_name = issuer_name unless issuer_name == SKIP
97
+ @funding_type = funding_type unless funding_type == SKIP
98
+ @brand = brand unless brand == SKIP
99
+ unless payment_account_reference == SKIP
100
+ @payment_account_reference =
101
+ payment_account_reference
102
+ end
103
+ end
104
+
105
+ # Creates an instance of the object from a hash.
106
+ def self.from_hash(hash)
107
+ return nil unless hash
108
+
109
+ # Extract variables from the hash.
110
+ number = Number.from_hash(hash['number']) if hash['number']
111
+ category = hash.key?('category') ? hash['category'] : SKIP
112
+ country_code = hash.key?('countryCode') ? hash['countryCode'] : SKIP
113
+ expiry_date = ExpiryDate1.from_hash(hash['expiryDate']) if hash['expiryDate']
114
+ issuer_name = hash.key?('issuerName') ? hash['issuerName'] : SKIP
115
+ funding_type = hash.key?('fundingType') ? hash['fundingType'] : SKIP
116
+ brand = hash.key?('brand') ? hash['brand'] : SKIP
117
+ payment_account_reference =
118
+ hash.key?('paymentAccountReference') ? hash['paymentAccountReference'] : SKIP
119
+
120
+ # Create object from extracted values.
121
+ Card.new(number,
122
+ category,
123
+ country_code,
124
+ expiry_date,
125
+ issuer_name,
126
+ funding_type,
127
+ brand,
128
+ payment_account_reference)
129
+ end
130
+
131
+ # Validates an instance of the object from a given value.
132
+ # @param [Card | Hash] The value against the validation is performed.
133
+ def self.validate(value)
134
+ return true if value.instance_of? self
135
+
136
+ return false unless value.instance_of? Hash
137
+
138
+ true
139
+ end
140
+
141
+ # Provides a human-readable string representation of the object.
142
+ def to_s
143
+ class_name = self.class.name.split('::').last
144
+ "<#{class_name} number: #{@number}, category: #{@category}, country_code: #{@country_code},"\
145
+ " expiry_date: #{@expiry_date}, issuer_name: #{@issuer_name}, funding_type:"\
146
+ " #{@funding_type}, brand: #{@brand}, payment_account_reference:"\
147
+ " #{@payment_account_reference}>"
148
+ end
149
+
150
+ # Provides a debugging-friendly string with detailed object information.
151
+ def inspect
152
+ class_name = self.class.name.split('::').last
153
+ "<#{class_name} number: #{@number.inspect}, category: #{@category.inspect}, country_code:"\
154
+ " #{@country_code.inspect}, expiry_date: #{@expiry_date.inspect}, issuer_name:"\
155
+ " #{@issuer_name.inspect}, funding_type: #{@funding_type.inspect}, brand: #{@brand.inspect},"\
156
+ " payment_account_reference: #{@payment_account_reference.inspect}>"
157
+ end
158
+ end
159
+ end