airwallex 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Airwallex
4
+ # Represents a Request for Information (RFI) — a compliance question
5
+ # Airwallex raises against your account (KYC, an ongoing KYC review, a
6
+ # cardholder, a transaction, payment enablement, or merchant risk).
7
+ #
8
+ # Supports retrieving and listing real RFIs, plus the sandbox Simulation
9
+ # endpoints for raising, closing and following up on them (there is no
10
+ # live create — real RFIs originate from Airwallex's own compliance
11
+ # review, same as Dispute). See
12
+ # https://www.airwallex.com/docs/api/risk/request_for_information_rfi and
13
+ # https://www.airwallex.com/docs/api/simulation/request-for-information
14
+ #
15
+ # Statuses: ACTION_REQUIRED, ANSWERED, CLOSED. Types: KYC, KYC_ONGOING,
16
+ # CARDHOLDER, TRANSACTION, PAYMENT_ENABLEMENT, MERCHANT_RISK.
17
+ #
18
+ # Reading RFIs requires the API key's "Risk → Request for Information
19
+ # (RFI): Read" permission — without it Airwallex returns 401
20
+ # (AuthenticationError).
21
+ #
22
+ # @example Retrieve an RFI for a connected account
23
+ # rfi = Airwallex::RFI.retrieve("rfi_123", headers: { "x-on-behalf-of" => "acct_123" })
24
+ # rfi.status # => "ACTION_REQUIRED"
25
+ # rfi.active_request[:questions].first # => { id: ..., title: { en: ... }, ... }
26
+ #
27
+ # @example List open RFIs, following every page
28
+ # Airwallex::RFI.list(
29
+ # { statuses: "ACTION_REQUIRED" },
30
+ # headers: { "x-on-behalf-of" => "acct_123" }
31
+ # ).auto_paging_each { |rfi| puts rfi.id }
32
+ #
33
+ # @example Raise a KYC RFI, then close it
34
+ # rfi = Airwallex::RFI.simulate_create(
35
+ # type: "KYC",
36
+ # questions: [{ answer: { type: "TEXT" } }]
37
+ # )
38
+ # rfi.simulate_close
39
+ class RFI < APIResource
40
+ extend APIOperations::Retrieve
41
+ extend APIOperations::List
42
+
43
+ # Sandbox-only — see https://www.airwallex.com/docs/api/simulation/request-for-information
44
+ SIMULATION_PATH = "/api/v1/simulation/rfis"
45
+
46
+ # @return [String] API resource path for RFIs
47
+ def self.resource_path
48
+ "/api/v1/rfis"
49
+ end
50
+
51
+ # List RFIs. Unlike most resources, RFIs use bookmark pagination: the
52
+ # response carries page_after/page_before instead of has_more/next_cursor,
53
+ # and the next page is requested with page: <page_after>.
54
+ #
55
+ # @param params [Hash] page: (bookmark), page_size: (1-2000, default
56
+ # 100), statuses: / types: (comma-separated strings, e.g.
57
+ # "ACTION_REQUIRED,ANSWERED"), from_created_at: / end_created_at:
58
+ # (ISO8601)
59
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id }),
60
+ # kept on every subsequent page
61
+ # @return [ListObject<RFI>]
62
+ def self.list(params = {}, opts = {})
63
+ response = Airwallex.client.get(resource_path, params, opts[:headers] || {})
64
+ items = extract_data(response)
65
+ page_after = response.is_a?(Hash) ? response[:page_after] || response["page_after"] : nil
66
+
67
+ ListObject.new(
68
+ data: items,
69
+ has_more: !page_after.nil? && !items.empty?,
70
+ next_cursor: page_after,
71
+ cursor_param: :page,
72
+ resource_class: self,
73
+ params: params,
74
+ opts: opts
75
+ )
76
+ end
77
+
78
+ # Simulate Airwallex raising an RFI
79
+ #
80
+ # @param params [Hash] type: (required, one of "KYC", "KYC_ONGOING",
81
+ # "CARDHOLDER", "TRANSACTION", "PAYMENT_ENABLEMENT",
82
+ # "MERCHANT_RISK"); questions: (required, array of
83
+ # { answer: { type: }, sources: [] })
84
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id })
85
+ # @return [RFI]
86
+ def self.simulate_create(params = {}, opts = {})
87
+ response = Airwallex.client.post("#{SIMULATION_PATH}/create", params, opts[:headers] || {})
88
+ new(response)
89
+ end
90
+
91
+ # Simulate closing an RFI
92
+ #
93
+ # @param rfi_id [String]
94
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id })
95
+ # @return [RFI]
96
+ def self.simulate_close(rfi_id, opts = {})
97
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{rfi_id}/close", {}, opts[:headers] || {})
98
+ new(response)
99
+ end
100
+
101
+ # Simulate a follow-up on an RFI — reopen an existing answered question
102
+ # (by id) or append a new one
103
+ #
104
+ # @param rfi_id [String]
105
+ # @param params [Hash] questions: (required, array of
106
+ # { id: } or { answer: { type: }, sources: [] })
107
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id })
108
+ # @return [RFI]
109
+ def self.simulate_follow_up(rfi_id, params = {}, opts = {})
110
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{rfi_id}/follow_up", params, opts[:headers] || {})
111
+ new(response)
112
+ end
113
+
114
+ # Simulate closing this RFI
115
+ #
116
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id })
117
+ # @return [RFI] self
118
+ def simulate_close(opts = {})
119
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{id}/close", {}, opts[:headers] || {})
120
+ refresh_from(response)
121
+ self
122
+ end
123
+
124
+ # Simulate a follow-up on this RFI
125
+ #
126
+ # @param params [Hash] questions: (required)
127
+ # @param opts [Hash] headers: (e.g. { "x-on-behalf-of" => account_id })
128
+ # @return [RFI] self
129
+ def simulate_follow_up(params = {}, opts = {})
130
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{id}/follow_up", params, opts[:headers] || {})
131
+ refresh_from(response)
132
+ self
133
+ end
134
+ end
135
+ end
@@ -6,6 +6,9 @@ module Airwallex
6
6
  extend APIOperations::Retrieve
