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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57cea3f8cb422bc2d6855683efe5d39130a19359d621df38e21358310218a0c9
4
- data.tar.gz: 1286c8ab428ef6b841a0be0e25e250efbe48671e6010a041e51081ae64e77f3b
3
+ metadata.gz: 9c597464425c2927b468ae8c969fd4d2046060668df8f4c9793f7e74ab18712d
4
+ data.tar.gz: 7e67ac949546fb2ddc85a4ae551ac8d06b5e62e71811d0ded3ccfe197bc85a4f
5
5
  SHA512:
6
- metadata.gz: 3f375e6bb1f7ab747ee4c2287c3609209dd5f3302991bebb5e5f7caa5356c3ef8468e8b1d94634681a6301b107ca487db9eba8f40fde4da4ec2cf7a1c5d750d4
7
- data.tar.gz: 35f1973debfd2cd53c7516dd790cdc2498f2cdcc20bc5a1231fa4a07d87e6a2a7be49441e70b89da43da95485ff7513522d6453ad4053e81f44856cb47850699
6
+ metadata.gz: 36c914a4554ec7de7bce64c8da8e5eced4c4da6009f63b481aa4cf9cf562878f84e81dec3f6178d8a0dc2b1295172128a630b145b5826a6019e0db066a9d1fb4
7
+ data.tar.gz: '008e96b29024a860c39bd4d168492525d5e8abc481e97978a17b1705e5557853e21ef566498740567fd95fbdc8a7e3514758f4e242d62e895bd5eda8ce150b2d'
data/changelog.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.4
4
+ Increase savon timeout to 5 minutes
5
+
6
+ ## 0.2.2
7
+ Add merchant number to stubs
8
+
3
9
  ## 0.2
4
10
  Add spec helpers
5
11
 
@@ -15,7 +15,17 @@ module GpWebpay
15
15
  end
16
16
 
17
17
  def [](config_name)
18
- @configurations[config_name]
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[merchant_number] = nil
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, valid?: valid, success?: success, status: status,
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',
@@ -1,3 +1,3 @@
1
1
  module GpWebpay
2
- VERSION = '0.2'.freeze
2
+ VERSION = '0.2.5'.freeze
3
3
  end
@@ -54,7 +54,11 @@ module GpWebpay
54
54
  end
55
55
 
56
56
  def client
57
- @client ||= Savon.client(wsdl: config.wsdl_file, endpoint: config.ws_url, pretty_print_xml: true)
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: '0.2'
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-04-22 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport