digital_femsa 1.1.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.
@@ -13,67 +13,91 @@ Generator version: 7.5.0
13
13
  require 'spec_helper'
14
14
  require 'json'
15
15
 
16
- # Unit tests for DigitalFemsa::EventsApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'EventsApi' do
20
- before do
21
- # run before each test
22
- @api_instance = DigitalFemsa::EventsApi.new
23
- end
16
+ RSpec.describe DigitalFemsa::EventsApi 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
- after do
26
- # run after each test
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 EventsApi' do
30
- it 'should create an instance of EventsApi' do
31
- expect(@api_instance).to be_instance_of(DigitalFemsa::EventsApi)
27
+ it 'creates an instance of EventsApi' do
28
+ expect(api_instance).to be_instance_of(DigitalFemsa::EventsApi)
32
29
  end
33
30
  end
34
31
 
35
- # unit tests for get_event
36
- # Get Event
37
- # Returns a single event
38
- # @param id Identifier of the resource
39
- # @param [Hash] opts the optional parameters
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 [EventResponse]
43
- describe 'get_event 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_event_with_http_info' do
33
+ it 'raises when id is missing' do
34
+ expect do
35
+ api_instance.get_event_with_http_info(nil)
36
+ end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
46
37
  end
47
- end
48
38
 
49
- # unit tests for get_events
50
- # Get list of Events
51
- # @param [Hash] opts the optional parameters
52
- # @option opts [String] :accept_language Use for knowing which language to use
53
- # @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.
54
- # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
55
- # @option opts [String] :search General order search, e.g. by mail, reference etc.
56
- # @option opts [String] :_next next page
57
- # @option opts [String] :previous previous page
58
- # @return [GetEventsResponse]
59
- describe 'get_events test' do
60
- it 'should work' do
61
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ it 'sends GET request with escaped event path' do
40
+ expect(api_client).to receive(:call_api).with(:GET, '/events/evt%2F123', hash_including(
41
+ operation: :'EventsApi.get_event',
42
+ return_type: 'EventResponse'
43
+ )).and_return([:event, 200, {}])
44
+
45
+ data = api_instance.get_event('evt/123')
46
+ expect(data).to eq(:event)
62
47
  end
63
48
  end
64
49
 
65
- # unit tests for resend_event
66
- # Resend Event
67
- # Try to send an event
68
- # @param event_id event identifier
69
- # @param webhook_log_id webhook log identifier
70
- # @param [Hash] opts the optional parameters
71
- # @option opts [String] :accept_language Use for knowing which language to use
72
- # @return [EventsResendResponse]
73
- describe 'resend_event test' do
74
- it 'should work' do
75
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
50
+ describe '#get_events_with_http_info' do
51
+ it 'raises for limit higher than 250' do
52
+ expect do
53
+ api_instance.get_events_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_events_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 into query params' do
64
+ expect(api_client).to receive(:call_api).with(:GET, '/events', hash_including(
65
+ operation: :'EventsApi.get_events',
66
+ query_params: {
67
+ limit: 30,
68
+ search: 'charge.paid',
69
+ next: 'next_token',
70
+ previous: 'prev_token'
71
+ },
72
+ return_type: 'GetEventsResponse'
73
+ )).and_return([:list, 200, {}])
74
+
75
+ data = api_instance.get_events(
76
+ limit: 30,
77
+ search: 'charge.paid',
78
+ _next: 'next_token',
79
+ previous: 'prev_token'
80
+ )
81
+
82
+ expect(data).to eq(:list)
76
83
  end
77
84
  end
78
85
 
86
+ describe '#resend_event_with_http_info' do
87
+ it 'raises when webhook_log_id is missing' do
88
+ expect do
89
+ api_instance.resend_event_with_http_info('evt_123', nil)
90
+ end.to raise_error(ArgumentError, /Missing the required parameter 'webhook_log_id'/)
91
+ end
92
+
93
+ it 'sends POST request with escaped event and webhook log ids' do
94
+ expect(api_client).to receive(:call_api).with(:POST, '/events/evt%2F123/webhook_logs/log%2F123/resend', hash_including(
95
+ operation: :'EventsApi.resend_event',
96
+ return_type: 'EventsResendResponse'
97
+ )).and_return([:resent, 200, {}])
98
+
99
+ data = api_instance.resend_event('evt/123', 'log/123')
100
+ expect(data).to eq(:resent)
101
+ end
102
+ end
79
103
  end
