Class: NewStoreApi::PaymentAccountController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/payment_account_controller.rb

Overview

PaymentAccountController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

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

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_account_charge(account_id, idempotency_key, body) ⇒ PostChargeResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Charges an account, asynchronously triggering capture requests for its payments if necessary. here here

Parameters:

  • account_id (String)

    Required parameter: TODO: type description

  • idempotency_key (String)

    Required parameter: TODO: type description

  • body (PostChargeRequest)

    Required parameter: Request body

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/new_store_api/controllers/payment_account_controller.rb', line 26

def (,
                          idempotency_key,
                          body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/payment/payments/accounts/{account_id}/charges',
                                 Server::API)
               .template_param(new_parameter(, key: 'account_id')
                                .should_encode(true))
               .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PostChargeResponse.method(:from_hash)))
    .execute
end