Class: ModernTreasury::PaymentOrderApi
- Defined in:
- lib/modern_treasury/apis/payment_order_api.rb
Overview
PaymentOrderApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_async_payment_order(idempotency_key: nil, body: nil) ⇒ ApiResponse
Create a new payment order asynchronously something unique, preferably something like an UUID.
-
#create_payment_order(type, amount, direction, originating_account_id, content_type: nil, idempotency_key: nil, subtype: nil, priority: nil, receiving_account_id: nil, accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, currency: nil, effective_date: nil, description: nil, statement_descriptor: nil, remittance_information: nil, purpose: nil, metadata: nil, charge_bearer: nil, foreign_exchange_indicator: nil, foreign_exchange_contract: nil, nsf_protected: nil, originating_party_name: nil, ultimate_originating_party_name: nil, ultimate_originating_party_identifier: nil, ultimate_receiving_party_name: nil, ultimate_receiving_party_identifier: nil, send_remittance_advice: nil, expires_at: nil, fallback_type: nil, receiving_account: nil, ledger_transaction: nil, line_items: nil, transaction_monitoring_enabled: nil, documents: nil) ⇒ ApiResponse
Create a new Payment Order ‘check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `signet`, `provexchange`.
-
#get_payment_order(id) ⇒ ApiResponse
Get details on a single payment order.
-
#list_payment_orders(after_cursor: nil, per_page: nil, type: nil, priority: nil, counterparty_id: nil, originating_account_id: nil, transaction_id: nil, status: nil, direction: nil, reference_number: nil, effective_date_start: nil, effective_date_end: nil, metadata: nil) ⇒ ApiResponse
Get a list of all payment orders here here For ACH and EFT payments, ‘high` represents a same-day ACH or EFT transfer, respectively.
-
#update_payment_order(id, body: nil) ⇒ ApiResponse
Update a payment order description here.
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 ModernTreasury::BaseApi
Instance Method Details
#create_async_payment_order(idempotency_key: nil, body: nil) ⇒ ApiResponse
Create a new payment order asynchronously something unique, preferably something like an UUID. type description here
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/modern_treasury/apis/payment_order_api.rb', line 15 def create_async_payment_order(idempotency_key: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/payment_orders/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)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException)) .execute end |
#create_payment_order(type, amount, direction, originating_account_id, content_type: nil, idempotency_key: nil, subtype: nil, priority: nil, receiving_account_id: nil, accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, currency: nil, effective_date: nil, description: nil, statement_descriptor: nil, remittance_information: nil, purpose: nil, metadata: nil, charge_bearer: nil, foreign_exchange_indicator: nil, foreign_exchange_contract: nil, nsf_protected: nil, originating_party_name: nil, ultimate_originating_party_name: nil, ultimate_originating_party_identifier: nil, ultimate_receiving_party_name: nil, ultimate_receiving_party_identifier: nil, send_remittance_advice: nil, expires_at: nil, fallback_type: nil, receiving_account: nil, ledger_transaction: nil, line_items: nil, transaction_monitoring_enabled: nil, documents: nil) ⇒ ApiResponse
Create a new Payment Order ‘check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `signet`, `provexchange`. smallest unit. e.g. $10 would be represented as 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000. `debit`. Describes the direction money is flowing in the transaction. A `credit` moves money from your account to someone else’s. A ‘debit` pulls money from someone else’s account to your own. Note that wire, rtp, and check payments will always be ‘credit`. of one of your organization’s internal accounts. something unique, preferably something like an UUID. classification for the type of payment order you are doing. This field is only used for ‘ach` payment orders currently. For `ach` payment orders, the `subtype` represents the SEC code. We currently support `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`. For ACH and EFT payments, `high` represents a same-day ACH or EFT transfer, respectively. For check payments, `high` can mean an overnight check rather than standard mail. `receiving_account` or `receiving_account_id` must be present. When using `receiving_account_id`, you may pass the id of an external account or an internal account. here of one of your accounting categories. Note that these will only be accessible if your accounting system has been connected. ID of one of your accounting ledger classes. Note that these will only be accessible if your accounting system has been connected. code. be posted to the participants’ account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd. for internal use. descriptor which will appear in the receiver’s statement. For ‘check` payments this field will be used as the memo line. For `ach` the maximum length is 10 characters. Note that for ACH payments, the name on your bank account will be included automatically by the bank, so you can use the characters for other useful information. For `eft` the maximum length is 15 characters. field will be passed through on an addenda record. For `wire` payments the field will be passed through as the “Originator to Beneficiary Information”, also known as OBI or Fedwire tag 6000. the purpose which is transmitted via the “InstrForDbtrAgt” field in the ISO20022 file. If you are using Currencycloud, this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit CPA Code that will be attached to the payment. represented as key-value pairs. Both the key and value must be strings. will pay the fees for the payment order. Only applies to wire payment orders. Can be one of shared, sender, or receiver, which correspond respectively with the SWIFT 71A values `SHA`, `OUR`, `BEN`. parameter: Indicates the type of FX transfer to initiate, can be either `variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order currency matches the originating account currency. indicates a specific foreign exchange contract number that has been generated by your financial institution. boolean to determine if NSF Protection is enabled for this payment order. Note that this setting must also be turned on in your organization settings page. this will replace your default company name on receiver’s bank statement. This field can only be used for ACH payments currently. For ACH, only the first 16 characters of this string will be used. Any additional characters will be truncated. of the ultimate originator of the payment order. Identifier of the ultimate originator of the payment order. the ultimate funds recipient. Identifier of the ultimate funds recipient. Send an email to the counterparty when the payment order is sent to the bank. If ‘null`, `send_remittance_advice` on the Counterparty is used. expires_at. This value must be past the effective_date. fallback to if the original type is not valid for the receiving account. Currently, this only supports falling back from RTP to ACH (type=rtp and fallback_type=ach) `receiving_account` or `receiving_account_id` must be present. When using `receiving_account_id`, you may pass the id of an external account or an internal account. parameter: TODO: type description here line items that must sum up to the amount of the payment order. parameter: A flag that determines whether a payment order should go through transaction monitoring. array of documents to be attached to the payment order. Note that if you attach documents, the request’s content type must be ‘multipart/form-data`.
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/modern_treasury/apis/payment_order_api.rb', line 223 def create_payment_order(type, amount, direction, originating_account_id, content_type: nil, idempotency_key: nil, subtype: nil, priority: nil, receiving_account_id: nil, accounting: nil, accounting_category_id: nil, accounting_ledger_class_id: nil, currency: nil, effective_date: nil, description: nil, statement_descriptor: nil, remittance_information: nil, purpose: nil, metadata: nil, charge_bearer: nil, foreign_exchange_indicator: nil, foreign_exchange_contract: nil, nsf_protected: nil, originating_party_name: nil, ultimate_originating_party_name: nil, ultimate_originating_party_identifier: nil, ultimate_receiving_party_name: nil, ultimate_receiving_party_identifier: nil, send_remittance_advice: nil, expires_at: nil, fallback_type: nil, receiving_account: nil, ledger_transaction: nil, line_items: nil, transaction_monitoring_enabled: nil, documents: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/payment_orders', Server::DEFAULT) .form_param(new_parameter(type, key: 'type') .is_required(true)) .form_param(new_parameter(amount, key: 'amount') .is_required(true)) .form_param(new_parameter(direction, key: 'direction') .is_required(true)) .form_param(new_parameter(originating_account_id, key: 'originating_account_id') .is_required(true)) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .form_param(new_parameter(subtype, key: 'subtype')) .form_param(new_parameter(priority, key: 'priority')) .form_param(new_parameter(receiving_account_id, key: 'receiving_account_id')) .form_param(new_parameter(accounting, key: 'accounting')) .form_param(new_parameter(accounting_category_id, key: 'accounting_category_id')) .form_param(new_parameter(accounting_ledger_class_id, key: 'accounting_ledger_class_id')) .form_param(new_parameter(currency, key: 'currency')) .form_param(new_parameter(effective_date, key: 'effective_date')) .form_param(new_parameter(description, key: 'description')) .form_param(new_parameter(statement_descriptor, key: 'statement_descriptor')) .form_param(new_parameter(remittance_information, key: 'remittance_information')) .form_param(new_parameter(purpose, key: 'purpose')) .form_param(new_parameter(, key: 'metadata')) .form_param(new_parameter(charge_bearer, key: 'charge_bearer')) .form_param(new_parameter(foreign_exchange_indicator, key: 'foreign_exchange_indicator')) .form_param(new_parameter(foreign_exchange_contract, key: 'foreign_exchange_contract')) .form_param(new_parameter(nsf_protected, key: 'nsf_protected')) .form_param(new_parameter(originating_party_name, key: 'originating_party_name')) .form_param(new_parameter(ultimate_originating_party_name, key: 'ultimate_originating_party_name')) .form_param(new_parameter(ultimate_originating_party_identifier, key: 'ultimate_originating_party_identifier')) .form_param(new_parameter(ultimate_receiving_party_name, key: 'ultimate_receiving_party_name')) .form_param(new_parameter(ultimate_receiving_party_identifier, key: 'ultimate_receiving_party_identifier')) .form_param(new_parameter(send_remittance_advice, key: 'send_remittance_advice')) .form_param(new_parameter(expires_at, key: 'expires_at')) .form_param(new_parameter(fallback_type, key: 'fallback_type')) .form_param(new_parameter(receiving_account, key: 'receiving_account')) .form_param(new_parameter(ledger_transaction, key: 'ledger_transaction')) .form_param(new_parameter(line_items, key: 'line_items')) .form_param(new_parameter(transaction_monitoring_enabled, key: 'transaction_monitoring_enabled')) .form_param(new_parameter(documents, key: 'documents')) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type')) .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(PaymentOrder.method(:from_hash)) .is_api_response(true) .local_error('400', 'parameter_invalid', ErrorMessageException) .local_error('401', 'unsuccessful', ErrorMessageException) .local_error('403', 'forbidden', ErrorMessageException) .local_error('422', 'unsuccessful', ErrorMessageException)) .execute end |
#get_payment_order(id) ⇒ ApiResponse
Get details on a single payment order
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/modern_treasury/apis/payment_order_api.rb', line 327 def get_payment_order(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/payment_orders/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .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(PaymentOrder.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_payment_orders(after_cursor: nil, per_page: nil, type: nil, priority: nil, counterparty_id: nil, originating_account_id: nil, transaction_id: nil, status: nil, direction: nil, reference_number: nil, effective_date_start: nil, effective_date_end: nil, metadata: nil) ⇒ ApiResponse
Get a list of all payment orders here here For ACH and EFT payments, ‘high` represents a same-day ACH or EFT transfer, respectively. For check payments, `high` can mean an overnight check rather than standard mail. description here type description here transaction that the payment order has been reconciled to. with the provided reference number bound for searching effective_date bound for searching effective_date 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.
66 67 68 69 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 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/modern_treasury/apis/payment_order_api.rb', line 66 def list_payment_orders(after_cursor: nil, per_page: nil, type: nil, priority: nil, counterparty_id: nil, originating_account_id: nil, transaction_id: nil, status: nil, direction: nil, reference_number: nil, effective_date_start: nil, effective_date_end: nil, metadata: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/payment_orders', Server::DEFAULT) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .query_param(new_parameter(type, key: 'type')) .query_param(new_parameter(priority, key: 'priority')) .query_param(new_parameter(counterparty_id, key: 'counterparty_id')) .query_param(new_parameter(originating_account_id, key: 'originating_account_id')) .query_param(new_parameter(transaction_id, key: 'transaction_id')) .query_param(new_parameter(status, key: 'status')) .query_param(new_parameter(direction, key: 'direction')) .query_param(new_parameter(reference_number, key: 'reference_number')) .query_param(new_parameter(effective_date_start, key: 'effective_date_start')) .query_param(new_parameter(effective_date_end, key: 'effective_date_end')) .query_param(new_parameter(, key: 'metadata')) .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(PaymentOrder.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |
#update_payment_order(id, body: nil) ⇒ ApiResponse
Update a payment order description here
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/modern_treasury/apis/payment_order_api.rb', line 352 def update_payment_order(id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/api/payment_orders/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .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(PaymentOrder.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException) .local_error('422', 'parameter_invalid', ErrorMessageException)) .execute end |