tappay_ruby 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26afeb3605a9764ffde41417a8c8bf569ce1ef747b55a0ea03227b2e4635ef1
4
- data.tar.gz: 5b37260f95d67ecef4e586bc52eeb854c00f151e0db0201e035285bbe51dabf8
3
+ metadata.gz: 9cbe85ab3afecf239323a807b1a2d55311d1bcb3ad471a85681170eb52770a06
4
+ data.tar.gz: f9d027824f0691aeb7487febc2155d7e31d5a487d2fe3562b79bdb009ca401c9
5
5
  SHA512:
6
- metadata.gz: 527eea4df79a39998aa805e5e13bf039d52042723014922f9e06f3884f5a050f90e4c23fffe1f201916658a8b197b64c06560bb19d6c0c149a31c71138d9f943
7
- data.tar.gz: e11121af219cb3d6b884bd2f951f9ba4794c3e8136ceca749ea54926e492257490b2adbacd3eb99542d6f5d7738a7602647b6390aeecc1b5d40ad878923dfcfc
6
+ metadata.gz: d98f0e74412ca52ecc67c9f9cf6a24a574f5d4f409aa0c4dda9f9e6ab073d3c775aeafda4cf49140e702e0e6c1e43add2843cda020a5190b40a504e6a5ec82ae
7
+ data.tar.gz: 3b13ec89b5d01fa9b92fe0c5586c89d17462aedeced858178333200c0417070cfe7285f9011da8b3dd2f3b366ac67c3fd45c6a5cb69494dc64325ed4e0aacdea
data/README.md CHANGED
@@ -14,6 +14,7 @@ A Ruby library for integrating with TapPay payment services. This gem provides a
14
14
  - Line Pay
15
15
  - JKO Pay
16
16
  - Apple Pay
17
+ - iPass Money
17
18
  - Flexible merchant identification:
18
19
  - Support for both `merchant_id` and `merchant_group_id`
19
20
  - Automatic fallback handling
@@ -83,6 +84,7 @@ The gem uses the following priority order when resolving merchant IDs:
83
84
  2. If `merchant_group_id` is not set:
84
85
  - For Line Pay: Uses `line_pay_merchant_id` if set, otherwise falls back to `merchant_id`
85
86
  - For JKO Pay: Uses `jko_pay_merchant_id` if set, otherwise falls back to `merchant_id`
87
+ - For iPass Money: Uses `ipass_money_merchant_id` if set, otherwise falls back to `merchant_id`
86
88
  - For Instalments: Uses `instalment_merchant_id` if set, otherwise falls back to `merchant_id`
87
89
  - For other payment types: Uses `merchant_id`
88
90
 
@@ -206,6 +208,40 @@ payment = Tappay::JkoPay::Pay.new(payment_options)
206
208
  result = payment.execute
