viva_wallet 0.1.5 → 0.3.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 +4 -4
- data/README.md +1 -0
- data/lib/viva_wallet/event.rb +76 -0
- data/lib/viva_wallet/version.rb +1 -1
- data/lib/viva_wallet.rb +8 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3cad47949660808efb02a2f3ac470ba504639ed04d4c8639dcd91794c6b177f
|
4
|
+
data.tar.gz: 899c1fd0603e084309b6ba9785da99d4f67e35bee39f64ff7c409cf70939e004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb7069df29b094634e17dbba010b5b111bc94037aab990a89561502b5ba042917e4b5570a3cfebdb2f15aa3930a1cf77f88c2167bc762631549a37c41c863ae
|
7
|
+
data.tar.gz: b54a5b62928933f40a87314b3bd273602407b41f901b3f947826753af2c9fe797da40507b823f1a2d2c81ce2837e5df7825b8587a6ef7cb5986f625eed870f61
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ Set up an initializer file with your Viva Wallet Smart Checkout client keys:
|
|
23
23
|
```ruby
|
24
24
|
VivaWallet.client_id = 'viva_client_id'
|
25
25
|
VivaWallet.client_secret = 'viva_client_secret'
|
26
|
+
VivaWallet.source_code = 'website_app_source_code'
|
26
27
|
VivaWallet.test_mode = true/false
|
27
28
|
```
|
28
29
|
e.g. *config/initializers/viva_wallet.rb*
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VivaWallet
|
4
|
+
class Payment
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def retrieve(event_id)
|
9
|
+
case event_id.to_i
|
10
|
+
when 0
|
11
|
+
{ reason: 'Undefined', explanation: 'System', type: 'System' }
|
12
|
+
when 2061
|
13
|
+
{ reason: '3DS flow incomplete', explanation: 'Browser closed before authentication finished.', type: 'User' }
|
14
|
+
when 2062
|
15
|
+
{ reason: '3DS validation failed', explanation: 'Wrong password or two-factor auth code entered.', type: 'User' }
|
16
|
+
when 2108
|
17
|
+
{ reason: 'Payments Policy Acquiring Restriction', explanation: 'Payments Policy Acquiring Restriction.', type: 'System' }
|
18
|
+
when 10001
|
19
|
+
{ reason: 'Refer to card issuer', explanation: 'The issuing bank prevented the transaction.', type: 'Issuer' }
|
20
|
+
when 10003
|
21
|
+
{ reason: 'Invalid merchant number', explanation: ' Security violation (source is not correct issuer).', type: 'Issuer' }
|
22
|
+
when 10004
|
23
|
+
{ reason: ' Pick up card', explanation: 'The card has been designated as lost or stolen.', type: 'Issuer' }
|
24
|
+
when 10005
|
25
|
+
{ reason: 'Do not honor', explanation: 'The issuing bank declined the transaction without an explanation.', type: 'Issuer' }
|
26
|
+
when 10006
|
27
|
+
{ reason: 'General error', explanation: 'The card issuer has declined the transaction as there is a problem with the card number.', type: 'Issuer' }
|
28
|
+
when 10012
|
29
|
+
{ reason: 'Invalid transaction', explanation: 'The bank has declined the transaction because of an invalid format or field. This indicates the card details were incorrect.', type: 'Issuer' }
|
30
|
+
when 10013
|
31
|
+
{ reason: 'Invalid amount', explanation: 'The card issuer has declined the transaction because of an invalid format or field.', type: 'System' }
|
32
|
+
when 10014
|
33
|
+
{ reason: 'Invalid card number', explanation: 'The card issuer has declined the transaction as the credit card number is incorrectly entered or does not exist.', type: 'User' }
|
34
|
+
when 10015
|
35
|
+
{ reason: 'Invalid issuer', explanation: 'The card issuer doesn\'t exist.', type: 'System' }
|
36
|
+
when 10030
|
37
|
+
{ reason: 'Format error', explanation: 'The card issuer does not recognise the transaction details being entered. This is due to a format error.', type: 'System' }
|
38
|
+
when 10041
|
39
|
+
{ reason: 'Lost card', explanation: 'The card issuer has declined the transaction as the card has been reported lost.', type: 'System' }
|
40
|
+
when 10043
|
41
|
+
{ reason: 'Stolen card', explanation: 'The card has been designated as lost or stolen.', type: 'User' }
|
42
|
+
when 10051
|
43
|
+
{ reason: 'Insufficient funds', explanation: ' The card has insufficient funds to cover the cost of the transaction.', type: 'Issuer' }
|
44
|
+
when 10054
|
45
|
+
{ reason: 'Expired card', explanation: 'The payment gateway declined the transaction because the expiration date is expired or does not match.', type: 'User' }
|
46
|
+
when 10057
|
47
|
+
{ reason: 'Function not permitted to cardholder', explanation: 'The card issuer has declined the transaction as the credit card cannot be used for this type of transaction.', type: 'Issuer' }
|
48
|
+
when 10058
|
49
|
+
{ reason: 'Function not permitted to terminal', explanation: 'The card issuer has declined the transaction as the credit card cannot be used for this type of transaction.', type: 'Issuer' }
|
50
|
+
when 10061
|
51
|
+
{ reason: 'Withdrawal limit exceeded', explanation: 'Exceeds withdrawal amount limit.', type: 'Issuer' }
|
52
|
+
when 10062
|
53
|
+
{ reason: 'Restricted card', explanation: ' The customer\'s bank has declined their card.', type: 'Issuer' }
|
54
|
+
when 10063
|
55
|
+
{ reason: 'Issuer response security violation', explanation: 'Flag raised due to security validation problem.', type: 'Issuer' }
|
56
|
+
when 10065
|
57
|
+
{ reason: 'Soft decline', explanation: 'The issuer requests Strong Customer Authentication. The merchant should retry the transaction after successfully authenticating customer with 3DS first.', type: 'Issuer' }
|
58
|
+
when 10070
|
59
|
+
{ reason: 'Call issuer', explanation: 'Contact card issuer.', type: 'Issuer' }
|
60
|
+
when 10075
|
61
|
+
{ reason: 'PIN entry tries exceeded', explanation: 'Allowable number of PIN tries exceeded.', type: 'User' }
|
62
|
+
when 10076
|
63
|
+
{ reason: 'Invalid / non-existent "to account" specified', explanation: 'Invalid / non-existent OR Invalid / non-existent specified.', type: 'System' }
|
64
|
+
when 10096
|
65
|
+
{ reason: 'System malfunction', explanation: 'A temporary error occurred during the transaction.', type: 'System' }
|
66
|
+
when 10200
|
67
|
+
{ reason: 'Generic error', explanation: 'A temporary error occurred during the transaction.', type: 'System' }
|
68
|
+
when 10301
|
69
|
+
{ reason: 'Soft decline', explanation: 'The issuer requests Strong Customer Authentication. The merchant should retry the transaction after successfully authenticating customer with 3DS first.', type: 'Issuer' }
|
70
|
+
else
|
71
|
+
{ reason: 'Unknown error', explanation: 'Viva Wallet was unable to supply an error reason.', type: 'System' }
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/viva_wallet/version.rb
CHANGED
data/lib/viva_wallet.rb
CHANGED
@@ -14,7 +14,8 @@ module VivaWallet
|
|
14
14
|
class ConfigurationError < VivaWalletError; end
|
15
15
|
|
16
16
|
class << self
|
17
|
-
attr_writer :client_id, :client_secret, :
|
17
|
+
attr_writer :client_id, :client_secret, :source_code, :test_mode,
|
18
|
+
:api_base, :account_api_base, :client_base64
|
18
19
|
|
19
20
|
def client_id
|
20
21
|
defined? @client_id and @client_id or raise(
|
@@ -28,6 +29,12 @@ module VivaWallet
|
|
28
29
|
)
|
29
30
|
end
|
30
31
|
|
32
|
+
def source_code
|
33
|
+
defined? @source_code and @source_code or raise(
|
34
|
+
ConfigurationError, "VivaWallet source_code not configured"
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
31
38
|
def test_mode
|
32
39
|
@test_mode.nil? ? false : @test_mode
|
33
40
|
end
|
@@ -45,9 +52,6 @@ module VivaWallet
|
|
45
52
|
end
|
46
53
|
|
47
54
|
def request(method, resource, params = {}, access_token = nil)
|
48
|
-
access_token = access_token
|
49
|
-
|
50
|
-
params.except!(:access_token)
|
51
55
|
|
52
56
|
defined? method or raise(
|
53
57
|
ArgumentError, "Request method has not been specified"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viva_wallet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Dallimore
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- bin/setup
|
51
51
|
- lib/viva_wallet.rb
|
52
52
|
- lib/viva_wallet/authentication.rb
|
53
|
+
- lib/viva_wallet/event.rb
|
53
54
|
- lib/viva_wallet/payment.rb
|
54
55
|
- lib/viva_wallet/version.rb
|
55
56
|
- viva_wallet.gemspec
|