ruby-gpwebpay 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gp_webpay.rb +9 -0
- data/lib/gp_webpay/payment.rb +6 -3
- data/lib/gp_webpay/payment_attributes.rb +22 -0
- data/lib/gp_webpay/verification.rb +3 -1
- data/lib/gp_webpay/version.rb +1 -1
- 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: dbb8572d1c96414b1da43ea890111fbf7a776a0fd2845b96d07730f32365b79f
|
4
|
+
data.tar.gz: bd03b5e106f58cc6557da15a3eae58505e88e47e333d4daa0197e8f475ed0b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec567e4861b931da3fc1b494ec5d22425491ab9921c5f02e9d432efda23f52286e411f43323c8b0b87751a5e6d2ae161e5d615ef034637fc7b0136cf1e7925e9
|
7
|
+
data.tar.gz: 1999b3932d7badfeb139152edefb334a2f50925598e2b1767edd3dbc30d4b58123473422a53897a9955ea030b44277a842024d532072f82348943db657aadff2
|
data/lib/gp_webpay.rb
CHANGED
data/lib/gp_webpay/payment.rb
CHANGED
@@ -27,9 +27,12 @@ module GpWebpay
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def pay_url(options = {})
|
30
|
-
self.redirect_url
|
30
|
+
self.redirect_url ||= options[:redirect_url]
|
31
31
|
|
32
|
-
"#{
|
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(
|
46
|
+
%i(OPERATION ORDERNUMBER PRCODE SRCODE RESULTTEXT)
|
44
47
|
end
|
45
48
|
|
46
49
|
def pay_attributes
|
@@ -16,6 +16,22 @@ module GpWebpay
|
|
16
16
|
|
17
17
|
MASTER_KEYS = %i(user_param)
|
18
18
|
|
19
|
+
TRANSITIONS = {
|
20
|
+
:merchant_number => 'MERCHANTNUMBER',
|
21
|
+
:order_number => 'ORDERNUMBER',
|
22
|
+
:master_order_number => 'MASTERORDERNUMBER',
|
23
|
+
:amount_in_cents => 'AMOUNT',
|
24
|
+
:deposit_flag => 'DEPOSITFLAG',
|
25
|
+
:merchant_order_number => 'MERORDERNUM',
|
26
|
+
:redirect_url => 'URL',
|
27
|
+
:merchant_description => 'MD',
|
28
|
+
:message_id => 'MESSAGEID',
|
29
|
+
:bank_id => 'BANKID',
|
30
|
+
:currency => 'CURRENCY',
|
31
|
+
:operation => 'OPERATION',
|
32
|
+
:user_param => 'USERPARAM1',
|
33
|
+
}
|
34
|
+
|
19
35
|
def initialize(payment, ws_flag = false, type = "")
|
20
36
|
@payment = payment
|
21
37
|
@ws_flag = ws_flag
|
@@ -54,5 +70,11 @@ module GpWebpay
|
|
54
70
|
hash
|
55
71
|
end
|
56
72
|
end
|
73
|
+
|
74
|
+
def self.map_to_keys(hash)
|
75
|
+
hash.each_with_object({}) do |(method, value), transformed|
|
76
|
+
transformed[TRANSITIONS[method]] = value
|
77
|
+
end
|
78
|
+
end
|
57
79
|
end
|
58
80
|
end
|
@@ -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)
|
@@ -13,7 +15,7 @@ module GpWebpay
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def payment_attributes_with_digest
|
16
|
-
@payment_attributes.merge("DIGEST" => digest)
|
18
|
+
PaymentAttributes.map_to_keys(@payment_attributes).merge("DIGEST" => digest)
|
17
19
|
end
|
18
20
|
|
19
21
|
def digest
|
data/lib/gp_webpay/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.1
|
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-
|
11
|
+
date: 2021-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|