spree_vpago 2.0.5.pre.beta2 → 2.0.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/Gemfile.lock +1 -1
- data/app/models/spree/gateway/vattanac_mini_app.rb +5 -10
- data/docs/vattanac_mini_app.md +12 -0
- data/lib/spree_vpago/version.rb +1 -1
- data/lib/vpago/vattanac_mini_app/base.rb +2 -3
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ef60f028340ceaa61336833ec624092ed9f32447fd7adbde31345b0eadd725
|
4
|
+
data.tar.gz: fbf8efefd803b39458c5e6f10b216098f4c22a65a84e3af61ebe580c592e4b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '089f3456f9992f1337974039c22e2d1484df07bf6c75053ebf53cb61927d53f6e16b6a086dcefababbc14d7b2ee2d4ec0ff61f08d0535cc2a6169dd80c0db53b'
|
7
|
+
data.tar.gz: d243bf13344af8e1a0c2c01ee05732c56c34761dccd25ef05cb428b0f3d6c12cf834646cb3942c6edac10fbe44318b71eb77d062578ce1b383e628f0204d968d
|
data/Gemfile.lock
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
class Gateway::VattanacMiniApp < PaymentMethod
|
3
|
+
preference :partner_code, :string
|
4
|
+
preference :refund_url, :string
|
3
5
|
|
4
6
|
def method_type
|
5
7
|
'vattanac_mini_app'
|
@@ -14,27 +16,23 @@ module Spree
|
|
14
16
|
true
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
19
|
# override
|
19
20
|
# purchase is used when pre auth disabled
|
20
21
|
def purchase(_amount, _source, gateway_options = {})
|
21
22
|
_, payment_number = gateway_options[:order_id].split('-')
|
22
23
|
payment = Spree::Payment.find_by(number: payment_number)
|
23
|
-
|
24
|
+
|
24
25
|
params = {}
|
25
26
|
|
26
27
|
params[:payment_response] = payment.transaction_response
|
27
|
-
|
28
28
|
|
29
|
-
if payment.transaction_response[
|
29
|
+
if payment.transaction_response['status'] == 'SUCCESS'
|
30
30
|
ActiveMerchant::Billing::Response.new(true, 'Payway Gateway: Purchased', params)
|
31
31
|
else
|
32
32
|
ActiveMerchant::Billing::Response.new(false, 'Payway Gateway: Purchasing Failed', params)
|
33
33
|
end
|
34
|
-
|
35
34
|
end
|
36
35
|
|
37
|
-
|
38
36
|
# override
|
39
37
|
def void(_response_code, gateway_options)
|
40
38
|
_, payment_number = gateway_options[:order_id].split('-')
|
@@ -42,7 +40,7 @@ module Spree
|
|
42
40
|
|
43
41
|
if payment.vattanac_mini_app_payment?
|
44
42
|
params = {}
|
45
|
-
success, params[:refund_response] =
|
43
|
+
success, params[:refund_response] = vattanac_mini_app_refund(payment)
|
46
44
|
|
47
45
|
if success
|
48
46
|
ActiveMerchant::Billing::Response.new(true, 'Payway Gateway: successfully canceled.', params)
|
@@ -54,14 +52,11 @@ module Spree
|
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
|
-
|
58
55
|
def vattanac_mini_app_refund(payment)
|
59
|
-
|
60
56
|
refund_issuer = Vpago::VattanacMiniApp::RefundIssuer.new(payment, {})
|
61
57
|
refund_issuer.call
|
62
58
|
|
63
59
|
[refund_issuer.success?, refund_issuer.response]
|
64
|
-
|
65
60
|
end
|
66
61
|
|
67
62
|
def cancel(_response_code)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
## Vattanac Mini App Payment Configuration
|
2
|
+
|
3
|
+
To configure Vattanac Mini App payment, set the following preferences on the payment method:
|
4
|
+
|
5
|
+
1. Add the **Partner Code** (`preferred_partner_code`) – this value is sent in the HTTP request header as `Partner-Code`.
|
6
|
+
2. Add the **Refund URL** (`preferred_refund_url`) – this URL is used to trigger refund API requests.
|
7
|
+
|
8
|
+
### Example:
|
9
|
+
|
10
|
+
|
11
|
+
- Partner Code: `your-partner-code`
|
12
|
+
- Refund URL: `https://your-api.com/refund`
|
data/lib/spree_vpago/version.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Vpago
|
2
2
|
module VattanacMiniApp
|
3
3
|
class Base
|
4
|
-
|
5
4
|
def initialize(payment, options = {})
|
6
5
|
@options = options
|
7
6
|
@payment = payment
|
@@ -41,11 +40,11 @@ module Vpago
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def partner_code
|
44
|
-
|
43
|
+
@payment.payment_method.preferred_partner_code
|
45
44
|
end
|
46
45
|
|
47
46
|
def refund_url
|
48
|
-
|
47
|
+
@payment.payment_method.preferred_refund_url
|
49
48
|
end
|
50
49
|
end
|
51
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_vpago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -339,6 +339,7 @@ files:
|
|
339
339
|
- db/migrate/20241202104014_add_enable_pre_auth_to_spree_payment_method.rb
|
340
340
|
- db/migrate/20250121044614_add_transaction_response_to_spree_payments.rb
|
341
341
|
- docs/acleda.md
|
342
|
+
- docs/vattanac_mini_app.md
|
342
343
|
- gemfiles/spree_3_7.gemfile
|
343
344
|
- gemfiles/spree_4_0.gemfile
|
344
345
|
- gemfiles/spree_4_1.gemfile
|
@@ -407,9 +408,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
407
408
|
version: 3.2.0
|
408
409
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
409
410
|
requirements:
|
410
|
-
- - "
|
411
|
+
- - ">="
|
411
412
|
- !ruby/object:Gem::Version
|
412
|
-
version:
|
413
|
+
version: '0'
|
413
414
|
requirements:
|
414
415
|
- none
|
415
416
|
rubygems_version: 3.4.1
|