Class: Airwallex::Transfer
- Inherits:
-
APIResource
- Object
- APIResource
- Airwallex::Transfer
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve
- Defined in:
- lib/airwallex/resources/transfer.rb
Constant Summary collapse
- SIMULATION_PATH =
Sandbox-only — see https://www.airwallex.com/docs/api/simulation/transfers
"/api/v1/simulation/transfers"
Instance Attribute Summary
Attributes inherited from APIResource
Class Method Summary collapse
- .resource_path ⇒ Object
-
.simulate_transition(transfer_id, next_status:, failure_type: nil) ⇒ Transfer
Simulate a transfer's status advancing one step.
Instance Method Summary collapse
-
#cancel ⇒ Object
Cancel a pending transfer.
-
#simulate_transition(next_status:, failure_type: nil) ⇒ Transfer
Simulate this transfer's status advancing one step.
Methods included from APIOperations::Create
Methods included from APIOperations::Retrieve
Methods included from APIOperations::List
Methods inherited from APIResource
#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, symbolized_get, symbolized_post, #to_hash, #to_json, #to_s
Constructor Details
This class inherits a constructor from Airwallex::APIResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource
Class Method Details
.resource_path ⇒ Object
12 13 14 |
# File 'lib/airwallex/resources/transfer.rb', line 12 def self.resource_path "/api/v1/transfers" end |
.simulate_transition(transfer_id, next_status:, failure_type: nil) ⇒ Transfer
Simulate a transfer's status advancing one step
52 53 54 55 56 57 |
# File 'lib/airwallex/resources/transfer.rb', line 52 def self.simulate_transition(transfer_id, next_status:, failure_type: nil) params = { next_status: next_status } params[:failure_type] = failure_type if failure_type response = Airwallex.client.post("#{SIMULATION_PATH}/#{transfer_id}/transition", params) new(response) end |
Instance Method Details
#cancel ⇒ Object
Cancel a pending transfer
17 18 19 20 21 22 23 24 |
# File 'lib/airwallex/resources/transfer.rb', line 17 def cancel response = Airwallex.client.post( "#{self.class.resource_path}/#{id}/cancel", {} ) refresh_from(response) self end |
#simulate_transition(next_status:, failure_type: nil) ⇒ Transfer
Simulate this transfer's status advancing one step. The standard lifecycle is SCHEDULED -> PROCESSING -> SENT -> PAID, progressed one step at a time; OVERDUE, FAILED, and CANCELLED can be jumped to directly.
36 37 38 39 40 41 42 |
# File 'lib/airwallex/resources/transfer.rb', line 36 def simulate_transition(next_status:, failure_type: nil) params = { next_status: next_status } params[:failure_type] = failure_type if failure_type response = Airwallex.client.post("#{SIMULATION_PATH}/#{id}/transition", params) refresh_from(response) self end |