paya 0.9.2 → 0.9.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: 280044176ed7f32b10a574989da8ce082e7afc9e
4
- data.tar.gz: 41251798b257c3914d5686134feefc8465633677
3
+ metadata.gz: e27d7653e50438032be08abf8a04c953464bcd3d
4
+ data.tar.gz: 6a55d44020af326aec2aebd043102b2c85662fd6
5
5
  SHA512:
6
- metadata.gz: 81bdc5ccae0731499557ad46e311e5924e89a0ce304628574435d9bd6e564d2550aeafdfa3bc5160df05fd59d874b0dc5a2df5668cec5090b971e07850314da6
7
- data.tar.gz: 1326bf96f99bb8eb325ee5bf22079556193b6c2407a756575509a6c02c434aeb8cadafcddc9fbf3dcce7b70a0b7140275781e2a13c7d417e5c0d4d50048cdad9
6
+ metadata.gz: 996bd6c5b0fb865217ea7bd48352f9dd59b57ec8617da1dbbf0ce40849ac67024484d611b8884b54c4d2de25786e98f2c0789f29f16147052b3eb1bec980b882
7
+ data.tar.gz: 4ad7c14d4942d51f2ef947be12fd6823cfc34904e857150dc0dde36643efcd8d73d6375d886dfb576967eca652b35301e0e23fdea64309e15481d5d7c5ad9266
@@ -0,0 +1,14 @@
1
+ module Jem
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+ desc "Creates Paya initializer for your application"
6
+
7
+ def copy_initializer
8
+ template "paya_initializer.rb", "config/initializers/paya.rb"
9
+
10
+ puts "Install complete! Truly Outrageous!"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'paya'
2
+ require 'securerandom'
3
+
4
+ Paya.configure do |config|
5
+ # config.user_name = "YOUR-USER-NAME"
6
+ # config.password = "YOUR-PASSWORD"
7
+ # config.production = true
8
+
9
+ # config.ccd_terminal_id = 000000
10
+ # config.ppd_terminal_id = 000000
11
+ # config.web_terminal_id = 000000
12
+ # config.tel_terminal_id = 000000
13
+ end
@@ -93,7 +93,6 @@ xml
93
93
  xml
94
94
 
95
95
  class << self
96
- attr_accessor :user_name, :password, :production
97
96
 
98
97
  def client
99
98
  test_mode ? sandbox_client : live_client
@@ -112,4 +111,19 @@ xml
112
111
  end
113
112
 
114
113
  end
114
+
115
+ def self.configure
116
+ self.configuration ||= Configuration.new
117
+ yield(configuration)
118
+ end
119
+
120
+ class Configuration
121
+ attr_accessor :user_name, :password, :production, :ccd_terminal_id, :ppd_terminal_id, :tel_terminal_id, :web_terminal_id
122
+
123
+ def initialize
124
+ @production = false
125
+ end
126
+ end
127
+
128
+
115
129
  end
@@ -1,7 +1,7 @@
1
1
  module Paya
2
2
  class Base
3
3
 
4
- def process_payment options, type=:ccd, guaranteed=true, debit_only=true, check_verification=false, identity_verification=false, dl_required=false
4
+ def process options, type=:ccd, guaranteed=true, debit_only=true, check_verification=false, identity_verification=false, dl_required=false
5
5
  type = type.to_s.capitalize
6
6
  sub_type = guaranteed ? 'Guaranteed' : 'NonGuaranteed'
7
7
  payment_type = debit_only ? 'DebitTransaction' : 'CreditDebitTransaction'
@@ -11,22 +11,35 @@ module Paya
11
11
  handler.process check_verification, identity_verification, dl_required
12
12
  end
13
13
 
