velopayments 2.11.73

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 (273) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/LICENSE +201 -0
  5. data/Makefile +39 -0
  6. data/README.md +279 -0
  7. data/Rakefile +10 -0
  8. data/docs/Address.md +31 -0
  9. data/docs/Challenge.md +19 -0
  10. data/docs/Company.md +19 -0
  11. data/docs/CountriesApi.md +106 -0
  12. data/docs/CreatePayee.md +59 -0
  13. data/docs/CreatePayeesCSVRequest.md +71 -0
  14. data/docs/CreatePayeesCSVResponse.md +19 -0
  15. data/docs/CreatePayeesRequest.md +19 -0
  16. data/docs/CreatePaymentChannel.md +29 -0
  17. data/docs/CreatePayoutRequest.md +21 -0
  18. data/docs/CurrenciesApi.md +57 -0
  19. data/docs/FailedSubmission.md +19 -0
  20. data/docs/FundingAudit.md +31 -0
  21. data/docs/FundingEvent.md +21 -0
  22. data/docs/FundingEventType.md +16 -0
  23. data/docs/FundingManagerApi.md +347 -0
  24. data/docs/FundingRequest.md +17 -0
  25. data/docs/FundingRequest2.md +17 -0
  26. data/docs/FxSummary.md +35 -0
  27. data/docs/GetFundingsResponse.md +21 -0
  28. data/docs/GetPaymentsForPayoutResponse.md +23 -0
  29. data/docs/GetPaymentsForPayoutResponseLinks.md +19 -0
  30. data/docs/GetPaymentsForPayoutResponsePage.md +25 -0
  31. data/docs/GetPaymentsForPayoutResponseSummary.md +25 -0
  32. data/docs/GetPayoutApi.md +61 -0
  33. data/docs/GetPayoutStatistics.md +19 -0
  34. data/docs/GetPayoutsResponse.md +23 -0
  35. data/docs/Individual.md +21 -0
  36. data/docs/IndividualName.md +23 -0
  37. data/docs/InstructPayoutApi.md +60 -0
  38. data/docs/InvitationStatusResponse.md +17 -0
  39. data/docs/InvitePayeeRequest.md +17 -0
  40. data/docs/Language.md +16 -0
  41. data/docs/ListPaymentsResponse.md +23 -0
  42. data/docs/ListSourceAccountResponse.md +21 -0
  43. data/docs/MarketingOptIn.md +19 -0
  44. data/docs/OfacStatus.md +16 -0
  45. data/docs/OnboardedStatus.md +16 -0
  46. data/docs/PagedResponse.md +19 -0
  47. data/docs/PagedResponsePage.md +25 -0
  48. data/docs/Payee.md +57 -0
  49. data/docs/PayeeInvitationApi.md +222 -0
  50. data/docs/PayeeInvitationStatus.md +21 -0
  51. data/docs/PayeeResponse.md +23 -0
  52. data/docs/PayeeType.md +16 -0
  53. data/docs/PayeesApi.md +192 -0
  54. data/docs/PaymentAuditCurrency.md +16 -0
  55. data/docs/PaymentAuditServiceApi.md +424 -0
  56. data/docs/PaymentChannel.md +29 -0
  57. data/docs/PaymentChannelCountry.md +19 -0
  58. data/docs/PaymentChannelRule.md +29 -0
  59. data/docs/PaymentChannelRulesResponse.md +17 -0
  60. data/docs/PaymentEventResponse.md +39 -0
  61. data/docs/PaymentInstruction.md +27 -0
  62. data/docs/PaymentResponse.md +81 -0
  63. data/docs/Payor.md +55 -0
  64. data/docs/PayorApplicationsApi.md +119 -0
  65. data/docs/PayorBrandingResponse.md +25 -0
  66. data/docs/PayorCreateApiKeyRequest.md +21 -0
  67. data/docs/PayorCreateApiKeyResponse.md +19 -0
  68. data/docs/PayorCreateApplicationRequest.md +19 -0
  69. data/docs/PayorEmailOptOutRequest.md +17 -0
  70. data/docs/PayorFundingBankDetailsUpdate.md +21 -0
  71. data/docs/PayorLogoRequest.md +17 -0
  72. data/docs/PayorRef.md +21 -0
  73. data/docs/PayorsApi.md +224 -0
  74. data/docs/PayoutHistoryApi.md +142 -0
  75. data/docs/PayoutStatus.md +16 -0
  76. data/docs/PayoutSummaryAudit.md +39 -0
  77. data/docs/PayoutSummaryResponse.md +31 -0
  78. data/docs/QueryBatchResponse.md +23 -0
  79. data/docs/QuoteFxSummary.md +37 -0
  80. data/docs/QuotePayoutApi.md +61 -0
  81. data/docs/QuoteResponse.md +17 -0
  82. data/docs/RejectedPayment.md +31 -0
  83. data/docs/Social.md +21 -0
  84. data/docs/SourceAccount.md +23 -0
  85. data/docs/SourceAccountResponse.md +39 -0
  86. data/docs/SourceAccountSummary.md +21 -0
  87. data/docs/SubmitPayoutApi.md +60 -0
  88. data/docs/SupportedCountriesResponse.md +17 -0
  89. data/docs/SupportedCountry.md +19 -0
  90. data/docs/SupportedCurrency.md +19 -0
  91. data/docs/SupportedCurrencyResponse.md +17 -0
  92. data/docs/WithdrawPayoutApi.md +60 -0
  93. data/lib/velopayments.rb +124 -0
  94. data/lib/velopayments/api/countries_api.rb +116 -0
  95. data/lib/velopayments/api/currencies_api.rb +69 -0
  96. data/lib/velopayments/api/funding_manager_api.rb +374 -0
  97. data/lib/velopayments/api/get_payout_api.rb +75 -0
  98. data/lib/velopayments/api/instruct_payout_api.rb +72 -0
  99. data/lib/velopayments/api/payee_invitation_api.rb +244 -0
  100. data/lib/velopayments/api/payees_api.rb +217 -0
  101. data/lib/velopayments/api/payment_audit_service_api.rb +473 -0
  102. data/lib/velopayments/api/payor_applications_api.rb +147 -0
  103. data/lib/velopayments/api/payors_api.rb +241 -0
  104. data/lib/velopayments/api/payout_history_api.rb +165 -0
  105. data/lib/velopayments/api/quote_payout_api.rb +75 -0
  106. data/lib/velopayments/api/submit_payout_api.rb +74 -0
  107. data/lib/velopayments/api/withdraw_payout_api.rb +72 -0
  108. data/lib/velopayments/api_client.rb +387 -0
  109. data/lib/velopayments/api_error.rb +57 -0
  110. data/lib/velopayments/configuration.rb +251 -0
  111. data/lib/velopayments/models/address.rb +478 -0
  112. data/lib/velopayments/models/challenge.rb +271 -0
  113. data/lib/velopayments/models/company.rb +256 -0
  114. data/lib/velopayments/models/create_payee.rb +466 -0
  115. data/lib/velopayments/models/create_payees_csv_request.rb +1052 -0
  116. data/lib/velopayments/models/create_payees_csv_response.rb +207 -0
  117. data/lib/velopayments/models/create_payees_request.rb +217 -0
  118. data/lib/velopayments/models/create_payment_channel.rb +414 -0
  119. data/lib/velopayments/models/create_payout_request.rb +226 -0
  120. data/lib/velopayments/models/failed_submission.rb +205 -0
  121. data/lib/velopayments/models/funding_audit.rb +295 -0
  122. data/lib/velopayments/models/funding_event.rb +214 -0
  123. data/lib/velopayments/models/funding_event_type.rb +41 -0
  124. data/lib/velopayments/models/funding_request.rb +230 -0
  125. data/lib/velopayments/models/funding_request2.rb +230 -0
  126. data/lib/velopayments/models/fx_summary.rb +363 -0
  127. data/lib/velopayments/models/get_fundings_response.rb +223 -0
  128. data/lib/velopayments/models/get_payments_for_payout_response.rb +228 -0
  129. data/lib/velopayments/models/get_payments_for_payout_response_links.rb +205 -0
  130. data/lib/velopayments/models/get_payments_for_payout_response_page.rb +232 -0
  131. data/lib/velopayments/models/get_payments_for_payout_response_summary.rb +232 -0
  132. data/lib/velopayments/models/get_payout_statistics.rb +215 -0
  133. data/lib/velopayments/models/get_payouts_response.rb +228 -0
  134. data/lib/velopayments/models/individual.rb +224 -0
  135. data/lib/velopayments/models/individual_name.rb +337 -0
  136. data/lib/velopayments/models/invitation_status_response.rb +203 -0
  137. data/lib/velopayments/models/invite_payee_request.rb +201 -0
  138. data/lib/velopayments/models/language.rb +45 -0
  139. data/lib/velopayments/models/list_payments_response.rb +228 -0
  140. data/lib/velopayments/models/list_source_account_response.rb +219 -0
  141. data/lib/velopayments/models/marketing_opt_in.rb +205 -0
  142. data/lib/velopayments/models/ofac_status.rb +37 -0
  143. data/lib/velopayments/models/onboarded_status.rb +38 -0
  144. data/lib/velopayments/models/paged_response.rb +207 -0
  145. data/lib/velopayments/models/paged_response_page.rb +232 -0
  146. data/lib/velopayments/models/payee.rb +381 -0
  147. data/lib/velopayments/models/payee_invitation_status.rb +258 -0
  148. data/lib/velopayments/models/payee_response.rb +228 -0
  149. data/lib/velopayments/models/payee_type.rb +36 -0
  150. data/lib/velopayments/models/payment_audit_currency.rb +37 -0
  151. data/lib/velopayments/models/payment_channel.rb +430 -0
  152. data/lib/velopayments/models/payment_channel_country.rb +207 -0
  153. data/lib/velopayments/models/payment_channel_rule.rb +250 -0
  154. data/lib/velopayments/models/payment_channel_rules_response.rb +198 -0
  155. data/lib/velopayments/models/payment_event_response.rb +351 -0
  156. data/lib/velopayments/models/payment_instruction.rb +430 -0
  157. data/lib/velopayments/models/payment_response.rb +587 -0
  158. data/lib/velopayments/models/payor.rb +435 -0
  159. data/lib/velopayments/models/payor_branding_response.rb +247 -0
  160. data/lib/velopayments/models/payor_create_api_key_request.rb +303 -0
  161. data/lib/velopayments/models/payor_create_api_key_response.rb +207 -0
  162. data/lib/velopayments/models/payor_create_application_request.rb +264 -0
  163. data/lib/velopayments/models/payor_email_opt_out_request.rb +196 -0
  164. data/lib/velopayments/models/payor_funding_bank_details_update.rb +316 -0
  165. data/lib/velopayments/models/payor_logo_request.rb +196 -0
  166. data/lib/velopayments/models/payor_ref.rb +214 -0
  167. data/lib/velopayments/models/payout_status.rb +43 -0
  168. data/lib/velopayments/models/payout_summary_audit.rb +314 -0
  169. data/lib/velopayments/models/payout_summary_response.rb +280 -0
  170. data/lib/velopayments/models/query_batch_response.rb +260 -0
  171. data/lib/velopayments/models/quote_fx_summary.rb +377 -0
  172. data/lib/velopayments/models/quote_response.rb +198 -0
  173. data/lib/velopayments/models/rejected_payment.rb +323 -0
  174. data/lib/velopayments/models/social.rb +214 -0
  175. data/lib/velopayments/models/source_account.rb +243 -0
  176. data/lib/velopayments/models/source_account_response.rb +341 -0
  177. data/lib/velopayments/models/source_account_summary.rb +224 -0
  178. data/lib/velopayments/models/supported_countries_response.rb +198 -0
  179. data/lib/velopayments/models/supported_country.rb +207 -0
  180. data/lib/velopayments/models/supported_currency.rb +206 -0
  181. data/lib/velopayments/models/supported_currency_response.rb +198 -0
  182. data/lib/velopayments/version.rb +15 -0
  183. data/oa3-config.json +8 -0
  184. data/spec/api/countries_api_spec.rb +57 -0
  185. data/spec/api/currencies_api_spec.rb +46 -0
  186. data/spec/api/funding_manager_api_spec.rb +117 -0
  187. data/spec/api/get_payout_api_spec.rb +47 -0
  188. data/spec/api/instruct_payout_api_spec.rb +47 -0
  189. data/spec/api/payee_invitation_api_spec.rb +84 -0
  190. data/spec/api/payees_api_spec.rb +82 -0
  191. data/spec/api/payment_audit_service_api_spec.rb +150 -0
  192. data/spec/api/payor_applications_api_spec.rb +62 -0
  193. data/spec/api/payors_api_spec.rb +85 -0
  194. data/spec/api/payout_history_api_spec.rb +71 -0
  195. data/spec/api/quote_payout_api_spec.rb +47 -0
  196. data/spec/api/submit_payout_api_spec.rb +47 -0
  197. data/spec/api/withdraw_payout_api_spec.rb +47 -0
  198. data/spec/api_client_spec.rb +226 -0
  199. data/spec/configuration_spec.rb +42 -0
  200. data/spec/models/address_spec.rb +83 -0
  201. data/spec/models/challenge_spec.rb +47 -0
  202. data/spec/models/company_spec.rb +47 -0
  203. data/spec/models/create_payee_spec.rb +167 -0
  204. data/spec/models/create_payees_csv_request_spec.rb +211 -0
  205. data/spec/models/create_payees_csv_response_spec.rb +47 -0
  206. data/spec/models/create_payees_request_spec.rb +47 -0
  207. data/spec/models/create_payment_channel_spec.rb +81 -0
  208. data/spec/models/create_payout_request_spec.rb +53 -0
  209. data/spec/models/failed_submission_spec.rb +47 -0
  210. data/spec/models/funding_audit_spec.rb +87 -0
  211. data/spec/models/funding_event_spec.rb +53 -0
  212. data/spec/models/funding_event_type_spec.rb +35 -0
  213. data/spec/models/funding_request2_spec.rb +41 -0
  214. data/spec/models/funding_request_spec.rb +41 -0
  215. data/spec/models/fx_summary_spec.rb +103 -0
  216. data/spec/models/get_fundings_response_spec.rb +53 -0
  217. data/spec/models/get_payments_for_payout_response_links_spec.rb +47 -0
  218. data/spec/models/get_payments_for_payout_response_page_spec.rb +65 -0
  219. data/spec/models/get_payments_for_payout_response_spec.rb +59 -0
  220. data/spec/models/get_payments_for_payout_response_summary_spec.rb +65 -0
  221. data/spec/models/get_payout_statistics_spec.rb +47 -0
  222. data/spec/models/get_payouts_response_spec.rb +59 -0
  223. data/spec/models/individual_name_spec.rb +59 -0
  224. data/spec/models/individual_spec.rb +53 -0
  225. data/spec/models/invitation_status_response_spec.rb +41 -0
  226. data/spec/models/invite_payee_request_spec.rb +41 -0
  227. data/spec/models/language_spec.rb +35 -0
  228. data/spec/models/list_payments_response_spec.rb +59 -0
  229. data/spec/models/list_source_account_response_spec.rb +53 -0
  230. data/spec/models/marketing_opt_in_spec.rb +47 -0
  231. data/spec/models/ofac_status_spec.rb +35 -0
  232. data/spec/models/onboarded_status_spec.rb +35 -0
  233. data/spec/models/paged_response_page_spec.rb +65 -0
  234. data/spec/models/paged_response_spec.rb +47 -0
  235. data/spec/models/payee_invitation_status_spec.rb +57 -0
  236. data/spec/models/payee_response_spec.rb +59 -0
  237. data/spec/models/payee_spec.rb +161 -0
  238. data/spec/models/payee_type_spec.rb +35 -0
  239. data/spec/models/payment_audit_currency_spec.rb +35 -0
  240. data/spec/models/payment_channel_country_spec.rb +47 -0
  241. data/spec/models/payment_channel_rule_spec.rb +77 -0
  242. data/spec/models/payment_channel_rules_response_spec.rb +41 -0
  243. data/spec/models/payment_channel_spec.rb +81 -0
  244. data/spec/models/payment_event_response_spec.rb +111 -0
  245. data/spec/models/payment_instruction_spec.rb +75 -0
  246. data/spec/models/payment_response_spec.rb +241 -0
  247. data/spec/models/payor_branding_response_spec.rb +65 -0
  248. data/spec/models/payor_create_api_key_request_spec.rb +57 -0
  249. data/spec/models/payor_create_api_key_response_spec.rb +47 -0
  250. data/spec/models/payor_create_application_request_spec.rb +47 -0
  251. data/spec/models/payor_email_opt_out_request_spec.rb +41 -0
  252. data/spec/models/payor_funding_bank_details_update_spec.rb +53 -0
  253. data/spec/models/payor_logo_request_spec.rb +41 -0
  254. data/spec/models/payor_ref_spec.rb +53 -0
  255. data/spec/models/payor_spec.rb +163 -0
  256. data/spec/models/payout_status_spec.rb +35 -0
  257. data/spec/models/payout_summary_audit_spec.rb +107 -0
  258. data/spec/models/payout_summary_response_spec.rb +83 -0
  259. data/spec/models/query_batch_response_spec.rb +63 -0
  260. data/spec/models/quote_fx_summary_spec.rb +101 -0
  261. data/spec/models/quote_response_spec.rb +41 -0
  262. data/spec/models/rejected_payment_spec.rb +87 -0
  263. data/spec/models/social_spec.rb +53 -0
  264. data/spec/models/source_account_response_spec.rb +111 -0
  265. data/spec/models/source_account_spec.rb +59 -0
  266. data/spec/models/source_account_summary_spec.rb +53 -0
  267. data/spec/models/supported_countries_response_spec.rb +41 -0
  268. data/spec/models/supported_country_spec.rb +47 -0
  269. data/spec/models/supported_currency_response_spec.rb +41 -0
  270. data/spec/models/supported_currency_spec.rb +47 -0
  271. data/spec/spec_helper.rb +111 -0
  272. data/velopayments.gemspec +45 -0
  273. metadata +586 -0
