ruby-gpwebpay 0.0.1 → 0.0.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: 0536ecb57b136380a6c1662e93b0cec5439bd59c655fa524a82ac14c0ac33117
4
- data.tar.gz: 325be4295cd941abffa4d5e7569572fe8f93de3799f2a529bb2f5f85228b2540
3
+ metadata.gz: 8c66ec822c799ec910c28ee98ba43fb4a106e1458ac9c4e12c419d3989e495c5
4
+ data.tar.gz: 986bcd67283921d0c3c8122cf61d9b728ba0c7f3243e0ecc8cdcdd7f8f13416d
5
5
  SHA512:
6
- metadata.gz: dcb7675ac86150be1b9c25c631b15d7176ceae25cb07da9dedf06a55fd2684478b728ee5c010179f28df5cdce13fac763373d30d9cca99fed821970b34fe7527
7
- data.tar.gz: 8d50edcae500961cd41a30ce7698cdc1b2772391a928841a379803c32f12148a3729eb281af3cbcbe04ded9b0616c17d49d87866e8fba3dbc30d4cc6768239ed
6
+ metadata.gz: 6b73eb3b3191b1b2e25b536931fdbdc0eac14d4bc6783cb3460280a75a6173b6b7d0981bc9b9cf42f96f52a8ebdcd9caf6d0ae5cb9db2ed092a4dc248bc65b0d
7
+ data.tar.gz: 7dd9b34112990ea1c058fa5818b6c5ad6df43241ec4780bf0f2a4cadbc46c020ef730b277c9a84c9fa7d8b7ad9e9d15b0cb0917a78c8c8e1cd5b848f37e6f6d9
@@ -27,7 +27,7 @@ module GpWebpay
27
27
  end
28
28
 
29
29
  def pay_url(options = {})
30
- self.redirect_url = options[:redirect_url]
30
+ self.redirect_url ||= options[:redirect_url]
31
31
 
32
32
  "#{config.pay_url}?#{pay_verification.payment_attributes_with_digest.to_param}"
33
33
  end
@@ -16,6 +16,21 @@ 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
+ }
33
+
19
34
  def initialize(payment, ws_flag = false, type = "")
20
35
  @payment = payment
21
36
  @ws_flag = ws_flag
@@ -54,5 +69,11 @@ module GpWebpay
54
69
  hash
55
70
  end
56
71
  end
72
+
73
+ def self.map_to_keys(hash)
74
+ hash.each_with_object({}) do |(method, value), transformed|
75
+ transformed[TRANSITIONS[method]] = value
76
+ end
77
+ end
57
78
  end
58
79
  end
@@ -13,7 +13,7 @@ module GpWebpay
13
13
  end
14
14
 
15
15
  def payment_attributes_with_digest
16
- @payment_attributes.merge("DIGEST" => digest)
16
+ PaymentAttributes.map_to_keys(@payment_attributes).merge("DIGEST" => digest)
17
17
  end
18
18
 
19
19
  def digest
@@ -1,3 +1,3 @@
1
1
  module GpWebpay
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
4
+ version: 0.0.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-02 00:00:00.000000000 Z
11
+ date: 2021-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport