Module: PayTM::Merchant

Included in:
Paytm
Defined in:
lib/paytm/merchant.rb,
lib/paytm/merchant/version.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

Staging_Base_Uri =

Constants

'https://trust-uat.paytm.in'
End_Points =
{
  salestouser: '/wallet-web/salesToUserCredit',
  checkstatus: '/wallet-web/checkStatus'
}
VERSION =
'0.2.1.1'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amountObject

Attr_accessors



22
23
24
# File 'lib/paytm/merchant.rb', line 22

def amount
  @amount
end

#emailObject

Attr_accessors



22
23
24
# File 'lib/paytm/merchant.rb', line 22

def email
  @email
end

#metadataObject

Attr_accessors



22
23
24
# File 'lib/paytm/merchant.rb', line 22

def 
  @metadata
end

#phoneObject

Attr_accessors



22
23
24
# File 'lib/paytm/merchant.rb', line 22

def phone
  @phone
end

#recipientObject

Attr_accessors



22
23
24
# File 'lib/paytm/merchant.rb', line 22

def recipient
  @recipient
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/paytm/merchant.rb', line 8

def self.included(base)
  base.send :include, HTTParty
  base.extend EncryptionNewPG
  base.extend ClassMethods
end

Instance Method Details

#check_transaction_status_for(transaction_id, options = {}) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/paytm/merchant.rb', line 66

def check_transaction_status_for(transaction_id, options = {})
  check_transaction_body = paytm_check_transation_status_body(transaction_id, options)
  @response = self.class.post(
    End_Points[:checkstatus],
    {
      body: check_transaction_body.to_json,
      headers: paytm_check_transation_status_header(check_transaction_body),
      verify: (options[:verify] == false ? false : true)
    }
  )
end

#initialize(data = {}) ⇒ Object

Instance Methods



46
47
48
49
50
51
# File 'lib/paytm/merchant.rb', line 46

def initialize(data = {})
  @amount = data[:amount]
  @recipient = data[:recipient]
  @phone = data[:phone]
  @email = data[:email]
end

#transfer(options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/paytm/merchant.rb', line 53

def transfer(options = {})
  @amount = amount if options[:amount]

  @response = self.class.post(
    End_Points[:salestouser],
    {
      body: paytm_request_body(options).to_json,
      headers: paytm_request_headers,
      verify: (options[:verify] == false ? false : true)
    }
  )
end