digital_femsa 1.0.0 → 1.1.1
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 +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +104 -0
- data/Makefile +14 -0
- data/README.md +28 -33
- data/VERSION +1 -1
- data/config-ruby.json +1 -1
- data/digital_femsa.gemspec +1 -1
- data/docs/ApiKeyCreateResponse.md +1 -1
- data/docs/ApiKeyRequest.md +2 -2
- data/docs/ApiKeyResponseOnDelete.md +2 -2
- data/docs/ApiKeysApi.md +10 -10
- data/docs/BalanceResponse.md +8 -8
- data/docs/BalancesApi.md +1 -1
- data/docs/ChargeOrderResponse.md +1 -1
- data/docs/ChargeOrderResponseChannel.md +24 -0
- data/docs/ChargeRequest.md +1 -1
- data/docs/ChargeRequestPaymentMethod.md +3 -3
- data/docs/ChargeResponse.md +9 -7
- data/docs/ChargeResponseChannel.md +3 -3
- data/docs/ChargeResponseRefundsData.md +5 -1
- data/docs/ChargesApi.md +16 -12
- data/docs/ChargesDataResponse.md +9 -7
- data/docs/Checkout.md +17 -15
- data/docs/CheckoutOrderTemplate.md +3 -3
- data/docs/CheckoutResponse.md +1 -1
- data/docs/CreateCustomerFiscalEntitiesResponse.md +2 -2
- data/docs/Customer.md +13 -19
- data/docs/CustomerAddress.md +2 -2
- data/docs/CustomerFiscalEntitiesDataResponse.md +2 -2
- data/docs/CustomerFiscalEntitiesRequest.md +3 -3
- data/docs/CustomerInfo.md +4 -4
- data/docs/CustomerPaymentMethodRequest.md +1 -1
- data/docs/CustomerResponse.md +17 -21
- data/docs/CustomerShippingContactsResponse.md +5 -5
- data/docs/CustomersApi.md +15 -15
- data/docs/CustomersResponse.md +1 -1
- data/docs/DeleteApiKeysResponse.md +1 -1
- data/docs/DiscountsApi.md +9 -9
- data/docs/EventsApi.md +2 -2
- data/docs/EventsResendResponse.md +1 -1
- data/docs/GetChargesResponse.md +4 -4
- data/docs/GetTransactionsResponse.md +1 -1
- data/docs/LogsApi.md +1 -1
- data/docs/OrderFiscalEntityRequest.md +4 -4
- data/docs/OrderRefundRequest.md +7 -5
- data/docs/OrderRequest.md +17 -19
- data/docs/OrderResponse.md +37 -35
- data/docs/OrderResponseChannel.md +24 -0
- data/docs/OrderResponseShippingContact.md +4 -4
- data/docs/OrderUpdateFiscalEntityRequest.md +1 -1
- data/docs/OrderUpdateRequest.md +19 -15
- data/docs/OrdersApi.md +16 -16
- data/docs/PaymentLinkApi.md +12 -82
- data/docs/PaymentMethodCash.md +4 -4
- data/docs/PaymentMethodCashRequest.md +2 -2
- data/docs/PaymentMethodsApi.md +5 -5
- data/docs/Product.md +10 -12
- data/docs/ProductDataResponse.md +9 -11
- data/docs/ProductOrderResponse.md +9 -11
- data/docs/ProductsApi.md +7 -7
- data/docs/ShippingContactsApi.md +9 -9
- data/docs/ShippingOrderResponse.md +5 -3
- data/docs/ShippingRequest.md +2 -0
- data/docs/ShippingsApi.md +7 -7
- data/docs/TaxesApi.md +7 -7
- data/docs/TransactionResponse.md +20 -14
- data/docs/TransactionsApi.md +6 -6
- data/docs/TransfersApi.md +10 -10
- data/docs/UpdateCustomer.md +17 -21
- data/docs/UpdateCustomerFiscalEntitiesResponse.md +2 -2
- data/docs/UpdateOrderTaxRequest.md +2 -2
- data/docs/UpdateProduct.md +7 -9
- data/docs/WebhookKeysApi.md +18 -14
- data/docs/WebhooksApi.md +28 -22
- data/lib/digital_femsa/api/api_keys_api.rb +8 -8
- data/lib/digital_femsa/api/balances_api.rb +2 -2
- data/lib/digital_femsa/api/charges_api.rb +13 -9
- data/lib/digital_femsa/api/customers_api.rb +12 -12
- data/lib/digital_femsa/api/discounts_api.rb +12 -12
- data/lib/digital_femsa/api/events_api.rb +4 -4
- data/lib/digital_femsa/api/logs_api.rb +2 -2
- data/lib/digital_femsa/api/orders_api.rb +20 -20
- data/lib/digital_femsa/api/payment_link_api.rb +10 -86
- data/lib/digital_femsa/api/payment_methods_api.rb +8 -8
- data/lib/digital_femsa/api/products_api.rb +10 -10
- data/lib/digital_femsa/api/shipping_contacts_api.rb +8 -8
- data/lib/digital_femsa/api/shippings_api.rb +10 -10
- data/lib/digital_femsa/api/taxes_api.rb +10 -10
- data/lib/digital_femsa/api/transactions_api.rb +6 -6
- data/lib/digital_femsa/api/transfers_api.rb +8 -8
- data/lib/digital_femsa/api/webhook_keys_api.rb +14 -10
- data/lib/digital_femsa/api/webhooks_api.rb +23 -16
- data/lib/digital_femsa/api_client.rb +9 -5
- data/lib/digital_femsa/models/api_key_create_response.rb +1 -1
- data/lib/digital_femsa/models/api_key_request.rb +36 -1
- data/lib/digital_femsa/models/balance_response.rb +9 -9
- data/lib/digital_femsa/models/charge_order_response.rb +1 -1
- data/lib/digital_femsa/models/{order_next_action_response.rb → charge_order_response_channel.rb} +34 -18
- data/lib/digital_femsa/models/charge_request_payment_method.rb +3 -2
- data/lib/digital_femsa/models/charge_response.rb +15 -4
- data/lib/digital_femsa/models/charge_response_refunds_data.rb +23 -4
- data/lib/digital_femsa/models/charge_update_request.rb +1 -1
- data/lib/digital_femsa/models/charges_data_response.rb +15 -4
- data/lib/digital_femsa/models/checkout.rb +97 -81
- data/lib/digital_femsa/models/checkout_order_template.rb +4 -4
- data/lib/digital_femsa/models/checkout_order_template_customer_info.rb +1 -1
- data/lib/digital_femsa/models/checkout_request.rb +1 -1
- data/lib/digital_femsa/models/checkout_response.rb +1 -1
- data/lib/digital_femsa/models/create_customer_fiscal_entities_response.rb +10 -10
- data/lib/digital_femsa/models/customer.rb +57 -95
- data/lib/digital_femsa/models/customer_address.rb +7 -0
- data/lib/digital_femsa/models/customer_fiscal_entities_data_response.rb +10 -10
- data/lib/digital_femsa/models/customer_fiscal_entities_request.rb +13 -13
- data/lib/digital_femsa/models/customer_info.rb +13 -20
- data/lib/digital_femsa/models/customer_payment_method_request.rb +2 -2
- data/lib/digital_femsa/models/customer_payment_sources_inner.rb +104 -0
- data/lib/digital_femsa/models/customer_response.rb +122 -113
- data/lib/digital_femsa/models/customer_shipping_contacts_response.rb +2 -0
- data/lib/digital_femsa/models/customers_response.rb +1 -0
- data/lib/digital_femsa/models/events_resend_response.rb +1 -1
- data/lib/digital_femsa/models/get_charges_response.rb +21 -21
- data/lib/digital_femsa/models/get_transactions_response.rb +1 -1
- data/lib/digital_femsa/models/log_response.rb +1 -1
- data/lib/digital_femsa/models/logs_response.rb +1 -1
- data/lib/digital_femsa/models/order_fiscal_entity_response.rb +1 -1
- data/lib/digital_femsa/models/order_refund_request.rb +59 -11
- data/lib/digital_femsa/models/order_request.rb +69 -79
- data/lib/digital_femsa/models/order_response.rb +187 -119
- data/lib/digital_femsa/models/{order_next_action_response_redirect_to_url.rb → order_response_channel.rb} +35 -19
- data/lib/digital_femsa/models/order_response_charges.rb +1 -1
- data/lib/digital_femsa/models/order_response_checkout.rb +1 -0
- data/lib/digital_femsa/models/order_response_customer_info.rb +1 -0
- data/lib/digital_femsa/models/order_response_shipping_contact.rb +3 -0
- data/lib/digital_femsa/models/order_update_fiscal_entity_request.rb +1 -1
- data/lib/digital_femsa/models/order_update_request.rb +106 -65
- data/lib/digital_femsa/models/payment_method_cash.rb +1 -1
- data/lib/digital_femsa/models/payment_method_cash_request.rb +2 -1
- data/lib/digital_femsa/models/product.rb +103 -95
- data/lib/digital_femsa/models/product_data_response.rb +103 -95
- data/lib/digital_femsa/models/product_order_response.rb +103 -95
- data/lib/digital_femsa/models/shipping_order_response.rb +11 -1
- data/lib/digital_femsa/models/shipping_request.rb +12 -1
- data/lib/digital_femsa/models/transaction_response.rb +172 -99
- data/lib/digital_femsa/models/transfers_response.rb +1 -1
- data/lib/digital_femsa/models/transfers_response_destination.rb +312 -0
- data/lib/digital_femsa/models/update_customer.rb +42 -85
- data/lib/digital_femsa/models/update_customer_fiscal_entities_response.rb +10 -10
- data/lib/digital_femsa/models/update_order_discount_lines_request.rb +34 -0
- data/lib/digital_femsa/models/update_order_tax_request.rb +2 -2
- data/lib/digital_femsa/models/update_payment_methods_amount.rb +105 -0
- data/lib/digital_femsa/models/update_payment_methods_expires_at.rb +105 -0
- data/lib/digital_femsa/models/update_product.rb +85 -58
- data/lib/digital_femsa/models/webhook_key_delete_response.rb +1 -1
- data/lib/digital_femsa/models/webhook_key_request.rb +1 -0
- data/lib/digital_femsa/models/webhook_key_response.rb +1 -1
- data/lib/digital_femsa/models/webhook_request.rb +248 -9
- data/lib/digital_femsa/models/webhook_response.rb +1 -1
- data/lib/digital_femsa/models/webhook_update_request.rb +1 -1
- data/lib/digital_femsa/version.rb +1 -1
- data/lib/digital_femsa.rb +2 -6
- data/spec/api/balances_api_spec.rb +24 -22
- data/spec/api/charges_api_spec.rb +92 -49
- data/spec/api/companies_api_spec.rb +57 -35
- data/spec/api/customers_api_spec.rb +115 -99
- data/spec/api/events_api_spec.rb +72 -48
- data/spec/api/generated_apis_coverage_spec.rb +94 -0
- data/spec/api/logs_api_spec.rb +57 -38
- data/spec/api/orders_api_spec.rb +134 -108
- data/spec/api/payment_link_api_spec.rb +91 -81
- data/spec/api/payment_methods_api_spec.rb +102 -65
- data/spec/api/transactions_api_spec.rb +63 -41
- data/spec/api/transfers_api_spec.rb +57 -38
- data/spec/api/webhook_keys_api_spec.rb +87 -68
- data/spec/api/webhooks_api_spec.rb +110 -79
- data/spec/api_client_spec.rb +259 -0
- data/spec/models/generated_models_coverage_spec.rb +152 -0
- data/spec/models/webhook_request_ssrf_protection_spec.rb +275 -0
- data/spec/spec_helper.rb +37 -0
- data/templates/ruby/api_client.mustache +8 -4
- metadata +40 -37
- data/docs/CustomerAntifraudInfo.md +0 -20
- data/docs/CustomerAntifraudInfoResponse.md +0 -20
- data/docs/OrderNextActionResponse.md +0 -20
- data/docs/OrderNextActionResponseRedirectToUrl.md +0 -20
- data/docs/SmsCheckoutRequest.md +0 -18
- data/docs/UpdateCustomerAntifraudInfo.md +0 -20
|
@@ -13,87 +13,124 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::PaymentMethodsApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::PaymentMethodsApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
24
|
+
allow(api_client).to receive(:select_header_content_type).and_return('application/json')
|
|
25
|
+
allow(api_client).to receive(:object_to_http_body) { |value| value.to_json }
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
describe 'test an instance of PaymentMethodsApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
29
|
+
it 'creates an instance of PaymentMethodsApi' do
|
|
30
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::PaymentMethodsApi)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
34
|
+
describe '#create_customer_payment_methods_with_http_info' do
|
|
35
|
+
it 'raises when customer id is missing' do
|
|
36
|
+
expect do
|
|
37
|
+
api_instance.create_customer_payment_methods_with_http_info(nil, { type: 'oxxo' })
|
|
38
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'raises when payment method payload is missing' do
|
|
42
|
+
expect do
|
|
43
|
+
api_instance.create_customer_payment_methods_with_http_info('cus_123', nil)
|
|
44
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'create_customer_payment_methods_request'/)
|
|
47
45
|
end
|
|
48
|
-
end
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
47
|
+
it 'sends POST request with escaped customer path and serialized body' do
|
|
48
|
+
payload = { type: 'card', token_id: 'tok_123' }
|
|
49
|
+
|
|
50
|
+
expect(api_client).to receive(:call_api).with(:POST, '/customers/cus%2F123/payment_sources', hash_including(
|
|
51
|
+
operation: :'PaymentMethodsApi.create_customer_payment_methods',
|
|
52
|
+
body: payload.to_json,
|
|
53
|
+
return_type: 'CreateCustomerPaymentMethodsResponse'
|
|
54
|
+
)).and_return([:created, 201, {}])
|
|
55
|
+
|
|
56
|
+
data = api_instance.create_customer_payment_methods('cus/123', payload)
|
|
57
|
+
expect(data).to eq(:created)
|
|
62
58
|
end
|
|
63
59
|
end
|
|
64
60
|
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
describe '#delete_customer_payment_methods_with_http_info' do
|
|
62
|
+
it 'raises when payment_method_id is missing' do
|
|
63
|
+
expect do
|
|
64
|
+
api_instance.delete_customer_payment_methods_with_http_info('cus_123', nil)
|
|
65
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'payment_method_id'/)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'sends DELETE request with escaped path components' do
|
|
69
|
+
expect(api_client).to receive(:call_api).with(:DELETE, '/customers/cus%2F123/payment_sources/pm%2F123', hash_including(
|
|
70
|
+
operation: :'PaymentMethodsApi.delete_customer_payment_methods',
|
|
71
|
+
return_type: 'UpdateCustomerPaymentMethodsResponse'
|
|
72
|
+
)).and_return([:deleted, 200, {}])
|
|
73
|
+
|
|
74
|
+
data = api_instance.delete_customer_payment_methods('cus/123', 'pm/123')
|
|
75
|
+
expect(data).to eq(:deleted)
|
|
80
76
|
end
|
|
81
77
|
end
|
|
82
78
|
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
describe '#get_customer_payment_methods_with_http_info' do
|
|
80
|
+
it 'raises for limit higher than 250' do
|
|
81
|
+
expect do
|
|
82
|
+
api_instance.get_customer_payment_methods_with_http_info('cus_123', limit: 251)
|
|
83
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'raises for limit lower than 1' do
|
|
87
|
+
expect do
|
|
88
|
+
api_instance.get_customer_payment_methods_with_http_info('cus_123', limit: 0)
|
|
89
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it 'maps pagination and search filters to query params' do
|
|
93
|
+
expect(api_client).to receive(:call_api).with(:GET, '/customers/cus_123/payment_sources', hash_including(
|
|
94
|
+
operation: :'PaymentMethodsApi.get_customer_payment_methods',
|
|
95
|
+
query_params: {
|
|
96
|
+
limit: 40,
|
|
97
|
+
next: 'next_token',
|
|
98
|
+
previous: 'prev_token',
|
|
99
|
+
search: 'card'
|
|
100
|
+
},
|
|
101
|
+
return_type: 'GetPaymentMethodResponse'
|
|
102
|
+
)).and_return([:list, 200, {}])
|
|
103
|
+
|
|
104
|
+
data = api_instance.get_customer_payment_methods(
|
|
105
|
+
'cus_123',
|
|
106
|
+
limit: 40,
|
|
107
|
+
_next: 'next_token',
|
|
108
|
+
previous: 'prev_token',
|
|
109
|
+
search: 'card'
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
expect(data).to eq(:list)
|
|
96
113
|
end
|
|
97
114
|
end
|
|
98
115
|
|
|
116
|
+
describe '#update_customer_payment_methods_with_http_info' do
|
|
117
|
+
it 'raises when update payload is missing' do
|
|
118
|
+
expect do
|
|
119
|
+
api_instance.update_customer_payment_methods_with_http_info('cus_123', 'pm_123', nil)
|
|
120
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'update_payment_methods'/)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
it 'sends PUT request with serialized body' do
|
|
124
|
+
payload = { expires_at: 1_700_000_000 }
|
|
125
|
+
|
|
126
|
+
expect(api_client).to receive(:call_api).with(:PUT, '/customers/cus_123/payment_sources/pm_123', hash_including(
|
|
127
|
+
operation: :'PaymentMethodsApi.update_customer_payment_methods',
|
|
128
|
+
body: payload.to_json,
|
|
129
|
+
return_type: 'UpdateCustomerPaymentMethodsResponse'
|
|
130
|
+
)).and_return([:updated, 200, {}])
|
|
131
|
+
|
|
132
|
+
data = api_instance.update_customer_payment_methods('cus_123', 'pm_123', payload)
|
|
133
|
+
expect(data).to eq(:updated)
|
|
134
|
+
end
|
|
135
|
+
end
|
|
99
136
|
end
|
|
@@ -13,57 +13,79 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::TransactionsApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::TransactionsApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
27
24
|
end
|
|
28
25
|
|
|
29
26
|
describe 'test an instance of TransactionsApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
27
|
+
it 'creates an instance of TransactionsApi' do
|
|
28
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::TransactionsApi)
|
|
32
29
|
end
|
|
33
30
|
end
|
|
34
31
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# @option opts [String] :accept_language Use for knowing which language to use
|
|
41
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
42
|
-
# @return [TransactionResponse]
|
|
43
|
-
describe 'get_transaction test' do
|
|
44
|
-
it 'should work' do
|
|
45
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
32
|
+
describe '#get_transaction_with_http_info' do
|
|
33
|
+
it 'raises when id is missing' do
|
|
34
|
+
expect do
|
|
35
|
+
api_instance.get_transaction_with_http_info(nil)
|
|
36
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
46
37
|
end
|
|
47
|
-
end
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# @option opts [String] :previous previous page
|
|
58
|
-
# @option opts [String] :id id of the object to be retrieved
|
|
59
|
-
# @option opts [String] :charge_id id of the charge used for filtering
|
|
60
|
-
# @option opts [String] :type type of the object to be retrieved
|
|
61
|
-
# @option opts [String] :currency currency of the object to be retrieved
|
|
62
|
-
# @return [GetTransactionsResponse]
|
|
63
|
-
describe 'get_transactions test' do
|
|
64
|
-
it 'should work' do
|
|
65
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
it 'sends GET request with escaped id path' do
|
|
40
|
+
expect(api_client).to receive(:call_api).with(:GET, '/transactions/trx%2F123', hash_including(
|
|
41
|
+
operation: :'TransactionsApi.get_transaction',
|
|
42
|
+
return_type: 'TransactionResponse'
|
|
43
|
+
)).and_return([:transaction, 200, {}])
|
|
44
|
+
|
|
45
|
+
data = api_instance.get_transaction('trx/123')
|
|
46
|
+
expect(data).to eq(:transaction)
|
|
66
47
|
end
|
|
67
48
|
end
|
|
68
49
|
|
|
50
|
+
describe '#get_transactions_with_http_info' do
|
|
51
|
+
it 'raises for limit higher than 250' do
|
|
52
|
+
expect do
|
|
53
|
+
api_instance.get_transactions_with_http_info(limit: 251)
|
|
54
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'raises for limit lower than 1' do
|
|
58
|
+
expect do
|
|
59
|
+
api_instance.get_transactions_with_http_info(limit: 0)
|
|
60
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'maps filters into query params' do
|
|
64
|
+
expect(api_client).to receive(:call_api).with(:GET, '/transactions', hash_including(
|
|
65
|
+
operation: :'TransactionsApi.get_transactions',
|
|
66
|
+
query_params: {
|
|
67
|
+
limit: 50,
|
|
68
|
+
next: 'next_token',
|
|
69
|
+
previous: 'prev_token',
|
|
70
|
+
id: 'txn_filter',
|
|
71
|
+
charge_id: 'chg_123',
|
|
72
|
+
type: 'debit',
|
|
73
|
+
currency: 'MXN'
|
|
74
|
+
},
|
|
75
|
+
return_type: 'GetTransactionsResponse'
|
|
76
|
+
)).and_return([:list, 200, {}])
|
|
77
|
+
|
|
78
|
+
data = api_instance.get_transactions(
|
|
79
|
+
limit: 50,
|
|
80
|
+
_next: 'next_token',
|
|
81
|
+
previous: 'prev_token',
|
|
82
|
+
id: 'txn_filter',
|
|
83
|
+
charge_id: 'chg_123',
|
|
84
|
+
type: 'debit',
|
|
85
|
+
currency: 'MXN'
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
expect(data).to eq(:list)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
69
91
|
end
|
|
@@ -13,54 +13,73 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::TransfersApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::TransfersApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
27
24
|
end
|
|
28
25
|
|
|
29
26
|
describe 'test an instance of TransfersApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
27
|
+
it 'creates an instance of TransfersApi' do
|
|
28
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::TransfersApi)
|
|
32
29
|
end
|
|
33
30
|
end
|
|
34
31
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# @option opts [String] :accept_language Use for knowing which language to use
|
|
41
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
42
|
-
# @return [TransferResponse]
|
|
43
|
-
describe 'get_transfer test' do
|
|
44
|
-
it 'should work' do
|
|
45
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
32
|
+
describe '#get_transfer_with_http_info' do
|
|
33
|
+
it 'raises when id is missing' do
|
|
34
|
+
expect do
|
|
35
|
+
api_instance.get_transfer_with_http_info(nil)
|
|
36
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
46
37
|
end
|
|
47
|
-
end
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# @option opts [String] :_next next page
|
|
58
|
-
# @option opts [String] :previous previous page
|
|
59
|
-
# @return [GetTransfersResponse]
|
|
60
|
-
describe 'get_transfers test' do
|
|
61
|
-
it 'should work' do
|
|
62
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
it 'sends GET request with escaped transfer id path' do
|
|
40
|
+
expect(api_client).to receive(:call_api).with(:GET, '/transfers/trf%2F123', hash_including(
|
|
41
|
+
operation: :'TransfersApi.get_transfer',
|
|
42
|
+
return_type: 'TransferResponse'
|
|
43
|
+
)).and_return([:transfer, 200, {}])
|
|
44
|
+
|
|
45
|
+
data = api_instance.get_transfer('trf/123')
|
|
46
|
+
expect(data).to eq(:transfer)
|
|
63
47
|
end
|
|
64
48
|
end
|
|
65
49
|
|
|
50
|
+
describe '#get_transfers_with_http_info' do
|
|
51
|
+
it 'raises for limit higher than 250' do
|
|
52
|
+
expect do
|
|
53
|
+
api_instance.get_transfers_with_http_info(limit: 251)
|
|
54
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'raises for limit lower than 1' do
|
|
58
|
+
expect do
|
|
59
|
+
api_instance.get_transfers_with_http_info(limit: 0)
|
|
60
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'maps pagination and search query params' do
|
|
64
|
+
expect(api_client).to receive(:call_api).with(:GET, '/transfers', hash_including(
|
|
65
|
+
operation: :'TransfersApi.get_transfers',
|
|
66
|
+
query_params: {
|
|
67
|
+
limit: 20,
|
|
68
|
+
search: 'bank',
|
|
69
|
+
next: 'next_token',
|
|
70
|
+
previous: 'prev_token'
|
|
71
|
+
},
|
|
72
|
+
return_type: 'GetTransfersResponse'
|
|
73
|
+
)).and_return([:list, 200, {}])
|
|
74
|
+
|
|
75
|
+
data = api_instance.get_transfers(
|
|
76
|
+
limit: 20,
|
|
77
|
+
search: 'bank',
|
|
78
|
+
_next: 'next_token',
|
|
79
|
+
previous: 'prev_token'
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
expect(data).to eq(:list)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
66
85
|
end
|
|
@@ -13,92 +13,111 @@ Generator version: 7.5.0
|
|
|
13
13
|
require 'spec_helper'
|
|
14
14
|
require 'json'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = DigitalFemsa::WebhookKeysApi.new
|
|
23
|
-
end
|
|
16
|
+
RSpec.describe DigitalFemsa::WebhookKeysApi do
|
|
17
|
+
let(:config) { DigitalFemsa::Configuration.new }
|
|
18
|
+
let(:api_client) { instance_double(DigitalFemsa::ApiClient) }
|
|
19
|
+
let(:api_instance) { described_class.new(api_client) }
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
before do
|
|
22
|
+
allow(api_client).to receive(:config).and_return(config)
|
|
23
|
+
allow(api_client).to receive(:select_header_accept).and_return('application/vnd.app-v2.1.0+json')
|
|
24
|
+
allow(api_client).to receive(:select_header_content_type).and_return('application/json')
|
|
25
|
+
allow(api_client).to receive(:object_to_http_body) { |value| value.to_json }
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
describe 'test an instance of WebhookKeysApi' do
|
|
30
|
-
it '
|
|
31
|
-
expect(
|
|
29
|
+
it 'creates an instance of WebhookKeysApi' do
|
|
30
|
+
expect(api_instance).to be_instance_of(DigitalFemsa::WebhookKeysApi)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
34
33
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
describe '#create_webhook_key_with_http_info' do
|
|
35
|
+
it 'sends POST request with serialized payload' do
|
|
36
|
+
payload = { enabled: true }
|
|
37
|
+
|
|
38
|
+
expect(api_client).to receive(:call_api).with(:POST, '/webhook_keys', hash_including(
|
|
39
|
+
operation: :'WebhookKeysApi.create_webhook_key',
|
|
40
|
+
body: payload.to_json,
|
|
41
|
+
return_type: 'WebhookKeyCreateResponse'
|
|
42
|
+
)).and_return([:created, 201, {}])
|
|
43
|
+
|
|
44
|
+
data = api_instance.create_webhook_key(webhook_key_request: payload)
|
|
45
|
+
expect(data).to eq(:created)
|
|
45
46
|
end
|
|
46
47
|
end
|
|
47
48
|
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# @return [WebhookKeyDeleteResponse]
|
|
54
|
-
describe 'delete_webhook_key test' do
|
|
55
|
-
it 'should work' do
|
|
56
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
49
|
+
describe '#delete_webhook_key_with_http_info' do
|
|
50
|
+
it 'raises when id is missing' do
|
|
51
|
+
expect do
|
|
52
|
+
api_instance.delete_webhook_key_with_http_info(nil)
|
|
53
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
57
54
|
end
|
|
58
|
-
end
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
it 'should work' do
|
|
69
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
56
|
+
it 'sends DELETE request with escaped id path' do
|
|
57
|
+
expect(api_client).to receive(:call_api).with(:DELETE, '/webhook_keys/key%2F123', hash_including(
|
|
58
|
+
operation: :'WebhookKeysApi.delete_webhook_key',
|
|
59
|
+
return_type: 'WebhookKeyDeleteResponse'
|
|
60
|
+
)).and_return([:deleted, 200, {}])
|
|
61
|
+
|
|
62
|
+
data = api_instance.delete_webhook_key('key/123')
|
|
63
|
+
expect(data).to eq(:deleted)
|
|
70
64
|
end
|
|
71
65
|
end
|
|
72
66
|
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request.
|
|
79
|
-
# @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
|
|
80
|
-
# @option opts [String] :search General order search, e.g. by mail, reference etc.
|
|
81
|
-
# @option opts [String] :_next next page
|
|
82
|
-
# @option opts [String] :previous previous page
|
|
83
|
-
# @return [GetWebhookKeysResponse]
|
|
84
|
-
describe 'get_webhook_keys test' do
|
|
85
|
-
it 'should work' do
|
|
86
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
67
|
+
describe '#get_webhook_keys_with_http_info' do
|
|
68
|
+
it 'raises for limit higher than 250' do
|
|
69
|
+
expect do
|
|
70
|
+
api_instance.get_webhook_keys_with_http_info(limit: 251)
|
|
71
|
+
end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
|
|
87
72
|
end
|
|
88
|
-
end
|
|
89
73
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
74
|
+
it 'raises for limit lower than 1' do
|
|
75
|
+
expect do
|
|
76
|
+
api_instance.get_webhook_keys_with_http_info(limit: 0)
|
|
77
|
+
end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'maps pagination and search query params' do
|
|
81
|
+
expect(api_client).to receive(:call_api).with(:GET, '/webhook_keys', hash_including(
|
|
82
|
+
operation: :'WebhookKeysApi.get_webhook_keys',
|
|
83
|
+
query_params: {
|
|
84
|
+
limit: 50,
|
|
85
|
+
search: 'active',
|
|
86
|
+
next: 'next_token',
|
|
87
|
+
previous: 'prev_token'
|
|
88
|
+
},
|
|
89
|
+
return_type: 'GetWebhookKeysResponse'
|
|
90
|
+
)).and_return([:list, 200, {}])
|
|
91
|
+
|
|
92
|
+
data = api_instance.get_webhook_keys(
|
|
93
|
+
limit: 50,
|
|
94
|
+
search: 'active',
|
|
95
|
+
_next: 'next_token',
|
|
96
|
+
previous: 'prev_token'
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
expect(data).to eq(:list)
|
|
101
100
|
end
|
|
102
101
|
end
|
|
103
102
|
|
|
103
|
+
describe '#update_webhook_key_with_http_info' do
|
|
104
|
+
it 'raises when id is missing' do
|
|
105
|
+
expect do
|
|
106
|
+
api_instance.update_webhook_key_with_http_info(nil)
|
|
107
|
+
end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'sends PUT request with serialized payload' do
|
|
111
|
+
payload = { disabled: true }
|
|
112
|
+
|
|
113
|
+
expect(api_client).to receive(:call_api).with(:PUT, '/webhook_keys/key_123', hash_including(
|
|
114
|
+
operation: :'WebhookKeysApi.update_webhook_key',
|
|
115
|
+
body: payload.to_json,
|
|
116
|
+
return_type: 'WebhookKeyResponse'
|
|
117
|
+
)).and_return([:updated, 200, {}])
|
|
118
|
+
|
|
119
|
+
data = api_instance.update_webhook_key('key_123', webhook_key_update_request: payload)
|
|
120
|
+
expect(data).to eq(:updated)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
104
123
|
end
|