Class: WalmartApIs::PayoutsApi

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

Overview

PayoutsApi

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

#configure_auto_payout(body) ⇒ ApiResponse

Enables or disables automatic scheduled payouts for the authenticated seller. When enabled, payouts are triggered automatically on the standard settlement cadence. Returns updated payout status. Requires "disbursements:write" scope. Delegates to GMPPaymentsPlatform (Phase 5). TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/walmart_ap_is/apis/payouts_api.rb', line 106

def configure_auto_payout(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/disbursements/v4/payment/autoPayout',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PayoutStatusResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('401',
                             'Unauthorized — missing, expired, or invalid OAuth2 token',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_annual_statement_optsApiResponse

Returns whether the authenticated seller is opted in to annual statement generation and the current statement year. Delegates to GMPPaymentsPlatform GET /annualStatementOpts/partnerId.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/walmart_ap_is/apis/payouts_api.rb', line 138

def get_annual_statement_opts
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/disbursements/v4/payment/annualStatementOpts',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AnnualStatementOptsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('401',
                             'Unauthorized — missing, expired, or invalid OAuth2 token',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_faster_payout_eligibilityApiResponse

Returns whether the authenticated seller is eligible for an on-demand faster payout, along with the approved amount and any ineligibility reason. Delegates to GMPPaymentsPlatform GET /fasterPayout/eligibility/partnerId.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/walmart_ap_is/apis/payouts_api.rb', line 42

def get_faster_payout_eligibility
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/disbursements/v4/payment/fasterPayoutEligibility',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(FasterPayoutEligibilityResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('401',
                             'Unauthorized — missing, expired, or invalid OAuth2 token',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#get_payment_statusApiResponse

Returns the current payout status for the authenticated seller, including scheduled payout date, amount, and lifecycle state (Pending, Processing, Completed, Failed, OnHold). Delegates to GMPPaymentsPlatform (Phase 5).

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/walmart_ap_is/apis/payouts_api.rb', line 13

def get_payment_status
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/disbursements/v4/payment/paymentstatus',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PayoutStatusResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('401',
                             'Unauthorized — missing, expired, or invalid OAuth2 token',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#initiate_faster_payoutApiResponse

Triggers an immediate on-demand payout for the authenticated seller, bypassing the standard settlement schedule. Returns the payout ID and initial status. Requires "disbursements:write" scope. Delegates to GMPPaymentsPlatform (Phase 5).

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/walmart_ap_is/apis/payouts_api.rb', line 70

def initiate_faster_payout
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/disbursements/v4/payment/fasterPayout',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InitiatePayoutResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('401',
                             'Unauthorized — missing, expired, or invalid OAuth2 token',
                             ErrorListErrorException)
                .local_error('409',
                             'Conflict — resource state prevents this operation',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end