@@ -0,0 +1,94 @@
1
+ require 'spec_helper'
2
+ require 'logger'
3
+
4
+ RSpec.describe 'Generated APIs coverage smoke tests' do
5
+ api_classes = DigitalFemsa.constants.filter_map do |const_name|
6
+ constant = DigitalFemsa.const_get(const_name)
7
+ next unless constant.is_a?(Class)
8
+ next unless constant.name.end_with?('Api')
9
+
10
+ constant
11
+ rescue NameError
12
+ nil
13
+ end.sort_by(&:name)
14
+
15
+ required_arg_value = lambda do |name|
16
+ name_str = name.to_s
17
+
18
+ if name_str == 'id' || name_str.end_with?('_id')
19
+ 'id_123'
20
+ elsif name_str.include?('request')
21
+ {}
22
+ elsif name_str.include?('amount')
23
+ 100
24
+ elsif name_str.include?('date')
25
+ '2024-01-01'
26
+ else
27
+ 'value'
28
+ end
29
+ end
30
+
31
+ optional_arg_value = lambda do |name|
32
+ unless name.to_s == 'opts'
33
+ return required_arg_value.call(name)
34
+ end
35
+
36
+ {
37
+ accept_language: 'es',
38
+ x_child_company_id: 'child_company_123',
39
+ limit: 20,
40
+ search: 'test',
41
+ _next: 'next_token',
42
+ previous: 'prev_token'
43
+ }
44
+ end
45
+
46
+ args_for = lambda do |method|
47
+ method.parameters.map do |kind, name|
48
+ kind == :opt ? optional_arg_value.call(name) : required_arg_value.call(name)
49
+ end
50
+ end
51
+
52
+ let(:config) do
53
+ double('Configuration', debugging: false, client_side_validation: true, logger: Logger.new(nil))
54
+ end
55
+
56
+ let(:api_client) do
57
+ double('ApiClient').tap do |client|
58
+ allow(client).to receive(:config).and_return(config)
59
+ allow(client).to receive(:select_header_accept).and_return('application/json')
60
+ allow(client).to receive(:select_header_content_type).and_return('application/json')
61
+ allow(client).to receive(:object_to_http_body) { |body| body }
62
+ allow(client).to receive(:call_api).and_return([{ 'ok' => true }, 200, { 'X-Test' => '1' }])
63
+ end
64
+ end
65
+
66
+ api_classes.each do |klass|
67
+ describe klass.name do
68
+ let(:api_instance) { klass.new(api_client) }
69
+
70
+ it 'creates an instance with injected api_client' do
71
+ expect(api_instance).to be_instance_of(klass)
72
+ expect(api_instance.api_client).to eq(api_client)
73
+ end
74
+
75
+ klass.instance_methods(false).sort.each do |method_name|
76
+ next if method_name == :initialize
77
+ next if %i[api_client api_client=].include?(method_name)
78
+
79
+ it "invokes ##{method_name}" do
80
+ method = klass.instance_method(method_name)
81
+ args = args_for.call(method)
82
+
83
+ result = api_instance.public_send(method_name, *args)
84
+
85
+ if method_name.to_s.end_with?('_with_http_info')
86
+ expect(result).to eq([{ 'ok' => true }, 200, { 'X-Test' => '1' }])
87
+ else
88
+ expect(result).to eq('ok' => true)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -13,54 +13,73 @@ Generator version: 7.5.0
13
13
  require 'spec_helper'
14
14
  require 'json'
15
15
 
16
- # Unit tests for DigitalFemsa::LogsApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'LogsApi' do
20
- before do
21
- # run before each test
22
- @api_instance = DigitalFemsa::LogsApi.new
23
- end
16
+ RSpec.describe DigitalFemsa::LogsApi 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
- after do
26
- # run after each test
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 LogsApi' do
30
- it 'should create an instance of LogsApi' do
31
- expect(@api_instance).to be_instance_of(DigitalFemsa::LogsApi)
27
+ it 'creates an instance of LogsApi' do
28
+ expect(api_instance).to be_instance_of(DigitalFemsa::LogsApi)
32
29
  end
33
30
  end
34
31
 
35
- # unit tests for get_log_by_id
36
- # Get Log
37
- # Get the details of a specific log
38
- # @param id Identifier of the resource
39
- # @param [Hash] opts the optional parameters
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 [LogResponse]
43
- describe 'get_log_by_id 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_log_by_id_with_http_info' do
33
+ it 'raises when id is missing' do
34
+ expect do
35
+ api_instance.get_log_by_id_with_http_info(nil)
36
+ end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
46
37
  end
47
- end
48
38
 
49
- # unit tests for get_logs
50
- # Get List Of Logs
51
- # Get log details in the form of a list
52
- # @param [Hash] opts the optional parameters
53
- # @option opts [String] :accept_language Use for knowing which language to use
54
- # @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.
55
- # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
56
- # @option opts [String] :search General order search, e.g. by mail, reference etc.
57
- # @option opts [String] :_next next page
58
- # @option opts [String] :previous previous page
59
- # @return [LogsResponse]
60
- describe 'get_logs 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 id path' do
40
+ expect(api_client).to receive(:call_api).with(:GET, '/logs/log%2F123', hash_including(
41
+ operation: :'LogsApi.get_log_by_id',
42
+ return_type: 'LogResponse'
43
+ )).and_return([:log, 200, {}])
44
+
45
+ data = api_instance.get_log_by_id('log/123')
46
+ expect(data).to eq(:log)
63
47
  end
64
48
  end
65
49
 
50
+ describe '#get_logs_with_http_info' do
51
+ it 'raises for limit higher than 250' do
52
+ expect do
53
+ api_instance.get_logs_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_logs_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, '/logs', hash_including(
65
+ operation: :'LogsApi.get_logs',
66
+ query_params: {
67
+ limit: 15,
68
+ search: 'timeout',
69
+ next: 'next_token',
70
+ previous: 'prev_token'
71
+ },
72
+ return_type: 'LogsResponse'
73
+ )).and_return([:list, 200, {}])
74
+
75
+ data = api_instance.get_logs(
76
+ limit: 15,
77
+ search: 'timeout',
78
+ _next: 'next_token',
79
+ previous: 'prev_token'
80
+ )
81
+
82
+ expect(data).to eq(:list)
83
+ end
84
+ end
66
85
  end
@@ -13,141 +13,167 @@ Generator version: 7.5.0
13
13
  require 'spec_helper'
14
14
  require 'json'
15
15
 
16
- # Unit tests for DigitalFemsa::OrdersApi
17
- # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
- # Please update as you see appropriate
19
- describe 'OrdersApi' do
20
- before do
21
- # run before each test
22
- @api_instance = DigitalFemsa::OrdersApi.new
23
- end
16
+ RSpec.describe DigitalFemsa::OrdersApi 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
- after do
26
- # run after each test
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 OrdersApi' do
30
- it 'should create an instance of OrdersApi' do
31
- expect(@api_instance).to be_instance_of(DigitalFemsa::OrdersApi)
29
+ it 'creates an instance of OrdersApi' do
30
+ expect(api_instance).to be_instance_of(DigitalFemsa::OrdersApi)
32
31
  end
33
32
  end
34
33
 
35
- # unit tests for cancel_order
36
- # Cancel Order
37
- # Cancel an order that has been previously created.
38
- # @param id Identifier of the resource
39
- # @param [Hash] opts the optional parameters
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 [OrderResponse]
43
- describe 'cancel_order test' do
44
- it 'should work' do
45
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
34
+ describe '#cancel_order_with_http_info' do
35
+ it 'raises when id is missing' do
36
+ expect do
37
+ api_instance.cancel_order_with_http_info(nil)
38
+ end.to raise_error(ArgumentError, /Missing the required parameter 'id'/)
46
39
  end
47
- end
48
40
 
49
- # unit tests for create_order
50
- # Create order
51
- # Create a new order.
52
- # @param order_request requested field for order
53
- # @param [Hash] opts the optional parameters
54
- # @option opts [String] :accept_language Use for knowing which language to use
55
- # @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.
56
- # @return [OrderResponse]
57
- describe 'create_order test' do
58
- it 'should work' do
59
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
41
+ it 'builds escaped path and sends POST request' do
42
+ expect(api_client).to receive(:call_api).with(:POST, '/orders/order%2F123/cancel', hash_including(
43
+ operation: :'OrdersApi.cancel_order',
44
+ return_type: 'OrderResponse',
45
+ auth_names: ['bearerAuth']
46
+ )).and_return([:ok, 200, {}])
47
+
48
+ data, status, _headers = api_instance.cancel_order_with_http_info('order/123')
49
+ expect(data).to eq(:ok)
50
+ expect(status).to eq(200)
60
51
  end