14
+ def process_single_ccd_check options={}, identifier='R'
15
+ process_single_check options, Paya.configuration.ccd_terminal_id, identifier
16
+ end
17
+
18
+ def process_single_ppd_check options={}, identifier='R'
19
+ process_single_check options, Paya.configuration.ppd_terminal_id, identifier
20
+ end
21
+
22
+ def process_single_web_check options={}, identifier='R'
23
+ process_single_check options, Paya.configuration.web_terminal_id, identifier
24
+ end
25
+
26
+ def process_single_tel_check options={}, identifier='R'
27
+ process_single_check options, Paya.configuration.tel_terminal_id, identifier
28
+ end
29
+
14
30
  def process_single_check options={}, terminal_id=nil, identifier='R'
15
- =begin
16
31
  @terminal_id = terminal_id.to_s
17
32
  @data_packet = data_packet(options, identifier)
18
- xml = Paya::PROCESS_SINGLE_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
19
- response = Paya.client.call(:process_single_certification_check, xml: xml)
20
- response_hash = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_check_result])
33
+ xml = Paya::PROCESS_SINGLE_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.configuration.user_name).gsub("&&&PASSWORD&&&", Paya.configuration.password)
34
+ response = Paya.client.call(:process_single_check, xml: xml)
35
+ response_hash = Hash.from_xml(response.body[:process_single_check_response][:process_single_check_result])
21
36
  {request: xml, response: response_hash}
22
- =end
23
- process_single_certification_check options, terminal_id, identifier
24
37
  end
25
38
 
26
39
  def process_single_check_with_token
27
40
  @terminal_id = terminal_id.to_s
28
41
  @data_packet = data_packet(options, identifier)
29
- xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
42
+ xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.configuration.user_name).gsub("&&&PASSWORD&&&", Paya.configuration.password)
30
43
  response = Paya.client.call(:process_single_certification_check, xml: xml)
31
44
  response_hash = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
32
45
  {request: xml, response: response_hash}
@@ -35,7 +48,7 @@ module Paya
35
48
  def process_single_certification_check options={}, terminal_id=nil, identifier='R'
36
49
  @terminal_id = terminal_id.to_s
37
50
  @data_packet = data_packet(options, identifier)
38
- xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD&&&", Paya.password)
51
+ xml = Paya::PROCESS_SINGLE_CERTIFICATION_CHECK.gsub("&&&DATA_PACKET&&&", @data_packet).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.configuration.user_name).gsub("&&&PASSWORD&&&", Paya.configuration.password)
39
52
  response = Paya.client.call(:process_single_certification_check, xml: xml)
40
53
  response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
41
54
  {request: xml, response: response}
@@ -43,7 +56,7 @@ module Paya
43
56
 
44
57
  def get_archived_response request_id
45
58
  @terminal_id = terminal_id.to_s
46
- xml = Paya::GET_ARCHIVED_RESPONSE.gsub("&&&REQUEST_ID&&&", request_id).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.user_name).gsub("&&&PASSWORD", Paya.password)
59
+ xml = Paya::GET_ARCHIVED_RESPONSE.gsub("&&&REQUEST_ID&&&", request_id).gsub("&&&TERMINAL_ID&&&", @terminal_id).gsub("&&&USER_NAME&&&", Paya.configuration.user_name).gsub("&&&PASSWORD", Paya.configuration.password)
47
60
  response = Paya.client.call(:get_archived_response, xml: xml)
48
61
  response_hash = Hash.from_xml(response.body[:get_archived_response])
49
62
  {request: xml, response: response_hash}
@@ -1,3 +1,3 @@
1
1
  module Paya
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shahzad Tariq
@@ -68,6 +68,8 @@ files:
68
68
  - Rakefile
69
69
  - bin/console
70
70
  - bin/setup
71
+ - lib/generators/paya/install_generator.rb
72
+ - lib/generators/templates/paya_initializer.rb
71
73
  - lib/paya.rb
72
74
  - lib/paya/base.rb
73
75
  - lib/paya/ccd/guaranteed/credit_debit_transaction.rb