yapstone-payments 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +203 -0
  5. data/Rakefile +10 -0
  6. data/docs/APM.md +29 -0
  7. data/docs/APMSpecInParameters.md +19 -0
  8. data/docs/Action.md +16 -0
  9. data/docs/Address.md +29 -0
  10. data/docs/Amount.md +21 -0
  11. data/docs/AuthResponse.md +19 -0
  12. data/docs/AuthTokenRequest.md +19 -0
  13. data/docs/AuthTokenResponse.md +17 -0
  14. data/docs/AuthenticationApi.md +58 -0
  15. data/docs/BankAccount.md +37 -0
  16. data/docs/BillingAddress.md +29 -0
  17. data/docs/BookingInfo.md +31 -0
  18. data/docs/CapturePaymentRequest.md +21 -0
  19. data/docs/Card.md +27 -0
  20. data/docs/CardResponse.md +21 -0
  21. data/docs/Consent.md +21 -0
  22. data/docs/CreditCardAuthResponse.md +25 -0
  23. data/docs/Customer.md +29 -0
  24. data/docs/CustomerData.md +19 -0
  25. data/docs/CustomerDetails.md +23 -0
  26. data/docs/Deposit.md +23 -0
  27. data/docs/DepositDetails.md +17 -0
  28. data/docs/DisburseLineItemsReq.md +19 -0
  29. data/docs/DisburseTransaction.md +19 -0
  30. data/docs/DisburseTransactionReq.md +17 -0
  31. data/docs/Disbursement.md +17 -0
  32. data/docs/DisbursementAllOf.md +17 -0
  33. data/docs/DisbursementDetails.md +17 -0
  34. data/docs/DisbursementRequest.md +16 -0
  35. data/docs/DisbursementRequests.md +17 -0
  36. data/docs/DisbursementResponse.md +17 -0
  37. data/docs/DisbursementsApi.md +138 -0
  38. data/docs/Error.md +25 -0
  39. data/docs/ErrorResponse.md +19 -0
  40. data/docs/Fields.md +17 -0
  41. data/docs/GovIdentification.md +29 -0
  42. data/docs/Guest.md +29 -0
  43. data/docs/GuestInfoResponse.md +19 -0
  44. data/docs/Href.md +17 -0
  45. data/docs/InlineResponse200.md +25 -0
  46. data/docs/InstallmentPlan.md +19 -0
  47. data/docs/Instrument.md +21 -0
  48. data/docs/InstrumentVerificationResponse.md +31 -0
  49. data/docs/KYC.md +21 -0
  50. data/docs/LeaseInfo.md +21 -0
  51. data/docs/LineItemDetails.md +25 -0
  52. data/docs/MarketplaceData.md +23 -0
  53. data/docs/Merketplace.md +17 -0
  54. data/docs/Money.md +19 -0
  55. data/docs/Name.md +27 -0
  56. data/docs/OfferingDetails.md +21 -0
  57. data/docs/OrderTransactions.md +25 -0
  58. data/docs/Payment.md +21 -0
  59. data/docs/PaymentCancelResponse.md +23 -0
  60. data/docs/PaymentCancelTransactionResponse.md +21 -0
  61. data/docs/PaymentDetails.md +29 -0
  62. data/docs/PaymentInstrument.md +27 -0
  63. data/docs/PaymentInstrumentCard.md +19 -0
  64. data/docs/PaymentInstrumentResponse.md +19 -0
  65. data/docs/PaymentPayment.md +27 -0
  66. data/docs/PaymentPaymentAllOf.md +27 -0
  67. data/docs/PaymentResponse.md +33 -0
  68. data/docs/PaymentsApi.md +447 -0
  69. data/docs/Phone.md +21 -0
  70. data/docs/ProcessPayment.md +29 -0
  71. data/docs/PropertyInfo.md +21 -0
  72. data/docs/PropertyInfoResponse.md +19 -0
  73. data/docs/RefundAction.md +16 -0
  74. data/docs/RefundCancelResponse.md +21 -0
  75. data/docs/RefundCancelTransactionResponse.md +19 -0
  76. data/docs/RefundRequest.md +25 -0
  77. data/docs/RefundResponse.md +29 -0
  78. data/docs/RefundStatus.md +16 -0
  79. data/docs/RefundTransactions.md +27 -0
  80. data/docs/RefundsApi.md +378 -0
  81. data/docs/RentalInfo.md +21 -0
  82. data/docs/Renter.md +29 -0
  83. data/docs/Resolution.md +17 -0
  84. data/docs/Result.md +21 -0
  85. data/docs/RiskStatus.md +17 -0
  86. data/docs/SanctionedEntities.md +19 -0
  87. data/docs/SearchApi.md +132 -0
  88. data/docs/SearchPaymentResponse.md +17 -0
  89. data/docs/StackTraceElement.md +25 -0
  90. data/docs/Status.md +16 -0
  91. data/docs/Throwable.md +21 -0
  92. data/docs/ToEntityRef.md +19 -0
  93. data/docs/Token.md +19 -0
  94. data/docs/TokenApi.md +134 -0
  95. data/docs/TokenReq.md +19 -0
  96. data/docs/TokenRequest.md +17 -0
  97. data/docs/TokenResponse.md +17 -0
  98. data/docs/Transaction.md +21 -0
  99. data/docs/TransactionResponse.md +27 -0
  100. data/docs/Triggers.md +21 -0
  101. data/docs/VacationRentalInfo.md +19 -0
  102. data/docs/VacationRentalInfoRequest.md +21 -0
  103. data/docs/VerifyInstrumentRequest.md +21 -0
  104. data/git_push.sh +55 -0
  105. data/lib/yapstone-payments.rb +137 -0
  106. data/lib/yapstone-payments/api/authentication_api.rb +92 -0
  107. data/lib/yapstone-payments/api/disbursements_api.rb +202 -0
  108. data/lib/yapstone-payments/api/payments_api.rb +598 -0
  109. data/lib/yapstone-payments/api/refunds_api.rb +507 -0
  110. data/lib/yapstone-payments/api/search_api.rb +187 -0
  111. data/lib/yapstone-payments/api/token_api.rb +182 -0
  112. data/lib/yapstone-payments/api_client.rb +386 -0
  113. data/lib/yapstone-payments/api_error.rb +57 -0
  114. data/lib/yapstone-payments/configuration.rb +249 -0
  115. data/lib/yapstone-payments/models/action.rb +39 -0
  116. data/lib/yapstone-payments/models/address.rb +258 -0
  117. data/lib/yapstone-payments/models/amount.rb +218 -0
  118. data/lib/yapstone-payments/models/apm.rb +292 -0
  119. data/lib/yapstone-payments/models/apm_spec_in_parameters.rb +208 -0
  120. data/lib/yapstone-payments/models/auth_response.rb +217 -0
  121. data/lib/yapstone-payments/models/auth_token_request.rb +205 -0
  122. data/lib/yapstone-payments/models/auth_token_response.rb +196 -0
  123. data/lib/yapstone-payments/models/bank_account.rb +347 -0
  124. data/lib/yapstone-payments/models/billing_address.rb +258 -0
  125. data/lib/yapstone-payments/models/booking_info.rb +266 -0
  126. data/lib/yapstone-payments/models/capture_payment_request.rb +252 -0
  127. data/lib/yapstone-payments/models/card.rb +247 -0
  128. data/lib/yapstone-payments/models/card_response.rb +217 -0
  129. data/lib/yapstone-payments/models/consent.rb +248 -0
  130. data/lib/yapstone-payments/models/credit_card_auth_response.rb +267 -0
  131. data/lib/yapstone-payments/models/customer.rb +256 -0
  132. data/lib/yapstone-payments/models/customer_data.rb +208 -0
  133. data/lib/yapstone-payments/models/customer_details.rb +226 -0
  134. data/lib/yapstone-payments/models/deposit.rb +228 -0
  135. data/lib/yapstone-payments/models/deposit_details.rb +199 -0
  136. data/lib/yapstone-payments/models/disburse_line_items_req.rb +208 -0
  137. data/lib/yapstone-payments/models/disburse_transaction.rb +208 -0
  138. data/lib/yapstone-payments/models/disburse_transaction_req.rb +199 -0
  139. data/lib/yapstone-payments/models/disbursement.rb +203 -0
  140. data/lib/yapstone-payments/models/disbursement_all_of.rb +197 -0
  141. data/lib/yapstone-payments/models/disbursement_details.rb +200 -0
  142. data/lib/yapstone-payments/models/disbursement_request.rb +187 -0
  143. data/lib/yapstone-payments/models/disbursement_requests.rb +198 -0
  144. data/lib/yapstone-payments/models/disbursement_response.rb +198 -0
  145. data/lib/yapstone-payments/models/error.rb +241 -0
  146. data/lib/yapstone-payments/models/error_response.rb +218 -0
  147. data/lib/yapstone-payments/models/fields.rb +196 -0
  148. data/lib/yapstone-payments/models/gov_identification.rb +292 -0
  149. data/lib/yapstone-payments/models/guest.rb +257 -0
  150. data/lib/yapstone-payments/models/guest_info_response.rb +208 -0
  151. data/lib/yapstone-payments/models/href.rb +196 -0
  152. data/lib/yapstone-payments/models/inline_response200.rb +232 -0
  153. data/lib/yapstone-payments/models/installment_plan.rb +208 -0
  154. data/lib/yapstone-payments/models/instrument.rb +250 -0
  155. data/lib/yapstone-payments/models/instrument_verification_response.rb +260 -0
  156. data/lib/yapstone-payments/models/kyc.rb +215 -0
  157. data/lib/yapstone-payments/models/lease_info.rb +218 -0
  158. data/lib/yapstone-payments/models/line_item_details.rb +236 -0
  159. data/lib/yapstone-payments/models/marketplace_data.rb +260 -0
  160. data/lib/yapstone-payments/models/merketplace.rb +197 -0
  161. data/lib/yapstone-payments/models/money.rb +207 -0
  162. data/lib/yapstone-payments/models/name.rb +248 -0
  163. data/lib/yapstone-payments/models/offering_details.rb +216 -0
  164. data/lib/yapstone-payments/models/order_transactions.rb +235 -0
  165. data/lib/yapstone-payments/models/payment.rb +216 -0
  166. data/lib/yapstone-payments/models/payment_cancel_response.rb +227 -0
  167. data/lib/yapstone-payments/models/payment_cancel_transaction_response.rb +218 -0
  168. data/lib/yapstone-payments/models/payment_details.rb +319 -0
  169. data/lib/yapstone-payments/models/payment_instrument.rb +277 -0
  170. data/lib/yapstone-payments/models/payment_instrument_card.rb +241 -0
  171. data/lib/yapstone-payments/models/payment_instrument_response.rb +205 -0
  172. data/lib/yapstone-payments/models/payment_payment.rb +257 -0
  173. data/lib/yapstone-payments/models/payment_payment_all_of.rb +250 -0
  174. data/lib/yapstone-payments/models/payment_response.rb +275 -0
  175. data/lib/yapstone-payments/models/phone.rb +218 -0
  176. data/lib/yapstone-payments/models/process_payment.rb +304 -0
  177. data/lib/yapstone-payments/models/property_info.rb +216 -0
  178. data/lib/yapstone-payments/models/property_info_response.rb +207 -0
  179. data/lib/yapstone-payments/models/refund_action.rb +35 -0
  180. data/lib/yapstone-payments/models/refund_cancel_response.rb +217 -0
  181. data/lib/yapstone-payments/models/refund_cancel_transaction_response.rb +207 -0
  182. data/lib/yapstone-payments/models/refund_request.rb +285 -0
  183. data/lib/yapstone-payments/models/refund_response.rb +253 -0
  184. data/lib/yapstone-payments/models/refund_status.rb +90 -0
  185. data/lib/yapstone-payments/models/refund_transactions.rb +245 -0
  186. data/lib/yapstone-payments/models/rental_info.rb +215 -0
  187. data/lib/yapstone-payments/models/renter.rb +254 -0
  188. data/lib/yapstone-payments/models/resolution.rb +196 -0
  189. data/lib/yapstone-payments/models/result.rb +218 -0
  190. data/lib/yapstone-payments/models/risk_status.rb +196 -0
  191. data/lib/yapstone-payments/models/sanctioned_entities.rb +207 -0
  192. data/lib/yapstone-payments/models/search_payment_response.rb +196 -0
  193. data/lib/yapstone-payments/models/stack_trace_element.rb +238 -0
  194. data/lib/yapstone-payments/models/status.rb +91 -0
  195. data/lib/yapstone-payments/models/throwable.rb +220 -0
  196. data/lib/yapstone-payments/models/to_entity_ref.rb +207 -0
  197. data/lib/yapstone-payments/models/token.rb +207 -0
  198. data/lib/yapstone-payments/models/token_req.rb +206 -0
  199. data/lib/yapstone-payments/models/token_request.rb +196 -0
  200. data/lib/yapstone-payments/models/token_response.rb +196 -0
  201. data/lib/yapstone-payments/models/transaction.rb +218 -0
  202. data/lib/yapstone-payments/models/transaction_response.rb +248 -0
  203. data/lib/yapstone-payments/models/triggers.rb +216 -0
  204. data/lib/yapstone-payments/models/vacation_rental_info.rb +205 -0
  205. data/lib/yapstone-payments/models/vacation_rental_info_request.rb +215 -0
  206. data/lib/yapstone-payments/models/verify_instrument_request.rb +215 -0
  207. data/lib/yapstone-payments/version.rb +15 -0
  208. data/spec/api/authentication_api_spec.rb +48 -0
  209. data/spec/api/disbursements_api_spec.rb +69 -0
  210. data/spec/api/payments_api_spec.rb +146 -0
  211. data/spec/api/refunds_api_spec.rb +127 -0
  212. data/spec/api/search_api_spec.rb +66 -0
  213. data/spec/api/token_api_spec.rb +67 -0
  214. data/spec/api_client_spec.rb +226 -0
  215. data/spec/configuration_spec.rb +42 -0
  216. data/spec/models/action_spec.rb +35 -0
  217. data/spec/models/address_spec.rb +77 -0
  218. data/spec/models/amount_spec.rb +53 -0
  219. data/spec/models/apm_spec.rb +81 -0
  220. data/spec/models/apm_spec_in_parameters_spec.rb +47 -0
  221. data/spec/models/auth_response_spec.rb +47 -0
  222. data/spec/models/auth_token_request_spec.rb +47 -0
  223. data/spec/models/auth_token_response_spec.rb +41 -0
  224. data/spec/models/bank_account_spec.rb +105 -0
  225. data/spec/models/billing_address_spec.rb +77 -0
  226. data/spec/models/booking_info_spec.rb +83 -0
  227. data/spec/models/capture_payment_request_spec.rb +57 -0
  228. data/spec/models/card_response_spec.rb +53 -0
  229. data/spec/models/card_spec.rb +71 -0
  230. data/spec/models/consent_spec.rb +57 -0
  231. data/spec/models/credit_card_auth_response_spec.rb +69 -0
  232. data/spec/models/customer_data_spec.rb +47 -0
  233. data/spec/models/customer_details_spec.rb +59 -0
  234. data/spec/models/customer_spec.rb +77 -0
  235. data/spec/models/deposit_details_spec.rb +41 -0
  236. data/spec/models/deposit_spec.rb +59 -0
  237. data/spec/models/disburse_line_items_req_spec.rb +47 -0
  238. data/spec/models/disburse_transaction_req_spec.rb +41 -0
  239. data/spec/models/disburse_transaction_spec.rb +47 -0
  240. data/spec/models/disbursement_all_of_spec.rb +41 -0
  241. data/spec/models/disbursement_details_spec.rb +41 -0
  242. data/spec/models/disbursement_request_spec.rb +35 -0
  243. data/spec/models/disbursement_requests_spec.rb +41 -0
  244. data/spec/models/disbursement_response_spec.rb +41 -0
  245. data/spec/models/disbursement_spec.rb +41 -0
  246. data/spec/models/error_response_spec.rb +47 -0
  247. data/spec/models/error_spec.rb +65 -0
  248. data/spec/models/fields_spec.rb +41 -0
  249. data/spec/models/gov_identification_spec.rb +81 -0
  250. data/spec/models/guest_info_response_spec.rb +47 -0
  251. data/spec/models/guest_spec.rb +77 -0
  252. data/spec/models/href_spec.rb +41 -0
  253. data/spec/models/inline_response200_spec.rb +65 -0
  254. data/spec/models/installment_plan_spec.rb +47 -0
  255. data/spec/models/instrument_spec.rb +57 -0
  256. data/spec/models/instrument_verification_response_spec.rb +83 -0
  257. data/spec/models/kyc_spec.rb +53 -0
  258. data/spec/models/lease_info_spec.rb +53 -0
  259. data/spec/models/line_item_details_spec.rb +65 -0
  260. data/spec/models/marketplace_data_spec.rb +63 -0
  261. data/spec/models/merketplace_spec.rb +41 -0
  262. data/spec/models/money_spec.rb +47 -0
  263. data/spec/models/name_spec.rb +71 -0
  264. data/spec/models/offering_details_spec.rb +53 -0
  265. data/spec/models/order_transactions_spec.rb +65 -0
  266. data/spec/models/payment_cancel_response_spec.rb +59 -0
  267. data/spec/models/payment_cancel_transaction_response_spec.rb +53 -0
  268. data/spec/models/payment_details_spec.rb +81 -0
  269. data/spec/models/payment_instrument_card_spec.rb +51 -0
  270. data/spec/models/payment_instrument_response_spec.rb +47 -0
  271. data/spec/models/payment_instrument_spec.rb +75 -0
  272. data/spec/models/payment_payment_all_of_spec.rb +71 -0
  273. data/spec/models/payment_payment_spec.rb +71 -0
  274. data/spec/models/payment_response_spec.rb +89 -0
  275. data/spec/models/payment_spec.rb +53 -0
  276. data/spec/models/phone_spec.rb +53 -0
  277. data/spec/models/process_payment_spec.rb +77 -0
  278. data/spec/models/property_info_response_spec.rb +47 -0
  279. data/spec/models/property_info_spec.rb +53 -0
  280. data/spec/models/refund_action_spec.rb +35 -0
  281. data/spec/models/refund_cancel_response_spec.rb +53 -0
  282. data/spec/models/refund_cancel_transaction_response_spec.rb +47 -0
  283. data/spec/models/refund_request_spec.rb +65 -0
  284. data/spec/models/refund_response_spec.rb +77 -0
  285. data/spec/models/refund_status_spec.rb +35 -0
  286. data/spec/models/refund_transactions_spec.rb +71 -0
  287. data/spec/models/rental_info_spec.rb +53 -0
  288. data/spec/models/renter_spec.rb +77 -0
  289. data/spec/models/resolution_spec.rb +41 -0
  290. data/spec/models/result_spec.rb +53 -0
  291. data/spec/models/risk_status_spec.rb +41 -0
  292. data/spec/models/sanctioned_entities_spec.rb +47 -0
  293. data/spec/models/search_payment_response_spec.rb +41 -0
  294. data/spec/models/stack_trace_element_spec.rb +65 -0
  295. data/spec/models/status_spec.rb +35 -0
  296. data/spec/models/throwable_spec.rb +53 -0
  297. data/spec/models/to_entity_ref_spec.rb +47 -0
  298. data/spec/models/token_req_spec.rb +47 -0
  299. data/spec/models/token_request_spec.rb +41 -0
  300. data/spec/models/token_response_spec.rb +41 -0
  301. data/spec/models/token_spec.rb +47 -0
  302. data/spec/models/transaction_response_spec.rb +71 -0
  303. data/spec/models/transaction_spec.rb +53 -0
  304. data/spec/models/triggers_spec.rb +53 -0
  305. data/spec/models/vacation_rental_info_request_spec.rb +53 -0
  306. data/spec/models/vacation_rental_info_spec.rb +47 -0
  307. data/spec/models/verify_instrument_request_spec.rb +53 -0
  308. data/spec/spec_helper.rb +111 -0
  309. data/yapstone-payments.gemspec +45 -0
  310. metadata +633 -0
@@ -0,0 +1,319 @@
1
+ =begin
2
+ #Payments Orchestrator
3
+
4
+ #\"REST API for Payments Orchestrator\"
5
+
6
+ The version of the OpenAPI document: 1.6.4-SNAPSHOT
7
+ Contact: test@yapstone.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Yapstone
16
+ # The payment method and any additional PII Yapstone may need to collect for risk purposes in order to process this payment.
17
+ class PaymentDetails
18
+ # If your payment is for multiple line items, detail them here. The sum of your line item amounts must equal the amount given at the root of the request body.
19
+ attr_accessor :line_items
20
+
21
+ # Used to list the authorization type. If it is PRIORAUTH this is a pre-authorization that places a hold on your customer's credit card for a specified dollar amount based on a projected sale amount. FINALAUTH is when you have completed all work checking the card and the customer and you are ready to actually withdraw the payment.
22
+ attr_accessor :authorization_type
23
+
24
+ # The descriptor that will be shown on the customer's bank statement after the transaction has been authorized.
25
+ attr_accessor :custom_soft_descriptor
26
+
27
+ attr_accessor :installment_plan
28
+
29
+ attr_accessor :amount
30
+
31
+ attr_accessor :payment_instrument
32
+
33
+ # This indicates whether it is true that the payment method a customer wants to use belongs to the customer or not.
34
+ attr_accessor :instrument_owner
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'line_items' => :'lineItems',
62
+ :'authorization_type' => :'authorizationType',
63
+ :'custom_soft_descriptor' => :'customSoftDescriptor',
64
+ :'installment_plan' => :'installmentPlan',
65
+ :'amount' => :'amount',
66
+ :'payment_instrument' => :'paymentInstrument',
67
+ :'instrument_owner' => :'instrumentOwner'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'line_items' => :'Array<OfferingDetails>',
75
+ :'authorization_type' => :'String',
76
+ :'custom_soft_descriptor' => :'String',
77
+ :'installment_plan' => :'InstallmentPlan',
78
+ :'amount' => :'Amount',
79
+ :'payment_instrument' => :'PaymentInstrument',
80
+ :'instrument_owner' => :'Boolean'
81
+ }
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::PaymentDetails` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::PaymentDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'line_items')
100
+ if (value = attributes[:'line_items']).is_a?(Array)
101
+ self.line_items = value
102
+ end
103
+ end
104
+
105
+ if attributes.key?(:'authorization_type')
106
+ self.authorization_type = attributes[:'authorization_type']
107
+ else
108
+ self.authorization_type = 'FINALAUTH'
109
+ end
110
+
111
+ if attributes.key?(:'custom_soft_descriptor')
112
+ self.custom_soft_descriptor = attributes[:'custom_soft_descriptor']
113
+ end
114
+
115
+ if attributes.key?(:'installment_plan')
116
+ self.installment_plan = attributes[:'installment_plan']
117
+ end
118
+
119
+ if attributes.key?(:'amount')
120
+ self.amount = attributes[:'amount']
121
+ end
122
+
123
+ if attributes.key?(:'payment_instrument')
124
+ self.payment_instrument = attributes[:'payment_instrument']
125
+ end
126
+
127
+ if attributes.key?(:'instrument_owner')
128
+ self.instrument_owner = attributes[:'instrument_owner']
129
+ else
130
+ self.instrument_owner = true
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ if !@custom_soft_descriptor.nil? && @custom_soft_descriptor.to_s.length > 36
139
+ invalid_properties.push('invalid value for "custom_soft_descriptor", the character length must be smaller than or equal to 36.')
140
+ end
141
+
142
+ if !@custom_soft_descriptor.nil? && @custom_soft_descriptor.to_s.length < 0
143
+ invalid_properties.push('invalid value for "custom_soft_descriptor", the character length must be great than or equal to 0.')
144
+ end
145
+
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ authorization_type_validator = EnumAttributeValidator.new('String', ["FINALAUTH", "PRIORAUTH", ""])
153
+ return false unless authorization_type_validator.valid?(@authorization_type)
154
+ return false if !@custom_soft_descriptor.nil? && @custom_soft_descriptor.to_s.length > 36
155
+ return false if !@custom_soft_descriptor.nil? && @custom_soft_descriptor.to_s.length < 0
156
+ true
157
+ end
158
+
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] authorization_type Object to be assigned
161
+ def authorization_type=(authorization_type)
162
+ validator = EnumAttributeValidator.new('String', ["FINALAUTH", "PRIORAUTH", ""])
163
+ unless validator.valid?(authorization_type)
164
+ fail ArgumentError, "invalid value for \"authorization_type\", must be one of #{validator.allowable_values}."
165
+ end
166
+ @authorization_type = authorization_type
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] custom_soft_descriptor Value to be assigned
171
+ def custom_soft_descriptor=(custom_soft_descriptor)
172
+ if !custom_soft_descriptor.nil? && custom_soft_descriptor.to_s.length > 36
173
+ fail ArgumentError, 'invalid value for "custom_soft_descriptor", the character length must be smaller than or equal to 36.'
174
+ end
175
+
176
+ if !custom_soft_descriptor.nil? && custom_soft_descriptor.to_s.length < 0
177
+ fail ArgumentError, 'invalid value for "custom_soft_descriptor", the character length must be great than or equal to 0.'
178
+ end
179
+
180
+ @custom_soft_descriptor = custom_soft_descriptor
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ line_items == o.line_items &&
189
+ authorization_type == o.authorization_type &&
190
+ custom_soft_descriptor == o.custom_soft_descriptor &&
191
+ installment_plan == o.installment_plan &&
192
+ amount == o.amount &&
193
+ payment_instrument == o.payment_instrument &&
194
+ instrument_owner == o.instrument_owner
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [line_items, authorization_type, custom_soft_descriptor, installment_plan, amount, payment_instrument, instrument_owner].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ Yapstone.const_get(type).build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ next if value.nil?
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ # Outputs non-array value in the form of hash
302
+ # For object, use to_hash. Otherwise, just return the value
303
+ # @param [Object] value Any valid value
304
+ # @return [Hash] Returns the value in the form of hash
305
+ def _to_hash(value)
306
+ if value.is_a?(Array)
307
+ value.compact.map { |v| _to_hash(v) }
308
+ elsif value.is_a?(Hash)
309
+ {}.tap do |hash|
310
+ value.each { |k, v| hash[k] = _to_hash(v) }
311
+ end
312
+ elsif value.respond_to? :to_hash
313
+ value.to_hash
314
+ else
315
+ value
316
+ end
317
+ end
318
+ end
319
+ end
@@ -0,0 +1,277 @@
1
+ =begin
2
+ #Payments Orchestrator
3
+
4
+ #\"REST API for Payments Orchestrator\"
5
+
6
+ The version of the OpenAPI document: 1.6.4-SNAPSHOT
7
+ Contact: test@yapstone.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Yapstone
16
+ # The payment method used by the customer, e.g. the credit card or bank account.
17
+ class PaymentInstrument
18
+ attr_accessor :apm
19
+
20
+ attr_accessor :bank
21
+
22
+ attr_accessor :card
23
+
24
+ attr_accessor :token
25
+
26
+ attr_accessor :kyc
27
+
28
+ # Credit Card(includes Debit card) or ACH or APM or of Wallet Type with possible values = androidpay, masterpass ,apple pay, paywithgoogle ,samsungpay, visacheckout
29
+ attr_accessor :instrument_type
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'apm' => :'apm',
57
+ :'bank' => :'bank',
58
+ :'card' => :'card',
59
+ :'token' => :'token',
60
+ :'kyc' => :'kyc',
61
+ :'instrument_type' => :'instrumentType'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'apm' => :'APM',
69
+ :'bank' => :'BankAccount',
70
+ :'card' => :'Card',
71
+ :'token' => :'TokenReq',
72
+ :'kyc' => :'KYC',
73
+ :'instrument_type' => :'String'
74
+ }
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::PaymentInstrument` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::PaymentInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'apm')
93
+ self.apm = attributes[:'apm']
94
+ end
95
+
96
+ if attributes.key?(:'bank')
97
+ self.bank = attributes[:'bank']
98
+ end
99
+
100
+ if attributes.key?(:'card')
101
+ self.card = attributes[:'card']
102
+ end
103
+
104
+ if attributes.key?(:'token')
105
+ self.token = attributes[:'token']
106
+ end
107
+
108
+ if attributes.key?(:'kyc')
109
+ self.kyc = attributes[:'kyc']
110
+ end
111
+
112
+ if attributes.key?(:'instrument_type')
113
+ self.instrument_type = attributes[:'instrument_type']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ instrument_type_validator = EnumAttributeValidator.new('String', ["CARD", "BANK", "APM", "TOKEN"])
128
+ return false unless instrument_type_validator.valid?(@instrument_type)
129
+ true
130
+ end
131
+
132
+ # Custom attribute writer method checking allowed values (enum).
133
+ # @param [Object] instrument_type Object to be assigned
134
+ def instrument_type=(instrument_type)
135
+ validator = EnumAttributeValidator.new('String', ["CARD", "BANK", "APM", "TOKEN"])
136
+ unless validator.valid?(instrument_type)
137
+ fail ArgumentError, "invalid value for \"instrument_type\", must be one of #{validator.allowable_values}."
138
+ end
139
+ @instrument_type = instrument_type
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ apm == o.apm &&
148
+ bank == o.bank &&
149
+ card == o.card &&
150
+ token == o.token &&
151
+ kyc == o.kyc &&
152
+ instrument_type == o.instrument_type
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(o)
158
+ self == o
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Integer] Hash code
163
+ def hash
164
+ [apm, bank, card, token, kyc, instrument_type].hash
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def self.build_from_hash(attributes)
171
+ new.build_from_hash(attributes)
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ self.class.openapi_types.each_pair do |key, type|
180
+ if type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
189
+ end
190
+
191
+ self
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def _deserialize(type, value)
199
+ case type.to_sym
200
+ when :DateTime
201
+ DateTime.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ Yapstone.const_get(type).build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ next if value.nil?
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Outputs non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ # @param [Object] value Any valid value
262
+ # @return [Hash] Returns the value in the form of hash
263
+ def _to_hash(value)
264
+ if value.is_a?(Array)
265
+ value.compact.map { |v| _to_hash(v) }
266
+ elsif value.is_a?(Hash)
267
+ {}.tap do |hash|
268
+ value.each { |k, v| hash[k] = _to_hash(v) }
269
+ end
270
+ elsif value.respond_to? :to_hash
271
+ value.to_hash
272
+ else
273
+ value
274
+ end
275
+ end
276
+ end
277
+ end