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,57 @@
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
+ module VeloPayments
14
+ class ApiError < StandardError
15
+ attr_reader :code, :response_headers, :response_body
16
+
17
+ # Usage examples:
18
+ # ApiError.new
19
+ # ApiError.new("message")
20
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
21
+ # ApiError.new(:code => 404, :message => "Not Found")
22
+ def initialize(arg = nil)
23
+ if arg.is_a? Hash
24
+ if arg.key?(:message) || arg.key?('message')
25
+ super(arg[:message] || arg['message'])
26
+ else
27
+ super arg
28
+ end
29
+
30
+ arg.each do |k, v|
31
+ instance_variable_set "@#{k}", v
32
+ end
33
+ else
34
+ super arg
35
+ end
36
+ end
37
+
38
+ # Override to_s to display a friendly error message
39
+ def to_s
40
+ message
41
+ end
42
+
43
+ def message
44
+ if @message.nil?
45
+ msg = "Error message: the server returns an error"
46
+ else
47
+ msg = @message
48
+ end
49
+
50
+ msg += "\nHTTP status code: #{code}" if code
51
+ msg += "\nResponse headers: #{response_headers}" if response_headers
52
+ msg += "\nResponse body: #{response_body}" if response_body
53
+
54
+ msg
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,251 @@
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 'uri'
14
+
15
+ module VeloPayments
16
+ class Configuration
17
+ # Defines url scheme
18
+ attr_accessor :scheme
19
+
20
+ # Defines url host
21
+ attr_accessor :host
22
+
23
+ # Defines url base path
24
+ attr_accessor :base_path
25
+
26
+ # Defines API keys used with API Key authentications.
27
+ #
28
+ # @return [Hash] key: parameter name, value: parameter value (API key)
29
+ #
30
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
31
+ # config.api_key['api_key'] = 'xxx'
32
+ attr_accessor :api_key
33
+
34
+ # Defines API key prefixes used with API Key authentications.
35
+ #
36
+ # @return [Hash] key: parameter name, value: API key prefix
37
+ #
38
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
39
+ # config.api_key_prefix['api_key'] = 'Token'
40
+ attr_accessor :api_key_prefix
41
+
42
+ # Defines the username used with HTTP basic authentication.
43
+ #
44
+ # @return [String]
45
+ attr_accessor :username
46
+
47
+ # Defines the password used with HTTP basic authentication.
48
+ #
49
+ # @return [String]
50
+ attr_accessor :password
51
+
52
+ # Defines the access token (Bearer) used with OAuth2.
53
+ attr_accessor :access_token
54
+
55
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
56
+ # details will be logged with `logger.debug` (see the `logger` attribute).
57
+ # Default to false.
58
+ #
59
+ # @return [true, false]
60
+ attr_accessor :debugging
61
+
62
+ # Defines the logger used for debugging.
63
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
64
+ #
65
+ # @return [#debug]
66
+ attr_accessor :logger
67
+
68
+ # Defines the temporary folder to store downloaded files
69
+ # (for API endpoints that have file response).
70
+ # Default to use `Tempfile`.
71
+ #
72
+ # @return [String]
73
+ attr_accessor :temp_folder_path
74
+
75
+ # The time limit for HTTP request in seconds.
76
+ # Default to 0 (never times out).
77
+ attr_accessor :timeout
78
+
79
+ # Set this to false to skip client side validation in the operation.
80
+ # Default to true.
81
+ # @return [true, false]
82
+ attr_accessor :client_side_validation
83
+
84
+ ### TLS/SSL setting
85
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
86
+ # Default to true.
87
+ #
88
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
89
+ #
90
+ # @return [true, false]
91
+ attr_accessor :verify_ssl
92
+
93
+ ### TLS/SSL setting
94
+ # Set this to false to skip verifying SSL host name
95
+ # Default to true.
96
+ #
97
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
98
+ #
99
+ # @return [true, false]
100
+ attr_accessor :verify_ssl_host
101
+
102
+ ### TLS/SSL setting
103
+ # Set this to customize the certificate file to verify the peer.
104
+ #
105
+ # @return [String] the path to the certificate file
106
+ #
107
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
108
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
109
+ attr_accessor :ssl_ca_cert
110
+
111
+ ### TLS/SSL setting
112
+ # Client certificate file (for client certificate)
113
+ attr_accessor :cert_file
114
+
115
+ ### TLS/SSL setting
116
+ # Client private key file (for client certificate)
117
+ attr_accessor :key_file
118
+
119
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
120
+ # Default to nil.
121
+ #
122
+ # @see The params_encoding option of Ethon. Related source code:
123
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
124
+ attr_accessor :params_encoding
125
+
126
+ attr_accessor :inject_format
127
+
128
+ attr_accessor :force_ending_format
129
+
130
+ def initialize
131
+ @scheme = 'https'
132
+ @host = 'api.sandbox.velopayments.com'
133
+ @base_path = ''
134
+ @api_key = {}
135
+ @api_key_prefix = {}
136
+ @timeout = 0
137
+ @client_side_validation = true
138
+ @verify_ssl = true
139
+ @verify_ssl_host = true
140
+ @params_encoding = nil
141
+ @cert_file = nil
142
+ @key_file = nil
143
+ @debugging = false
144
+ @inject_format = false
145
+ @force_ending_format = false
146
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
147
+
148
+ yield(self) if block_given?
149
+ end
150
+
151
+ # The default Configuration object.
152
+ def self.default
153
+ @@default ||= Configuration.new
154
+ end
155
+
156
+ def configure
157
+ yield(self) if block_given?
158
+ end
159
+
160
+ def scheme=(scheme)
161
+ # remove :// from scheme
162
+ @scheme = scheme.sub(/:\/\//, '')
163
+ end
164
+
165
+ def host=(host)
166
+ # remove http(s):// and anything after a slash
167
+ @host = host.sub(/https?:\/\//, '').split('/').first
168
+ end
169
+
170
+ def base_path=(base_path)
171
+ # Add leading and trailing slashes to base_path
172
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
173
+ @base_path = '' if @base_path == '/'
174
+ end
175
+
176
+ def base_url
177
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
+ URI.encode(url)
179
+ end
180
+
181
+ # Gets API key (with prefix if set).
182
+ # @param [String] param_name the parameter name of API key auth
183
+ def api_key_with_prefix(param_name)
184
+ if @api_key_prefix[param_name]
185
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
186
+ else
187
+ @api_key[param_name]
188
+ end
189
+ end
190
+
191
+ # Gets Basic Auth token string
192
+ def basic_auth_token
193
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
194
+ end
195
+
196
+ # Returns Auth Settings hash for api client.
197
+ def auth_settings
198
+ {
199
+ 'OAuth2' =>
200
+ {
201
+ type: 'oauth2',
202
+ in: 'header',
203
+ key: 'Authorization',
204
+ value: "Bearer #{access_token}"
205
+ },
206
+ }
207
+ end
208
+
209
+ # Returns an array of Server setting
210
+ def server_settings
211
+ [
212
+ {
213
+ url: "https://api.sandbox.velopayments.com/",
214
+ description: "Velo Payments Sandbox for testing",
215
+ }
216
+ ]
217
+ end
218
+
219
+ # Returns URL based on server settings
220
+ #
221
+ # @param index array index of the server settings
222
+ # @param variables hash of variable and the corresponding value
223
+ def server_url(index, variables = {})
224
+ servers = server_settings
225
+
226
+ # check array index out of bound
227
+ if (index < 0 || index >= servers.size)
228
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
229
+ end
230
+
231
+ server = servers[index]
232
+ url = server[:url]
233
+
234
+ # go through variable and assign a value
235
+ server[:variables].each do |name, variable|
236
+ if variables.key?(name)
237
+ if (server[:variables][name][:enum_values].include? variables[name])
238
+ url.gsub! "{" + name.to_s + "}", variables[name]
239
+ else
240
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
241
+ end
242
+ else
243
+ # use default value
244
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
245
+ end
246
+ end
247
+
248
+ url
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,478 @@
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 Address
17
+ attr_accessor :line1
18
+
19
+ attr_accessor :line2
20
+
21
+ attr_accessor :line3
22
+
23
+ attr_accessor :line4
24
+
25
+ attr_accessor :city
26
+
27
+ attr_accessor :county_or_province
28
+
29
+ attr_accessor :zip_or_postcode
30
+
31
+ attr_accessor :country
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'line1' => :'line1',
37
+ :'line2' => :'line2',
38
+ :'line3' => :'line3',
39
+ :'line4' => :'line4',
40
+ :'city' => :'city',
41
+ :'county_or_province' => :'countyOrProvince',
42
+ :'zip_or_postcode' => :'zipOrPostcode',
43
+ :'country' => :'country'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'line1' => :'String',
51
+ :'line2' => :'String',
52
+ :'line3' => :'String',
53
+ :'line4' => :'String',
54
+ :'city' => :'String',
55
+ :'county_or_province' => :'String',
56
+ :'zip_or_postcode' => :'String',
57
+ :'country' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VeloPayments::Address` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VeloPayments::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'line1')
77
+ self.line1 = attributes[:'line1']
78
+ end
79
+
80
+ if attributes.key?(:'line2')
81
+ self.line2 = attributes[:'line2']
82
+ end
83
+
84
+ if attributes.key?(:'line3')
85
+ self.line3 = attributes[:'line3']
86
+ end
87
+
88
+ if attributes.key?(:'line4')
89
+ self.line4 = attributes[:'line4']
90
+ end
91
+
92
+ if attributes.key?(:'city')
93
+ self.city = attributes[:'city']
94
+ end
95
+
96
+ if attributes.key?(:'county_or_province')
97
+ self.county_or_province = attributes[:'county_or_province']
98
+ end
99
+
100
+ if attributes.key?(:'zip_or_postcode')
101
+ self.zip_or_postcode = attributes[:'zip_or_postcode']
102
+ end
103
+
104
+ if attributes.key?(:'country')
105
+ self.country = attributes[:'country']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ if @line1.nil?
114
+ invalid_properties.push('invalid value for "line1", line1 cannot be nil.')
115
+ end
116
+
117
+ if @line1.to_s.length > 255
118
+ invalid_properties.push('invalid value for "line1", the character length must be smaller than or equal to 255.')
119
+ end
120
+
121
+ if @line1.to_s.length < 2
122
+ invalid_properties.push('invalid value for "line1", the character length must be great than or equal to 2.')
123
+ end
124
+
125
+ if !@line2.nil? && @line2.to_s.length > 255
126
+ invalid_properties.push('invalid value for "line2", the character length must be smaller than or equal to 255.')
127
+ end
128
+
129
+ if !@line2.nil? && @line2.to_s.length < 0
130
+ invalid_properties.push('invalid value for "line2", the character length must be great than or equal to 0.')
131
+ end
132
+
133
+ if !@line3.nil? && @line3.to_s.length > 255
134
+ invalid_properties.push('invalid value for "line3", the character length must be smaller than or equal to 255.')
135
+ end
136
+
137
+ if !@line3.nil? && @line3.to_s.length < 0
138
+ invalid_properties.push('invalid value for "line3", the character length must be great than or equal to 0.')
139
+ end
140
+
141
+ if !@line4.nil? && @line4.to_s.length > 255
142
+ invalid_properties.push('invalid value for "line4", the character length must be smaller than or equal to 255.')
143
+ end
144
+
145
+ if !@line4.nil? && @line4.to_s.length < 0
146
+ invalid_properties.push('invalid value for "line4", the character length must be great than or equal to 0.')
147
+ end
148
+
149
+ if @city.nil?
150
+ invalid_properties.push('invalid value for "city", city cannot be nil.')
151
+ end
152
+
153
+ if @city.to_s.length > 100
154
+ invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 100.')
155
+ end
156
+
157
+ if @city.to_s.length < 2
158
+ invalid_properties.push('invalid value for "city", the character length must be great than or equal to 2.')
159
+ end
160
+
161
+ if !@county_or_province.nil? && @county_or_province.to_s.length > 100
162
+ invalid_properties.push('invalid value for "county_or_province", the character length must be smaller than or equal to 100.')
163
+ end
164
+
165
+ if !@county_or_province.nil? && @county_or_province.to_s.length < 2
166
+ invalid_properties.push('invalid value for "county_or_province", the character length must be great than or equal to 2.')
167
+ end
168
+
169
+ if !@zip_or_postcode.nil? && @zip_or_postcode.to_s.length > 30
170
+ invalid_properties.push('invalid value for "zip_or_postcode", the character length must be smaller than or equal to 30.')
171
+ end
172
+
173
+ if !@zip_or_postcode.nil? && @zip_or_postcode.to_s.length < 2
174
+ invalid_properties.push('invalid value for "zip_or_postcode", the character length must be great than or equal to 2.')
175
+ end
176
+
177
+ if @country.nil?
178
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
179
+ end
180
+
181
+ if @country.to_s.length > 50
182
+ invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 50.')
183
+ end
184
+
185
+ if @country.to_s.length < 2
186
+ invalid_properties.push('invalid value for "country", the character length must be great than or equal to 2.')
187
+ end
188
+
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ return false if @line1.nil?
196
+ return false if @line1.to_s.length > 255
197
+ return false if @line1.to_s.length < 2
198
+ return false if !@line2.nil? && @line2.to_s.length > 255
199
+ return false if !@line2.nil? && @line2.to_s.length < 0
200
+ return false if !@line3.nil? && @line3.to_s.length > 255
201
+ return false if !@line3.nil? && @line3.to_s.length < 0
202
+ return false if !@line4.nil? && @line4.to_s.length > 255
203
+ return false if !@line4.nil? && @line4.to_s.length < 0
204
+ return false if @city.nil?
205
+ return false if @city.to_s.length > 100
206
+ return false if @city.to_s.length < 2
207
+ return false if !@county_or_province.nil? && @county_or_province.to_s.length > 100
208
+ return false if !@county_or_province.nil? && @county_or_province.to_s.length < 2
209
+ return false if !@zip_or_postcode.nil? && @zip_or_postcode.to_s.length > 30
210
+ return false if !@zip_or_postcode.nil? && @zip_or_postcode.to_s.length < 2
211
+ return false if @country.nil?
212
+ return false if @country.to_s.length > 50
213
+ return false if @country.to_s.length < 2
214
+ true
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] line1 Value to be assigned
219
+ def line1=(line1)
220
+ if line1.nil?
221
+ fail ArgumentError, 'line1 cannot be nil'
222
+ end
223
+
224
+ if line1.to_s.length > 255
225
+ fail ArgumentError, 'invalid value for "line1", the character length must be smaller than or equal to 255.'
226
+ end
227
+
228
+ if line1.to_s.length < 2
229
+ fail ArgumentError, 'invalid value for "line1", the character length must be great than or equal to 2.'
230
+ end
231
+
232
+ @line1 = line1
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] line2 Value to be assigned
237
+ def line2=(line2)
238
+ if !line2.nil? && line2.to_s.length > 255
239
+ fail ArgumentError, 'invalid value for "line2", the character length must be smaller than or equal to 255.'
240
+ end
241
+
242
+ if !line2.nil? && line2.to_s.length < 0
243
+ fail ArgumentError, 'invalid value for "line2", the character length must be great than or equal to 0.'
244
+ end
245
+
246
+ @line2 = line2
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] line3 Value to be assigned
251
+ def line3=(line3)
252
+ if !line3.nil? && line3.to_s.length > 255
253
+ fail ArgumentError, 'invalid value for "line3", the character length must be smaller than or equal to 255.'
254
+ end
255
+
256
+ if !line3.nil? && line3.to_s.length < 0
257
+ fail ArgumentError, 'invalid value for "line3", the character length must be great than or equal to 0.'
258
+ end
259
+
260
+ @line3 = line3
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] line4 Value to be assigned
265
+ def line4=(line4)
266
+ if !line4.nil? && line4.to_s.length > 255
267
+ fail ArgumentError, 'invalid value for "line4", the character length must be smaller than or equal to 255.'
268
+ end
269
+
270
+ if !line4.nil? && line4.to_s.length < 0
271
+ fail ArgumentError, 'invalid value for "line4", the character length must be great than or equal to 0.'
272
+ end
273
+
274
+ @line4 = line4
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] city Value to be assigned
279
+ def city=(city)
280
+ if city.nil?
281
+ fail ArgumentError, 'city cannot be nil'
282
+ end
283
+
284
+ if city.to_s.length > 100
285
+ fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 100.'
286
+ end
287
+
288
+ if city.to_s.length < 2
289
+ fail ArgumentError, 'invalid value for "city", the character length must be great than or equal to 2.'
290
+ end
291
+
292
+ @city = city
293
+ end
294
+
295
+ # Custom attribute writer method with validation
296
+ # @param [Object] county_or_province Value to be assigned
297
+ def county_or_province=(county_or_province)
298
+ if !county_or_province.nil? && county_or_province.to_s.length > 100
299
+ fail ArgumentError, 'invalid value for "county_or_province", the character length must be smaller than or equal to 100.'
300
+ end
301
+
302
+ if !county_or_province.nil? && county_or_province.to_s.length < 2
303
+ fail ArgumentError, 'invalid value for "county_or_province", the character length must be great than or equal to 2.'
304
+ end
305
+
306
+ @county_or_province = county_or_province
307
+ end
308
+
309
+ # Custom attribute writer method with validation
310
+ # @param [Object] zip_or_postcode Value to be assigned
311
+ def zip_or_postcode=(zip_or_postcode)
312
+ if !zip_or_postcode.nil? && zip_or_postcode.to_s.length > 30
313
+ fail ArgumentError, 'invalid value for "zip_or_postcode", the character length must be smaller than or equal to 30.'
314
+ end
315
+
316
+ if !zip_or_postcode.nil? && zip_or_postcode.to_s.length < 2
317
+ fail ArgumentError, 'invalid value for "zip_or_postcode", the character length must be great than or equal to 2.'
318
+ end
319
+
320
+ @zip_or_postcode = zip_or_postcode
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] country Value to be assigned
325
+ def country=(country)
326
+ if country.nil?
327
+ fail ArgumentError, 'country cannot be nil'
328
+ end
329
+
330
+ if country.to_s.length > 50
331
+ fail ArgumentError, 'invalid value for "country", the character length must be smaller than or equal to 50.'
332
+ end
333
+
334
+ if country.to_s.length < 2
335
+ fail ArgumentError, 'invalid value for "country", the character length must be great than or equal to 2.'
336
+ end
337
+
338
+ @country = country
339
+ end
340
+
341
+ # Checks equality by comparing each attribute.
342
+ # @param [Object] Object to be compared
343
+ def ==(o)
344
+ return true if self.equal?(o)
345
+ self.class == o.class &&
346
+ line1 == o.line1 &&
347
+ line2 == o.line2 &&
348
+ line3 == o.line3 &&
349
+ line4 == o.line4 &&
350
+ city == o.city &&
351
+ county_or_province == o.county_or_province &&
352
+ zip_or_postcode == o.zip_or_postcode &&
353
+ country == o.country
354
+ end
355
+
356
+ # @see the `==` method
357
+ # @param [Object] Object to be compared
358
+ def eql?(o)
359
+ self == o
360
+ end
361
+
362
+ # Calculates hash code according to all attributes.
363
+ # @return [Integer] Hash code
364
+ def hash
365
+ [line1, line2, line3, line4, city, county_or_province, zip_or_postcode, country].hash
366
+ end
367
+
368
+ # Builds the object from hash
369
+ # @param [Hash] attributes Model attributes in the form of hash
370
+ # @return [Object] Returns the model itself
371
+ def self.build_from_hash(attributes)
372
+ new.build_from_hash(attributes)
373
+ end
374
+
375
+ # Builds the object from hash
376
+ # @param [Hash] attributes Model attributes in the form of hash
377
+ # @return [Object] Returns the model itself
378
+ def build_from_hash(attributes)
379
+ return nil unless attributes.is_a?(Hash)
380
+ self.class.openapi_types.each_pair do |key, type|
381
+ if type =~ /\AArray<(.*)>/i
382
+ # check to ensure the input is an array given that the attribute
383
+ # is documented as an array but the input is not
384
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
385
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
386
+ end
387
+ elsif !attributes[self.class.attribute_map[key]].nil?
388
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
389
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
390
+ end
391
+
392
+ self
393
+ end
394
+
395
+ # Deserializes the data based on type
396
+ # @param string type Data type
397
+ # @param string value Value to be deserialized
398
+ # @return [Object] Deserialized data
399
+ def _deserialize(type, value)
400
+ case type.to_sym
401
+ when :DateTime
402
+ DateTime.parse(value)
403
+ when :Date
404
+ Date.parse(value)
405
+ when :String
406
+ value.to_s
407
+ when :Integer
408
+ value.to_i
409
+ when :Float
410
+ value.to_f
411
+ when :Boolean
412
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
413
+ true
414
+ else
415
+ false
416
+ end
417
+ when :Object
418
+ # generic object (usually a Hash), return directly
419
+ value
420
+ when /\AArray<(?<inner_type>.+)>\z/
421
+ inner_type = Regexp.last_match[:inner_type]
422
+ value.map { |v| _deserialize(inner_type, v) }
423
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
424
+ k_type = Regexp.last_match[:k_type]
425
+ v_type = Regexp.last_match[:v_type]
426
+ {}.tap do |hash|
427
+ value.each do |k, v|
428
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
429
+ end
430
+ end
431
+ else # model
432
+ VeloPayments.const_get(type).build_from_hash(value)
433
+ end
434
+ end
435
+
436
+ # Returns the string representation of the object
437
+ # @return [String] String presentation of the object
438
+ def to_s
439
+ to_hash.to_s
440
+ end
441
+
442
+ # to_body is an alias to to_hash (backward compatibility)
443
+ # @return [Hash] Returns the object in the form of hash
444
+ def to_body
445
+ to_hash
446
+ end
447
+
448
+ # Returns the object in the form of hash
449
+ # @return [Hash] Returns the object in the form of hash
450
+ def to_hash
451
+ hash = {}
452
+ self.class.attribute_map.each_pair do |attr, param|
453
+ value = self.send(attr)
454
+ next if value.nil?
455
+ hash[param] = _to_hash(value)
456
+ end
457
+ hash
458
+ end
459
+
460
+ # Outputs non-array value in the form of hash
461
+ # For object, use to_hash. Otherwise, just return the value
462
+ # @param [Object] value Any valid value
463
+ # @return [Hash] Returns the value in the form of hash
464
+ def _to_hash(value)
465
+ if value.is_a?(Array)
466
+ value.compact.map { |v| _to_hash(v) }
467
+ elsif value.is_a?(Hash)
468
+ {}.tap do |hash|
469
+ value.each { |k, v| hash[k] = _to_hash(v) }
470
+ end
471
+ elsif value.respond_to? :to_hash
472
+ value.to_hash
473
+ else
474
+ value
475
+ end
476
+ end
477
+ end
478
+ end