tappay_ruby 0.14.1 → 0.15.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: 30a0a7672bbced59b2ff0ef6903782a1e451e63a7396044be89bfe8270e68fe0
4
- data.tar.gz: 9ef971abeaa9a67078161aec185cc0e593d3a0fd830928d4e6e5e3e722a96e5b
3
+ metadata.gz: 2f742c529704f4c8827279a389a8248b31187a0a4d0e7fe78c3f8cce4c37d258
4
+ data.tar.gz: a748c1be3290bfd4958a916f0d091e65aac613194e272f2e77bd27a31ec6ad46
5
5
  SHA512:
6
- metadata.gz: 806ffac0928ab096a8d15bc28dc3ef10ed4e55c4ffdd9a27d84678992e34cfa89e6486a206af66068a0dd06e7c8f2c934b37826c0ed9121fb146d01643f8dc7b
7
- data.tar.gz: b32fed3a1c14b5b1d56487dfe2adc8da85e4154d3c94c2c9d75143cd89f144980badafdc9fd3c2fb5e642496af0324c6aa51c5af57153fae265fea4130d0604a
6
+ metadata.gz: d4e7882a06763c5bcea9b1baa2a9e2f8fb18bc337b34a24492111753d97693c11f5e5b641906f111d92d62c78453b0b4657dca63c4b6dcaa4cb256c1141da851
7
+ data.tar.gz: 337f14cde883f0de677da6b04c856ed8258440d6eecc82bc50e032ab67fb731cf8f090d6ab8d05daaa671b29cd6577d081a6d5e14389ab8090040de992270bb7
data/README.md CHANGED
@@ -18,7 +18,7 @@ A Ruby library for integrating with TapPay payment services. This gem provides a
18
18
  - Support for both `merchant_id` and `merchant_group_id`
19
19
  - Automatic fallback handling
20
20
  - Priority-based merchant ID resolution
21
- - Refund processing
21
+ - Universal refund processing for all payment methods
22
22
  - Transaction status queries
23
23
  - Comprehensive error handling
24
24
  - Configurable sandbox/production environments
@@ -131,6 +131,18 @@ result = Tappay::LinePay::Pay.new(
131
131
  ).execute
132
132
  ```
133
133
 
134
+ ### Refund Processing
135
+
136
+ Process refunds for any payment method:
137
+
138
+ ```ruby
139
+ # Process a refund
140
+ result = Tappay::Refund.new(
141
+ rec_trade_id: 'TRANSACTION_ID',
142
+ amount: 1000
143
+ ).execute
144
+ ```
145
+
134
146
  ### JKO Pay
135
147
 
136
148
  #### Configuration
@@ -10,6 +10,10 @@ module Tappay
10
10
  'https://prod.tappaysdk.com'
11
11
  end
12
12
  end
13
+
14
+ def refund_url
15
+ "#{base_url}/tpc/transaction/refund"
16
+ end
13
17
  end
14
18
 
15
19
  module Payment
@@ -24,14 +28,6 @@ module Tappay
24
28
  end
25
29
  end
26
30
 
27
- module CreditCard
28
- class << self
29
- def refund_url
30
- "#{Endpoints.base_url}/tpc/transaction/refund"
31
- end
32
- end
33
- end
34
-
35
31
  module Transaction
36
32
  class << self
37
33
  def query_url
@@ -0,0 +1,28 @@
1
+ module Tappay
2
+ class Refund < Client
3
+ def initialize(options = {})
4
+ super
5
+ validate_options!
6
+ end
7
+
8
+ def execute
9
+ post(Endpoints.refund_url, refund_data)
10
+ end
11
+
12
+ private
13
+
14
+ def refund_data
15
+ {
16
+ partner_key: Tappay.configuration.partner_key,
17
+ rec_trade_id: options[:rec_trade_id],
18
+ amount: options[:amount]
19
+ }
20
+ end
21
+
22
+ def validate_options!
23
+ required = [:rec_trade_id, :amount]
24
+ missing = required.select { |key| options[key].nil? }
25
+ raise ValidationError, "Missing required options: #{missing.join(', ')}" if missing.any?
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tappay
4
- VERSION = "0.14.1"
4
+ VERSION = "0.15.0"
5
5
  end
data/lib/tappay.rb CHANGED
@@ -9,12 +9,12 @@ require_relative "tappay/version"
9
9
  require_relative "tappay/configuration"
10
10
  require_relative "tappay/client"
11
11
  require_relative "tappay/errors"
12
+ require_relative "tappay/refund"
12
13
  require_relative "tappay/payment_base"
13
14
  require_relative "tappay/card_holder"
14
15
  require_relative "tappay/endpoints"
15
16
  require_relative "tappay/transaction/query"
16
17
  require_relative "tappay/credit_card/pay"
17
- require_relative "tappay/credit_card/refund"
18
18
  require_relative "tappay/credit_card/instalment"
19
19
  require_relative "tappay/line_pay/pay"
20
20
  require_relative "tappay/jko_pay/pay"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tappay_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zac
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-21 00:00:00.000000000 Z
10
+ date: 2025-01-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: httparty
@@ -81,13 +81,13 @@ files:
81
81
  - lib/tappay/configuration.rb
82
82
  - lib/tappay/credit_card/instalment.rb
83
83
  - lib/tappay/credit_card/pay.rb
84
- - lib/tappay/credit_card/refund.rb
85
84
  - lib/tappay/endpoints.rb
86
85
  - lib/tappay/errors.rb
87
86
  - lib/tappay/google_pay/pay.rb
88
87
  - lib/tappay/jko_pay/pay.rb
89
88
  - lib/tappay/line_pay/pay.rb
90
89
  - lib/tappay/payment_base.rb
90
+ - lib/tappay/refund.rb
91
91
  - lib/tappay/transaction/query.rb
92
92
  - lib/tappay/version.rb
93
93
  - lib/tappay_ruby.rb
@@ -1,31 +0,0 @@
1
- module Tappay
2
- module CreditCard
3
- class Refund < Client
4
- def initialize(options = {})
5
- super
6
- validate_options!
7
- end
8
-
9
- def execute
10
- post(Endpoints::CreditCard.refund_url, refund_data)
11
- end
12
-
13
- private
14
-
15
- def refund_data
16
- {
17
- partner_key: Tappay.configuration.partner_key,
18
- rec_trade_id: options[:transaction_id],
19
- amount: options[:amount]
20
- }
21
- end
22
-
23
- def validate_options!
24
- required = [:transaction_id, :amount]
25
- missing = required.select { |key| options[key].nil? }
26
-
27
- raise ValidationError, "Missing required options: #{missing.join(', ')}" if missing.any?
28
- end
29
- end
30
- end
31
- end