tappay_ruby 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc1badbabf5c5def08a9d4083c9d7d5914208a2d9854cabf0281741c386f2ae0
4
- data.tar.gz: 82ff98a54ceb603606186c94e7bb6c9dd28173543dabc28e68cf286f84363f55
3
+ metadata.gz: 42349c6d543ca1fa3a3bf6ead0e0f6eb9f281c80b28d35811058d2661d084f10
4
+ data.tar.gz: 82da8ed41bed6cfa50845bf8d9751fb796e8c2373e7978c9e60d35d560c2ccb8
5
5
  SHA512:
6
- metadata.gz: 7b3a89d63470d95a2d62af9a32b04048c211409a09af1a05e5c5a955a7d059e29f166c512d874a73c7f6b0af94618ed965d8b144b495e8c7df36bb17dfc528b4
7
- data.tar.gz: a2f99fbd4e843b457249a455d6e711f4d52deb44469c727df30cd97666c31c64879c20990b1f9e96f395786c749a6f09527590744805568c28ddd2fe6815b5c4
6
+ metadata.gz: bfd22c013a32a3aa5c13bc28c84d94e21f49cdaf71657b6f7cf39e2c0240cff23fe61db6b396ccbb02cdf0571802318689b022bc796e4253ea799bc3837c1898
7
+ data.tar.gz: 4878db49a06c88e21fc6a5affa06eed404bf2a90feaaa82921824ad27a280977caafe05d945765a43ca21cba41dba78bf52d6bd7cbdf8d59706a62207accacc3
data/README.md CHANGED
@@ -52,13 +52,40 @@ Tappay.configure do |config|
52
52
  # Common settings
53
53
  config.partner_key = 'your_partner_key'.freeze
54
54
  config.app_id = 'your_app_id'.freeze
55
+
56
+ # Merchant settings (use either merchant_id or merchant_group_id, not both)
55
57
  config.merchant_id = 'your_merchant_id'.freeze
58
+ # OR
59
+ config.merchant_group_id = 'your_merchant_group_id'.freeze
60
+
56
61
  config.instalment_merchant_id = 'your_instalment_merchant_id'.freeze
57
62
  config.currency = 'TWD'.freeze
58
63
  config.vat_number = 'your_vat_number'.freeze
59
64
  end
60
65
  ```
61
66
 
67
+ ### Merchant ID Configuration
68
+
69
+ The gem supports two types of merchant identification:
70
+ 1. `merchant_id`: Individual merchant ID
71
+ 2. `merchant_group_id`: Group merchant ID
72
+
73
+ Important rules:
74
+ - You can set either `merchant_id` or `merchant_group_id` in the configuration, but not both
75
+ - When making a payment, you can override the configured merchant ID by providing either `merchant_id` or `merchant_group_id` in the payment options
76
+ - If you provide merchant ID in the payment options, it will take precedence over any configuration
77
+
78
+ Example of overriding merchant ID in payment:
79
+ ```ruby
80
+ # Using merchant_group_id in payment options
81
+ result = Tappay::CreditCard::Pay.by_prime(
82
+ prime: 'prime_from_tappay_sdk',
83
+ amount: 100,
84
+ merchant_group_id: 'group_123', # This will be used instead of configured merchant_id
85
+ order_number: 'ORDER-123'
86
+ )
87
+ ```
88
+
62
89
  ### 2. Using Environment Variables
63
90
 
64
91
  For better security, you can use environment variables:
@@ -138,6 +165,38 @@ result = Tappay::CreditCard::Pay.by_prime(
138
165
 
139
166
  Both approaches are valid and will work the same way. The CardHolder object provides a more structured way to handle cardholder information and includes validation.
140
167
 
168
+ ## Payment URL
169
+
170
+ When processing payments, the API response may include a `payment_url` field. This URL is used for redirecting users to complete their payment in scenarios such as:
171
+
172
+ - 3D Secure verification
173
+ - LINE Pay payment page
174
+ - JKO Pay payment page
175
+
176
+ Note: payment_url is not supported for:
177
+ - Apple Pay
178
+ - Google Pay
179
+ - Samsung Pay
180
+
181
+ Example of handling payment URL in response:
182
+ ```ruby
183
+ result = Tappay::CreditCard::Pay.by_prime(
184
+ prime: 'prime_from_tappay_sdk',
185
+ amount: 100,
186
+ order_number: 'ORDER-123'
187
+ )
188
+
189
+ if result['status'] == 0
190
+ if result['payment_url']
191
+ # Redirect user to payment page for:
192
+ # - 3D Secure verification
193
+ # - LINE Pay payment
194
+ # - JKO Pay payment
195
+ redirect_to result['payment_url']
196
+ end
197
+ end
198
+ ```
199
+
141
200
  ## Usage
142
201
 
143
202
  ### Pay by Prime
@@ -165,6 +224,11 @@ if result['status'] == 0
165
224
  card_token = result['card_secret']['card_token']
166
225
  # Store card_key and card_token securely for future payments
167
226
  end
227
+
228
+ # Handle payment URL if present (for 3D Secure, LINE Pay, JKO Pay)
229
+ if result['payment_url']
230
+ redirect_to result['payment_url']
231
+ end
168
232
  end
169
233
  ```
170
234
 
@@ -213,6 +277,11 @@ begin
213
277
  number_of_instalments = instalment_info['number_of_instalments']
214
278
  first_payment = instalment_info['first_payment']
215
279
  each_payment = instalment_info['each_payment']
280
+
281
+ # Handle payment URL if present (for 3D Secure)
282
+ if result['payment_url']
283
+ redirect_to result['payment_url']
284
+ end
216
285
  end
217
286
  rescue Tappay::PaymentError => e
218
287
  # Handle payment error
@@ -61,7 +61,6 @@ module Tappay
61
61
  end
62
62
  data[:cardholder] = card_holder_data if options[:cardholder]
63
63
  data[:instalment] = options[:instalment] if options[:instalment]
64
- data[:payment_url] = options[:payment_url] if options[:payment_url]
65
64
  end
66
65
  end
67
66
 
@@ -1,3 +1,3 @@
1
1
  module Tappay
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tappay_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac