subfi_pay 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +101 -0
- data/README.md +188 -0
- data/Rakefile +10 -0
- data/bin/console +11 -0
- data/docs/AccessKey.md +32 -0
- data/docs/AccessKeysApi.md +228 -0
- data/docs/AccountAttributes.md +20 -0
- data/docs/AccountAttributesAccount.md +20 -0
- data/docs/AccountCreateRequest.md +18 -0
- data/docs/AccountResponse.md +26 -0
- data/docs/AccountsApi.md +227 -0
- data/docs/BalanceTransactionAttributes.md +30 -0
- data/docs/BalanceTransactionResponse.md +38 -0
- data/docs/BalanceTransactionsApi.md +87 -0
- data/docs/BankAccountProfile.md +28 -0
- data/docs/BillingAddress.md +36 -0
- data/docs/CardProfile.md +42 -0
- data/docs/ChargeAttributes.md +26 -0
- data/docs/ChargeResponse.md +42 -0
- data/docs/ChargesApi.md +167 -0
- data/docs/ConnectedAccountAttributes.md +20 -0
- data/docs/ConnectedAccountResponse.md +26 -0
- data/docs/CreateAccountRequest.md +18 -0
- data/docs/CreateAccountRequestAccount.md +20 -0
- data/docs/CreateCustomerRequest.md +24 -0
- data/docs/CreateWebhookEndpointRequest.md +18 -0
- data/docs/CreateWebhookEndpointRequestWebhookEndpoint.md +28 -0
- data/docs/Customer.md +26 -0
- data/docs/CustomerAttributes.md +24 -0
- data/docs/CustomerAttributesCustomer.md +24 -0
- data/docs/CustomerCreateRequest.md +18 -0
- data/docs/CustomerUpdateAttributes.md +20 -0
- data/docs/CustomerUpdateAttributesCustomer.md +20 -0
- data/docs/CustomerUpdateRequest.md +18 -0
- data/docs/CustomersApi.md +307 -0
- data/docs/Event.md +30 -0
- data/docs/EventsApi.md +159 -0
- data/docs/ListAccessKeysResponse.md +20 -0
- data/docs/ListAccountsResponse.md +20 -0
- data/docs/ListBalanceTransactionsResponse.md +20 -0
- data/docs/ListChargesResponse.md +20 -0
- data/docs/ListCustomersResponse.md +20 -0
- data/docs/ListEventsResponse.md +20 -0
- data/docs/ListPaymentIntentsResponse.md +20 -0
- data/docs/ListPaymentMethodsResponse.md +20 -0
- data/docs/ListRefundsResponse.md +20 -0
- data/docs/ListWebhookEndpointsResponse.md +20 -0
- data/docs/ListWebhookRequestsResponse.md +20 -0
- data/docs/Meta.md +28 -0
- data/docs/PaymentIntentAttributes.md +26 -0
- data/docs/PaymentIntentAttributesPaymentIntent.md +26 -0
- data/docs/PaymentIntentCreateRequest.md +18 -0
- data/docs/PaymentIntentResponse.md +30 -0
- data/docs/PaymentIntentUpdateAttributes.md +18 -0
- data/docs/PaymentIntentUpdateAttributesPaymentIntent.md +18 -0
- data/docs/PaymentIntentsApi.md +533 -0
- data/docs/PaymentMethodAttributes.md +24 -0
- data/docs/PaymentMethodResponse.md +36 -0
- data/docs/PaymentMethodsApi.md +239 -0
- data/docs/RefundAttributes.md +20 -0
- data/docs/RefundResponse.md +30 -0
- data/docs/RefundsApi.md +311 -0
- data/docs/RollAccessKeyAttributes.md +18 -0
- data/docs/RollAccessKeyAttributesAccessKey.md +18 -0
- data/docs/RollAccessKeyRequest.md +18 -0
- data/docs/RollAccessKeyRequestAccessKey.md +18 -0
- data/docs/SubscriptionAttributes.md +30 -0
- data/docs/SubscriptionAttributesSubscription.md +30 -0
- data/docs/SubscriptionCreateRequest.md +18 -0
- data/docs/SubscriptionCreateRequestSubscription.md +30 -0
- data/docs/SubscriptionResponse.md +36 -0
- data/docs/SubscriptionsApi.md +155 -0
- data/docs/WebhookEndpoint.md +34 -0
- data/docs/WebhookEndpointsApi.md +380 -0
- data/docs/WebhookRequest.md +38 -0
- data/docs/WebhookRequestsApi.md +85 -0
- data/git_push.sh +57 -0
- data/lib/subfi_pay/api/access_keys_api.rb +235 -0
- data/lib/subfi_pay/api/accounts_api.rb +231 -0
- data/lib/subfi_pay/api/balance_transactions_api.rb +100 -0
- data/lib/subfi_pay/api/charges_api.rb +181 -0
- data/lib/subfi_pay/api/customers_api.rb +331 -0
- data/lib/subfi_pay/api/events_api.rb +172 -0
- data/lib/subfi_pay/api/payment_intents_api.rb +566 -0
- data/lib/subfi_pay/api/payment_methods_api.rb +262 -0
- data/lib/subfi_pay/api/refunds_api.rb +334 -0
- data/lib/subfi_pay/api/subscriptions_api.rb +177 -0
- data/lib/subfi_pay/api/webhook_endpoints_api.rb +404 -0
- data/lib/subfi_pay/api/webhook_requests_api.rb +97 -0
- data/lib/subfi_pay/api_client.rb +394 -0
- data/lib/subfi_pay/api_error.rb +58 -0
- data/lib/subfi_pay/configuration.rb +305 -0
- data/lib/subfi_pay/models/access_key.rb +275 -0
- data/lib/subfi_pay/models/account_attributes.rb +221 -0
- data/lib/subfi_pay/models/account_attributes_account.rb +221 -0
- data/lib/subfi_pay/models/account_create_request.rb +212 -0
- data/lib/subfi_pay/models/account_response.rb +248 -0
- data/lib/subfi_pay/models/balance_transaction_attributes.rb +266 -0
- data/lib/subfi_pay/models/balance_transaction_response.rb +303 -0
- data/lib/subfi_pay/models/bank_account_profile.rb +257 -0
- data/lib/subfi_pay/models/billing_address.rb +294 -0
- data/lib/subfi_pay/models/card_profile.rb +324 -0
- data/lib/subfi_pay/models/charge_attributes.rb +265 -0
- data/lib/subfi_pay/models/charge_response.rb +326 -0
- data/lib/subfi_pay/models/connected_account_attributes.rb +235 -0
- data/lib/subfi_pay/models/connected_account_response.rb +248 -0
- data/lib/subfi_pay/models/create_account_request.rb +219 -0
- data/lib/subfi_pay/models/create_account_request_account.rb +221 -0
- data/lib/subfi_pay/models/create_customer_request.rb +239 -0
- data/lib/subfi_pay/models/create_webhook_endpoint_request.rb +212 -0
- data/lib/subfi_pay/models/create_webhook_endpoint_request_webhook_endpoint.rb +257 -0
- data/lib/subfi_pay/models/customer.rb +248 -0
- data/lib/subfi_pay/models/customer_attributes.rb +239 -0
- data/lib/subfi_pay/models/customer_attributes_customer.rb +239 -0
- data/lib/subfi_pay/models/customer_create_request.rb +212 -0
- data/lib/subfi_pay/models/customer_update_attributes.rb +221 -0
- data/lib/subfi_pay/models/customer_update_attributes_customer.rb +221 -0
- data/lib/subfi_pay/models/customer_update_request.rb +212 -0
- data/lib/subfi_pay/models/event.rb +266 -0
- data/lib/subfi_pay/models/list_access_keys_response.rb +223 -0
- data/lib/subfi_pay/models/list_accounts_response.rb +223 -0
- data/lib/subfi_pay/models/list_balance_transactions_response.rb +223 -0
- data/lib/subfi_pay/models/list_charges_response.rb +223 -0
- data/lib/subfi_pay/models/list_customers_response.rb +223 -0
- data/lib/subfi_pay/models/list_events_response.rb +223 -0
- data/lib/subfi_pay/models/list_payment_intents_response.rb +223 -0
- data/lib/subfi_pay/models/list_payment_methods_response.rb +223 -0
- data/lib/subfi_pay/models/list_refunds_response.rb +223 -0
- data/lib/subfi_pay/models/list_webhook_endpoints_response.rb +223 -0
- data/lib/subfi_pay/models/list_webhook_requests_response.rb +223 -0
- data/lib/subfi_pay/models/meta.rb +259 -0
- data/lib/subfi_pay/models/payment_intent_attributes.rb +257 -0
- data/lib/subfi_pay/models/payment_intent_attributes_payment_intent.rb +257 -0
- data/lib/subfi_pay/models/payment_intent_create_request.rb +212 -0
- data/lib/subfi_pay/models/payment_intent_response.rb +268 -0
- data/lib/subfi_pay/models/payment_intent_update_attributes.rb +212 -0
- data/lib/subfi_pay/models/payment_intent_update_attributes_payment_intent.rb +214 -0
- data/lib/subfi_pay/models/payment_method_attributes.rb +246 -0
- data/lib/subfi_pay/models/payment_method_response.rb +296 -0
- data/lib/subfi_pay/models/refund_attributes.rb +228 -0
- data/lib/subfi_pay/models/refund_response.rb +268 -0
- data/lib/subfi_pay/models/roll_access_key_attributes.rb +212 -0
- data/lib/subfi_pay/models/roll_access_key_attributes_access_key.rb +219 -0
- data/lib/subfi_pay/models/roll_access_key_request.rb +212 -0
- data/lib/subfi_pay/models/roll_access_key_request_access_key.rb +219 -0
- data/lib/subfi_pay/models/subscription_attributes.rb +266 -0
- data/lib/subfi_pay/models/subscription_attributes_subscription.rb +266 -0
- data/lib/subfi_pay/models/subscription_create_request.rb +212 -0
- data/lib/subfi_pay/models/subscription_create_request_subscription.rb +266 -0
- data/lib/subfi_pay/models/subscription_response.rb +293 -0
- data/lib/subfi_pay/models/webhook_endpoint.rb +284 -0
- data/lib/subfi_pay/models/webhook_request.rb +302 -0
- data/lib/subfi_pay/version.rb +15 -0
- data/lib/subfi_pay.rb +99 -0
- data/run_fix_gemfile.sh +11 -0
- data/spec/api/access_keys_api_spec.rb +138 -0
- data/spec/api/accounts_api_spec.rb +145 -0
- data/spec/api/balance_transactions_api_spec.rb +86 -0
- data/spec/api/charges_api_spec.rb +121 -0
- data/spec/api/customers_api_spec.rb +134 -0
- data/spec/api/events_api_spec.rb +105 -0
- data/spec/api/payment_intents_api_spec.rb +250 -0
- data/spec/api/payment_methods_api_spec.rb +226 -0
- data/spec/api/refunds_api_spec.rb +158 -0
- data/spec/api/subscriptions_api_spec.rb +113 -0
- data/spec/api/webhook_endpoints_api_spec.rb +198 -0
- data/spec/api/webhook_requests_api_spec.rb +79 -0
- data/spec/configuration_spec.rb +23 -0
- data/spec/fixtures/access_keys/list_200.json +1 -0
- data/spec/fixtures/access_keys/roll_200.json +1 -0
- data/spec/fixtures/accounts/create_201.json +1 -0
- data/spec/fixtures/accounts/list_200.json +1 -0
- data/spec/fixtures/accounts/show_200.json +1 -0
- data/spec/fixtures/balance_transactions/list_200.json +69 -0
- data/spec/fixtures/charges/create_201.json +39 -0
- data/spec/fixtures/charges/list_200.json +1 -0
- data/spec/fixtures/charges/retrieve_200.json +1 -0
- data/spec/fixtures/customers/create_201.json +1 -0
- data/spec/fixtures/customers/list_200.json +1 -0
- data/spec/fixtures/customers/show_200.json +1 -0
- data/spec/fixtures/events/list_200.json +1 -0
- data/spec/fixtures/events/show_200.json +1 -0
- data/spec/fixtures/payment_intents/cancel_200.json +1 -0
- data/spec/fixtures/payment_intents/capture_200.json +1 -0
- data/spec/fixtures/payment_intents/confirm_200.json +1 -0
- data/spec/fixtures/payment_intents/create_201.json +1 -0
- data/spec/fixtures/payment_intents/fetch_200.json +1 -0
- data/spec/fixtures/payment_intents/list_200.json +1 -0
- data/spec/fixtures/payment_intents/update_200.json +1 -0
- data/spec/fixtures/payment_methods/create_bank_account_201.json +1 -0
- data/spec/fixtures/payment_methods/create_card_201.json +1 -0
- data/spec/fixtures/payment_methods/get_bank_account_200.json +29 -0
- data/spec/fixtures/payment_methods/get_card_200.json +1 -0
- data/spec/fixtures/payment_methods/list_200.json +1 -0
- data/spec/fixtures/refunds/create_201.json +1 -0
- data/spec/fixtures/refunds/list_200.json +1 -0
- data/spec/fixtures/refunds/show_200.json +1 -0
- data/spec/fixtures/subscriptions/create_201.json +1 -0
- data/spec/fixtures/subscriptions/show_200.json +1 -0
- data/spec/fixtures/webhook_endpoints/create_201.json +11 -0
- data/spec/fixtures/webhook_endpoints/list_200.json +1 -0
- data/spec/fixtures/webhook_endpoints/show_200.json +1 -0
- data/spec/fixtures/webhook_endpoints/update_200.json +13 -0
- data/spec/fixtures/webhook_requests/list_200.json +1 -0
- data/spec/models/access_key_spec.rb +39 -0
- data/spec/models/account_attributes_spec.rb +40 -0
- data/spec/models/account_create_request_spec.rb +38 -0
- data/spec/models/account_response_spec.rb +39 -0
- data/spec/models/balance_transaction_response_spec.rb +38 -0
- data/spec/models/bank_account_profile_spec.rb +38 -0
- data/spec/models/billing_address_spec.rb +38 -0
- data/spec/models/card_profile_spec.rb +38 -0
- data/spec/models/charge_attributes_spec.rb +45 -0
- data/spec/models/charge_response_spec.rb +45 -0
- data/spec/models/connected_account_attributes_spec.rb +38 -0
- data/spec/models/connected_account_response_spec.rb +39 -0
- data/spec/models/create_account_request_account_spec.rb +39 -0
- data/spec/models/create_account_request_spec.rb +39 -0
- data/spec/models/create_webhook_endpoint_request_spec.rb +38 -0
- data/spec/models/create_webhook_endpoint_request_webhook_endpoint_spec.rb +38 -0
- data/spec/models/customer_attributes_spec.rb +40 -0
- data/spec/models/customer_create_request_spec.rb +38 -0
- data/spec/models/customer_spec.rb +39 -0
- data/spec/models/customer_update_attributes_spec.rb +39 -0
- data/spec/models/customer_update_request_spec.rb +39 -0
- data/spec/models/event_spec.rb +39 -0
- data/spec/models/list_access_keys_response_spec.rb +38 -0
- data/spec/models/list_accounts_response_spec.rb +38 -0
- data/spec/models/list_balance_transactions_response_spec.rb +38 -0
- data/spec/models/list_charges_response_spec.rb +38 -0
- data/spec/models/list_customers_response_spec.rb +39 -0
- data/spec/models/list_events_response_spec.rb +38 -0
- data/spec/models/list_payment_intents_response_spec.rb +45 -0
- data/spec/models/list_payment_methods_response_spec.rb +39 -0
- data/spec/models/list_refunds_response_spec.rb +38 -0
- data/spec/models/list_webhook_endpoints_response_spec.rb +38 -0
- data/spec/models/list_webhook_requests_response_spec.rb +39 -0
- data/spec/models/meta_spec.rb +38 -0
- data/spec/models/payment_intent_attributes_spec.rb +44 -0
- data/spec/models/payment_intent_create_request_spec.rb +38 -0
- data/spec/models/payment_intent_response_spec.rb +45 -0
- data/spec/models/payment_intent_update_attributes_payment_intent_spec.rb +38 -0
- data/spec/models/payment_intent_update_attributes_spec.rb +37 -0
- data/spec/models/payment_method_attributes_spec.rb +38 -0
- data/spec/models/payment_method_response_spec.rb +38 -0
- data/spec/models/refund_attributes_spec.rb +39 -0
- data/spec/models/refund_response_spec.rb +38 -0
- data/spec/models/roll_access_key_attributes_access_key_spec.rb +39 -0
- data/spec/models/roll_access_key_attributes_spec.rb +40 -0
- data/spec/models/roll_access_key_request_access_key_spec.rb +38 -0
- data/spec/models/roll_access_key_request_spec.rb +37 -0
- data/spec/models/subscription_attributes_spec.rb +38 -0
- data/spec/models/subscription_create_request_spec.rb +40 -0
- data/spec/models/subscription_response_spec.rb +38 -0
- data/spec/models/webhook_endpoint_spec.rb +40 -0
- data/spec/models/webhook_request_spec.rb +40 -0
- data/spec/spec_helper.rb +123 -0
- data/subfi_pay.gemspec +39 -0
- metadata +444 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
=begin
|
2
|
+
#SubFi Pay API
|
3
|
+
|
4
|
+
#API for SubFi Pay services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.7.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for SubFiPay::AccountsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'AccountsApi' do
|
20
|
+
let(:api_instance) { SubFiPay::AccountsApi.new }
|
21
|
+
let(:api_key) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
22
|
+
let(:api_version) { "0.1.0" }
|
23
|
+
let(:account_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
24
|
+
let(:config) do
|
25
|
+
api_instance.api_client.config.tap do |c|
|
26
|
+
c.api_key['ApiKeyAuth'] = api_key
|
27
|
+
c.host = "localhost:3000"
|
28
|
+
c.scheme = "http"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
let(:path) { "/accounts" }
|
32
|
+
let(:request_headers) do
|
33
|
+
{
|
34
|
+
'Accept' => 'application/json',
|
35
|
+
"Content-Type" => "application/json",
|
36
|
+
'X-Api-Version' => api_version,
|
37
|
+
'X-Api-Key' => api_key
|
38
|
+
}
|
39
|
+
end
|
40
|
+
let(:response_headers) do
|
41
|
+
{
|
42
|
+
'Accept' => 'application/json',
|
43
|
+
"Content-Type" => "application/json"
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test an instance of AccountsApi' do
|
48
|
+
it 'should create an instance of AccountsApi' do
|
49
|
+
expect(api_instance).to be_instance_of(SubFiPay::AccountsApi)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# unit tests for create_account
|
54
|
+
# Create a new account
|
55
|
+
# @param x_api_version
|
56
|
+
# @param x_account_id
|
57
|
+
# @param create_account_request
|
58
|
+
# @param [Hash] opts the optional parameters
|
59
|
+
# @return [AccountResponse]
|
60
|
+
describe 'create_account test' do
|
61
|
+
let(:body) do
|
62
|
+
{
|
63
|
+
account: {
|
64
|
+
name: Faker::Name.name,
|
65
|
+
email: Faker::Internet.email
|
66
|
+
}
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
before do
|
71
|
+
stub_request(:post, [config.host, path].join)
|
72
|
+
.with(headers: request_headers, body: body.to_json)
|
73
|
+
.to_return(
|
74
|
+
status: 201,
|
75
|
+
body: fixture("accounts/create_201.json"),
|
76
|
+
headers: response_headers
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should work' do
|
81
|
+
res = api_instance.create_account(api_version, body)
|
82
|
+
|
83
|
+
expect(res).to be_instance_of(SubFiPay::AccountResponse)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# unit tests for get_account
|
88
|
+
# Retrieve an account by ID
|
89
|
+
# @param x_api_version
|
90
|
+
# @param x_account_id
|
91
|
+
# @param id
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @return [AccountResponse]
|
94
|
+
describe 'get_account test' do
|
95
|
+
let(:account_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
96
|
+
|
97
|
+
before do
|
98
|
+
stub_request(:get, [config.host, "#{path}/#{account_id}"].join)
|
99
|
+
.with(headers: request_headers)
|
100
|
+
.to_return(
|
101
|
+
status: 200,
|
102
|
+
body: fixture("accounts/show_200.json"),
|
103
|
+
headers: response_headers
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should work' do
|
108
|
+
res = api_instance.get_account(api_version, account_id)
|
109
|
+
|
110
|
+
expect(res).to be_instance_of(SubFiPay::AccountResponse)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# unit tests for list_accounts
|
115
|
+
# List all accounts
|
116
|
+
# @param x_api_version
|
117
|
+
# @param x_account_id
|
118
|
+
# @param [Hash] opts the optional parameters
|
119
|
+
# @option opts [Integer] :page The page of results to retrieve.
|
120
|
+
# @option opts [Integer] :per_page Number of results per page.
|
121
|
+
# @return [ListAccountsResponse]
|
122
|
+
describe 'list_accounts test' do
|
123
|
+
let(:page) { 1 }
|
124
|
+
let(:per_page) { 10 }
|
125
|
+
|
126
|
+
before do
|
127
|
+
stub_request(:get, [config.host, path].join)
|
128
|
+
.with(
|
129
|
+
headers: request_headers,
|
130
|
+
query: { page: page, per_page: per_page }
|
131
|
+
)
|
132
|
+
.to_return(
|
133
|
+
status: 200,
|
134
|
+
body: fixture("accounts/list_200.json"),
|
135
|
+
headers: response_headers
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should work' do
|
140
|
+
res = api_instance.list_accounts(api_version, page: page, per_page: per_page)
|
141
|
+
|
142
|
+
expect(res).to be_instance_of(SubFiPay::ListAccountsResponse)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
describe 'BalanceTransactionsApi' do
|
5
|
+
let(:api_instance) { SubFiPay::BalanceTransactionsApi.new }
|
6
|
+
let(:api_key) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
7
|
+
let(:api_version) { "0.1.0" }
|
8
|
+
let(:account_id) { Faker::Number.number(digits: 10) }
|
9
|
+
let(:config) do
|
10
|
+
api_instance.api_client.config.tap do |c|
|
11
|
+
c.api_key['ApiKeyAuth'] = api_key
|
12
|
+
c.host = Faker::Internet.domain_name
|
13
|
+
c.scheme = 'http'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
let(:path) { '/balance_transactions' }
|
17
|
+
let(:url) { [config.host, path].join }
|
18
|
+
let(:request_headers) do
|
19
|
+
{
|
20
|
+
'Accept' => 'application/json',
|
21
|
+
"Content-Type" => "application/json",
|
22
|
+
'X-Api-Version' => api_version,
|
23
|
+
'X-Api-Key' => api_key
|
24
|
+
}
|
25
|
+
end
|
26
|
+
let(:response_headers) do
|
27
|
+
{
|
28
|
+
'Accept' => 'application/json',
|
29
|
+
"Content-Type" => "application/json"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'test an instance of BalanceTransactionsApi' do
|
34
|
+
it 'should create an instance of BalanceTransactionsApi' do
|
35
|
+
expect(api_instance).to be_instance_of(SubFiPay::BalanceTransactionsApi)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# unit tests for balance_transactions_get
|
40
|
+
# List all balance transactions
|
41
|
+
# @param x_api_version
|
42
|
+
# @param content_type
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [BalanceTransactionsGet200Response]
|
45
|
+
describe "#list_balance_transactions" do
|
46
|
+
context "without query params" do
|
47
|
+
before do
|
48
|
+
stub_request(:get, url)
|
49
|
+
.with(headers: request_headers)
|
50
|
+
.to_return(
|
51
|
+
body: fixture("balance_transactions/list_200.json"),
|
52
|
+
headers: response_headers,
|
53
|
+
status: 200
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should work" do
|
58
|
+
res = api_instance.list_balance_transactions(api_version, account_id)
|
59
|
+
|
60
|
+
expect(res.data).to be_a(Array)
|
61
|
+
expect(res.data.first).to be_a(SubFiPay::BalanceTransactionResponse)
|
62
|
+
expect(a_request(:get, url).with(headers: request_headers)).to have_been_made.once
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "with pagination" do
|
67
|
+
before do
|
68
|
+
stub_request(:get, [url, "?page=1&per_page=2"].join)
|
69
|
+
.with(headers: request_headers)
|
70
|
+
.to_return(
|
71
|
+
body: fixture("balance_transactions/list_200.json"),
|
72
|
+
headers: response_headers,
|
73
|
+
status: 200
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
it do
|
78
|
+
res = api_instance.list_balance_transactions(api_version, account_id, page: 1, per_page: 2)
|
79
|
+
|
80
|
+
expect(res.data).to be_a(Array)
|
81
|
+
expect(res.data.first).to be_a(SubFiPay::BalanceTransactionResponse)
|
82
|
+
expect(a_request(:get, [url, "?page=1&per_page=2"].join).with(headers: request_headers)).to have_been_made.once
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
describe 'ChargesApi' do
|
5
|
+
let(:api_instance) { SubFiPay::ChargesApi.new }
|
6
|
+
let(:api_key) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
7
|
+
let(:api_version) { "0.1.0" }
|
8
|
+
let(:account_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
9
|
+
let(:config) do
|
10
|
+
api_instance.api_client.config.tap do |c|
|
11
|
+
c.api_key['ApiKeyAuth'] = api_key
|
12
|
+
c.host = "localhost:3000"
|
13
|
+
c.scheme = "http"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
let(:path) { "/charges" }
|
17
|
+
let(:request_headers) do
|
18
|
+
{
|
19
|
+
'Accept' => 'application/json',
|
20
|
+
"Content-Type" => "application/json",
|
21
|
+
'X-Api-Version' => api_version,
|
22
|
+
'X-Api-Key' => api_key,
|
23
|
+
'X-Account-Id' => account_id
|
24
|
+
}
|
25
|
+
end
|
26
|
+
let(:response_headers) do
|
27
|
+
{
|
28
|
+
'Accept' => 'application/json',
|
29
|
+
"Content-Type" => "application/json"
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'test an instance of ChargesApi' do
|
34
|
+
it 'should create an instance of ChargesApi' do
|
35
|
+
expect(api_instance).to be_instance_of(SubFiPay::ChargesApi)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# unit tests for list_charges
|
40
|
+
# List all charges
|
41
|
+
# @param x_api_version
|
42
|
+
# @param content_type
|
43
|
+
# @param [Hash] opts the optional parameters
|
44
|
+
# @return [Array<Charge>]
|
45
|
+
describe "#list_charges" do
|
46
|
+
context "without query params" do
|
47
|
+
before do
|
48
|
+
stub_request(:get, [config.host, path].join)
|
49
|
+
.with(headers: request_headers)
|
50
|
+
.to_return(
|
51
|
+
body: fixture("charges/list_200.json"),
|
52
|
+
headers: response_headers,
|
53
|
+
status: 200
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should work' do
|
58
|
+
res = api_instance.list_charges(api_version, account_id)
|
59
|
+
|
60
|
+
expect(res.data).to be_a(Array)
|
61
|
+
expect(res.data.first).to be_a(SubFiPay::ChargeResponse)
|
62
|
+
expect(a_request(:get, [config.host, path].join).with(headers: request_headers)).to have_been_made.once
|
63
|
+
|
64
|
+
expect(res.data.first.amount).to be_truthy
|
65
|
+
expect(res.data.first.payment_method.card_profile).to be_truthy
|
66
|
+
expect(res.data.first.payment_method.billing_address).to be_truthy
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "with pagination" do
|
71
|
+
before do
|
72
|
+
stub_request(:get, [config.host, path, "?page=1&per_page=2"].join)
|
73
|
+
.with(headers: request_headers)
|
74
|
+
.to_return(
|
75
|
+
body: fixture("charges/list_200.json"),
|
76
|
+
headers: response_headers,
|
77
|
+
status: 200
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
it do
|
82
|
+
res = api_instance.list_charges(api_version, account_id, page: 1, per_page: 2)
|
83
|
+
|
84
|
+
expect(res.data).to be_a(Array)
|
85
|
+
expect(res.data.first).to be_a(SubFiPay::ChargeResponse)
|
86
|
+
expect(a_request(:get, [config.host, path, "?page=1&per_page=2"].join).with(headers: request_headers)).to have_been_made.once
|
87
|
+
|
88
|
+
expect(res.data.first.amount).to be_truthy
|
89
|
+
expect(res.data.first.payment_method.card_profile).to be_truthy
|
90
|
+
expect(res.data.first.payment_method.billing_address).to be_truthy
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# unit tests for charges_id_get
|
96
|
+
# Retrieve a charge
|
97
|
+
# @param x_api_version
|
98
|
+
# @param content_type
|
99
|
+
# @param id
|
100
|
+
# @param [Hash] opts the optional parameters
|
101
|
+
# @return [Charge]
|
102
|
+
describe "#get_charge" do
|
103
|
+
let(:charge_id) { "97b3f0e1-24ce-46e1-a4b8-d0a95258a4d6" }
|
104
|
+
|
105
|
+
before do
|
106
|
+
stub_request(:get, [config.host, "#{path}/#{charge_id}"].join)
|
107
|
+
.with(headers: request_headers)
|
108
|
+
.to_return(
|
109
|
+
body: fixture("charges/retrieve_200.json"),
|
110
|
+
headers: response_headers,
|
111
|
+
status: 200
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'should work' do
|
116
|
+
res = api_instance.get_charge(api_version, account_id, charge_id)
|
117
|
+
|
118
|
+
expect(res).to be_a(SubFiPay::ChargeResponse)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
=begin
|
2
|
+
#SubFi Pay API
|
3
|
+
|
4
|
+
#API for SubFi Pay services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.7.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for SubFiPay::CustomersApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'CustomersApi' do
|
20
|
+
let(:api_instance) { SubFiPay::CustomersApi.new }
|
21
|
+
let(:api_key) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
22
|
+
let(:api_version) { "0.1.0" }
|
23
|
+
let(:account_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
24
|
+
let(:config) do
|
25
|
+
api_instance.api_client.config.tap do |c|
|
26
|
+
c.api_key['ApiKeyAuth'] = api_key
|
27
|
+
c.host = "localhost:3000"
|
28
|
+
c.scheme = "http"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
let(:path) { "/customers" }
|
32
|
+
let(:request_headers) do
|
33
|
+
{
|
34
|
+
"Content-Type" => "application/json",
|
35
|
+
'X-Api-Version' => SubFiPay::VERSION,
|
36
|
+
'X-Api-Key' => api_key,
|
37
|
+
'Expect' => '',
|
38
|
+
}
|
39
|
+
end
|
40
|
+
let(:response_headers) do
|
41
|
+
{
|
42
|
+
'Accept' => 'application/json',
|
43
|
+
"Content-Type" => "application/json"
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test an instance of CustomersApi' do
|
48
|
+
it 'should create an instance of CustomersApi' do
|
49
|
+
expect(api_instance).to be_instance_of(SubFiPay::CustomersApi)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# unit tests for create_customer
|
54
|
+
# Create a new customer
|
55
|
+
# @param x_api_version
|
56
|
+
# @param create_customer_request
|
57
|
+
# @param [Hash] opts the optional parameters
|
58
|
+
# @return [Customer]
|
59
|
+
describe 'create_customer test' do
|
60
|
+
let(:body) do
|
61
|
+
{
|
62
|
+
customer: {
|
63
|
+
name: Faker::Name.name,
|
64
|
+
email: Faker::Internet.email
|
65
|
+
}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
before do
|
70
|
+
stub_request(:post, [config.host, "/customers"].join)
|
71
|
+
.with(headers: request_headers, body: body.to_json)
|
72
|
+
.to_return(
|
73
|
+
status: 200,
|
74
|
+
body: fixture("customers/create_201.json"),
|
75
|
+
headers: response_headers
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should work' do
|
80
|
+
res = api_instance.create_customer(api_version, body)
|
81
|
+
expect(res).to be_instance_of(SubFiPay::Customer)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# unit tests for get_customer
|
86
|
+
# Retrieve a customer by ID
|
87
|
+
# @param x_api_version
|
88
|
+
# @param id
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Customer]
|
91
|
+
describe 'get_customer test' do
|
92
|
+
let(:customer_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
93
|
+
|
94
|
+
before do
|
95
|
+
stub_request(:get, [config.host, "/customers/#{customer_id}"].join)
|
96
|
+
.with(headers: request_headers)
|
97
|
+
.to_return(
|
98
|
+
status: 200,
|
99
|
+
body: fixture("customers/show_200.json"),
|
100
|
+
headers: response_headers
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should work' do
|
105
|
+
res = api_instance.get_customer(api_version, account_id, customer_id)
|
106
|
+
expect(res).to be_instance_of(SubFiPay::Customer)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# unit tests for list_customers
|
111
|
+
# List all customers
|
112
|
+
# @param x_api_version
|
113
|
+
# @param [Hash] opts the optional parameters
|
114
|
+
# @option opts [Integer] :page The page of results to retrieve.
|
115
|
+
# @option opts [Integer] :per_page Number of results per page.
|
116
|
+
# @return [ListCustomersResponse]
|
117
|
+
describe 'list_customers test' do
|
118
|
+
before do
|
119
|
+
stub_request(:get, [config.host, "/customers"].join)
|
120
|
+
.with(headers: request_headers)
|
121
|
+
.to_return(
|
122
|
+
status: 200,
|
123
|
+
body: fixture("customers/list_200.json"),
|
124
|
+
headers: response_headers
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'should work' do
|
129
|
+
res = api_instance.list_customers(api_version, account_id)
|
130
|
+
expect(res).to be_instance_of(SubFiPay::ListCustomersResponse)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
=begin
|
2
|
+
#SubFi Pay API
|
3
|
+
|
4
|
+
#API for SubFi Pay services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.7.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for SubFiPay::EventsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'EventsApi' do
|
20
|
+
let(:api_instance) { SubFiPay::EventsApi.new }
|
21
|
+
let(:api_key) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
22
|
+
let(:api_version) { "0.1.0" }
|
23
|
+
let(:account_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
24
|
+
let(:config) do
|
25
|
+
api_instance.api_client.config.tap do |c|
|
26
|
+
c.api_key['ApiKeyAuth'] = api_key
|
27
|
+
c.host = "localhost:3000"
|
28
|
+
c.scheme = "http"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
let(:path) { "/events" }
|
32
|
+
let(:request_headers) do
|
33
|
+
{
|
34
|
+
"Content-Type" => "application/json",
|
35
|
+
'X-Api-Version' => SubFiPay::VERSION,
|
36
|
+
'X-Api-Key' => api_key,
|
37
|
+
'Expect' => '',
|
38
|
+
}
|
39
|
+
end
|
40
|
+
let(:response_headers) do
|
41
|
+
{
|
42
|
+
'Accept' => 'application/json',
|
43
|
+
"Content-Type" => "application/json"
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test an instance of EventsApi' do
|
48
|
+
it 'should create an instance of EventsApi' do
|
49
|
+
expect(api_instance).to be_instance_of(SubFiPay::EventsApi)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# unit tests for get_event
|
54
|
+
# Retrieve a single event by ID
|
55
|
+
# @param x_api_version
|
56
|
+
# @param id
|
57
|
+
# @param [Hash] opts the optional parameters
|
58
|
+
# @return [Event]
|
59
|
+
describe 'get_event test' do
|
60
|
+
let(:event_id) { Faker::Alphanumeric.alphanumeric(number: 32) }
|
61
|
+
let(:path) { "/events/#{event_id}" }
|
62
|
+
|
63
|
+
before do
|
64
|
+
stub_request(:get, [config.host, path].join)
|
65
|
+
.with(headers: request_headers)
|
66
|
+
.to_return(
|
67
|
+
status: 200,
|
68
|
+
body: fixture("events/show_200.json"),
|
69
|
+
headers: response_headers
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should work' do
|
74
|
+
res = api_instance.get_event(api_version, account_id, event_id)
|
75
|
+
expect(res).to be_instance_of(SubFiPay::Event)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# unit tests for list_events
|
80
|
+
# List all events
|
81
|
+
# @param x_api_version
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @option opts [Integer] :page The page of results to retrieve.
|
84
|
+
# @option opts [Integer] :per_page Number of results per page.
|
85
|
+
# @return [ListEventsResponse]
|
86
|
+
describe 'list_events test' do
|
87
|
+
let(:path) { "/events" }
|
88
|
+
|
89
|
+
before do
|
90
|
+
stub_request(:get, [config.host, path].join)
|
91
|
+
.with(headers: request_headers)
|
92
|
+
.to_return(
|
93
|
+
status: 200,
|
94
|
+
body: fixture("events/list_200.json"),
|
95
|
+
headers: response_headers
|
96
|
+
)
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should work' do
|
100
|
+
res = api_instance.list_events(api_version, account_id)
|
101
|
+
expect(res).to be_instance_of(SubFiPay::ListEventsResponse)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|