rails-gp-webpay 0.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +6 -0
- data/lib/gp_webpay/configuration.rb +12 -2
- data/lib/gp_webpay/mock/spec_helper.rb +7 -5
- data/lib/gp_webpay/version.rb +1 -1
- data/lib/gp_webpay/ws/base_signed_request.rb +5 -1
- data/lib/gp_webpay/ws/services/process_card_on_file_payment.rb +2 -2
- 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: 9c597464425c2927b468ae8c969fd4d2046060668df8f4c9793f7e74ab18712d
|
4
|
+
data.tar.gz: 7e67ac949546fb2ddc85a4ae551ac8d06b5e62e71811d0ded3ccfe197bc85a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36c914a4554ec7de7bce64c8da8e5eced4c4da6009f63b481aa4cf9cf562878f84e81dec3f6178d8a0dc2b1295172128a630b145b5826a6019e0db066a9d1fb4
|
7
|
+
data.tar.gz: '008e96b29024a860c39bd4d168492525d5e8abc481e97978a17b1705e5557853e21ef566498740567fd95fbdc8a7e3514758f4e242d62e895bd5eda8ce150b2d'
|
data/changelog.md
CHANGED
@@ -15,7 +15,17 @@ module GpWebpay
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def [](config_name)
|
18
|
-
|
18
|
+
return if config_name.blank?
|
19
|
+
|
20
|
+
@configurations[config_name] || find_configuration_by_merchant_number(config_name)
|
21
|
+
end
|
22
|
+
|
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 }
|
26
|
+
return nil if config.blank?
|
27
|
+
|
28
|
+
config[-1]
|
19
29
|
end
|
20
30
|
|
21
31
|
def add_configuration(merchant_number:, default: false)
|
@@ -25,7 +35,7 @@ module GpWebpay
|
|
25
35
|
end
|
26
36
|
|
27
37
|
def remove_configuration(merchant_number:)
|
28
|
-
@configurations
|
38
|
+
@configurations.delete(merchant_number)
|
29
39
|
@configurations[:default] = @configurations[@configurations.keys[0]]
|
30
40
|
end
|
31
41
|
|
@@ -33,14 +33,15 @@ module GpWebpay
|
|
33
33
|
.and_return(instance_double(GpWebpay::Ws::WsResponse, valid?: valid, success?: success, status: status))
|
34
34
|
end
|
35
35
|
|
36
|
-
def stub_payment_status(payment_number, status: 'VERIFIED', sub_status: 'SETTLED', success: true, valid: true)
|
36
|
+
def stub_payment_status(payment_number, merchant_number: nil, status: 'VERIFIED', sub_status: 'SETTLED', success: true, valid: true)
|
37
37
|
allow(GpWebpay::Ws::Services::GetPaymentStatus)
|
38
|
-
.to receive(:call).with(hash_including(payment_number: payment_number, message_id: anything))
|
39
|
-
.and_return(instance_double(GpWebpay::Ws::WsResponse,
|
38
|
+
.to receive(:call).with(hash_including(payment_number: payment_number, message_id: anything), merchant_number: merchant_number)
|
39
|
+
.and_return(instance_double(GpWebpay::Ws::WsResponse,
|
40
|
+
valid?: valid, success?: success, status: status,
|
40
41
|
params: { sub_status: sub_status }))
|
41
42
|
end
|
42
43
|
|
43
|
-
def stub_usage_based_payment(attributes, valid: true, success: true, status: '', result_text: 'OK', response_token_data: nil)
|
44
|
+
def stub_usage_based_payment(attributes, merchant_number:, valid: true, success: true, status: '', result_text: 'OK', response_token_data: nil)
|
44
45
|
allow(GpWebpay::Ws::Services::ProcessUsageBasedPayment)
|
45
46
|
.to receive(:call).with(
|
46
47
|
hash_including(
|
@@ -51,7 +52,8 @@ module GpWebpay
|
|
51
52
|
currency_code: anything,
|
52
53
|
capture_flag: '1'
|
53
54
|
}.merge(attributes)
|
54
|
-
)
|
55
|
+
),
|
56
|
+
merchant_number: merchant_number,
|
55
57
|
).and_return(instance_double(GpWebpay::Ws::WsResponse,
|
56
58
|
valid?: valid, success?: success, status: status, result_text: result_text,
|
57
59
|
pr_code: success ? '0' : '123', sr_code: success ? '0' : '4',
|
data/lib/gp_webpay/version.rb
CHANGED
@@ -54,7 +54,11 @@ module GpWebpay
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def client
|
57
|
-
@client ||= Savon.client(wsdl: config.wsdl_file,
|
57
|
+
@client ||= Savon.client(wsdl: config.wsdl_file,
|
58
|
+
endpoint: config.ws_url,
|
59
|
+
pretty_print_xml: true,
|
60
|
+
open_timeout: 300,
|
61
|
+
read_timeout: 300)
|
58
62
|
end
|
59
63
|
|
60
64
|
def rescue_from_http(error)
|
@@ -29,9 +29,9 @@ module GpWebpay
|
|
29
29
|
|
30
30
|
if response.valid? && response.params[:authentication_link].present?
|
31
31
|
raise GpWebpayConfirmationRequired.new('GP Webpay requires authentication', response.params[:authentication_link])
|
32
|
-
else
|
33
|
-
response
|
34
32
|
end
|
33
|
+
|
34
|
+
response
|
35
35
|
end
|
36
36
|
|
37
37
|
class GpWebpayConfirmationRequired < GpWebpay::Error
|
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:
|
4
|
+
version: 0.2.5
|
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-
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|