61
52
  end
62
53
 
63
- # unit tests for get_order_by_id
64
- # Get Order
65
- # Info for a specific order
66
- # @param id Identifier of the resource
67
- # @param [Hash] opts the optional parameters
68
- # @option opts [String] :accept_language Use for knowing which language to use
69
- # @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.
70
- # @return [OrderResponse]
71
- describe 'get_order_by_id test' do
72
- it 'should work' do
73
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
54
+ describe '#create_order_with_http_info' do
55
+ it 'raises when order_request is missing' do
56
+ expect do
57
+ api_instance.create_order_with_http_info(nil)
58
+ end.to raise_error(ArgumentError, /Missing the required parameter 'order_request'/)
74
59
  end
75
- end
76
60
 
77
- # unit tests for get_orders
78
- # Get a list of Orders
79
- # Get order details in the form of a list
80
- # @param [Hash] opts the optional parameters
81
- # @option opts [String] :accept_language Use for knowing which language to use
82
- # @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.
83
- # @option opts [Integer] :limit The numbers of items to return, the maximum value is 250
84
- # @option opts [String] :search General order search, e.g. by mail, reference etc.
85
- # @option opts [String] :_next next page
86
- # @option opts [String] :previous previous page
87
- # @return [GetOrdersResponse]
88
- describe 'get_orders test' do
89
- it 'should work' do
90
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
61
+ it 'sends serialized body and headers' do
62
+ payload = { amount: 1000, currency: 'MXN' }
63
+
64
+ expect(api_client).to receive(:call_api).with(:POST, '/orders', hash_including(
65
+ operation: :'OrdersApi.create_order',
66
+ body: payload.to_json,
67
+ return_type: 'OrderResponse'
68
+ )).and_return([:created, 201, {}])
69
+
70
+ data = api_instance.create_order(payload, accept_language: 'es', x_child_company_id: 'company_1')
71
+ expect(data).to eq(:created)
91
72
  end
92
73
  end
93
74
 
94
- # unit tests for order_cancel_refund
95
- # Cancel Refund
96
- # A refunded order describes the items, amount, and reason an order is being refunded.
97
- # @param id Identifier of the resource
98
- # @param refund_id refund identifier
99
- # @param [Hash] opts the optional parameters
100
- # @option opts [String] :accept_language Use for knowing which language to use
101
- # @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.
102
- # @return [OrderResponse]
103
- describe 'order_cancel_refund test' do
104
- it 'should work' do
105
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
75
+ describe '#get_orders_with_http_info' do
76
+ it 'raises for limit higher than 250' do
77
+ expect do
78
+ api_instance.get_orders_with_http_info(limit: 251)
79
+ end.to raise_error(ArgumentError, /must be smaller than or equal to 250/)
80
+ end
81
+
82
+ it 'raises for limit lower than 1' do
83
+ expect do
84
+ api_instance.get_orders_with_http_info(limit: 0)
85
+ end.to raise_error(ArgumentError, /must be greater than or equal to 1/)
86
+ end
87
+
88
+ it 'maps pagination and search into query params' do
89
+ expect(api_client).to receive(:call_api).with(:GET, '/orders', hash_including(
90
+ operation: :'OrdersApi.get_orders',
91
+ query_params: {
92
+ limit: 10,
93
+ search: 'john',
94
+ next: 'next_token',
95
+ previous: 'prev_token'
96
+ },
97
+ return_type: 'GetOrdersResponse'
98
+ )).and_return([:list, 200, {}])
99
+
100
+ data = api_instance.get_orders(
101
+ limit: 10,
102
+ search: 'john',
103
+ _next: 'next_token',
104
+ previous: 'prev_token'
105
+ )
106
+
107
+ expect(data).to eq(:list)
106
108
  end
107
109
  end
108
110
 
