paya 0.9.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2a0d9ed9f341baf25331b897b4563890c467da3
4
- data.tar.gz: a6843fed80926cd2dd6f8bf0beeba342b76e6a40
3
+ metadata.gz: 280044176ed7f32b10a574989da8ce082e7afc9e
4
+ data.tar.gz: 41251798b257c3914d5686134feefc8465633677
5
5
  SHA512:
6
- metadata.gz: 10e68cc8dadad41ef9cb09c1043ad3ed31c6326ecfa1b3d4324ad867b94ab7397e5c79b2d45b928ac108a14154b52fb67a2fa99d8b64007a5c7eeeea3cd0f35c
7
- data.tar.gz: 08c0d35575e9a6eb94d18d0f6afae15fc7c3a97fe79a44dddc701a1e3628956e00c643c0418e02df7b9dc07f7ee7f31c7733ed8fe7e9b219ae9eec01c91529b8
6
+ metadata.gz: 81bdc5ccae0731499557ad46e311e5924e89a0ce304628574435d9bd6e564d2550aeafdfa3bc5160df05fd59d874b0dc5a2df5668cec5090b971e07850314da6
7
+ data.tar.gz: 1326bf96f99bb8eb325ee5bf22079556193b6c2407a756575509a6c02c434aeb8cadafcddc9fbf3dcce7b70a0b7140275781e2a13c7d417e5c0d4d50048cdad9
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  .idea
11
11
  .idea/*
12
+ *.gem
data/lib/paya.rb CHANGED
@@ -96,10 +96,14 @@ xml
96
96
  attr_accessor :user_name, :password, :production
97
97
 
98
98
  def client
99
+ test_mode ? sandbox_client : live_client
100
+ end
101
+
102
+ def live_client
99
103
  ::Savon.client(wsdl: Paya::API_END_POINT)
100
104
  end
101
105
 
102
- def certification_client
106
+ def sandbox_client
103
107
  ::Savon.client(wsdl: Paya::CERTITICATION_API_END_POINT)
104
108
  end
105
109
 
data/lib/paya/base.rb CHANGED
@@ -12,61 +12,47 @@ module Paya
12
12
  end
13
13
 
14
14
  def process_single_check options={}, terminal_id=nil, identifier='R'
15
- Paya.production == true ? process_single_actual_check(options, terminal_id, identifier) : process_single_certification_check(options, terminal_id, identifier)
16
- end
17
-
18
- def process_single_check_with_token
19
- Paya.production == true ? process_single_actual_check_with_token(options, terminal_id, identifier) : process_single_certification_check_with_token(options, terminal_id, identifier)
20
- end
21
-
22
- def get_archived_response request_id
23
- @terminal_id = terminal_id.to_s
24
- 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)
25
- response = Paya.client.call(:get_archived_response, xml: xml)
26
- response = Hash.from_xml(response.body[:get_archived_response])
27
- {request: xml, response: response}
28
- end
29
-
30
- alias_method :archived, :get_archived_response
31
- alias_method :get_archived, :get_archived_response
32
- alias_method :archived_response, :get_archived_response
33
-
34
- def process_single_actual_check options={}, terminal_id=nil, identifier='R'
15
+ =begin
35
16
  @terminal_id = terminal_id.to_s
36
17
  @data_packet = data_packet(options, identifier)
37
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)
38
- response = Paya.client.call(:process_single_check, xml: xml)
39
- response = Hash.from_xml(response.body[:process_single_check_response][:process_single_check_result])
40
- {request: xml, response: response}
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])
21
+ {request: xml, response: response_hash}
22
+ =end
23
+ process_single_certification_check options, terminal_id, identifier
41
24
  end
42
25
 
43
- def process_single_certification_check options={}, terminal_id=nil, identifier='R'
26
+ def process_single_check_with_token
44
27
  @terminal_id = terminal_id.to_s
45
28
  @data_packet = data_packet(options, identifier)
46
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)
47
- response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
48
- response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
49
- {request: xml, response: response}
30
+ response = Paya.client.call(:process_single_certification_check, xml: xml)
31
+ response_hash = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
32
+ {request: xml, response: response_hash}
50
33
  end
51
34
 
52
- def process_single_actual_check_with_token options={}, terminal_id=nil, identifier='R'
35
+ def process_single_certification_check options={}, terminal_id=nil, identifier='R'
53
36
  @terminal_id = terminal_id.to_s
54
37
  @data_packet = data_packet(options, identifier)
55
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)
56
- response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
39
+ response = Paya.client.call(:process_single_certification_check, xml: xml)
57
40
  response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
58
41
  {request: xml, response: response}
59
42
  end
60
43
 
61
- def process_single_certification_check_with_token options={}, terminal_id=nil, identifier='R'
44
+ def get_archived_response request_id
62
45
  @terminal_id = terminal_id.to_s
63
- @data_packet = data_packet(options, identifier)
64
- 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)
65
- response = Paya.certification_client.call(:process_single_certification_check, xml: xml)
66
- response = Hash.from_xml(response.body[:process_single_certification_check_response][:process_single_certification_check_result])
67
- {request: xml, response: response}
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)
47
+ response = Paya.client.call(:get_archived_response, xml: xml)
48
+ response_hash = Hash.from_xml(response.body[:get_archived_response])
49
+ {request: xml, response: response_hash}
68
50
  end
69
51
 
52
+ alias_method :archived, :get_archived_response
53
+ alias_method :get_archived, :get_archived_response
54
+ alias_method :archived_response, :get_archived_response
55
+
70
56
  def data_packet options={}, identifier
71
57
  identifier = options[:identifier] if options[:identifier].present?
72
58
  xml = <<xml
data/lib/paya/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Paya
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.2"
3
3
  end
data/paya.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Ruby wrapper for Paya ACH payment gateway integration. This is developed by reading Paya documentation and is not official team of Paya}
14
14
  spec.homepage = "https://github.com/mshahzadtariq"
15
15
  spec.license = "MIT"
16
-
16
+
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
  spec.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shahzad Tariq
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler