spree_vpago 2.1.3.pre.beta → 2.1.3
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 +10 -10
- data/app/helpers/vpago/admin/base_helper_decorator.rb +0 -1
- data/app/models/spree/gateway/payway_v2.rb +1 -0
- data/app/models/vpago/payment_decorator.rb +0 -4
- data/app/models/vpago/payment_method_decorator.rb +1 -3
- data/app/services/vpago/payment_finder.rb +8 -3
- data/lib/spree_vpago/engine.rb +0 -1
- data/lib/spree_vpago/version.rb +1 -1
- data/lib/vpago/payway_v2/base.rb +9 -3
- metadata +4 -10
- data/app/models/spree/gateway/vattanac.rb +0 -70
- data/app/views/spree/admin/payments/source_views/_vattanac.html.erb +0 -6
- data/app/views/spree/vpago_payments/forms/spree/gateway/_vattanac.html.erb +0 -31
- data/lib/vpago/vattanac/base.rb +0 -90
- data/lib/vpago/vattanac/checkout.rb +0 -27
- data/lib/vpago/vattanac/transaction_status.rb +0 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc59b39533f02adc34b7b7edc24d3bbe009dbe3b00b061926524fe02a186c68a
|
|
4
|
+
data.tar.gz: 47cb85dd273e6fcc594950d407f10727098ccdc6341e153d0d1704af8682f465
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c93a137f4412f7fd4812695da770bca17c323492f3d88c2acbafbaaac638093b9b2c044bd71ccf4e0d28b56274407ef7b311939f4ebc18b68ecf04aa047fe18f
|
|
7
|
+
data.tar.gz: d1e84acedcfdfc08d05b5e106a89cd7c807bd8c997d6038b4b0210b3b3396e24ac274efff24d82494c60dcbc0508a437adb59b27a00c2ccaabbbb0596b280188
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
spree_vpago (2.1.3
|
|
4
|
+
spree_vpago (2.1.3)
|
|
5
5
|
faraday
|
|
6
6
|
google-cloud-firestore
|
|
7
7
|
spree_api (>= 4.5)
|
|
@@ -228,21 +228,21 @@ GEM
|
|
|
228
228
|
base64 (~> 0.2)
|
|
229
229
|
faraday (>= 1.0, < 3.a)
|
|
230
230
|
google-cloud-errors (1.5.0)
|
|
231
|
-
google-cloud-firestore (3.1.
|
|
231
|
+
google-cloud-firestore (3.1.1)
|
|
232
232
|
bigdecimal (~> 3.0)
|
|
233
233
|
concurrent-ruby (~> 1.0)
|
|
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.2.
|
|
237
|
+
google-cloud-firestore-v1 (2.2.1)
|
|
238
238
|
gapic-common (~> 1.2)
|
|
239
239
|
google-cloud-errors (~> 1.0)
|
|
240
240
|
google-cloud-location (~> 1.0)
|
|
241
|
-
google-cloud-location (1.2.
|
|
241
|
+
google-cloud-location (1.2.1)
|
|
242
242
|
gapic-common (~> 1.2)
|
|
243
243
|
google-cloud-errors (~> 1.0)
|
|
244
244
|
google-logging-utils (0.2.0)
|
|
245
|
-
google-protobuf (4.33.0
|
|
245
|
+
google-protobuf (4.33.0)
|
|
246
246
|
bigdecimal
|
|
247
247
|
rake (>= 13)
|
|
248
248
|
googleapis-common-protos (1.9.0)
|
|
@@ -259,7 +259,7 @@ GEM
|
|
|
259
259
|
multi_json (~> 1.11)
|
|
260
260
|
os (>= 0.9, < 2.0)
|
|
261
261
|
signet (>= 0.16, < 2.a)
|
|
262
|
-
grpc (1.76.0
|
|
262
|
+
grpc (1.76.0)
|
|
263
263
|
google-protobuf (>= 3.25, < 5.0)
|
|
264
264
|
googleapis-common-protos-types (~> 1.0)
|
|
265
265
|
hashdiff (1.1.0)
|
|
@@ -276,7 +276,7 @@ GEM
|
|
|
276
276
|
inline_svg (1.10.0)
|
|
277
277
|
activesupport (>= 3.0)
|
|
278
278
|
nokogiri (>= 1.6)
|
|
279
|
-
jquery-rails (4.6.
|
|
279
|
+
jquery-rails (4.6.1)
|
|
280
280
|
rails-dom-testing (>= 1, < 3)
|
|
281
281
|
railties (>= 4.2.0)
|
|
282
282
|
thor (>= 0.14, < 2.0)
|
|
@@ -409,9 +409,9 @@ GEM
|
|
|
409
409
|
redis-client (0.14.1)
|
|
410
410
|
connection_pool
|
|
411
411
|
regexp_parser (2.8.0)
|
|
412
|
-
responders (3.
|
|
413
|
-
actionpack (>=
|
|
414
|
-
railties (>=
|
|
412
|
+
responders (3.2.0)
|
|
413
|
+
actionpack (>= 7.0)
|
|
414
|
+
railties (>= 7.0)
|
|
415
415
|
rexml (3.2.5)
|
|
416
416
|
rspec-activemodel-mocks (1.1.0)
|
|
417
417
|
activemodel (>= 3.0)
|
|
@@ -4,6 +4,7 @@ module Spree
|
|
|
4
4
|
preference :api_key, :string
|
|
5
5
|
preference :merchant_id, :string
|
|
6
6
|
preference :payment_option, :string # 'abapay', 'cards', 'abapay_deeplink'
|
|
7
|
+
preference :app_scheme, :text
|
|
7
8
|
preference :transaction_fee_fix, :string
|
|
8
9
|
preference :transaction_fee_percentage, :string
|
|
9
10
|
preference :public_key, :text
|
|
@@ -5,9 +5,8 @@ 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_TRUE_MONEY = 'Spree::Gateway::TrueMoney'.freeze
|
|
9
|
-
TYPE_VATTANAC = 'Spree::Gateway::Vattanac'.freeze
|
|
10
8
|
TYPE_VATTANAC_MINI_APP = 'Spree::Gateway::VattanacMiniApp'.freeze
|
|
9
|
+
TYPE_TRUE_MONEY = 'Spree::Gateway::TrueMoney'.freeze
|
|
11
10
|
|
|
12
11
|
def self.prepended(base)
|
|
13
12
|
base.preference :icon_name, :string, default: 'cheque'
|
|
@@ -20,7 +19,6 @@ module Vpago
|
|
|
20
19
|
Spree::PaymentMethod::TYPE_WINGSDK,
|
|
21
20
|
Spree::PaymentMethod::TYPE_ACLEDA,
|
|
22
21
|
Spree::PaymentMethod::TYPE_ACLEDA_MOBILE,
|
|
23
|
-
Spree::PaymentMethod::TYPE_VATTANAC,
|
|
24
22
|
Spree::PaymentMethod::TYPE_VATTANAC_MINI_APP,
|
|
25
23
|
Spree::PaymentMethod::TYPE_TRUE_MONEY
|
|
26
24
|
]
|
|
@@ -7,6 +7,7 @@ module Vpago
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def find_and_verify
|
|
10
|
+
|
|
10
11
|
find_and_verify!
|
|
11
12
|
rescue StandardError, ActiveRecord::RecordNotFound => e
|
|
12
13
|
Rails.logger.error("PaymentJwtVerifier#find_and_verify error: #{e.class} - #{e.message}")
|
|
@@ -14,15 +15,16 @@ module Vpago
|
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def find_and_verify!
|
|
18
|
+
|
|
17
19
|
if vattanac_mini_app_payload?
|
|
18
|
-
payload =
|
|
20
|
+
payload = Vpago::VattanacMiniAppDataHandler.new.decrypt_data(@params_hash[:data])
|
|
19
21
|
payment = Spree::Payment.find_by!(number: payload['paymentId'])
|
|
20
22
|
payment.update(transaction_response: payload)
|
|
21
23
|
payment
|
|
22
|
-
else
|
|
24
|
+
else
|
|
23
25
|
order = Spree::Order.find_by!(number: params_hash[:order_number])
|
|
24
26
|
verify_jwt!(order)
|
|
25
|
-
|
|
27
|
+
|
|
26
28
|
Spree::Payment.find_by!(number: params_hash[:payment_number])
|
|
27
29
|
end
|
|
28
30
|
end
|
|
@@ -34,5 +36,8 @@ module Vpago
|
|
|
34
36
|
def vattanac_mini_app_payload?
|
|
35
37
|
params_hash[:data].present?
|
|
36
38
|
end
|
|
39
|
+
|
|
37
40
|
end
|
|
38
41
|
end
|
|
42
|
+
|
|
43
|
+
|
data/lib/spree_vpago/engine.rb
CHANGED
data/lib/spree_vpago/version.rb
CHANGED
data/lib/vpago/payway_v2/base.rb
CHANGED
|
@@ -105,9 +105,15 @@ module Vpago
|
|
|
105
105
|
# redirect to continue URL, let it handle redirecting to app.
|
|
106
106
|
# allowed override to specific app eg. from tg://t.me
|
|
107
107
|
def return_deeplink_url
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
app_scheme = @payment.payment_method.preferences[:app_scheme]
|
|
109
|
+
|
|
110
|
+
if app_scheme.present?
|
|
111
|
+
uri = URI.parse(continue_success_url)
|
|
112
|
+
uri.scheme = app_scheme
|
|
113
|
+
uri.to_s
|
|
114
|
+
else
|
|
115
|
+
continue_success_url
|
|
116
|
+
end
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
def return_deeplink
|
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.3
|
|
4
|
+
version: 2.1.3
|
|
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-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -193,7 +193,6 @@ files:
|
|
|
193
193
|
- app/models/spree/gateway/payway.rb
|
|
194
194
|
- app/models/spree/gateway/payway_v2.rb
|
|
195
195
|
- app/models/spree/gateway/true_money.rb
|
|
196
|
-
- app/models/spree/gateway/vattanac.rb
|
|
197
196
|
- app/models/spree/gateway/vattanac_mini_app.rb
|
|
198
197
|
- app/models/spree/gateway/wing_sdk.rb
|
|
199
198
|
- app/models/spree/payout.rb
|
|
@@ -278,7 +277,6 @@ files:
|
|
|
278
277
|
- app/views/spree/admin/payments/source_views/_payment_payway.html.erb
|
|
279
278
|
- app/views/spree/admin/payments/source_views/_payway_v2.html.erb
|
|
280
279
|
- app/views/spree/admin/payments/source_views/_true_money.html.erb
|
|
281
|
-
- app/views/spree/admin/payments/source_views/_vattanac.html.erb
|
|
282
280
|
- app/views/spree/admin/payments/source_views/_vattanac_mini_app.html.erb
|
|
283
281
|
- app/views/spree/admin/payments/source_views/_vpago_payment_tmpl.html.erb
|
|
284
282
|
- app/views/spree/admin/payments/source_views/_wingsdk.html.erb
|
|
@@ -327,7 +325,6 @@ files:
|
|
|
327
325
|
- app/views/spree/vpago_payments/checkout.html.erb
|
|
328
326
|
- app/views/spree/vpago_payments/forms/spree/gateway/_payway_v2.html.erb
|
|
329
327
|
- app/views/spree/vpago_payments/forms/spree/gateway/_true_money.html.erb
|
|
330
|
-
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac.html.erb
|
|
331
328
|
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac_mini_app.html.erb
|
|
332
329
|
- app/views/spree/vpago_payments/processing.html.erb
|
|
333
330
|
- app/views/spree/vpago_payments/success.html.erb
|
|
@@ -401,9 +398,6 @@ files:
|
|
|
401
398
|
- lib/vpago/true_money/checkout.rb
|
|
402
399
|
- lib/vpago/true_money/refund_issuer.rb
|
|
403
400
|
- 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
|
|
407
401
|
- lib/vpago/vattanac_mini_app/base.rb
|
|
408
402
|
- lib/vpago/vattanac_mini_app/checkout.rb
|
|
409
403
|
- lib/vpago/vattanac_mini_app/refund_issuer.rb
|
|
@@ -434,9 +428,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
434
428
|
version: 3.2.0
|
|
435
429
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
436
430
|
requirements:
|
|
437
|
-
- - "
|
|
431
|
+
- - ">="
|
|
438
432
|
- !ruby/object:Gem::Version
|
|
439
|
-
version:
|
|
433
|
+
version: '0'
|
|
440
434
|
requirements:
|
|
441
435
|
- none
|
|
442
436
|
rubygems_version: 3.4.1
|
|
@@ -1,70 +0,0 @@
|
|
|
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
|
|
@@ -1,31 +0,0 @@
|
|
|
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/vpago/vattanac/base.rb
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|