active_merchant_pay2go 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +19 -16
- data/active_merchant_pay2go.gemspec +4 -4
- data/lib/active_merchant_pay2go/version.rb +1 -1
- data/lib/offsite_payments/integrations/pay2go/helper.rb +1 -1
- data/lib/offsite_payments/integrations/pay2go/notification.rb +2 -2
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 468cd8230ae4b28338e3560cf9c22878f13dd66d
|
4
|
+
data.tar.gz: cfa97ca9cd92f85e8e76f4a38e2d9ca62e63066f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd6eb0e2ceceb241bb3951974c294bb2d85a0a76badd276c2de91c6c0eb9943e6bcdedeacd2a8b66567e841ce4e1771785a483f05b1db5f306e7bb43a1048c4
|
7
|
+
data.tar.gz: 15f870b8d587fc9f104116fe5db70000c36742309447c3d0361120bbf325094dd2a66a4d9b3b102b0dea19d8a614c285e4adbfb7044bf364da3bca8369e07a5e
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
= ActiveMerchantPay2go CHANGELOG
|
2
|
+
|
3
|
+
== Version 0.1.6 (Oct 8, 2016)
|
4
|
+
- update activemerchant version to from '~> 1.50' to '~> 1.60'
|
5
|
+
- update bundler version to from '~> 1.10' to '~> 1.13'
|
6
|
+
- update rake version to from '~> 10.0' to '~> 11.2'
|
7
|
+
- update rails version to from '>= 3.2.6', '< 5' to '>= 3.2.6', '< 6'
|
8
|
+
- Helper FIELDS: add ExpireTime
|
9
|
+
- Notification PARAMS_FIELDS: add RedAmt
|
10
|
+
- Notification PARAMS_FIELDS: add ExpireTime
|
data/README.md
CHANGED
@@ -1,37 +1,41 @@
|
|
1
|
+
[](https://badge.fury.io/rb/active_merchant_pay2go)
|
1
2
|
[](https://travis-ci.org/imgarylai/active_merchant_pay2go)
|
2
3
|
[](https://codeclimate.com/github/imgarylai/active_merchant_pay2go)
|
3
4
|
|
4
5
|
# ActiveMerchantPay2go
|
5
6
|
|
6
|
-
|
7
|
+
[](https://gitter.im/imgarylai/active_merchant_pay2go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
7
8
|
|
8
|
-
|
9
|
+
這個 gem 的目的是要串接 [pay2go(智付寶)](https://www.pay2go.com/) 的金流,不過不是只有單純的 API 封裝,是透過 [active_merchant](https://github.com/activemerchant/active_merchant) 和 [offsite_payments](https://github.com/activemerchant/offsite_payments) 包裝後可以快速的在 Rails 上使用。
|
9
10
|
|
10
|
-
|
11
|
+
另外非常感謝 [active_merchant_allpay](https://github.com/xwaynec/active_merchant_allpay)。
|
11
12
|
|
12
|
-
|
13
|
+
## 安裝
|
14
|
+
|
15
|
+
Gemfile 中加入這一行
|
13
16
|
|
14
17
|
```ruby
|
15
18
|
gem 'active_merchant_pay2go'
|
16
19
|
```
|
17
20
|
|
18
|
-
|
21
|
+
透過 bundle 安裝:
|
19
22
|
|
20
23
|
```
|
21
24
|
$ bundle
|
22
25
|
```
|
23
26
|
|
24
|
-
##
|
27
|
+
## 設定
|
25
28
|
|
26
|
-
-
|
29
|
+
- 建議第一次使用的人可以先看一下官方的文件... [official API](https://www.pay2go.com/dw_files/info_api/pay2go_gateway_MPGapi_V1_1_8.pdf) 。
|
27
30
|
|
28
|
-
-
|
31
|
+
- 建立 `config/initializers/pay2go.rb`
|
29
32
|
``` sh
|
30
33
|
rails g pay2go:install
|
31
34
|
```
|
32
35
|
|
33
|
-
-
|
36
|
+
- 到智付寶上申請申請相關的 key 並放入 `config/initializers/pay2go.rb` 中。
|
34
37
|
```rb
|
38
|
+
# Example
|
35
39
|
OffsitePayments::Integrations::Pay2go.setup do |pay2go|
|
36
40
|
# You have to apply credential below by yourself.
|
37
41
|
pay2go.merchant_id = '123456'
|
@@ -40,7 +44,7 @@ OffsitePayments::Integrations::Pay2go.setup do |pay2go|
|
|
40
44
|
end
|
41
45
|
```
|
42
46
|
|
43
|
-
-
|
47
|
+
- 環境設定:
|
44
48
|
```rb
|
45
49
|
# config/environments/development.rb
|
46
50
|
config.after_initialize do
|
@@ -54,9 +58,9 @@ config.after_initialize do
|
|
54
58
|
end
|
55
59
|
```
|
56
60
|
|
57
|
-
##
|
61
|
+
## 範例
|
58
62
|
|
59
|
-
```
|
63
|
+
```erb
|
60
64
|
<% payment_service_for @order,
|
61
65
|
@order.user.email,
|
62
66
|
service: :pay2go,
|
@@ -71,12 +75,11 @@ end
|
|
71
75
|
<%= submit_tag '付款' %>
|
72
76
|
<% end %>
|
73
77
|
```
|
74
|
-
|
78
|
+
這段程式碼只有實做了很基本的功能。
|
75
79
|
|
76
|
-
|
77
|
-
I put some comments in the [code](https://github.com/imgarylai/active_merchant_pay2go/blob/master/lib/offsite_payments/integrations/pay2go.rb) as well!
|
80
|
+
如果有更多的設定,建議看一下官方文件有沒有支援。
|
78
81
|
|
79
|
-
|
82
|
+
[範例](https://github.com/imgarylai/rails_active_merchant_pay2go) (很簡陋的範例).
|
80
83
|
|
81
84
|
## Contributing
|
82
85
|
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'activemerchant', '~> 1.
|
22
|
+
spec.add_dependency 'activemerchant', '~> 1.60'
|
23
23
|
spec.add_dependency 'offsite_payments', '~> 2'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
-
spec.add_development_dependency 'rails', '>= 3.2.6', '<
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
26
|
+
spec.add_development_dependency 'rake', '~> 11.2'
|
27
|
+
spec.add_development_dependency 'rails', '>= 3.2.6', '< 6'
|
28
28
|
|
29
29
|
end
|
@@ -6,7 +6,7 @@ module OffsitePayments #:nodoc:
|
|
6
6
|
module Pay2go
|
7
7
|
class Helper < OffsitePayments::Helper
|
8
8
|
FIELDS = %w(
|
9
|
-
MerchantID LangType MerchantOrderNo Amt ItemDesc TradeLimit ExpireDate ReturnURL NotifyURL CustomerURL ClientBackURL Email EmailModify LoginType OrderComment CREDIT CreditRed InstFlag UNIONPAY WEBATM VACC CVS BARCODE CUSTOM TokenTerm
|
9
|
+
MerchantID LangType MerchantOrderNo Amt ItemDesc TradeLimit ExpireDate ExpireTime ReturnURL NotifyURL CustomerURL ClientBackURL Email EmailModify LoginType OrderComment CREDIT CreditRed InstFlag UNIONPAY WEBATM VACC CVS BARCODE CUSTOM TokenTerm
|
10
10
|
)
|
11
11
|
|
12
12
|
FIELDS.each do |field|
|
@@ -7,8 +7,8 @@ module OffsitePayments #:nodoc:
|
|
7
7
|
class Notification < OffsitePayments::Notification
|
8
8
|
PARAMS_FIELDS = %w(
|
9
9
|
Status Message MerchantID Amt TradeNo MerchantOrderNo PaymentType RespondType CheckCode PayTime IP
|
10
|
-
EscrowBank TokenUseStatus RespondCode Auth Card6No Card4No Inst InstFirst InstEach ECI PayBankCode
|
11
|
-
PayerAccount5Code CodeNo BankCode Barcode_1 Barcode_2 Barcode_3 ExpireDate CheckCode
|
10
|
+
EscrowBank TokenUseStatus RedAmt RespondCode Auth Card6No Card4No Inst InstFirst InstEach ECI PayBankCode
|
11
|
+
PayerAccount5Code CodeNo BankCode Barcode_1 Barcode_2 Barcode_3 ExpireDate ExpireTime CheckCode
|
12
12
|
)
|
13
13
|
|
14
14
|
PARAMS_FIELDS.each do |field|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_merchant_pay2go
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.60'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.60'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: offsite_payments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.13'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.13'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '11.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '11.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
version: 3.2.6
|
76
76
|
- - "<"
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
78
|
+
version: '6'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -85,7 +85,7 @@ dependencies:
|
|
85
85
|
version: 3.2.6
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '6'
|
89
89
|
description: This gem integrate Rails with pay2go(智付寶).
|
90
90
|
email:
|
91
91
|
- garylai1990@gmail.com
|
@@ -95,6 +95,7 @@ extra_rdoc_files: []
|
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
97
|
- ".travis.yml"
|
98
|
+
- CHANGELOG.md
|
98
99
|
- CODE_OF_CONDUCT.md
|
99
100
|
- Gemfile
|
100
101
|
- LICENSE.txt
|