Class: Multicard::Resources::Payments
- Defined in:
- lib/multicard/resources/payments.rb
Instance Method Summary collapse
-
#confirm(payment_id, otp_code: nil) ⇒ Response
Confirm a payment (submit OTP code if required).
-
#create_by_card(card_number:, card_expiry:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay by card number (requires PCI DSS).
-
#create_by_token(card_token:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay by saved card token.
-
#create_split(card_token:, amount:, invoice_id:, split:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Split payment across multiple recipients.
-
#create_wallet(service:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay via wallet app (Payme, Click, Uzum, etc.).
-
#partial_refund(payment_id, refund_amount:, ofd:, card_pan: nil) ⇒ Response
Partial refund.
-
#refund(payment_id) ⇒ Response
Full refund.
-
#retrieve(payment_id) ⇒ Response
Retrieve payment info.
-
#send_fiscal_link(payment_id, fiscal_url:) ⇒ Response
Submit a fiscal receipt link.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Multicard::Resources::Base
Instance Method Details
#confirm(payment_id, otp_code: nil) ⇒ Response
Confirm a payment (submit OTP code if required).
93 94 95 96 |
# File 'lib/multicard/resources/payments.rb', line 93 def confirm(payment_id, otp_code: nil) body = otp_code ? { code: otp_code } : {} post("/payment/#{encode_path(payment_id)}/confirm", body) end |
#create_by_card(card_number:, card_expiry:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay by card number (requires PCI DSS).
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/multicard/resources/payments.rb', line 35 def create_by_card(card_number:, card_expiry:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **) post('/payment/card', { card: { number: card_number, expiry: card_expiry }, amount: amount, store_id: store_id || default_store_id, invoice_id: invoice_id, callback_url: callback_url, ofd: ofd, ** }.compact) end |
#create_by_token(card_token:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay by saved card token.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/multicard/resources/payments.rb', line 15 def create_by_token(card_token:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **) post('/payment/token', { card: { token: card_token }, amount: amount, store_id: store_id || default_store_id, invoice_id: invoice_id, callback_url: callback_url, ofd: ofd, ** }.compact) end |
#create_split(card_token:, amount:, invoice_id:, split:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Split payment across multiple recipients.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/multicard/resources/payments.rb', line 55 def create_split(card_token:, amount:, invoice_id:, split:, store_id: nil, callback_url: nil, ofd: nil, **) post('/payment/split', { card: { token: card_token }, amount: amount, store_id: store_id || default_store_id, invoice_id: invoice_id, callback_url: callback_url, split: split, ofd: ofd, ** }.compact) end |
#create_wallet(service:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **options) ⇒ Response
Pay via wallet app (Payme, Click, Uzum, etc.).
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/multicard/resources/payments.rb', line 75 def create_wallet(service:, amount:, invoice_id:, store_id: nil, callback_url: nil, ofd: nil, **) post('/payment/app', { service: service, amount: amount, store_id: store_id || default_store_id, invoice_id: invoice_id, callback_url: callback_url, ofd: ofd, ** }.compact) end |
#partial_refund(payment_id, refund_amount:, ofd:, card_pan: nil) ⇒ Response
Partial refund.
Cancels the original fiscal receipt and issues a new one for the remaining items (the ofd array is mandatory for partial refunds).
124 125 126 127 128 129 130 |
# File 'lib/multicard/resources/payments.rb', line 124 def partial_refund(payment_id, refund_amount:, ofd:, card_pan: nil) delete("/payment/#{encode_path(payment_id)}/partial", body: { refund_amount: refund_amount, ofd: ofd, card_pan: card_pan }.compact) end |
#refund(payment_id) ⇒ Response
Full refund.
110 111 112 |
# File 'lib/multicard/resources/payments.rb', line 110 def refund(payment_id) delete("/payment/#{encode_path(payment_id)}") end |
#retrieve(payment_id) ⇒ Response
Retrieve payment info.
102 103 104 |
# File 'lib/multicard/resources/payments.rb', line 102 def retrieve(payment_id) get("/payment/#{encode_path(payment_id)}") end |
#send_fiscal_link(payment_id, fiscal_url:) ⇒ Response
Submit a fiscal receipt link.
137 138 139 |
# File 'lib/multicard/resources/payments.rb', line 137 def send_fiscal_link(payment_id, fiscal_url:) post("/payment/#{encode_path(payment_id)}/fiscal", { fiscal_url: fiscal_url }) end |