gp_webpay 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 10ba0ceb21e113147dd590184baab614557c2629
4
- data.tar.gz: cb0ea7cce9a1864cbca5478ed14c787b08ed7579
3
+ metadata.gz: 66f08654173a78510ff2a06bd98a034b49ec4c83
4
+ data.tar.gz: 0b88f8af914d24caf3109774aa87b8f017c62b80
5
5
  SHA512:
6
- metadata.gz: f9bbbd16959cdee745e60ea4e93fadac2517638847db037629532844e3282b98c26b619bc79d39a62c25e4d17ea9d200e82451138e83f302f5766320828ac6b3
7
- data.tar.gz: 6639c89416dc3b9cd6a3ab37f70228db3a635b820c174983dc0b679be0578d50bd5ad1d1556d4637eded52f1f386644c7cbb4d787fe7645de2aa0994ba735e9b
6
+ metadata.gz: 329179521d2a27b1afbc761e31f40d6f8ccc96cb5b00957b775709d2f98f38a946ef64f42bd4ec6f7565c89a11903d53d629bc6f16d65e7d9692f99e0ec7d41d
7
+ data.tar.gz: 3b6b3af161ea17838901475e57a4708bede0da2c18abbc0b753afc40b6707373a3f8b57d93790eb817b44d9616bacc15137235cc162ff2245a628eeb21407680
data/README.md CHANGED
@@ -26,9 +26,9 @@ config/initializers/gp_webpay.rb
26
26
 
27
27
  ```ruby
28
28
  GpWebpay.configure do |config|
29
- config.merchant_number = ##########
30
- config.pem_path = 'my_cert.pem'
31
- config.password = 'password'
29
+ config.merchant_number = ##########
30
+ config.merchant_pem_path = 'my_cert.pem'
31
+ config.merchant_password = 'password'
32
32
  end
33
33
  ```
34
34
 
@@ -58,7 +58,18 @@ class OrdersController
58
58
  def create
59
59
  ...
60
60
  payment = Payment.create
61
- redirect_to payment.pay_url(redirect_url: 'http://app/callback')
61
+ redirect_to payment.pay_url(redirect_url: 'http://example.com/orders/callback')
62
+ end
63
+
64
+ def callback
65
+ ...
66
+ payment = Payment.find(params['ORDERNUMBER'])
67
+ if payment.success?(params)
68
+ # Payment success
69
+ else
70
+ # Payment failed
71
+ # params['PRCODE'], params['SRCODE']
72
+ end
62
73
  end
63
74
  end
64
75
  ```
@@ -18,6 +18,7 @@ module GpWebpay
18
18
  class Configuration #:nodoc:
19
19
  include ActiveSupport::Configurable
20
20
  config_accessor :merchant_number
21
+ config_accessor :merchant_pem
21
22
  config_accessor :merchant_pem_path
22
23
  config_accessor :merchant_password
23
24
  config_accessor :gpe_pem_path
@@ -54,6 +55,7 @@ module GpWebpay
54
55
  # this is ugly. why can't we pass the default value to config_accessor...?
55
56
  configure do |config|
56
57
  config.merchant_number = nil
58
+ config.merchant_pem = nil
57
59
  config.merchant_pem_path = nil
58
60
  config.merchant_password = nil
59
61
  config.environment = defined?(Rails) && Rails.env || 'test'
@@ -72,7 +72,7 @@ module GpWebpay
72
72
 
73
73
  def merchant_key
74
74
  @merchant_key ||= begin
75
- pem = File.read config.merchant_pem_path
75
+ pem = config.merchant_pem || File.read(config.merchant_pem_path)
76
76
  OpenSSL::PKey::RSA.new(pem, config.merchant_password)
77
77
  end
78
78
  end
@@ -1,3 +1,3 @@
1
1
  module GpWebpay
2
- VERSION = "0.2.1"
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gp_webpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Magnusek
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport