spree_vpago 2.1.1 → 2.1.3.pre.beta
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 +18 -18
- data/app/assets/images/payment_logos/acleda-cards.png +0 -0
- data/app/assets/images/payment_logos/acleda-khqr.png +0 -0
- data/app/assets/images/payment_logos/acleda.png +0 -0
- data/app/assets/images/payment_logos/cheque.png +0 -0
- data/app/assets/images/payment_logos/payway-abapay-khqr.png +0 -0
- data/app/assets/images/payment_logos/payway-abapay.png +0 -0
- data/app/assets/images/payment_logos/payway-alipay.png +0 -0
- data/app/assets/images/payment_logos/payway-cards.png +0 -0
- data/app/assets/images/payment_logos/payway-wechat.png +0 -0
- data/app/assets/images/payment_logos/true-money.png +0 -0
- data/app/assets/images/payment_logos/vattanac-mini-app.png +0 -0
- data/app/assets/images/payment_logos/wingpay.png +0 -0
- data/app/helpers/vpago/admin/base_helper_decorator.rb +1 -0
- data/app/models/spree/gateway/vattanac.rb +70 -0
- data/app/models/vpago/line_item_decorator.rb +12 -11
- data/app/models/vpago/payment_decorator.rb +8 -0
- data/app/models/vpago/payment_method_decorator.rb +12 -1
- data/app/services/vpago/payment_finder.rb +3 -8
- data/app/services/vpago/payments/find_or_create.rb +2 -1
- data/app/views/spree/admin/payments/source_views/_vattanac.html.erb +6 -0
- data/app/views/spree/vpago_payments/forms/spree/gateway/_vattanac.html.erb +31 -0
- data/lib/spree_vpago/engine.rb +1 -0
- data/lib/spree_vpago/version.rb +1 -1
- data/lib/vpago/vattanac/base.rb +90 -0
- data/lib/vpago/vattanac/checkout.rb +27 -0
- data/lib/vpago/vattanac/transaction_status.rb +23 -0
- metadata +22 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 050cbc236c6ee73efa288a53ccb9ed0d997d5056a364c329cc1d6fdf943c2588
|
|
4
|
+
data.tar.gz: '09dac79729125ce876a4865bc17b9dc58fc37f4153bcf803014f5ed17afc06b3'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1b906c102871367972b3deff873c39bc5bdc0c2e6748c2324f00e0e0b7db946699b9e2984b8364050c4ff6f929d3dd36473605ee06904141213cb9957b10517
|
|
7
|
+
data.tar.gz: 8b9392064584a88fbb22f0554680c90ba2b3943764e08b8123548d20112946b356e23b7b5fbca533d983e64865c37dcab38af7f03e7b280485c78453f1d99b2e
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
spree_vpago (2.1.
|
|
4
|
+
spree_vpago (2.1.3.pre.beta)
|
|
5
5
|
faraday
|
|
6
6
|
google-cloud-firestore
|
|
7
7
|
spree_api (>= 4.5)
|
|
@@ -198,12 +198,12 @@ GEM
|
|
|
198
198
|
flatpickr (4.6.13.1)
|
|
199
199
|
friendly_id (5.5.0)
|
|
200
200
|
activerecord (>= 4.0.0)
|
|
201
|
-
gapic-common (1.0
|
|
201
|
+
gapic-common (1.2.0)
|
|
202
202
|
faraday (>= 1.9, < 3.a)
|
|
203
203
|
faraday-retry (>= 1.0, < 3.a)
|
|
204
204
|
google-cloud-env (~> 2.2)
|
|
205
205
|
google-logging-utils (~> 0.1)
|
|
206
|
-
google-protobuf (
|
|
206
|
+
google-protobuf (~> 4.26)
|
|
207
207
|
googleapis-common-protos (~> 1.6)
|
|
208
208
|
googleapis-common-protos-types (~> 1.15)
|
|
209
209
|
googleauth (~> 1.12)
|
|
@@ -234,32 +234,32 @@ GEM
|
|
|
234
234
|
google-cloud-core (~> 1.7)
|
|
235
235
|
google-cloud-firestore-v1 (~> 2.0)
|
|
236
236
|
rbtree (~> 0.4.2)
|
|
237
|
-
google-cloud-firestore-v1 (2.
|
|
238
|
-
gapic-common (~> 1.
|
|
237
|
+
google-cloud-firestore-v1 (2.2.0)
|
|
238
|
+
gapic-common (~> 1.2)
|
|
239
239
|
google-cloud-errors (~> 1.0)
|
|
240
240
|
google-cloud-location (~> 1.0)
|
|
241
|
-
google-cloud-location (1.
|
|
242
|
-
gapic-common (~> 1.
|
|
241
|
+
google-cloud-location (1.2.0)
|
|
242
|
+
gapic-common (~> 1.2)
|
|
243
243
|
google-cloud-errors (~> 1.0)
|
|
244
244
|
google-logging-utils (0.2.0)
|
|
245
|
-
google-protobuf (4.
|
|
245
|
+
google-protobuf (4.33.0-arm64-darwin)
|
|
246
246
|
bigdecimal
|
|
247
247
|
rake (>= 13)
|
|
248
|
-
googleapis-common-protos (1.
|
|
249
|
-
google-protobuf (
|
|
250
|
-
googleapis-common-protos-types (~> 1.
|
|
248
|
+
googleapis-common-protos (1.9.0)
|
|
249
|
+
google-protobuf (~> 4.26)
|
|
250
|
+
googleapis-common-protos-types (~> 1.21)
|
|
251
251
|
grpc (~> 1.41)
|
|
252
|
-
googleapis-common-protos-types (1.
|
|
253
|
-
google-protobuf (
|
|
254
|
-
googleauth (1.
|
|
252
|
+
googleapis-common-protos-types (1.22.0)
|
|
253
|
+
google-protobuf (~> 4.26)
|
|
254
|
+
googleauth (1.15.1)
|
|
255
255
|
faraday (>= 1.0, < 3.a)
|
|
256
256
|
google-cloud-env (~> 2.2)
|
|
257
257
|
google-logging-utils (~> 0.1)
|
|
258
|
-
jwt (>= 1.4, <
|
|
258
|
+
jwt (>= 1.4, < 4.0)
|
|
259
259
|
multi_json (~> 1.11)
|
|
260
260
|
os (>= 0.9, < 2.0)
|
|
261
261
|
signet (>= 0.16, < 2.a)
|
|
262
|
-
grpc (1.
|
|
262
|
+
grpc (1.76.0-arm64-darwin)
|
|
263
263
|
google-protobuf (>= 3.25, < 5.0)
|
|
264
264
|
googleapis-common-protos-types (~> 1.0)
|
|
265
265
|
hashdiff (1.1.0)
|
|
@@ -479,10 +479,10 @@ GEM
|
|
|
479
479
|
websocket (~> 1.0)
|
|
480
480
|
shoulda-matchers (6.2.0)
|
|
481
481
|
activesupport (>= 5.2.0)
|
|
482
|
-
signet (0.
|
|
482
|
+
signet (0.21.0)
|
|
483
483
|
addressable (~> 2.8)
|
|
484
484
|
faraday (>= 0.17.5, < 3.a)
|
|
485
|
-
jwt (>= 1.5, <
|
|
485
|
+
jwt (>= 1.5, < 4.0)
|
|
486
486
|
multi_json (~> 1.10)
|
|
487
487
|
simplecov (0.22.0)
|
|
488
488
|
docile (~> 1.1)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
class Gateway::Vattanac < PaymentMethod
|
|
3
|
+
preference :generate_payment_url, :string
|
|
4
|
+
preference :access_token_url, :string
|
|
5
|
+
preference :check_transaction_url, :string
|
|
6
|
+
|
|
7
|
+
preference :username, :string
|
|
8
|
+
preference :password, :string
|
|
9
|
+
preference :merchant_id, :string
|
|
10
|
+
preference :payment_type, :string, default: 'GOLF_TICKET'
|
|
11
|
+
preference :open_type, :string, default: 'both'
|
|
12
|
+
|
|
13
|
+
def method_type
|
|
14
|
+
'vattanac'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def payment_source_class
|
|
18
|
+
Spree::VpagoPaymentSource
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# force to purchase instead of authorize
|
|
22
|
+
def auto_capture?
|
|
23
|
+
true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# override
|
|
27
|
+
# purchase is used when pre auth disabled
|
|
28
|
+
def purchase(_amount, _source, gateway_options = {})
|
|
29
|
+
_, payment_number = gateway_options[:order_id].split('-')
|
|
30
|
+
payment = Spree::Payment.find_by(number: payment_number)
|
|
31
|
+
|
|
32
|
+
checker = check_transaction(payment)
|
|
33
|
+
payment.update(transaction_response: checker.json_response)
|
|
34
|
+
|
|
35
|
+
success = checker.success?
|
|
36
|
+
params = {}
|
|
37
|
+
|
|
38
|
+
params[:payment_response] = payment.transaction_response
|
|
39
|
+
|
|
40
|
+
if success
|
|
41
|
+
ActiveMerchant::Billing::Response.new(true, 'Payway Gateway: Purchased', params)
|
|
42
|
+
else
|
|
43
|
+
ActiveMerchant::Billing::Response.new(false, 'Payway Gateway: Purchasing Failed', params)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def vattanac_refund(payment)
|
|
48
|
+
refund_issuer = Vpago::Vattanac::RefundIssuer.new(payment, {})
|
|
49
|
+
refund_issuer.call
|
|
50
|
+
|
|
51
|
+
[refund_issuer.success?, refund_issuer.parsed_response]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def cancel(_response_code, _payment)
|
|
55
|
+
# we can use this to send request to payment gateway api to cancel the payment ( void )
|
|
56
|
+
# currently Vattanac does not support to cancel the gateway
|
|
57
|
+
|
|
58
|
+
# in our case don't do anything
|
|
59
|
+
ActiveMerchant::Billing::Response.new(true, '')
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def check_transaction(payment)
|
|
65
|
+
checker = Vpago::Vattanac::TransactionStatus.new(payment)
|
|
66
|
+
checker.call
|
|
67
|
+
checker
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -52,17 +52,18 @@ module Vpago
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def latest_private_metadata
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
# Preserve existing metadata and merge with new financial data
|
|
56
|
+
updated_private_metadata = (private_metadata || {}).dup
|
|
57
|
+
|
|
58
|
+
updated_private_metadata[:subtotal] = subtotal.to_f
|
|
59
|
+
updated_private_metadata[:commission_rate] = commission_rate.to_f
|
|
60
|
+
updated_private_metadata[:commission_amount] = commission_amount.to_f
|
|
61
|
+
updated_private_metadata[:vendor_pre_tax_amount] = vendor_pre_tax_amount.to_f
|
|
62
|
+
updated_private_metadata[:pre_commission_amount] = pre_commission_amount.to_f
|
|
63
|
+
updated_private_metadata[:vendor_tax_total] = vendor_tax_total.to_f
|
|
64
|
+
updated_private_metadata[:vendor_adjustments_total_excluding_tax] = vendor_adjustments_total_excluding_tax.to_f
|
|
65
|
+
|
|
66
|
+
updated_private_metadata
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
# generate metadata for financial reports.
|
|
@@ -61,9 +61,17 @@ module Vpago
|
|
|
61
61
|
payment_method.type_true_money?
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
def vattanac_payment?
|
|
65
|
+
payment_method.type_vattanac?
|
|
66
|
+
end
|
|
67
|
+
|
|
64
68
|
def vattanac_mini_app_payment?
|
|
65
69
|
payment_method.type_vattanac_mini_app?
|
|
66
70
|
end
|
|
71
|
+
|
|
72
|
+
def check_payment?
|
|
73
|
+
payment_method.type_check?
|
|
74
|
+
end
|
|
67
75
|
end
|
|
68
76
|
end
|
|
69
77
|
|
|
@@ -5,8 +5,9 @@ module Vpago
|
|
|
5
5
|
TYPE_WINGSDK = 'Spree::Gateway::WingSdk'.freeze
|
|
6
6
|
TYPE_ACLEDA = 'Spree::Gateway::Acleda'.freeze
|
|
7
7
|
TYPE_ACLEDA_MOBILE = 'Spree::Gateway::AcledaMobile'.freeze
|
|
8
|
-
TYPE_VATTANAC_MINI_APP = 'Spree::Gateway::VattanacMiniApp'.freeze
|
|
9
8
|
TYPE_TRUE_MONEY = 'Spree::Gateway::TrueMoney'.freeze
|
|
9
|
+
TYPE_VATTANAC = 'Spree::Gateway::Vattanac'.freeze
|
|
10
|
+
TYPE_VATTANAC_MINI_APP = 'Spree::Gateway::VattanacMiniApp'.freeze
|
|
10
11
|
|
|
11
12
|
def self.prepended(base)
|
|
12
13
|
base.preference :icon_name, :string, default: 'cheque'
|
|
@@ -19,6 +20,7 @@ module Vpago
|
|
|
19
20
|
Spree::PaymentMethod::TYPE_WINGSDK,
|
|
20
21
|
Spree::PaymentMethod::TYPE_ACLEDA,
|
|
21
22
|
Spree::PaymentMethod::TYPE_ACLEDA_MOBILE,
|
|
23
|
+
Spree::PaymentMethod::TYPE_VATTANAC,
|
|
22
24
|
Spree::PaymentMethod::TYPE_VATTANAC_MINI_APP,
|
|
23
25
|
Spree::PaymentMethod::TYPE_TRUE_MONEY
|
|
24
26
|
]
|
|
@@ -97,6 +99,15 @@ module Vpago
|
|
|
97
99
|
def type_true_money?
|
|
98
100
|
type == Spree::PaymentMethod::TYPE_TRUE_MONEY
|
|
99
101
|
end
|
|
102
|
+
|
|
103
|
+
def type_check?
|
|
104
|
+
type == 'Spree::PaymentMethod::Check'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# @return [String] the image asset path, e.g. "payment_logos/payway-abapay-khqr.png"
|
|
108
|
+
def payment_icon_path
|
|
109
|
+
"payment_logos/#{preferred_icon_name.tr('_', ' ').parameterize}.png"
|
|
110
|
+
end
|
|
100
111
|
end
|
|
101
112
|
end
|
|
102
113
|
|
|
@@ -7,7 +7,6 @@ module Vpago
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def find_and_verify
|
|
10
|
-
|
|
11
10
|
find_and_verify!
|
|
12
11
|
rescue StandardError, ActiveRecord::RecordNotFound => e
|
|
13
12
|
Rails.logger.error("PaymentJwtVerifier#find_and_verify error: #{e.class} - #{e.message}")
|
|
@@ -15,16 +14,15 @@ module Vpago
|
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
def find_and_verify!
|
|
18
|
-
|
|
19
17
|
if vattanac_mini_app_payload?
|
|
20
|
-
payload =
|
|
18
|
+
payload = Vpago::VattanacMiniAppDataHandler.new.decrypt_data(@params_hash[:data])
|
|
21
19
|
payment = Spree::Payment.find_by!(number: payload['paymentId'])
|
|
22
20
|
payment.update(transaction_response: payload)
|
|
23
21
|
payment
|
|
24
|
-
else
|
|
22
|
+
else
|
|
25
23
|
order = Spree::Order.find_by!(number: params_hash[:order_number])
|
|
26
24
|
verify_jwt!(order)
|
|
27
|
-
|
|
25
|
+
|
|
28
26
|
Spree::Payment.find_by!(number: params_hash[:payment_number])
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -36,8 +34,5 @@ module Vpago
|
|
|
36
34
|
def vattanac_mini_app_payload?
|
|
37
35
|
params_hash[:data].present?
|
|
38
36
|
end
|
|
39
|
-
|
|
40
37
|
end
|
|
41
38
|
end
|
|
42
|
-
|
|
43
|
-
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<%
|
|
2
|
+
checkout = Vpago::Vattanac::Checkout.new(@payment)
|
|
3
|
+
result = checkout.create
|
|
4
|
+
payment_url = params[:platform] == 'app' ? result[:mobile_url] : result[:web_url]
|
|
5
|
+
open_type = @payment.payment_method.preferred_open_type
|
|
6
|
+
%>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
const openType = "<%= open_type %>";
|
|
10
|
+
const mobileUrl = "<%= raw(result[:mobile_url]) %>";
|
|
11
|
+
const webUrl = "<%= raw(result[:web_url]) %>";
|
|
12
|
+
|
|
13
|
+
if (openType === "both") {
|
|
14
|
+
if (mobileUrl) {
|
|
15
|
+
window.location.href = mobileUrl;
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
window.location.href = webUrl;
|
|
18
|
+
}, 1500);
|
|
19
|
+
} else {
|
|
20
|
+
alert("Mobile payment URL not available.");
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
const paymentUrl = "<%= raw(payment_url) %>";
|
|
24
|
+
if (paymentUrl) {
|
|
25
|
+
window.location.href = paymentUrl;
|
|
26
|
+
} else {
|
|
27
|
+
alert("Failed to create payment link.");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
data/lib/spree_vpago/engine.rb
CHANGED
data/lib/spree_vpago/version.rb
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'faraday'
|
|
2
|
+
|
|
3
|
+
module Vpago
|
|
4
|
+
module Vattanac
|
|
5
|
+
class Base
|
|
6
|
+
CONTENT_TYPE_JSON = 'application/json'.freeze
|
|
7
|
+
|
|
8
|
+
def initialize(payment)
|
|
9
|
+
@payment = payment
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def username
|
|
13
|
+
payment_method.preferred_username
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def password
|
|
17
|
+
payment_method.preferred_password
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def access_token_url
|
|
21
|
+
payment_method.preferred_access_token_url
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def generate_payment_url
|
|
25
|
+
payment_method.preferred_generate_payment_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def check_transaction_url
|
|
29
|
+
payment_method.preferred_check_transaction_url
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def access_token
|
|
33
|
+
@access_token ||= fetch_access_token
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def payment_method
|
|
37
|
+
@payment.payment_method
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def payment_number
|
|
41
|
+
@payment.number
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def payment_type
|
|
45
|
+
payment_method.preferred_payment_type
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def merchant_id
|
|
49
|
+
payment_method.preferred_merchant_id
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def amount
|
|
53
|
+
@payment.amount
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def currency
|
|
57
|
+
'USD'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def default_headers
|
|
61
|
+
{ 'Authorization' => "Bearer #{access_token}", 'Content-Type' => CONTENT_TYPE_JSON }
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def parse_json(body)
|
|
65
|
+
JSON.parse(body)
|
|
66
|
+
rescue JSON::ParserError
|
|
67
|
+
{}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def fetch_access_token
|
|
73
|
+
response = Faraday.post(access_token_url, { username: username, password: password }.to_json, { 'Content-Type' => CONTENT_TYPE_JSON })
|
|
74
|
+
raise "Access Token Error: #{response.status} - #{response.body}" unless response.success?
|
|
75
|
+
|
|
76
|
+
parse_json(response.body).dig('data', 'accessToken') || raise('Missing accessToken in response')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def post(url, body)
|
|
80
|
+
response = Faraday.post(url, body.to_json, default_headers)
|
|
81
|
+
parse_json(response.body)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def get(url, params)
|
|
85
|
+
response = Faraday.get(url, params, default_headers)
|
|
86
|
+
parse_json(response.body)['data'] || {}
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Vpago
|
|
2
|
+
module Vattanac
|
|
3
|
+
class Checkout < Base
|
|
4
|
+
def payload
|
|
5
|
+
{
|
|
6
|
+
transactionId: payment_number,
|
|
7
|
+
requestId: "req-#{SecureRandom.hex(8)}",
|
|
8
|
+
paymentType: payment_type,
|
|
9
|
+
amount: amount,
|
|
10
|
+
currency: currency,
|
|
11
|
+
merchantId: merchant_id,
|
|
12
|
+
returnUrl: @payment.processing_url
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create
|
|
17
|
+
response_data = post(generate_payment_url, payload)['data']
|
|
18
|
+
{
|
|
19
|
+
web_url: response_data['webPaymentUrl'],
|
|
20
|
+
mobile_url: response_data['mobileDeepLink'],
|
|
21
|
+
expires_at: response_data['expiredIn'],
|
|
22
|
+
generated_at: response_data['generatedAt']
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Vpago
|
|
2
|
+
module Vattanac
|
|
3
|
+
class TransactionStatus < Base
|
|
4
|
+
def call
|
|
5
|
+
@response = post(check_transaction_url, payload)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def json_response
|
|
9
|
+
@response
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def success?
|
|
13
|
+
@response.dig('msgEntity', 'code') == '0'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def payload
|
|
19
|
+
{ transactionId: payment_number }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
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.1.
|
|
4
|
+
version: 2.1.3.pre.beta
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -132,6 +132,18 @@ files:
|
|
|
132
132
|
- app/.gitkeep
|
|
133
133
|
- app/assets/config/spree_vpago_manifest.js
|
|
134
134
|
- app/assets/images/backend-process.svg
|
|
135
|
+
- app/assets/images/payment_logos/acleda-cards.png
|
|
136
|
+
- app/assets/images/payment_logos/acleda-khqr.png
|
|
137
|
+
- app/assets/images/payment_logos/acleda.png
|
|
138
|
+
- app/assets/images/payment_logos/cheque.png
|
|
139
|
+
- app/assets/images/payment_logos/payway-abapay-khqr.png
|
|
140
|
+
- app/assets/images/payment_logos/payway-abapay.png
|
|
141
|
+
- app/assets/images/payment_logos/payway-alipay.png
|
|
142
|
+
- app/assets/images/payment_logos/payway-cards.png
|
|
143
|
+
- app/assets/images/payment_logos/payway-wechat.png
|
|
144
|
+
- app/assets/images/payment_logos/true-money.png
|
|
145
|
+
- app/assets/images/payment_logos/vattanac-mini-app.png
|
|
146
|
+
- app/assets/images/payment_logos/wingpay.png
|
|
135
147
|
- app/assets/images/vpago/payway/abapay.png
|
|
136
148
|
- app/assets/images/vpago/payway/cards.png
|
|
137
149
|
- app/assets/javascripts/vpago/vpago_payments/payment_processing_listener.js
|
|
@@ -181,6 +193,7 @@ files:
|
|
|
181
193
|
- app/models/spree/gateway/payway.rb
|
|
182
194
|
- app/models/spree/gateway/payway_v2.rb
|
|
183
195
|
- app/models/spree/gateway/true_money.rb
|
|
196
|
+
- app/models/spree/gateway/vattanac.rb
|
|
184
197
|
- app/models/spree/gateway/vattanac_mini_app.rb
|
|
185
198
|
- app/models/spree/gateway/wing_sdk.rb
|
|
186
199
|
- app/models/spree/payout.rb
|
|
@@ -265,6 +278,7 @@ files:
|
|
|
265
278
|
- app/views/spree/admin/payments/source_views/_payment_payway.html.erb
|
|
266
279
|
- app/views/spree/admin/payments/source_views/_payway_v2.html.erb
|
|
267
280
|
- app/views/spree/admin/payments/source_views/_true_money.html.erb
|
|
281
|
+
- app/views/spree/admin/payments/source_views/_vattanac.html.erb
|
|
268
282
|
- app/views/spree/admin/payments/source_views/_vattanac_mini_app.html.erb
|
|
269
283
|
- app/views/spree/admin/payments/source_views/_vpago_payment_tmpl.html.erb
|
|
270
284
|
- app/views/spree/admin/payments/source_views/_wingsdk.html.erb
|
|
@@ -313,6 +327,7 @@ files:
|
|
|
313
327
|
- app/views/spree/vpago_payments/checkout.html.erb
|
|
314
328
|
- app/views/spree/vpago_payments/forms/spree/gateway/_payway_v2.html.erb
|
|
315
329
|
- app/views/spree/vpago_payments/forms/spree/gateway/_true_money.html.erb
|
|
330
|
+
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac.html.erb
|
|
316
331
|
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac_mini_app.html.erb
|
|
317
332
|
- app/views/spree/vpago_payments/processing.html.erb
|
|
318
333
|
- app/views/spree/vpago_payments/success.html.erb
|
|
@@ -386,6 +401,9 @@ files:
|
|
|
386
401
|
- lib/vpago/true_money/checkout.rb
|
|
387
402
|
- lib/vpago/true_money/refund_issuer.rb
|
|
388
403
|
- lib/vpago/true_money/transaction_status.rb
|
|
404
|
+
- lib/vpago/vattanac/base.rb
|
|
405
|
+
- lib/vpago/vattanac/checkout.rb
|
|
406
|
+
- lib/vpago/vattanac/transaction_status.rb
|
|
389
407
|
- lib/vpago/vattanac_mini_app/base.rb
|
|
390
408
|
- lib/vpago/vattanac_mini_app/checkout.rb
|
|
391
409
|
- lib/vpago/vattanac_mini_app/refund_issuer.rb
|
|
@@ -416,9 +434,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
416
434
|
version: 3.2.0
|
|
417
435
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
436
|
requirements:
|
|
419
|
-
- - "
|
|
437
|
+
- - ">"
|
|
420
438
|
- !ruby/object:Gem::Version
|
|
421
|
-
version:
|
|
439
|
+
version: 1.3.1
|
|
422
440
|
requirements:
|
|
423
441
|
- none
|
|
424
442
|
rubygems_version: 3.4.1
|