Class: Paymob::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/paymob/base.rb

Constant Summary collapse

REQUIRED_BILLING_DATA_FIELDS =
%i[first_name last_name email phone_number].freeze
REQUIRED_PAYMENT_FIELDS =
%i[amount billing_data payment_reference].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accept_apiObject

Returns the value of attribute accept_api.



7
8
9
# File 'lib/paymob/base.rb', line 7

def accept_api
  @accept_api
end

Instance Method Details

#initialize_order(payment_params) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/paymob/base.rb', line 9

def initialize_order(payment_params)
  validate_payment_params(payment_params)
  @accept_api = AcceptAPI.new(amount: payment_params[:amount], billing_data: payment_params[:billing_data],
                              payment_reference: payment_params[:payment_reference])
  @accept_api.authenticate
  @accept_api.create_order
  @accept_api.request_payment_key(integration_id)
end