@@ -0,0 +1,430 @@
1
+ =begin
2
+ #Velo Payments APIs
3
+
4
+ ### Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor. * **Payment.** A single transfer of funds from a payor to a payee. * **Payout.** A batch of Payments, typically used by a payor to logically group payments (e.g. by business day). Technically there need be no relationship between the payments in a payout - a single payout can contain payments to multiple payees and/or multiple payments to a single payee. * **Sandbox.** An integration environment provided by Velo Payments which offers a similar API experience to the production environment, but all funding and payment events are simulated, along with many other services such as OFAC sanctions list checking. ## Overview The Velo Payments API allows a payor to perform a number of operations. The following is a list of the main capabilities in a natural order of execution: * Authenticate with the Velo platform * Maintain a collection of payees * Query the payor’s current balance of funds within the platform and perform additional funding * Issue payments to payees * Query the platform for a history of those payments This document describes the main concepts and APIs required to get up and running with the Velo Payments platform. It is not an exhaustive API reference. For that, please see the separate Velo Payments API Reference. ## API Considerations The Velo Payments API is REST based and uses the JSON format for requests and responses. Most calls are secured using OAuth 2 security and require a valid authentication access token for successful operation. See the Authentication section for details. Where a dynamic value is required in the examples below, the {token} format is used, suggesting that the caller needs to supply the appropriate value of the token in question (without including the { or } characters). Where curl examples are given, the –d @filename.json approach is used, indicating that the request body should be placed into a file named filename.json in the current directory. Each of the curl examples in this document should be considered a single line on the command-line, regardless of how they appear in print. ## Authenticating with the Velo Platform Once Velo backoffice staff have added your organization as a payor within the Velo platform sandbox, they will create you a payor Id, an API key and an API secret and share these with you in a secure manner. You will need to use these values to authenticate with the Velo platform in order to gain access to the APIs. The steps to take are explained in the following: create a string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 base64 encode this string. E.g.: NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== create an HTTP **Authorization** header with the value set to e.g. Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== perform the Velo authentication REST call using the HTTP header created above e.g. via curl: ``` curl -X POST \\ -H \"Content-Type: application/json\" \\ -H \"Authorization: Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==\" \\ 'https://api.sandbox.velopayments.com/v1/authenticate?grant_type=client_credentials' ``` If successful, this call will result in a **200** HTTP status code and a response body such as: ``` { \"access_token\":\"19f6bafd-93fd-4747-b229-00507bbc991f\", \"token_type\":\"bearer\", \"expires_in\":1799, \"scope\":\"...\" } ``` ## API access following authentication Following successful authentication, the value of the access_token field in the response (indicated in green above) should then be presented with all subsequent API calls to allow the Velo platform to validate that the caller is authenticated. This is achieved by setting the HTTP Authorization header with the value set to e.g. Bearer 19f6bafd-93fd-4747-b229-00507bbc991f such as the curl example below: ``` -H \"Authorization: Bearer 19f6bafd-93fd-4747-b229-00507bbc991f \" ``` If you make other Velo API calls which require authorization but the Authorization header is missing or invalid then you will get a **401** HTTP status response.
5
+
6
+ OpenAPI spec version: 2.11.73
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module VeloPayments
16
+ class PaymentInstruction
17
+ # Your identifier for payee
18
+ attr_accessor :remote_id
19
+
20
+ # Payee's currency
21
+ attr_accessor :currency
22
+
23
+ # Amount to send to Payee
24
+ attr_accessor :amount
25
+
26
+ attr_accessor :payment_memo
27
+
28
+ attr_accessor :source_account_name
29
+
30
+ attr_accessor :payor_payment_id
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'remote_id' => :'remoteId',
58
+ :'currency' => :'currency',
59
+ :'amount' => :'amount',
60
+ :'payment_memo' => :'paymentMemo',
61
+ :'source_account_name' => :'sourceAccountName',
62
+ :'payor_payment_id' => :'payorPaymentId'
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'remote_id' => :'String',
70
+ :'currency' => :'String',
71
+ :'amount' => :'Integer',
72
+ :'payment_memo' => :'String',
73
+ :'source_account_name' => :'String',
74
+ :'payor_payment_id' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VeloPayments::PaymentInstruction` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VeloPayments::PaymentInstruction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'remote_id')
94
+ self.remote_id = attributes[:'remote_id']
95
+ end
96
+
97
+ if attributes.key?(:'currency')
98
+ self.currency = attributes[:'currency']
99
+ end
100
+
101
+ if attributes.key?(:'amount')
102
+ self.amount = attributes[:'amount']
103
+ end
104
+
105
+ if attributes.key?(:'payment_memo')
106
+ self.payment_memo = attributes[:'payment_memo']
107
+ end
108
+
109
+ if attributes.key?(:'source_account_name')
110
+ self.source_account_name = attributes[:'source_account_name']
111
+ end
112
+
113
+ if attributes.key?(:'payor_payment_id')
114
+ self.payor_payment_id = attributes[:'payor_payment_id']
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ invalid_properties = Array.new
122
+ if @remote_id.nil?
123
+ invalid_properties.push('invalid value for "remote_id", remote_id cannot be nil.')
124
+ end
125
+
126
+ if @remote_id.to_s.length > 100
127
+ invalid_properties.push('invalid value for "remote_id", the character length must be smaller than or equal to 100.')
128
+ end
129
+
130
+ if @remote_id.to_s.length < 1
131
+ invalid_properties.push('invalid value for "remote_id", the character length must be great than or equal to 1.')
132
+ end
133
+
134
+ if @currency.nil?
135
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
136
+ end
137
+
138
+ if @amount.nil?
139
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
140
+ end
141
+
142
+ if @amount > 9223372036854775807
143
+ invalid_properties.push('invalid value for "amount", must be smaller than or equal to 9223372036854775807.')
144
+ end
145
+
146
+ if @amount < 1
147
+ invalid_properties.push('invalid value for "amount", must be greater than or equal to 1.')
148
+ end
149
+
150
+ if !@payment_memo.nil? && @payment_memo.to_s.length > 40
151
+ invalid_properties.push('invalid value for "payment_memo", the character length must be smaller than or equal to 40.')
152
+ end
153
+
154
+ if !@payment_memo.nil? && @payment_memo.to_s.length < 0
155
+ invalid_properties.push('invalid value for "payment_memo", the character length must be great than or equal to 0.')
156
+ end
157
+
158
+ if @source_account_name.nil?
159
+ invalid_properties.push('invalid value for "source_account_name", source_account_name cannot be nil.')
160
+ end
161
+
162
+ if @source_account_name.to_s.length > 64
163
+ invalid_properties.push('invalid value for "source_account_name", the character length must be smaller than or equal to 64.')
164
+ end
165
+
166
+ if @source_account_name.to_s.length < 1
167
+ invalid_properties.push('invalid value for "source_account_name", the character length must be great than or equal to 1.')
168
+ end
169
+
170
+ if !@payor_payment_id.nil? && @payor_payment_id.to_s.length > 40
171
+ invalid_properties.push('invalid value for "payor_payment_id", the character length must be smaller than or equal to 40.')
172
+ end
173
+
174
+ if !@payor_payment_id.nil? && @payor_payment_id.to_s.length < 0
175
+ invalid_properties.push('invalid value for "payor_payment_id", the character length must be great than or equal to 0.')
176
+ end
177
+
178
+ invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ return false if @remote_id.nil?
185
+ return false if @remote_id.to_s.length > 100
186
+ return false if @remote_id.to_s.length < 1
187
+ return false if @currency.nil?
188
+ currency_validator = EnumAttributeValidator.new('String', ["USD", "GBP", "EUR"])
189
+ return false unless currency_validator.valid?(@currency)
190
+ return false if @amount.nil?
191
+ return false if @amount > 9223372036854775807
192
+ return false if @amount < 1
193
+ return false if !@payment_memo.nil? && @payment_memo.to_s.length > 40
194
+ return false if !@payment_memo.nil? && @payment_memo.to_s.length < 0
195
+ return false if @source_account_name.nil?
196
+ return false if @source_account_name.to_s.length > 64
197
+ return false if @source_account_name.to_s.length < 1
198
+ return false if !@payor_payment_id.nil? && @payor_payment_id.to_s.length > 40
199
+ return false if !@payor_payment_id.nil? && @payor_payment_id.to_s.length < 0
200
+ true
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] remote_id Value to be assigned
205
+ def remote_id=(remote_id)
206
+ if remote_id.nil?
207
+ fail ArgumentError, 'remote_id cannot be nil'
208
+ end
209
+
210
+ if remote_id.to_s.length > 100
211
+ fail ArgumentError, 'invalid value for "remote_id", the character length must be smaller than or equal to 100.'
212
+ end
213
+
214
+ if remote_id.to_s.length < 1
215
+ fail ArgumentError, 'invalid value for "remote_id", the character length must be great than or equal to 1.'
216
+ end
217
+
218
+ @remote_id = remote_id
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] currency Object to be assigned
223
+ def currency=(currency)
224
+ validator = EnumAttributeValidator.new('String', ["USD", "GBP", "EUR"])
225
+ unless validator.valid?(currency)
226
+ fail ArgumentError, "invalid value for \"currency\", must be one of #{validator.allowable_values}."
227
+ end
228
+ @currency = currency
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] amount Value to be assigned
233
+ def amount=(amount)
234
+ if amount.nil?
235
+ fail ArgumentError, 'amount cannot be nil'
236
+ end
237
+
238
+ if amount > 9223372036854775807
239
+ fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 9223372036854775807.'
240
+ end
241
+
242
+ if amount < 1
243
+ fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 1.'
244
+ end
245
+
246
+ @amount = amount
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] payment_memo Value to be assigned
251
+ def payment_memo=(payment_memo)
252
+ if !payment_memo.nil? && payment_memo.to_s.length > 40
253
+ fail ArgumentError, 'invalid value for "payment_memo", the character length must be smaller than or equal to 40.'
254
+ end
255
+
256
+ if !payment_memo.nil? && payment_memo.to_s.length < 0
257
+ fail ArgumentError, 'invalid value for "payment_memo", the character length must be great than or equal to 0.'
258
+ end
259
+
260
+ @payment_memo = payment_memo
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] source_account_name Value to be assigned
265
+ def source_account_name=(source_account_name)
266
+ if source_account_name.nil?
267
+ fail ArgumentError, 'source_account_name cannot be nil'
268
+ end
269
+
270
+ if source_account_name.to_s.length > 64
271
+ fail ArgumentError, 'invalid value for "source_account_name", the character length must be smaller than or equal to 64.'
272
+ end
273
+
274
+ if source_account_name.to_s.length < 1
275
+ fail ArgumentError, 'invalid value for "source_account_name", the character length must be great than or equal to 1.'
276
+ end
277
+
278
+ @source_account_name = source_account_name
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] payor_payment_id Value to be assigned
283
+ def payor_payment_id=(payor_payment_id)
284
+ if !payor_payment_id.nil? && payor_payment_id.to_s.length > 40
285
+ fail ArgumentError, 'invalid value for "payor_payment_id", the character length must be smaller than or equal to 40.'
286
+ end
287
+
288
+ if !payor_payment_id.nil? && payor_payment_id.to_s.length < 0
289
+ fail ArgumentError, 'invalid value for "payor_payment_id", the character length must be great than or equal to 0.'
290
+ end
291
+
292
+ @payor_payment_id = payor_payment_id
293
+ end
294
+
295
+ # Checks equality by comparing each attribute.
296
+ # @param [Object] Object to be compared
297
+ def ==(o)
298
+ return true if self.equal?(o)
299
+ self.class == o.class &&
300
+ remote_id == o.remote_id &&
301
+ currency == o.currency &&
302
+ amount == o.amount &&
303
+ payment_memo == o.payment_memo &&
304
+ source_account_name == o.source_account_name &&
305
+ payor_payment_id == o.payor_payment_id
306
+ end
307
+
308
+ # @see the `==` method
309
+ # @param [Object] Object to be compared
310
+ def eql?(o)
311
+ self == o
312
+ end
313
+
314
+ # Calculates hash code according to all attributes.
315
+ # @return [Integer] Hash code
316
+ def hash
317
+ [remote_id, currency, amount, payment_memo, source_account_name, payor_payment_id].hash
318
+ end
319
+
320
+ # Builds the object from hash
321
+ # @param [Hash] attributes Model attributes in the form of hash
322
+ # @return [Object] Returns the model itself
323
+ def self.build_from_hash(attributes)
324
+ new.build_from_hash(attributes)
325
+ end
326
+
327
+ # Builds the object from hash
328
+ # @param [Hash] attributes Model attributes in the form of hash
329
+ # @return [Object] Returns the model itself
330
+ def build_from_hash(attributes)
331
+ return nil unless attributes.is_a?(Hash)
332
+ self.class.openapi_types.each_pair do |key, type|
333
+ if type =~ /\AArray<(.*)>/i
334
+ # check to ensure the input is an array given that the attribute
335
+ # is documented as an array but the input is not
336
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
337
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
338
+ end
339
+ elsif !attributes[self.class.attribute_map[key]].nil?
340
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
341
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
342
+ end
343
+
344
+ self
345
+ end
346
+
347
+ # Deserializes the data based on type
348
+ # @param string type Data type
349
+ # @param string value Value to be deserialized
350
+ # @return [Object] Deserialized data
351
+ def _deserialize(type, value)
352
+ case type.to_sym
353
+ when :DateTime
354
+ DateTime.parse(value)
355
+ when :Date
356
+ Date.parse(value)
357
+ when :String
358
+ value.to_s
359
+ when :Integer
360
+ value.to_i
361
+ when :Float
362
+ value.to_f
363
+ when :Boolean
364
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
365
+ true
366
+ else
367
+ false
368
+ end
369
+ when :Object
370
+ # generic object (usually a Hash), return directly
371
+ value
372
+ when /\AArray<(?<inner_type>.+)>\z/
373
+ inner_type = Regexp.last_match[:inner_type]
374
+ value.map { |v| _deserialize(inner_type, v) }
375
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
376
+ k_type = Regexp.last_match[:k_type]
377
+ v_type = Regexp.last_match[:v_type]
378
+ {}.tap do |hash|
379
+ value.each do |k, v|
380
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
381
+ end
382
+ end
383
+ else # model
384
+ VeloPayments.const_get(type).build_from_hash(value)
385
+ end
386
+ end
387
+
388
+ # Returns the string representation of the object
389
+ # @return [String] String presentation of the object
390
+ def to_s
391
+ to_hash.to_s
392
+ end
393
+
394
+ # to_body is an alias to to_hash (backward compatibility)
395
+ # @return [Hash] Returns the object in the form of hash
396
+ def to_body
397
+ to_hash
398
+ end
399
+
400
+ # Returns the object in the form of hash
401
+ # @return [Hash] Returns the object in the form of hash
402
+ def to_hash
403
+ hash = {}
404
+ self.class.attribute_map.each_pair do |attr, param|
405
+ value = self.send(attr)
406
+ next if value.nil?
407
+ hash[param] = _to_hash(value)
408
+ end
409
+ hash
410
+ end
411
+
412
+ # Outputs non-array value in the form of hash
413
+ # For object, use to_hash. Otherwise, just return the value
414
+ # @param [Object] value Any valid value
415
+ # @return [Hash] Returns the value in the form of hash
416
+ def _to_hash(value)
417
+ if value.is_a?(Array)
418
+ value.compact.map { |v| _to_hash(v) }
419
+ elsif value.is_a?(Hash)
420
+ {}.tap do |hash|
421
+ value.each { |k, v| hash[k] = _to_hash(v) }
422
+ end
423
+ elsif value.respond_to? :to_hash
424
+ value.to_hash
425
+ else
426
+ value
427
+ end
428
+ end
429
+ end
430
+ end
@@ -0,0 +1,587 @@
1
+ =begin
2
+ #Velo Payments APIs
3
+
4
+ ### Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor. * **Payment.** A single transfer of funds from a payor to a payee. * **Payout.** A batch of Payments, typically used by a payor to logically group payments (e.g. by business day). Technically there need be no relationship between the payments in a payout - a single payout can contain payments to multiple payees and/or multiple payments to a single payee. * **Sandbox.** An integration environment provided by Velo Payments which offers a similar API experience to the production environment, but all funding and payment events are simulated, along with many other services such as OFAC sanctions list checking. ## Overview The Velo Payments API allows a payor to perform a number of operations. The following is a list of the main capabilities in a natural order of execution: * Authenticate with the Velo platform * Maintain a collection of payees * Query the payor’s current balance of funds within the platform and perform additional funding * Issue payments to payees * Query the platform for a history of those payments This document describes the main concepts and APIs required to get up and running with the Velo Payments platform. It is not an exhaustive API reference. For that, please see the separate Velo Payments API Reference. ## API Considerations The Velo Payments API is REST based and uses the JSON format for requests and responses. Most calls are secured using OAuth 2 security and require a valid authentication access token for successful operation. See the Authentication section for details. Where a dynamic value is required in the examples below, the {token} format is used, suggesting that the caller needs to supply the appropriate value of the token in question (without including the { or } characters). Where curl examples are given, the –d @filename.json approach is used, indicating that the request body should be placed into a file named filename.json in the current directory. Each of the curl examples in this document should be considered a single line on the command-line, regardless of how they appear in print. ## Authenticating with the Velo Platform Once Velo backoffice staff have added your organization as a payor within the Velo platform sandbox, they will create you a payor Id, an API key and an API secret and share these with you in a secure manner. You will need to use these values to authenticate with the Velo platform in order to gain access to the APIs. The steps to take are explained in the following: create a string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 base64 encode this string. E.g.: NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== create an HTTP **Authorization** header with the value set to e.g. Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ== perform the Velo authentication REST call using the HTTP header created above e.g. via curl: ``` curl -X POST \\ -H \"Content-Type: application/json\" \\ -H \"Authorization: Basic NDRhOTUzN2QtZDU1ZC00YjQ3LTgwODItMTQwNjFjMmJjZGQ4OmMzOTZiMjZiLTEzN2EtNDRmZC04N2Y1LTM0NjMxZjhmZDUyOQ==\" \\ 'https://api.sandbox.velopayments.com/v1/authenticate?grant_type=client_credentials' ``` If successful, this call will result in a **200** HTTP status code and a response body such as: ``` { \"access_token\":\"19f6bafd-93fd-4747-b229-00507bbc991f\", \"token_type\":\"bearer\", \"expires_in\":1799, \"scope\":\"...\" } ``` ## API access following authentication Following successful authentication, the value of the access_token field in the response (indicated in green above) should then be presented with all subsequent API calls to allow the Velo platform to validate that the caller is authenticated. This is achieved by setting the HTTP Authorization header with the value set to e.g. Bearer 19f6bafd-93fd-4747-b229-00507bbc991f such as the curl example below: ``` -H \"Authorization: Bearer 19f6bafd-93fd-4747-b229-00507bbc991f \" ``` If you make other Velo API calls which require authorization but the Authorization header is missing or invalid then you will get a **401** HTTP status response.
5
+
6
+ OpenAPI spec version: 2.11.73
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module VeloPayments
16
+ class PaymentResponse
17
+ attr_accessor :payment_id
18
+
19
+ attr_accessor :payee_id
20
+
21
+ attr_accessor :payor_id
22
+
23
+ attr_accessor :payor_name
24
+
25
+ attr_accessor :quote_id
26
+
27
+ attr_accessor :source_account_id
28
+
29
+ attr_accessor :source_account_name
30
+
31
+ attr_accessor :remote_id
32
+
33
+ attr_accessor :source_amount
34
+
35
+ attr_accessor :source_currency
36
+
37
+ attr_accessor :payment_amount
38
+
39
+ attr_accessor :payment_currency
40
+
41
+ attr_accessor :rate
42
+
43
+ attr_accessor :inverted_rate
44
+
45
+ attr_accessor :submitted_date_time
46
+
47
+ attr_accessor :status
48
+
49
+ attr_accessor :funding_status
50
+
51
+ attr_accessor :routing_number
52
+
53
+ attr_accessor :account_number
54
+
55
+ attr_accessor :iban
56
+
57
+ attr_accessor :payment_memo
58
+
59
+ attr_accessor :filename_reference
60
+
61
+ attr_accessor :individual_identification_number
62
+
63
+ attr_accessor :trace_number
64
+
65
+ attr_accessor :payor_payment_id
66
+
67
+ attr_accessor :payment_channel_id
68
+
69
+ attr_accessor :payment_channel_name
70
+
71
+ attr_accessor :account_name
72
+
73
+ attr_accessor :rails_id
74
+
75
+ attr_accessor :country_code
76
+
77
+ attr_accessor :events
78
+
79
+ attr_accessor :return_cost
80
+
81
+ attr_accessor :return_reason
82
+
83
+ class EnumAttributeValidator
84
+ attr_reader :datatype
85
+ attr_reader :allowable_values
86
+
87
+ def initialize(datatype, allowable_values)
88
+ @allowable_values = allowable_values.map do |value|
89
+ case datatype.to_s
90
+ when /Integer/i
91
+ value.to_i
92
+ when /Float/i
93
+ value.to_f
94
+ else
95
+ value
96
+ end
97
+ end
98
+ end
99
+
100
+ def valid?(value)
101
+ !value || allowable_values.include?(value)
102
+ end
103
+ end
104
+
105
+ # Attribute mapping from ruby-style variable name to JSON key.
106
+ def self.attribute_map
107
+ {
108
+ :'payment_id' => :'paymentId',
109
+ :'payee_id' => :'payeeId',
110
+ :'payor_id' => :'payorId',
111
+ :'payor_name' => :'payorName',
112
+ :'quote_id' => :'quoteId',
113
+ :'source_account_id' => :'sourceAccountId',
114
+ :'source_account_name' => :'sourceAccountName',
115
+ :'remote_id' => :'remoteId',
116
+ :'source_amount' => :'sourceAmount',
117
+ :'source_currency' => :'sourceCurrency',
118
+ :'payment_amount' => :'paymentAmount',
119
+ :'payment_currency' => :'paymentCurrency',
120
+ :'rate' => :'rate',
121
+ :'inverted_rate' => :'invertedRate',
122
+ :'submitted_date_time' => :'submittedDateTime',
123
+ :'status' => :'status',
124
+ :'funding_status' => :'fundingStatus',
125
+ :'routing_number' => :'routingNumber',
126
+ :'account_number' => :'accountNumber',
127
+ :'iban' => :'iban',
128
+ :'payment_memo' => :'paymentMemo',
129
+ :'filename_reference' => :'filenameReference',
130
+ :'individual_identification_number' => :'individualIdentificationNumber',
131
+ :'trace_number' => :'traceNumber',
132
+ :'payor_payment_id' => :'payorPaymentId',
133
+ :'payment_channel_id' => :'paymentChannelId',
134
+ :'payment_channel_name' => :'paymentChannelName',
135
+ :'account_name' => :'accountName',
136
+ :'rails_id' => :'railsId',
137
+ :'country_code' => :'countryCode',
138
+ :'events' => :'events',
139
+ :'return_cost' => :'returnCost',
140
+ :'return_reason' => :'returnReason'
141
+ }
142
+ end
143
+
144
+ # Attribute type mapping.
145
+ def self.openapi_types
146
+ {
147
+ :'payment_id' => :'String',
148
+ :'payee_id' => :'String',
149
+ :'payor_id' => :'String',
150
+ :'payor_name' => :'String',
151
+ :'quote_id' => :'String',
152
+ :'source_account_id' => :'String',
153
+ :'source_account_name' => :'String',
154
+ :'remote_id' => :'String',
155
+ :'source_amount' => :'Integer',
156
+ :'source_currency' => :'PaymentAuditCurrency',
157
+ :'payment_amount' => :'Integer',
158
+ :'payment_currency' => :'PaymentAuditCurrency',
159
+ :'rate' => :'Float',
160
+ :'inverted_rate' => :'Float',
161
+ :'submitted_date_time' => :'DateTime',
162
+ :'status' => :'String',
163
+ :'funding_status' => :'String',
164
+ :'routing_number' => :'String',
165
+ :'account_number' => :'String',
166
+ :'iban' => :'String',
167
+ :'payment_memo' => :'String',
168
+ :'filename_reference' => :'String',
169
+ :'individual_identification_number' => :'String',
170
+ :'trace_number' => :'String',
171
+ :'payor_payment_id' => :'String',
172
+ :'payment_channel_id' => :'String',
173
+ :'payment_channel_name' => :'String',
174
+ :'account_name' => :'String',
175
+ :'rails_id' => :'String',
176
+ :'country_code' => :'String',
177
+ :'events' => :'Array<PaymentEventResponse>',
178
+ :'return_cost' => :'Integer',
179
+ :'return_reason' => :'String'
180
+ }
181
+ end
182
+
183
+ # Initializes the object
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ def initialize(attributes = {})
186
+ if (!attributes.is_a?(Hash))
187
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VeloPayments::PaymentResponse` initialize method"
188
+ end
189
+
190
+ # check to see if the attribute exists and convert string to symbol for hash key
191
+ attributes = attributes.each_with_object({}) { |(k, v), h|
192
+ if (!self.class.attribute_map.key?(k.to_sym))
193
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VeloPayments::PaymentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
194
+ end
195
+ h[k.to_sym] = v
196
+ }
197
+
198
+ if attributes.key?(:'payment_id')
199
+ self.payment_id = attributes[:'payment_id']
200
+ end
201
+
202
+ if attributes.key?(:'payee_id')
203
+ self.payee_id = attributes[:'payee_id']
204
+ end
205
+
206
+ if attributes.key?(:'payor_id')
207
+ self.payor_id = attributes[:'payor_id']
208
+ end
209
+
210
+ if attributes.key?(:'payor_name')
211
+ self.payor_name = attributes[:'payor_name']
212
+ end
213
+
214
+ if attributes.key?(:'quote_id')
215
+ self.quote_id = attributes[:'quote_id']
216
+ end
217
+
218
+ if attributes.key?(:'source_account_id')
219
+ self.source_account_id = attributes[:'source_account_id']
220
+ end
221
+
222
+ if attributes.key?(:'source_account_name')
223
+ self.source_account_name = attributes[:'source_account_name']
224
+ end
225
+
226
+ if attributes.key?(:'remote_id')
227
+ self.remote_id = attributes[:'remote_id']
228
+ end
229
+
230
+ if attributes.key?(:'source_amount')
231
+ self.source_amount = attributes[:'source_amount']
232
+ end
233
+
234
+ if attributes.key?(:'source_currency')
235
+ self.source_currency = attributes[:'source_currency']
236
+ end
237
+
238
+ if attributes.key?(:'payment_amount')
239
+ self.payment_amount = attributes[:'payment_amount']
240
+ end
241
+
242
+ if attributes.key?(:'payment_currency')
243
+ self.payment_currency = attributes[:'payment_currency']
244
+ end
245
+
246
+ if attributes.key?(:'rate')
247
+ self.rate = attributes[:'rate']
248
+ end
249
+
250
+ if attributes.key?(:'inverted_rate')
251
+ self.inverted_rate = attributes[:'inverted_rate']
252
+ end
253
+
254
+ if attributes.key?(:'submitted_date_time')
255
+ self.submitted_date_time = attributes[:'submitted_date_time']
256
+ end
257
+
258
+ if attributes.key?(:'status')
259
+ self.status = attributes[:'status']
260
+ end
261
+
262
+ if attributes.key?(:'funding_status')
263
+ self.funding_status = attributes[:'funding_status']
264
+ end
265
+
266
+ if attributes.key?(:'routing_number')
267
+ self.routing_number = attributes[:'routing_number']
268
+ end
269
+
270
+ if attributes.key?(:'account_number')
271
+ self.account_number = attributes[:'account_number']
272
+ end
273
+
274
+ if attributes.key?(:'iban')
275
+ self.iban = attributes[:'iban']
276
+ end
277
+
278
+ if attributes.key?(:'payment_memo')
279
+ self.payment_memo = attributes[:'payment_memo']
280
+ end
281
+
282
+ if attributes.key?(:'filename_reference')
283
+ self.filename_reference = attributes[:'filename_reference']
284
+ end
285
+
286
+ if attributes.key?(:'individual_identification_number')
287
+ self.individual_identification_number = attributes[:'individual_identification_number']
288
+ end
289
+
290
+ if attributes.key?(:'trace_number')
291
+ self.trace_number = attributes[:'trace_number']
292
+ end
293
+
294
+ if attributes.key?(:'payor_payment_id')
295
+ self.payor_payment_id = attributes[:'payor_payment_id']
296
+ end
297
+
298
+ if attributes.key?(:'payment_channel_id')
299
+ self.payment_channel_id = attributes[:'payment_channel_id']
300
+ end
301
+
302
+ if attributes.key?(:'payment_channel_name')
303
+ self.payment_channel_name = attributes[:'payment_channel_name']
304
+ end
305
+
306
+ if attributes.key?(:'account_name')
307
+ self.account_name = attributes[:'account_name']
308
+ end
309
+
310
+ if attributes.key?(:'rails_id')
311
+ self.rails_id = attributes[:'rails_id']
312
+ end
313
+
314
+ if attributes.key?(:'country_code')
315
+ self.country_code = attributes[:'country_code']
316
+ end
317
+
318
+ if attributes.key?(:'events')
319
+ if (value = attributes[:'events']).is_a?(Array)
320
+ self.events = value
321
+ end
322
+ end
323
+
324
+ if attributes.key?(:'return_cost')
325
+ self.return_cost = attributes[:'return_cost']
326
+ end
327
+
328
+ if attributes.key?(:'return_reason')
329
+ self.return_reason = attributes[:'return_reason']
330
+ end
331
+ end
332
+
333
+ # Show invalid properties with the reasons. Usually used together with valid?
334
+ # @return Array for valid properties with the reasons
335
+ def list_invalid_properties
336
+ invalid_properties = Array.new
337
+ if @payment_id.nil?
338
+ invalid_properties.push('invalid value for "payment_id", payment_id cannot be nil.')
339
+ end
340
+
341
+ if @payee_id.nil?
342
+ invalid_properties.push('invalid value for "payee_id", payee_id cannot be nil.')
343
+ end
344
+
345
+ if @payor_id.nil?
346
+ invalid_properties.push('invalid value for "payor_id", payor_id cannot be nil.')
347
+ end
348
+
349
+ if @quote_id.nil?
350
+ invalid_properties.push('invalid value for "quote_id", quote_id cannot be nil.')
351
+ end
352
+
353
+ if @source_account_id.nil?
354
+ invalid_properties.push('invalid value for "source_account_id", source_account_id cannot be nil.')
355
+ end
356
+
357
+ if @payment_amount.nil?
358
+ invalid_properties.push('invalid value for "payment_amount", payment_amount cannot be nil.')
359
+ end
360
+
361
+ if @submitted_date_time.nil?
362
+ invalid_properties.push('invalid value for "submitted_date_time", submitted_date_time cannot be nil.')
363
+ end
364
+
365
+ if @status.nil?
366
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
367
+ end
368
+
369
+ if @funding_status.nil?
370
+ invalid_properties.push('invalid value for "funding_status", funding_status cannot be nil.')
371
+ end
372
+
373
+ if @rails_id.nil?
374
+ invalid_properties.push('invalid value for "rails_id", rails_id cannot be nil.')
375
+ end
376
+
377
+ if @events.nil?
378
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
379
+ end
380
+
381
+ invalid_properties
382
+ end
383
+
384
+ # Check to see if the all the properties in the model are valid
385
+ # @return true if the model is valid
386
+ def valid?
387
+ return false if @payment_id.nil?
388
+ return false if @payee_id.nil?
389
+ return false if @payor_id.nil?
390
+ return false if @quote_id.nil?
391
+ return false if @source_account_id.nil?
392
+ return false if @payment_amount.nil?
393
+ return false if @submitted_date_time.nil?
394
+ return false if @status.nil?
395
+ status_validator = EnumAttributeValidator.new('String', ["ACCEPTED", "AWAITING_FUNDS", "FUNDED", "UNFUNDED", "BANK_PAYMENT_REQUESTED", "REJECTED", "ACCEPTED_BY_RAILS", "CONFIRMED", "FAILED", "WITHDRAWN"])
396
+ return false unless status_validator.valid?(@status)
397
+ return false if @funding_status.nil?
398
+ funding_status_validator = EnumAttributeValidator.new('String', ["FUNDED", "INSTRUCTED", "UNFUNDED"])
399
+ return false unless funding_status_validator.valid?(@funding_status)
400
+ return false if @rails_id.nil?
401
+ return false if @events.nil?
402
+ true
403
+ end
404
+
405
+ # Custom attribute writer method checking allowed values (enum).
406
+ # @param [Object] status Object to be assigned
407
+ def status=(status)
408
+ validator = EnumAttributeValidator.new('String', ["ACCEPTED", "AWAITING_FUNDS", "FUNDED", "UNFUNDED", "BANK_PAYMENT_REQUESTED", "REJECTED", "ACCEPTED_BY_RAILS", "CONFIRMED", "FAILED", "WITHDRAWN"])
409
+ unless validator.valid?(status)
410
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
411
+ end
412
+ @status = status
413
+ end
414
+
415
+ # Custom attribute writer method checking allowed values (enum).
416
+ # @param [Object] funding_status Object to be assigned
417
+ def funding_status=(funding_status)
418
+ validator = EnumAttributeValidator.new('String', ["FUNDED", "INSTRUCTED", "UNFUNDED"])
419
+ unless validator.valid?(funding_status)
420
+ fail ArgumentError, "invalid value for \"funding_status\", must be one of #{validator.allowable_values}."
421
+ end
422
+ @funding_status = funding_status
423
+ end
424
+
425
+ # Checks equality by comparing each attribute.
426
+ # @param [Object] Object to be compared
427
+ def ==(o)
428
+ return true if self.equal?(o)
429
+ self.class == o.class &&
430
+ payment_id == o.payment_id &&
431
+ payee_id == o.payee_id &&
432
+ payor_id == o.payor_id &&
433
+ payor_name == o.payor_name &&
434
+ quote_id == o.quote_id &&
435
+ source_account_id == o.source_account_id &&
436
+ source_account_name == o.source_account_name &&
437
+ remote_id == o.remote_id &&
438
+ source_amount == o.source_amount &&
439
+ source_currency == o.source_currency &&
440
+ payment_amount == o.payment_amount &&
441
+ payment_currency == o.payment_currency &&
442
+ rate == o.rate &&
443
+ inverted_rate == o.inverted_rate &&
444
+ submitted_date_time == o.submitted_date_time &&
445
+ status == o.status &&
446
+ funding_status == o.funding_status &&
447
+ routing_number == o.routing_number &&
448
+ account_number == o.account_number &&
449
+ iban == o.iban &&
450
+ payment_memo == o.payment_memo &&
451
+ filename_reference == o.filename_reference &&
452
+ individual_identification_number == o.individual_identification_number &&
453
+ trace_number == o.trace_number &&
454
+ payor_payment_id == o.payor_payment_id &&
455
+ payment_channel_id == o.payment_channel_id &&
456
+ payment_channel_name == o.payment_channel_name &&
457
+ account_name == o.account_name &&
458
+ rails_id == o.rails_id &&
459
+ country_code == o.country_code &&
460
+ events == o.events &&
461
+ return_cost == o.return_cost &&
462
+ return_reason == o.return_reason
463
+ end
464
+
465
+ # @see the `==` method
466
+ # @param [Object] Object to be compared
467
+ def eql?(o)
468
+ self == o
469
+ end
470
+
471
+ # Calculates hash code according to all attributes.
472
+ # @return [Integer] Hash code
473
+ def hash
474
+ [payment_id, payee_id, payor_id, payor_name, quote_id, source_account_id, source_account_name, remote_id, source_amount, source_currency, payment_amount, payment_currency, rate, inverted_rate, submitted_date_time, status, funding_status, routing_number, account_number, iban, payment_memo, filename_reference, individual_identification_number, trace_number, payor_payment_id, payment_channel_id, payment_channel_name, account_name, rails_id, country_code, events, return_cost, return_reason].hash
475
+ end
476
+
477
+ # Builds the object from hash
478
+ # @param [Hash] attributes Model attributes in the form of hash
479
+ # @return [Object] Returns the model itself
480
+ def self.build_from_hash(attributes)
481
+ new.build_from_hash(attributes)
482
+ end
483
+
484
+ # Builds the object from hash
485
+ # @param [Hash] attributes Model attributes in the form of hash
486
+ # @return [Object] Returns the model itself
487
+ def build_from_hash(attributes)
488
+ return nil unless attributes.is_a?(Hash)
489
+ self.class.openapi_types.each_pair do |key, type|
490
+ if type =~ /\AArray<(.*)>/i
491
+ # check to ensure the input is an array given that the attribute
492
+ # is documented as an array but the input is not
493
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
494
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
495
+ end
496
+ elsif !attributes[self.class.attribute_map[key]].nil?
497
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
498
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
499
+ end
500
+
501
+ self
502
+ end
503
+
504
+ # Deserializes the data based on type
505
+ # @param string type Data type
506
+ # @param string value Value to be deserialized
507
+ # @return [Object] Deserialized data
508
+ def _deserialize(type, value)
509
+ case type.to_sym
510
+ when :DateTime
511
+ DateTime.parse(value)
512
+ when :Date
513
+ Date.parse(value)
514
+ when :String
515
+ value.to_s
516
+ when :Integer
517
+ value.to_i
518
+ when :Float
519
+ value.to_f
520
+ when :Boolean
521
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
522
+ true
523
+ else
524
+ false
525
+ end
526
+ when :Object
527
+ # generic object (usually a Hash), return directly
528
+ value
529
+ when /\AArray<(?<inner_type>.+)>\z/
530
+ inner_type = Regexp.last_match[:inner_type]
531
+ value.map { |v| _deserialize(inner_type, v) }
532
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
533
+ k_type = Regexp.last_match[:k_type]
534
+ v_type = Regexp.last_match[:v_type]
535
+ {}.tap do |hash|
536
+ value.each do |k, v|
537
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
538
+ end
539
+ end
540
+ else # model
541
+ VeloPayments.const_get(type).build_from_hash(value)
542
+ end
543
+ end
544
+
545
+ # Returns the string representation of the object
546
+ # @return [String] String presentation of the object
547
+ def to_s
548
+ to_hash.to_s
549
+ end
550
+
551
+ # to_body is an alias to to_hash (backward compatibility)
552
+ # @return [Hash] Returns the object in the form of hash
553
+ def to_body
554
+ to_hash
555
+ end
556
+
557
+ # Returns the object in the form of hash
558
+ # @return [Hash] Returns the object in the form of hash
559
+ def to_hash
560
+ hash = {}
561
+ self.class.attribute_map.each_pair do |attr, param|
562
+ value = self.send(attr)
563
+ next if value.nil?
564
+ hash[param] = _to_hash(value)
565
+ end
566
+ hash
567
+ end
568
+
569
+ # Outputs non-array value in the form of hash
570
+ # For object, use to_hash. Otherwise, just return the value
571
+ # @param [Object] value Any valid value
572
+ # @return [Hash] Returns the value in the form of hash
573
+ def _to_hash(value)
574
+ if value.is_a?(Array)
575
+ value.compact.map { |v| _to_hash(v) }
576
+ elsif value.is_a?(Hash)
577
+ {}.tap do |hash|
578
+ value.each { |k, v| hash[k] = _to_hash(v) }
579
+ end
580
+ elsif value.respond_to? :to_hash
581
+ value.to_hash
582
+ else
583
+ value
584
+ end
585
+ end
586
+ end
587
+ end