ruby-gpwebpay 0.0.2 → 0.1.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
  SHA256:
3
- metadata.gz: 8c66ec822c799ec910c28ee98ba43fb4a106e1458ac9c4e12c419d3989e495c5
4
- data.tar.gz: 986bcd67283921d0c3c8122cf61d9b728ba0c7f3243e0ecc8cdcdd7f8f13416d
3
+ metadata.gz: e6bbbf7e5953de3462e71079455cd181b675b01ddb63e2c59f22f28e51afbd23
4
+ data.tar.gz: ed0f1389c4e4113f64c72edb2d42671ade68db9045e117cc904fdc221c9f340a
5
5
  SHA512:
6
- metadata.gz: 6b73eb3b3191b1b2e25b536931fdbdc0eac14d4bc6783cb3460280a75a6173b6b7d0981bc9b9cf42f96f52a8ebdcd9caf6d0ae5cb9db2ed092a4dc248bc65b0d
7
- data.tar.gz: 7dd9b34112990ea1c058fa5818b6c5ad6df43241ec4780bf0f2a4cadbc46c020ef730b277c9a84c9fa7d8b7ad9e9d15b0cb0917a78c8c8e1cd5b848f37e6f6d9
6
+ metadata.gz: 52049cba9cc3ef1cd7ff6a95fa02e16648bfd8aa2b534d25ce1017431e95aea215e64c947398fb78d9fb415988dec07c64c626ccd9c80463f3dc9afef6501837
7
+ data.tar.gz: 8e3f76458acebae7b8ebf2270103047663db8aa907cd4a75b40e5ffb6de8eefe6a346e9a5ec6fcb0ad2dee57426a7a3bce5b1b10603453a6e52766dcaf8e96c1
data/lib/gp_webpay.rb CHANGED
@@ -6,4 +6,13 @@ require "gp_webpay/verification"
6
6
  require "gp_webpay/web_services"
7
7
 
8
8
  module GpWebpay
9
+ class << self
10
+ attr_writer :logger
11
+
12
+ def logger
13
+ @logger ||= Logger.new($stdout).tap do |log|
14
+ log.progname = self.name
15
+ end
16
+ end
17
+ end
9
18
  end
@@ -29,7 +29,10 @@ module GpWebpay
29
29
  def pay_url(options = {})
30
30
  self.redirect_url ||= options[:redirect_url]
31
31
 
32
- "#{config.pay_url}?#{pay_verification.payment_attributes_with_digest.to_param}"
32
+ GpWebpay.logger.info "Attributes user for URL generation: #{pay_verification.payment_attributes_with_digest}"
33
+ generated_url = "#{config.pay_url}?#{pay_verification.payment_attributes_with_digest.to_param}"
34
+ GpWebpay.logger.info "Produced URL: #{generated_url}"
35
+ generated_url
33
36
  end
34
37
 
35
38
  def success?(params)
@@ -40,7 +43,7 @@ module GpWebpay
40
43
  private
41
44
 
42
45
  def pay_verification_attrs
43
- %i(operation order_number prcode srcode resulttext)
46
+ %i(OPERATION ORDERNUMBER PRCODE SRCODE RESULTTEXT)
44
47
  end
45
48
 
46
49
  def pay_attributes
@@ -28,7 +28,8 @@ module GpWebpay
28
28
  :message_id => 'MESSAGEID',
29
29
  :bank_id => 'BANKID',
30
30
  :currency => 'CURRENCY',
31
- :operation => 'OPERATION'
31
+ :operation => 'OPERATION',
32
+ :user_param => 'USERPARAM1',
32
33
  }
33
34
 
34
35
  def initialize(payment, ws_flag = false, type = "")
@@ -4,7 +4,9 @@ module GpWebpay
4
4
  class Verification
5
5
  def initialize(payment_attributes, verification_attrs = nil)
6
6
  @payment_attributes = payment_attributes
7
+ GpWebpay.logger.info "Payment Attrs: #{@payment_attributes}"
7
8
  @verification_attrs = verification_attrs
9
+ GpWebpay.logger.info "Verification Attrs: #{@verification_attrs}"
8
10
  end
9
11
 
10
12
  def verified_response?(params)
@@ -1,3 +1,3 @@
1
1
  module GpWebpay
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -75,10 +75,13 @@ module GpWebpay
75
75
  end
76
76
 
77
77
  def request_attributes(type = "")
78
- {
78
+ base_attributes = {
79
79
  message_id: message_id(type),
80
80
  merchant_number: config.merchant_number,
81
81
  order_number: order_number,
82
+ digest: ws_verification(type).digest,
83
+ }
84
+ payment_attributes = {
82
85
  merchant_order_number: merchant_order_number,
83
86
  master_order_number: master_order_number,
84
87
  amount: amount_in_cents,
@@ -100,10 +103,16 @@ module GpWebpay
100
103
  shipping_city: shipping.city,
101
104
  shipping_postal_code: shipping.postal_code,
102
105
  shipping_country: shipping.country,
103
- digest: ws_verification(type).digest,
104
106
  # Deprecated Attrs, will remove
105
107
  currency: currency,
106
108
  }
109
+
110
+ case type
111
+ when "processRegularSubscriptionPayment"
112
+ base_attributes.merge(payment_attributes)
113
+ else
114
+ base_attributes
115
+ end
107
116
  end
108
117
 
109
118
  def config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-gpwebpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrej Antas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-07 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport