Class: DragonPay::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dragon_pay/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
# File 'lib/dragon_pay/client.rb', line 14

def initialize(options)
  self.transaction_id         = options[:transaction_id]
  self.amount                 = options[:amount]
  self.customer_email_address = options[:customer_email_address]
  fill_in_defaults(options)
end

Instance Attribute Details

#amount=(value) ⇒ Object

attributes that are required



12
13
14
# File 'lib/dragon_pay/client.rb', line 12

def amount=(value)
  @amount = value
end

#currencyObject

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def currency
  @currency
end

#customer_email_addressObject

attributes that are required



12
13
14
# File 'lib/dragon_pay/client.rb', line 12

def customer_email_address
  @customer_email_address
end

#digest=(value) ⇒ Object

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def digest=(value)
  @digest = value
end

#merchant_idObject

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def merchant_id
  @merchant_id
end

#param1Object

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def param1
  @param1
end

#param2Object

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def param2
  @param2
end

#payment_descriptionObject

attributes that can be generated from other attributes



9
10
11
# File 'lib/dragon_pay/client.rb', line 9

def payment_description
  @payment_description
end

#secret_keyObject

attributes that can be given default value



6
7
8
# File 'lib/dragon_pay/client.rb', line 6

def secret_key
  @secret_key
end

#transaction_idObject

attributes that are required



12
13
14
# File 'lib/dragon_pay/client.rb', line 12

def transaction_id
  @transaction_id
end

Instance Method Details

#generate_request_urlObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dragon_pay/client.rb', line 21

def generate_request_url
  %Q{
    #{payment_switch_url}?
     merchantid = #{merchant_id}&
          txnid = #{transaction_id}&
         amount = #{amount}&
            ccy = #{currency}&
    description = #{uri_encode(payment_description)}&
          email = #{uri_encode(customer_email_address)}&
         digest = #{digest}&
         param1 = #{param1}&
         param2 = #{param2}
  }.split.join
end