@@ -144,6 +144,12 @@ def collect_customer_details(identity, options = {})
144
144
# The endpoint takes the same payload as Customer Bank Accounts, but check
145
145
# the bank account is valid for the billing request scheme before creating
146
146
# and attaching it.
147
+ #
148
+ # _ACH scheme_ For compliance reasons, an extra validation step is done using
149
+ # a third-party provider to make sure the customer's bank account can accept
150
+ # Direct Debit. If a bank account is discovered to be closed or invalid, the
151
+ # customer is requested to adjust the account number/routing number and
152
+ # succeed in this check to continue with the flow.
147
153
# Example URL: /billing_requests/:identity/actions/collect_bank_account
148
154
#
149
155
# @param identity # Unique identifier, beginning with "BRQ".
@@ -218,6 +224,46 @@ def fulfil(identity, options = {})
218
224
Resources ::BillingRequest . new ( unenvelope_body ( response . body ) , response )
219
225
end
220
226
227
+ # This will allow for the updating of the currency and subsequently the scheme
228
+ # if needed for a billing request
229
+ # this will only be available for mandate only flows, it will not support
230
+ # payments requests or plans
231
+ # Example URL: /billing_requests/:identity/actions/choose_currency
232
+ #
233
+ # @param identity # Unique identifier, beginning with "BRQ".
234
+ # @param options [Hash] parameters as a hash, under a params key.
235
+ def choose_currency ( identity , options = { } )
236
+ path = sub_url ( '/billing_requests/:identity/actions/choose_currency' , 'identity' => identity )
237
+
238
+ params = options . delete ( :params ) || { }
239
+ options [ :params ] = { }
240
+ options [ :params ] [ 'data' ] = params
241
+
242
+ options [ :retry_failures ] = false
243
+
244
+ begin
245
+ response = make_request ( :post , path , options )
246
+
247
+ # Response doesn't raise any errors until #body is called
248
+ response . tap ( &:body )
249
+ rescue InvalidStateError => e
250
+ if e . idempotent_creation_conflict?
251
+ case @api_service . on_idempotency_conflict
252
+ when :raise
253
+ raise IdempotencyConflict , e . error
254
+ when :fetch
255
+ return get ( e . conflicting_resource_id )
256
+ end
257
+ end
258
+
259
+ raise e
260
+ end
261
+
262
+ return if response . body . nil?
263
+
264
+ Resources ::BillingRequest . new ( unenvelope_body ( response . body ) , response )
265
+ end
266
+
221
267
# This is needed when you have a mandate request. As a scheme compliance rule we
222
268
# are required to
223
269
# allow the payer to crosscheck the details entered by them and confirm it.
0 commit comments