rails-gp-webpay 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +3 -0
- data/lib/gp_webpay/configuration.rb +1 -2
- data/lib/gp_webpay/mock/spec_helper.rb +11 -12
- data/lib/gp_webpay/version.rb +1 -1
- data/lib/gp_webpay/ws/base_signed_request.rb +10 -2
- data/lib/gp_webpay/ws/services/process_capture_reverse.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557be3e38c554946e0fe2839549b752342205f2bfaa911a4861a3f1ea268c1a3
|
4
|
+
data.tar.gz: e48dd123da0ac8e2180d43917e3b3c2e63e8afe56cb17b08127824f65faf4f24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae3c2c5e04ae5cb2230e28a87d732f8769679b48f2ee0f1eb0f0c2b00e553a69cdaecad3201e0cf6368a0e359ca8f99b970939204160c4b98d1d6869af79ed7e
|
7
|
+
data.tar.gz: ce49aa4b92af16bfb9aff3cec47c2baf190c5361045bbf7acb134a61a2f93626c005725bc80cf854bb592ce3e109b35900234c6841bb365f7b2dc46faf8256fc
|
data/changelog.md
CHANGED
@@ -21,8 +21,7 @@ module GpWebpay
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def find_configuration_by_merchant_number(merchant_number)
|
24
|
-
|
25
|
-
config = @configurations.find { |_key, value| puts _key;value.merchant_number.to_s == merchant_number.to_s }
|
24
|
+
config = @configurations.find { |_key, value| value.merchant_number.to_s == merchant_number.to_s }
|
26
25
|
return nil if config.blank?
|
27
26
|
|
28
27
|
config[-1]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'savon/mock/spec_helper'
|
2
|
-
|
2
|
+
# rubocop:disable Metrics/ParameterLists
|
3
3
|
module GpWebpay
|
4
4
|
module SpecHelper
|
5
5
|
class Interface
|
@@ -45,15 +45,13 @@ module GpWebpay
|
|
45
45
|
allow(GpWebpay::Ws::Services::ProcessUsageBasedPayment)
|
46
46
|
.to receive(:call).with(
|
47
47
|
hash_including(
|
48
|
-
{
|
49
|
-
message_id: anything,
|
48
|
+
{ message_id: anything,
|
50
49
|
payment_number: anything,
|
51
50
|
order_number: anything,
|
52
51
|
currency_code: anything,
|
53
|
-
capture_flag: '1'
|
54
|
-
}.merge(attributes)
|
52
|
+
capture_flag: '1' }.merge(attributes)
|
55
53
|
),
|
56
|
-
merchant_number: merchant_number
|
54
|
+
merchant_number: merchant_number
|
57
55
|
).and_return(instance_double(GpWebpay::Ws::WsResponse,
|
58
56
|
valid?: valid, success?: success, status: status, result_text: result_text,
|
59
57
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4',
|
@@ -69,28 +67,28 @@ module GpWebpay
|
|
69
67
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4'))
|
70
68
|
end
|
71
69
|
|
72
|
-
def stub_refund_payment(attributes, valid: true, success: true, status: '', result_text: 'OK')
|
70
|
+
def stub_refund_payment(attributes, merchant_number: nil, valid: true, success: true, status: '', result_text: 'OK')
|
73
71
|
allow(GpWebpay::Ws::Services::ProcessRefundPayment)
|
74
72
|
.to receive(:call).with(
|
75
|
-
hash_including({ message_id: anything }.merge(attributes))
|
73
|
+
hash_including({ message_id: anything }.merge(attributes)), merchant_number: merchant_number
|
76
74
|
).and_return(instance_double(GpWebpay::Ws::WsResponse,
|
77
75
|
valid?: valid, success?: success, status: status, result_text: result_text,
|
78
76
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4'))
|
79
77
|
end
|
80
78
|
|
81
|
-
def stub_capture_reverse(attributes, valid: true, success: true, status: '', result_text: 'OK')
|
79
|
+
def stub_capture_reverse(attributes, merchant_number: nil, valid: true, success: true, status: '', result_text: 'OK')
|
82
80
|
allow(GpWebpay::Ws::Services::ProcessCaptureReverse)
|
83
81
|
.to receive(:call).with(
|
84
|
-
hash_including({ message_id: anything }.merge(attributes))
|
82
|
+
hash_including({ message_id: anything }.merge(attributes)), merchant_number: merchant_number
|
85
83
|
).and_return(instance_double(GpWebpay::Ws::WsResponse,
|
86
84
|
valid?: valid, success?: success, status: status, result_text: result_text,
|
87
85
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4'))
|
88
86
|
end
|
89
87
|
|
90
|
-
def stub_cancel_capture(attributes, valid: true, success: true, status: '', result_text: 'OK')
|
88
|
+
def stub_cancel_capture(attributes, merchant_number: nil, valid: true, success: true, status: '', result_text: 'OK')
|
91
89
|
allow(GpWebpay::Ws::Services::ProcessCancelCapture)
|
92
90
|
.to receive(:call).with(
|
93
|
-
hash_including({ message_id: anything }.merge(attributes))
|
91
|
+
hash_including({ message_id: anything }.merge(attributes)), merchant_number: merchant_number
|
94
92
|
).and_return(instance_double(GpWebpay::Ws::WsResponse,
|
95
93
|
valid?: valid, success?: success, status: status, result_text: result_text,
|
96
94
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4'))
|
@@ -102,3 +100,4 @@ module GpWebpay
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
103
|
+
# rubocop:enable Metrics/ParameterLists
|
data/lib/gp_webpay/version.rb
CHANGED
@@ -23,6 +23,7 @@ module GpWebpay
|
|
23
23
|
RESPONSE_NAME = 'override_me'.freeze
|
24
24
|
RESPONSE_ENTITY_NAME = 'override_me'.freeze
|
25
25
|
SERVICE_EXCEPTION = :service_exception
|
26
|
+
DEFAULT_ATTRIBUTES = {}.freeze
|
26
27
|
|
27
28
|
def initialize(attributes, merchant_number: :default)
|
28
29
|
@attributes = attributes
|
@@ -32,9 +33,10 @@ module GpWebpay
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def call
|
35
|
-
attrs = WsRequest.new(
|
36
|
+
attrs = WsRequest.new(final_attributes).to_gpwebpay
|
36
37
|
|
37
|
-
|
38
|
+
Rails.logger.debug([self.class::OPERATION_NAME, { message: { self.class::REQUEST_NAME => attributes_with_signature(attrs) } }])
|
39
|
+
res = client.call(self.class::OPERATION_NAME, { message: { self.class::REQUEST_NAME => attributes_with_signature(attrs) } })
|
38
40
|
WsResponse.from_success(res.body, self.class::RESPONSE_NAME, self.class::RESPONSE_ENTITY_NAME, config.merchant_number)
|
39
41
|
rescue Savon::HTTPError => e
|
40
42
|
rescue_from_http(e)
|
@@ -44,6 +46,12 @@ module GpWebpay
|
|
44
46
|
|
45
47
|
protected
|
46
48
|
|
49
|
+
def final_attributes
|
50
|
+
{}.merge(self.class::DEFAULT_ATTRIBUTES,
|
51
|
+
attributes,
|
52
|
+
{ provider: config.provider, merchant_number: config.merchant_number })
|
53
|
+
end
|
54
|
+
|
47
55
|
def digest_text(attrs)
|
48
56
|
attrs.values.join('|')
|
49
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-gp-webpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lubomir Vnenk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|