207
209
  ```
208
210
 
211
+ ### iPass Money
212
+
213
+ #### Configuration
214
+
215
+ ```ruby
216
+ Tappay.configure do |config|
217
+ config.partner_key = 'YOUR_PARTNER_KEY'
218
+ config.merchant_id = 'YOUR_MERCHANT_ID'
219
+ config.merchant_group_id = 'YOUR_MERCHANT_GROUP_ID' # Optional, mutually exclusive with merchant_id
220
+ config.ipass_money_merchant_id = 'YOUR_IPASS_MONEY_MERCHANT_ID' # Optional, falls back to merchant_id if not set
221
+ config.sandbox = true # Set to false for production
222
+ end
223
+ ```
224
+
225
+ #### Processing an iPass Money Payment
226
+
227
+ ```ruby
228
+ payment_options = {
229
+ prime: 'ipass_money_prime',
230
+ amount: 1000,
231
+ details: 'Some item',
232
+ frontend_redirect_url: 'https://your-site.com/ipass_money/result',
233
+ backend_notify_url: 'https://your-site.com/ipass_money/notify',
234
+ cardholder: {
235
+ phone_number: '0912345678',
236
+ name: 'Test User',
237
+ email: 'test@example.com'
238
+ }
239
+ }
240
+
241
+ payment = Tappay::IPassMoney::Pay.new(payment_options)
242
+ result = payment.execute
243
+ ```
244
+
209
245
  ### Transaction Query
210
246
 
211
247
  Query transaction records with required time range:
@@ -4,7 +4,8 @@ module Tappay
4
4
  class Configuration
5
5
  attr_accessor :partner_key, :merchant_id, :merchant_group_id, :instalment_merchant_id,
6
6
  :line_pay_merchant_id, :jko_pay_merchant_id, :currency,
7
- :google_pay_merchant_id, :apple_pay_merchant_id
7
+ :google_pay_merchant_id, :apple_pay_merchant_id,
8
+ :ipass_money_merchant_id
8
9
  attr_writer :api_version
9
10
 
10
11
  def initialize
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Tappay
4
+ module IPassMoney
5
+ class Pay < PaymentBase
6
+ def endpoint_url
7
+ Tappay::Endpoints::Payment.pay_by_prime_url
8
+ end
9
+
10
+ private
11
+
12
+ def get_merchant_id
13
+ # If merchant_group_id is set, it takes precedence
14
+ return nil if Tappay.configuration.merchant_group_id
15
+
16
+ # Otherwise, use ipass_money_merchant_id or fall back to default merchant_id
17
+ Tappay.configuration.ipass_money_merchant_id || super
18
+ end
19
+
20
+ def additional_required_options
21
+ [:prime, :frontend_redirect_url, :backend_notify_url, :cardholder]
22
+ end
23
+
24
+ def validate_options!
25
+ super
26
+ validate_result_url_format!
27
+ end
28
+
29
+ def validate_result_url_format!
30
+ # First validate that if result_url is provided, it's a hash with required fields
31
+ if options.key?(:result_url)
32
+ raise ValidationError, "result_url must be a hash" unless options[:result_url].is_a?(Hash)
33
+
34
+ result_url = options[:result_url]
35
+ required_fields = %w[frontend_redirect_url backend_notify_url]
36
+ missing = required_fields.select { |field| result_url[field.to_sym].nil? && result_url[field].nil? }
37
+
38
+ if missing.any?
39
+ raise ValidationError, "result_url must contain both frontend_redirect_url and backend_notify_url"
40
+ end
41
+ end
42
+
43
+ # Then validate frontend_redirect_url and backend_notify_url are present and not empty
44
+ if !options[:frontend_redirect_url].to_s.strip.empty? && !options[:backend_notify_url].to_s.strip.empty?
45
+ return
46
+ end
47
+
48
+ raise ValidationError, "result_url must contain both frontend_redirect_url and backend_notify_url"
49
+ end
50
+
51
+ protected
52
+
53
+ def payment_data
54
+ super.merge(
55
+ prime: options[:prime],
56
+ result_url: {
57
+ frontend_redirect_url: options[:frontend_redirect_url],
58
+ backend_notify_url: options[:backend_notify_url]
59
+ }
60
+ )
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tappay
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
data/lib/tappay.rb CHANGED
@@ -20,6 +20,7 @@ require_relative "tappay/line_pay/pay"
20
20
  require_relative "tappay/jko_pay/pay"
21
21
  require_relative "tappay/apple_pay/pay"
22
22
  require_relative "tappay/google_pay/pay"
23
+ require_relative "tappay/ipass_money/pay"
23
24
 
24
25
  module Tappay
25
26
  class Error < StandardError; 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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '2.1'
60
+ version: '3.1'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '2.1'
67
+ version: '3.1'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: webmock
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -126,6 +126,7 @@ files:
126
126
  - lib/tappay/endpoints.rb
127
127
  - lib/tappay/errors.rb
128
128
  - lib/tappay/google_pay/pay.rb
129
+ - lib/tappay/ipass_money/pay.rb
129
130
  - lib/tappay/jko_pay/pay.rb
130
131
  - lib/tappay/line_pay/pay.rb
131
132
  - lib/tappay/payment_base.rb
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
155
  - !ruby/object:Gem::Version
155
156
  version: '0'
156
157
  requirements: []
157
- rubygems_version: 4.0.3
158
+ rubygems_version: 4.0.6
158
159
  specification_version: 4
159
160
  summary: Ruby wrapper for TapPay payment gateway
160
161
  test_files: []