Class: ModernTreasury::IncomingPaymentDetailController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/modern_treasury/controllers/incoming_payment_detail_controller.rb

Overview

IncomingPaymentDetailController

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 ModernTreasury::BaseController

Instance Method Details

#create_async_incoming_payment_detail(idempotency_key: nil, body: nil) ⇒ AsyncResponse

Simulate Incoming Payment Detail something unique, preferably something like an UUID. type description here

Parameters:

  • idempotency_key (String) (defaults to: nil)

    Optional parameter: This key should be

  • body (IncomingPaymentDetailCreateRequest) (defaults to: nil)

    Optional parameter: TODO:

Returns:



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/modern_treasury/controllers/incoming_payment_detail_controller.rb', line 123

def create_async_incoming_payment_detail(idempotency_key: nil,
                                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/simulations/incoming_payment_details/create_async',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
               .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('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AsyncResponse.method(:from_hash))
                .local_error('404',
                             'not found',
                             ErrorMessageException)
                .local_error('405',
                             'not allowed',
                             ErrorMessageException)
                .local_error('422',
                             'unsuccessful',
                             ErrorMessageException))
    .execute
end

#get_incoming_payment_detail(id) ⇒ IncomingPaymentDetail

Get an existing Incoming Payment Detail. incoming payment detail.

Parameters:

  • id (String)

    Required parameter: The unique identifier of the

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/modern_treasury/controllers/incoming_payment_detail_controller.rb', line 71

def get_incoming_payment_detail(id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/incoming_payment_details/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IncomingPaymentDetail.method(:from_hash))
                .local_error('404',
                             'not found',
                             ErrorMessageException))
    .execute
end

#list_incoming_payment_details(per_page: nil, direction: nil, status: nil, type: nil, as_of_date_start: nil, as_of_date_end: nil, metadata: nil, virtual_account_id: nil, after_cursor: nil) ⇒ Array[IncomingPaymentDetail]

Get a list of Incoming Payment Details. here ‘debit`. incoming payment order. One of `pending`, `completed`, or `returned`. `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. payment details with an as_of_date starting on or after the specified date (YYYY-MM-DD). details with an as_of_date starting on or before the specified date (YYYY-MM-DD). you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters. payment detail is in a virtual account, the ID of the Virtual Account. here

Parameters:

  • per_page (Integer) (defaults to: nil)

    Optional parameter: TODO: type description

  • direction (Direction15Enum) (defaults to: nil)

    Optional parameter: One of ‘credit` or

  • status (Status21Enum) (defaults to: nil)

    Optional parameter: The current status of the

  • type (Type14Enum) (defaults to: nil)

    Optional parameter: One of: ‘ach`, `book`,

  • as_of_date_start (Date) (defaults to: nil)

    Optional parameter: Filters incoming

  • as_of_date_end (Date) (defaults to: nil)

    Optional parameter: Filters incoming payment

  • metadata (Hash[String, String]) (defaults to: nil)

    Optional parameter: For example, if

  • virtual_account_id (String) (defaults to: nil)

    Optional parameter: If the incoming

  • after_cursor (String) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/modern_treasury/controllers/incoming_payment_detail_controller.rb', line 33

def list_incoming_payment_details(per_page: nil,
                                  direction: nil,
                                  status: nil,
                                  type: nil,
                                  as_of_date_start: nil,
                                  as_of_date_end: nil,
                                  metadata: nil,
                                  virtual_account_id: nil,
                                  after_cursor: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/incoming_payment_details',
                                 Server::DEFAULT)
               .query_param(new_parameter(per_page, key: 'per_page'))
               .query_param(new_parameter(direction, key: 'direction'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(type, key: 'type'))
               .query_param(new_parameter(as_of_date_start, key: 'as_of_date_start'))
               .query_param(new_parameter(as_of_date_end, key: 'as_of_date_end'))
               .query_param(new_parameter(, key: 'metadata'))
               .query_param(new_parameter(, key: 'virtual_account_id'))
               .query_param(new_parameter(after_cursor, key: 'after_cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IncomingPaymentDetail.method(:from_hash))
                .is_response_array(true)
                .local_error('401',
                             'unsuccessful',
                             ErrorMessageException))
    .execute
end

#update_incoming_payment_detail(id, body: nil) ⇒ IncomingPaymentDetail

Update an existing Incoming Payment Detail. incoming payment detail. type description here

Parameters:

Returns:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/modern_treasury/controllers/incoming_payment_detail_controller.rb', line 95

def update_incoming_payment_detail(id,
                                   body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/api/incoming_payment_details/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .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('basic_auth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IncomingPaymentDetail.method(:from_hash))
                .local_error('404',
                             'not found',
                             ErrorMessageException))
    .execute
end