paytm-merchant 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4a499b9d32a0ae534d4962b1ccbcadab48fa6c0
4
- data.tar.gz: 337bd82a94f5989d41ef05ea0a3b6a3f7fb3bb27
3
+ metadata.gz: a5dc04189ff55f3ba21011dc3fcad44333aaf5c6
4
+ data.tar.gz: f57806c3333d525337f773e6a2906fd21bc0fd0c
5
5
  SHA512:
6
- metadata.gz: 7239598b7f787b7523c279e3081d9f9fe8a81ca4f42f40d43464eeba16ae9f6661f57a6cbea9460a02c33accd23daf0cd2d1bfc6dd4c25dc8ed48d61c8f4b086
7
- data.tar.gz: 1ad2ab76368be71d21c73c40e3e938ae84ea5fce786d64683e887053e8fb6997d94c9a4a63eb9a49072adcc63f8d96f549676a0460bf17a5f6f2c3d18453ffd9
6
+ metadata.gz: 0c8a6de3b585236a17cfe6e0dc9fca5d029d439c799dbaf3d2828429c69643d547fcfc309bc91713bc57cec13d412582f23bba1893e3ec63d5d4217d38396005
7
+ data.tar.gz: 3cd259c6e206fc7d100486559cd304d60d8b9c9528cdfcc855624251f1dad9aba53aa8b2daa1ea687d8ff5f987e819445f4e791db8fedcdec00d09badfe2ff54
data/README.md CHANGED
@@ -24,7 +24,7 @@ To setup, first initialize the library with credentials.
24
24
 
25
25
  ```ruby
26
26
  Paytm.config do |paytm|
27
- # paytm.base_uri = 'Some Base URI' # Default is staging api URI fpr paytm
27
+ # paytm.api_base_uri = 'Some Base URI' # Default is staging api URI fpr paytm
28
28
  paytm.merchant_guid = 'Paytm Merchant Guid'
29
29
  paytm.aes_key = 'Paytm AES Key'
30
30
  paytm.sales_wallet_id = 'Paytm Sales Wallet Id'
@@ -1,6 +1,6 @@
1
1
  InitializerContent = "# Paytm initializer to setup with configurations
2
2
  Paytm.config do |paytm|
3
- # paytm.base_uri = 'Some Base URI' # Default is staging api URI fpr paytm
3
+ # paytm.api_base_uri = 'Some Base URI' # Default is staging api URI fpr paytm
4
4
  paytm.merchant_guid = 'Paytm Merchant Guid'
5
5
  paytm.aes_key = 'Paytm AES Key'
6
6
  paytm.sales_wallet_id = 'Paytm Sales Wallet Id'
@@ -4,15 +4,12 @@ require 'httparty'
4
4
 
5
5
  module PayTM
6
6
  module Merchant
7
- include EncryptionNewPG
8
- include HTTParty
9
- extend EncryptionNewPG
10
7
 
11
- # Class Variables
12
- @@base_uri = nil
13
- @@merchant_guid = nil
14
- @@aes_key = nil
15
- @@sales_wallet_id = nil
8
+ def self.included(base)
9
+ base.send :include, HTTParty
10
+ base.extend EncryptionNewPG
11
+ base.extend ClassMethods
12
+ end
16
13
 
17
14
  # Constants
18
15
  Staging_Base_Uri = 'http://trust-uat.paytm.in'
@@ -25,20 +22,9 @@ module PayTM
25
22
  attr_accessor :amount, :recipient, :phone, :email, :metadata
26
23
 
27
24
  # Class Methods
28
- class << self
29
-
30
- def base_uri=(value)
31
- @@base_uri = value
32
- end
33
- def merchant_guid=(value)
34
- @@merchant_guid = value
35
- end
36
- def aes_key=(value)
37
- @@aes_key = value
38
- end
39
- def sales_wallet_id=(value)
40
- @@sales_wallet_id = value
41
- end
25
+ module ClassMethods
26
+ # Class attr_accessors
27
+ attr_accessor :api_base_uri, :merchant_guid, :aes_key, :sales_wallet_id
42
28
 
43
29
  def config(&block)
44
30
  instance_eval(&block)
@@ -47,7 +33,7 @@ module PayTM
47
33
 
48
34
  # Base URI for HTTParty requests
49
35
  def set_httparty_base_uri
50
- base_uri(@@base_uri || Staging_Base_Uri)
36
+ base_uri(api_base_uri || PayTM::Merchant::Staging_Base_Uri)
51
37
  end
52
38
 
53
39
  def check_transaction_status_for(transaction_id, options = {})
@@ -106,7 +92,7 @@ module PayTM
106
92
  requestType: request_type,
107
93
  txnType: transaction_type,
108
94
  txnId: transaction_id,
109
- merchantGuid: @@merchant_guid
95
+ merchantGuid: self.class.merchant_guid
110
96
  },
111
97
  platformName: 'PayTM',
112
98
  operationType: 'CHECK_TXN_STATUS'
@@ -121,10 +107,10 @@ module PayTM
121
107
  {
122
108
  request: {
123
109
  requestType: options[:request_type],
124
- merchantGuid: @@merchant_guid,
125
- merchantOrderId: options[:merchant_order_id] || "#{ @phone }-#{ Time.current.to_i }",
110
+ merchantGuid: self.class.merchant_guid,
111
+ merchantOrderId: options[:merchant_order_id] || "#{ @phone }-#{ Time.now.to_i }",
126
112
  salesWalletName: options[:sales_wallet_name],
127
- salesWalletGuid: @@sales_wallet_id,
113
+ salesWalletGuid: self.class.sales_wallet_id,
128
114
  payeeEmailId: @email,
129
115
  payeePhoneNumber: @phone,
130
116
  payeeSsoId: options[:payee_sso_id] || '',
@@ -143,8 +129,8 @@ module PayTM
143
129
  {
144
130
  'Content-Type' => 'application/json',
145
131
  'Accept' => 'application/json',
146
- 'mid' => @@merchant_guid,
147
- 'checksumhash' => generate_hash(@@aes_key, request_body)
132
+ 'mid' => self.class.merchant_guid,
133
+ 'checksumhash' => generate_hash(self.class.aes_key, request_body)
148
134
  }
149
135
  end
150
136
 
@@ -1,5 +1,5 @@
1
1
  module PayTM
2
2
  module Merchant
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paytm-merchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sachin
@@ -53,9 +53,9 @@ files:
53
53
  - Rakefile
54
54
  - bin/console
55
55
  - bin/setup
56
+ - lib/generators/paytm_setup_generator.rb
56
57
  - lib/paytm/merchant.rb
57
58
  - lib/paytm/merchant/encryption_new_p_g.rb
58
- - lib/paytm/merchant/generators/paytm_setup_generator.rb
59
59
  - lib/paytm/merchant/version.rb
60
60
  - paytm-merchant.gemspec
61
61
  homepage: https://github.com/schnmudgal/paytm-merchant.git