7
7
  extend APIOperations::List
8
8
 
9
+ # Sandbox-only — see https://www.airwallex.com/docs/api/simulation/transfers
10
+ SIMULATION_PATH = "/api/v1/simulation/transfers"
11
+
9
12
  def self.resource_path
10
13
  "/api/v1/transfers"
11
14
  end
@@ -19,5 +22,38 @@ module Airwallex
19
22
  refresh_from(response)
20
23
  self
21
24
  end
25
+
26
+ # Simulate this transfer's status advancing one step. The standard
27
+ # lifecycle is SCHEDULED -> PROCESSING -> SENT -> PAID, progressed one
28
+ # step at a time; OVERDUE, FAILED, and CANCELLED can be jumped to
29
+ # directly.
30
+ #
31
+ # @param next_status [String] one of "OVERDUE", "PROCESSING", "SENT",
32
+ # "PAID", "FAILED", "CANCELLED"
33
+ # @param failure_type [String, nil] failure reason code, only
34
+ # meaningful when next_status is "FAILED"
35
+ # @return [Transfer] self
36
+ def simulate_transition(next_status:, failure_type: nil)
37
+ params = { next_status: next_status }
38
+ params[:failure_type] = failure_type if failure_type
39
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{id}/transition", params)
40
+ refresh_from(response)
41
+ self
42
+ end
43
+
44
+ # Simulate a transfer's status advancing one step
45
+ #
46
+ # @param transfer_id [String]
47
+ # @param next_status [String] one of "OVERDUE", "PROCESSING", "SENT",
48
+ # "PAID", "FAILED", "CANCELLED"
49
+ # @param failure_type [String, nil] failure reason code, only
50
+ # meaningful when next_status is "FAILED"
51
+ # @return [Transfer]
52
+ def self.simulate_transition(transfer_id, next_status:, failure_type: nil)
53
+ params = { next_status: next_status }
54
+ params[:failure_type] = failure_type if failure_type
55
+ response = Airwallex.client.post("#{SIMULATION_PATH}/#{transfer_id}/transition", params)
56
+ new(response)
57
+ end
22
58
  end
23
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Airwallex
4
- VERSION = "0.8.0"
4
+ VERSION = "0.10.0"
5
5
  end
data/lib/airwallex.rb CHANGED
@@ -48,6 +48,13 @@ require_relative "airwallex/resources/connected_account"
48
48
  require_relative "airwallex/resources/account_amendment"
49
49
  require_relative "airwallex/resources/funds_split"
50
50
  require_relative "airwallex/resources/charge"
51
+ require_relative "airwallex/resources/deposit"
52
+ require_relative "airwallex/resources/issuing_transaction"
53
+ require_relative "airwallex/resources/cardholder"
54
+ require_relative "airwallex/resources/linked_account"
55
+ require_relative "airwallex/resources/account_offboarding"
56
+ require_relative "airwallex/resources/rfi"
57
+ require_relative "airwallex/resources/pos_terminal"
51
58
 
52
59
  module Airwallex
53
60
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airwallex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chayut Orapinpatipat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-02 00:00:00.000000000 Z
11
+ date: 2026-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -81,6 +81,7 @@ files:
81
81
  - lib/airwallex/middleware/auth_refresh.rb
82
82
  - lib/airwallex/middleware/idempotency.rb
83
83
  - lib/airwallex/resources/account_amendment.rb
84
+ - lib/airwallex/resources/account_offboarding.rb
84
85
  - lib/airwallex/resources/balance.rb
85
86
  - lib/airwallex/resources/batch_transfer.rb
86
87
  - lib/airwallex/resources/beneficiary.rb
@@ -89,23 +90,29 @@ files:
89
90
  - lib/airwallex/resources/billing_product.rb
90
91
  - lib/airwallex/resources/billing_subscription.rb
91
92
  - lib/airwallex/resources/billing_subscription_item.rb
93
+ - lib/airwallex/resources/cardholder.rb
92
94
  - lib/airwallex/resources/charge.rb
93
95
  - lib/airwallex/resources/connected_account.rb
94
96
  - lib/airwallex/resources/conversion.rb
95
97
  - lib/airwallex/resources/customer.rb
98
+ - lib/airwallex/resources/deposit.rb
96
99
  - lib/airwallex/resources/dispute.rb
97
100
  - lib/airwallex/resources/funds_split.rb
98
101
  - lib/airwallex/resources/global_account.rb
99
102
  - lib/airwallex/resources/global_account_alias.rb
100
103
  - lib/airwallex/resources/global_account_mandate.rb
101
104
  - lib/airwallex/resources/global_account_transaction.rb
105
+ - lib/airwallex/resources/issuing_transaction.rb
106
+ - lib/airwallex/resources/linked_account.rb
102
107
  - lib/airwallex/resources/payment_consent.rb
103
108
  - lib/airwallex/resources/payment_intent.rb
104
109
  - lib/airwallex/resources/payment_method.rb
105
110
  - lib/airwallex/resources/payment_source.rb
111
+ - lib/airwallex/resources/pos_terminal.rb
106
112
  - lib/airwallex/resources/quote.rb
107
113
  - lib/airwallex/resources/rate.rb
108
114
  - lib/airwallex/resources/refund.rb
115
+ - lib/airwallex/resources/rfi.rb
109
116
  - lib/airwallex/resources/transfer.rb
110
117
  - lib/airwallex/util.rb
111
118
  - lib/airwallex/version.rb
@@ -137,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
144
  - !ruby/object:Gem::Version
138
145
  version: '0'
139
146
  requirements: []
140
- rubygems_version: 3.5.22
147
+ rubygems_version: 3.5.16
141
148
  signing_key:
142
149
  specification_version: 4
143
150
  summary: Production-grade Ruby client for the Airwallex API