109
- # unit tests for order_refund
110
- # Refund Order
111
- # A refunded order describes the items, amount, and reason an order is being refunded.
112
- # @param id Identifier of the resource
113
- # @param order_refund_request requested field for a refund
114
- # @param [Hash] opts the optional parameters
115
- # @option opts [String] :accept_language Use for knowing which language to use
116
- # @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.
117
- # @return [OrderResponse]
118
- describe 'order_refund test' do
119
- it 'should work' do
120
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
111
+ describe '#order_cancel_refund_with_http_info' do
112
+ it 'raises when refund_id is missing' do
113
+ expect do
114
+ api_instance.order_cancel_refund_with_http_info('ord_123', nil)
115
+ end.to raise_error(ArgumentError, /Missing the required parameter 'refund_id'/)
116
+ end
117
+
118
+ it 'sends DELETE request with expected path' do
119
+ expect(api_client).to receive(:call_api).with(:DELETE, '/orders/ord_123/refunds/ref_123', hash_including(
120
+ operation: :'OrdersApi.order_cancel_refund',
121
+ return_type: 'OrderResponse'
122
+ )).and_return([:deleted, 200, {}])
123
+
124
+ data = api_instance.order_cancel_refund('ord_123', 'ref_123')
125
+ expect(data).to eq(:deleted)
121
126
  end
122
127
  end
123
128
 
124
- # unit tests for orders_create_capture
125
- # Capture Order
126
- # Processes an order that has been previously authorized.
127
- # @param id Identifier of the resource
128
- # @param [Hash] opts the optional parameters
129
- # @option opts [String] :accept_language Use for knowing which language to use
130
- # @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.
131
- # @option opts [OrderCaptureRequest] :order_capture_request requested fields for capture order
132
- # @return [OrderResponse]
133
- describe 'orders_create_capture test' do
134
- it 'should work' do
135
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
129
+ describe '#order_refund_with_http_info' do
130
+ it 'sends refund payload in POST body' do
131
+ payload = { reason: 'requested_by_customer', amount: 500 }
132
+
133
+ expect(api_client).to receive(:call_api).with(:POST, '/orders/ord_123/refunds', hash_including(
134
+ operation: :'OrdersApi.order_refund',
135
+ body: payload.to_json,
136
+ return_type: 'OrderResponse'
137
+ )).and_return([:refunded, 200, {}])
138
+
139
+ data = api_instance.order_refund('ord_123', payload)
140
+ expect(data).to eq(:refunded)
136
141
  end
137
142
  end
138
143
 
139
- # unit tests for update_order
140
- # Update Order
141
- # Update an existing Order.
142
- # @param id Identifier of the resource
143
- # @param order_update_request requested field for an order
144
- # @param [Hash] opts the optional parameters
145
- # @option opts [String] :accept_language Use for knowing which language to use
146
- # @return [OrderResponse]
147
- describe 'update_order test' do
148
- it 'should work' do
149
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
144
+ describe '#orders_create_capture_with_http_info' do
145
+ it 'sends capture payload in POST body' do
146
+ payload = { amount: 300 }
147
+
148
+ expect(api_client).to receive(:call_api).with(:POST, '/orders/ord_123/capture', hash_including(
149
+ operation: :'OrdersApi.orders_create_capture',
150
+ body: payload.to_json,
151
+ return_type: 'OrderResponse'
152
+ )).and_return([:captured, 200, {}])
153
+
154
+ data = api_instance.orders_create_capture('ord_123', order_capture_request: payload)
155
+ expect(data).to eq(:captured)
150
156
  end
151
157
  end
152
158
 
159
+ describe '#update_order_with_http_info' do
160
+ it 'raises when order_update_request is missing' do
161
+ expect do
162
+ api_instance.update_order_with_http_info('ord_123', nil)
163
+ end.to raise_error(ArgumentError, /Missing the required parameter 'order_update_request'/)
164
+ end
165
+
166
+ it 'sends PUT request with serialized body' do
167
+ payload = { metadata: { source: 'tests' } }
168
+
169
+ expect(api_client).to receive(:call_api).with(:PUT, '/orders/ord_123', hash_including(
170
+ operation: :'OrdersApi.update_order',
171
+ body: payload.to_json,
172
+ return_type: 'OrderResponse'
173
+ )).and_return([:updated, 200, {}])
174
+
175
+ data = api_instance.update_order('ord_123', payload, accept_language: 'en')
176
+ expect(data).to eq(:updated)
177
+ end
178
+ end
153
179
  end