active_merchant_gmo_pg 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1c7bb63e545450d808cb77df7a1f700a3589eb70c9527109ae2313e386d6596
4
+ data.tar.gz: 1abcb6c7d8dbac3c07b63f9c4951ccd26f481fa988f249152ff2d4b48d5f3436
5
+ SHA512:
6
+ metadata.gz: c03b434331ff343c7379ac19d3e04dec3f81844b5dc3f5983919cf80f8de47954b2e8adab28d450f76ed3552714d0b9787f99bdb9bb9a2ed68f91d0bfad1b4c7
7
+ data.tar.gz: e80d7d6ce3ab4320d325632cb61a1e20b7b30ea86048c5063d014579e9a8640f81b9ed055ec449b60dd2d95a053f18cdf081eafcd0ab877b9acd652350517fcc
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Be Agile
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # ActiveMerchant GMO-PG
2
+
3
+ An ActiveMerchant gateway that wraps the GMO Payment Gateway (GMO-PG) payment API.
4
+
5
+ ## Features
6
+
7
+ - Register / delete stored credit cards (member management)
8
+ - Authorize, immediate capture, capture, void, refund
9
+ - 3DS2.0 authentication
10
+ - Token-based payments
11
+ - Multiple cards per member
12
+
13
+ ## Installation
14
+
15
+ Add this line to your Gemfile:
16
+
17
+ ```ruby
18
+ gem 'active_merchant_gmo_pg'
19
+ ```
20
+
21
+ Then run:
22
+
23
+ ```bash
24
+ bundle install
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### Initializing the gateway
30
+
31
+ ```ruby
32
+ gateway = ActiveMerchant::Billing::GmoPgGateway.new(
33
+ shop_id: 'your_shop_id',
34
+ shop_pass: 'your_shop_pass',
35
+ site_id: 'your_site_id',
36
+ site_pass: 'your_site_pass',
37
+ test: true # set to false in production
38
+ )
39
+ ```
40
+
41
+ ### Registering a card
42
+
43
+ ```ruby
44
+ credit_card = ActiveMerchant::Billing::CreditCard.new(
45
+ number: '4111111111111111',
46
+ month: 12,
47
+ year: 2025,
48
+ verification_value: '123',
49
+ first_name: 'Taro',
50
+ last_name: 'Yamada'
51
+ )
52
+
53
+ response = gateway.store(credit_card, member_id: 'user123')
54
+
55
+ if response.success?
56
+ # response.authorization contains an identifier in "member_id|card_seq" form
57
+ puts "Card registered: #{response.authorization}"
58
+ else
59
+ puts "Error: #{response.message}"
60
+ end
61
+ ```
62
+
63
+ ### Authorize
64
+
65
+ ```ruby
66
+ response = gateway.authorize(1000, credit_card, order_id: 'order123')
67
+
68
+ if response.success?
69
+ puts "Authorized: #{response.authorization}"
70
+ else
71
+ puts "Error: #{response.message}"
72
+ end
73
+ ```
74
+
75
+ ### Immediate capture (purchase)
76
+
77
+ ```ruby
78
+ response = gateway.purchase(1000, credit_card, order_id: 'order124')
79
+
80
+ if response.success?
81
+ puts "Charged: #{response.authorization}"
82
+ else
83
+ puts "Error: #{response.message}"
84
+ end
85
+ ```
86
+
87
+ ### Capture
88
+
89
+ ```ruby
90
+ response = gateway.capture(1000, authorization)
91
+
92
+ if response.success?
93
+ puts "Captured"
94
+ else
95
+ puts "Error: #{response.message}"
96
+ end
97
+ ```
98
+
99
+ ### Void
100
+
101
+ ```ruby
102
+ response = gateway.void(authorization)
103
+
104
+ if response.success?
105
+ puts "Voided"
106
+ else
107
+ puts "Error: #{response.message}"
108
+ end
109
+ ```
110
+
111
+ ### Refund
112
+
113
+ ```ruby
114
+ response = gateway.credit(1000, authorization)
115
+
116
+ if response.success?
117
+ puts "Refunded"
118
+ else
119
+ puts "Error: #{response.message}"
120
+ end
121
+ ```
122
+
123
+ ### Deleting a stored card
124
+
125
+ ```ruby
126
+ response = gateway.unstore(authorization)
127
+
128
+ if response.success?
129
+ puts "Card deleted"
130
+ else
131
+ puts "Error: #{response.message}"
132
+ end
133
+ ```
134
+
135
+ ## 3DS2.0 authentication
136
+
137
+ To use 3DS2.0, pass the `ret_url` option to `authorize` or `purchase`:
138
+
139
+ ```ruby
140
+ response = gateway.authorize(1000, credit_card,
141
+ order_id: 'order125',
142
+ ret_url: 'https://example.com/callback'
143
+ )
144
+
145
+ if response.success?
146
+ redirect_url = response.params['RedirectUrl']
147
+ # Redirect the user to redirect_url to complete 3DS authentication
148
+ end
149
+ ```
150
+
151
+ ## Configuration
152
+
153
+ ### Switching environments
154
+
155
+ For production, pass `test: false`:
156
+
157
+ ```ruby
158
+ gateway = ActiveMerchant::Billing::GmoPgGateway.new(
159
+ shop_id: 'your_shop_id',
160
+ shop_pass: 'your_shop_pass',
161
+ site_id: 'your_site_id',
162
+ site_pass: 'your_site_pass',
163
+ test: false
164
+ )
165
+ ```
166
+
167
+ ## Licence
168
+
169
+ MIT License.
170
+
171
+ ## References
172
+
173
+ - [GMO-PG official site](https://www.gmo-pg.com/)
174
+ - [GMO-PG API documentation](https://docs.mul-pay.jp/)
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec