Class: Multicard::Resources::Holds
- Defined in:
- lib/multicard/resources/holds.rb
Instance Method Summary collapse
-
#cancel(hold_id) ⇒ Response
Cancel a hold (release blocked funds).
-
#capture(hold_id, amount: nil) ⇒ Response
Capture (debit) held funds.
-
#confirm(hold_id, otp_code: nil) ⇒ Response
Confirm a hold (block funds on card).
-
#create(card_token:, amount:, invoice_id:, store_id: nil, **options) ⇒ Response
Create a hold (pre-authorization).
-
#retrieve(hold_id) ⇒ Response
Retrieve hold info.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Multicard::Resources::Base
Instance Method Details
#cancel(hold_id) ⇒ Response
Cancel a hold (release blocked funds).
55 56 57 |
# File 'lib/multicard/resources/holds.rb', line 55 def cancel(hold_id) delete("/hold/#{encode_path(hold_id)}") end |
#capture(hold_id, amount: nil) ⇒ Response
Capture (debit) held funds. Full or partial.
38 39 40 41 |
# File 'lib/multicard/resources/holds.rb', line 38 def capture(hold_id, amount: nil) body = amount ? { amount: amount } : {} post("/hold/#{encode_path(hold_id)}/charge", body) end |
#confirm(hold_id, otp_code: nil) ⇒ Response
Confirm a hold (block funds on card).
28 29 30 31 |
# File 'lib/multicard/resources/holds.rb', line 28 def confirm(hold_id, otp_code: nil) body = otp_code ? { code: otp_code } : {} post("/hold/#{encode_path(hold_id)}/confirm", body) end |
#create(card_token:, amount:, invoice_id:, store_id: nil, **options) ⇒ Response
Create a hold (pre-authorization).
13 14 15 16 17 18 19 20 21 |
# File 'lib/multicard/resources/holds.rb', line 13 def create(card_token:, amount:, invoice_id:, store_id: nil, **) post('/hold', { card: { token: card_token }, amount: amount, store_id: store_id || default_store_id, invoice_id: invoice_id, ** }.compact) end |
#retrieve(hold_id) ⇒ Response
Retrieve hold info.
47 48 49 |
# File 'lib/multicard/resources/holds.rb', line 47 def retrieve(hold_id) get("/hold/#{encode_path(hold_id)}") end |