Class: PaymobRuby::PayToken

Inherits:
ApplicationService show all
Defined in:
lib/paymob_ruby/api/pay_token.rb

Instance Method Summary collapse

Methods inherited from ApplicationService

call, #failure, #success

Instance Method Details

#call(user:, amount:, integration_id:, cc_token:, commission_fees: 0) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/paymob_ruby/api/pay_token.rb', line 3

def call(user:, amount:, integration_id:, cc_token:, commission_fees: 0)
  @cc_token = cc_token
  result = PaymobRuby::PaymentToken.call(
    integration_id:,
    user:,
    amount:,
    commission_fees:
  ).payload
  @payment_token = result[:payment_token]

  response = pay!

  success({ response: }.merge(result))
end