Class: WalmartApIs::FinancesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/walmart_ap_is/apis/finances_api.rb

Overview

FinancesApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from WalmartApIs::BaseApi

Instance Method Details

#list_financial_event_groups(max_results_per_page: nil, financial_event_group_started_before: nil, financial_event_group_started_after: nil, next_token: nil) ⇒ ApiResponse

Returns financial event groups for the seller. Status: stub — no upstream endpoint found that models the SP-API FinancialEventGroup (requires eventGroupId keying, date-range filter, and cursor pagination). Returns empty response pending Phase 5. number of results per page. Financial event groups that opened before this date/time (ISO 8601). Financial event groups that opened after this date/time (ISO 8601). page of results.

Parameters:

  • max_results_per_page (Integer) (defaults to: nil)

    Optional parameter: The maximum

  • financial_event_group_started_before (DateTime) (defaults to: nil)

    Optional parameter:

  • financial_event_group_started_after (DateTime) (defaults to: nil)

    Optional parameter:

  • next_token (String) (defaults to: nil)

    Optional parameter: Cursor token for the next

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/walmart_ap_is/apis/finances_api.rb', line 22

def list_financial_event_groups(max_results_per_page: nil,
                                financial_event_group_started_before: nil,
                                financial_event_group_started_after: nil,
                                next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/finances/v4/financialEventGroups',
                                 Server::DEFAULT1)
               .query_param(new_parameter(max_results_per_page, key: 'MaxResultsPerPage'))
               .query_param(new_parameter(financial_event_group_started_before, key: 'FinancialEventGroupStartedBefore'))
               .query_param(new_parameter(financial_event_group_started_after, key: 'FinancialEventGroupStartedAfter'))
               .query_param(new_parameter(next_token, key: 'NextToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#list_financial_events(max_results_per_page: nil, posted_after: nil, posted_before: nil, next_token: nil) ⇒ ApiResponse

Returns financial events for the authenticated seller via GMP partnerTxnSearch. Best-effort implementation — backed by GMP partnerTxnSearch. Returns transaction records for the seller keyed by partnerId. Unsupported parameters: PostedAfter, PostedBefore, and NextToken are not supported by the upstream. Supplying any of these parameters returns 400 Bad Request. returns all results in a single page. 400 Bad Request if supplied. returns 400 Bad Request if supplied. Bad Request if supplied.

Parameters:

  • max_results_per_page (Integer) (defaults to: nil)

    Optional parameter: Ignored — GMP

  • posted_after (DateTime) (defaults to: nil)

    Optional parameter: Not supported — returns

  • posted_before (DateTime) (defaults to: nil)

    Optional parameter: Not supported —

  • next_token (String) (defaults to: nil)

    Optional parameter: Not supported — returns 400

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/walmart_ap_is/apis/finances_api.rb', line 127

def list_financial_events(max_results_per_page: nil,
                          posted_after: nil,
                          posted_before: nil,
                          next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/finances/v4/financialEvents',
                                 Server::DEFAULT1)
               .query_param(new_parameter(max_results_per_page, key: 'MaxResultsPerPage'))
               .query_param(new_parameter(posted_after, key: 'PostedAfter'))
               .query_param(new_parameter(posted_before, key: 'PostedBefore'))
               .query_param(new_parameter(next_token, key: 'NextToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#list_financial_events_by_group_id(event_group_id, max_results_per_page: nil, posted_after: nil, posted_before: nil, next_token: nil) ⇒ ApiResponse

Returns financial events for a specific financial event group. Status: stub — no upstream maps eventGroupId to a financial event set. Returns empty response pending Phase 5. financial event group. number of results to return per page. after (or on) this date (ISO 8601). posted before (but not on) this date (ISO 8601). page of results.

Parameters:

  • event_group_id (String)

    Required parameter: The identifier of the

  • max_results_per_page (Integer) (defaults to: nil)

    Optional parameter: The maximum

  • posted_after (DateTime) (defaults to: nil)

    Optional parameter: Financial events posted

  • posted_before (DateTime) (defaults to: nil)

    Optional parameter: Financial events

  • next_token (String) (defaults to: nil)

    Optional parameter: Cursor token for the next

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/walmart_ap_is/apis/finances_api.rb', line 71

def list_financial_events_by_group_id(event_group_id,
                                      max_results_per_page: nil,
                                      posted_after: nil,
                                      posted_before: nil,
                                      next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/finances/v4/financialEventGroups/{eventGroupId}/financialEvents',
                                 Server::DEFAULT1)
               .template_param(new_parameter(event_group_id, key: 'eventGroupId')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(max_results_per_page, key: 'MaxResultsPerPage'))
               .query_param(new_parameter(posted_after, key: 'PostedAfter'))
               .query_param(new_parameter(posted_before, key: 'PostedBefore'))
               .query_param(new_parameter(next_token, key: 'NextToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#list_financial_events_by_order_id(order_id, max_results_per_page: nil, next_token: nil) ⇒ ApiResponse

Returns financial events for a specific order via GMP commission endpoint. Best-effort implementation — returns commission charges only; refunds, fees, and adjustments are absent. IDOR ownership gate enforced. be numeric (1–50 digits). returns all commission entries in one page. Bad Request if supplied.

Parameters:

  • order_id (String)

    Required parameter: Walmart order number — must

  • max_results_per_page (Integer) (defaults to: nil)

    Optional parameter: Ignored — GMP

  • next_token (String) (defaults to: nil)

    Optional parameter: Not supported — returns 400

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/walmart_ap_is/apis/finances_api.rb', line 172

def list_financial_events_by_order_id(order_id,
                                      max_results_per_page: nil,
                                      next_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/finances/v4/orders/{orderId}/financialEvents',
                                 Server::DEFAULT1)
               .template_param(new_parameter(order_id, key: 'orderId')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(max_results_per_page, key: 'MaxResultsPerPage'))
               .query_param(new_parameter(next_token, key: 'NextToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end