ipay-rest 0.1.1 → 0.1.2
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/lib/ipay/rest/error.rb +1 -31
- data/lib/ipay/rest/errors/failed_transaction.rb +9 -0
- data/lib/ipay/rest/errors/over_payment.rb +9 -0
- data/lib/ipay/rest/errors/payment_deficit.rb +9 -0
- data/lib/ipay/rest/errors/pending_transaction.rb +9 -0
- data/lib/ipay/rest/errors/used_code.rb +9 -0
- data/lib/ipay/rest/resource.rb +6 -1
- data/lib/ipay/rest/version.rb +1 -1
- data/lib/ipay/rest.rb +7 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21b3bd6148d40350b70bf844eb02642580a224ab64dd6b2fa3534a60a4837f79
|
4
|
+
data.tar.gz: a2de27dd1bce5c4c41ad6838c5d2d782f7624984bac436ae540db63085c25c10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564922754cfea3b02157c1985b067dbd99b1860a72f041908b48ec4e920d1d23bf251b2be9c8c638b5255db6d9147f7ee1090f50301a783536463b473b877c5e
|
7
|
+
data.tar.gz: 3b81cccfd0fdfa854ab5cc2265a2c57aabd5b179b762ddae4b70f29564c2092f9dd329866e1aa61f95234273b2b436976edacd42efcd30eb1ffc2cbd36ec4625
|
data/lib/ipay/rest/error.rb
CHANGED
@@ -1,35 +1,5 @@
|
|
1
1
|
module Ipay
|
2
2
|
module Rest
|
3
|
-
class
|
4
|
-
|
5
|
-
class FailedTransactionError < StandardError
|
6
|
-
def to_s
|
7
|
-
'Failed transaction. Not all parameters fulfilled. A notification of this transaction sent to the merchant.'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class PendingTransactionError < StandardError
|
12
|
-
def to_s
|
13
|
-
'Pending: Incoming Mobile Money Transaction Not found. Please try again in 5 minutes.'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class UsedCodeError < StandardError
|
18
|
-
def to_s
|
19
|
-
'Used: This code has been used already. A notification of this transaction sent to the merchant.'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class PaymentDeficitError < StandardError
|
24
|
-
def to_s
|
25
|
-
'Less: The amount that you have sent via mobile money is LESS than what was required to validate this transaction.'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class OverPaymentError < StandardError
|
30
|
-
def to_s
|
31
|
-
'More: The amount that you have sent via mobile money is MORE than what was required to validate this transaction.'
|
32
|
-
end
|
33
|
-
end
|
3
|
+
class IpayError < StandardError; end
|
34
4
|
end
|
35
5
|
end
|
data/lib/ipay/rest/resource.rb
CHANGED
@@ -22,10 +22,15 @@ module Ipay
|
|
22
22
|
|
23
23
|
def handle_response(response)
|
24
24
|
status = response.body['status'] || response.body['header_status']
|
25
|
+
message = response.body['text'] || response.body['error']
|
25
26
|
|
26
27
|
case status
|
27
28
|
when 0
|
28
|
-
raise
|
29
|
+
raise IpayError, message
|
30
|
+
when 2
|
31
|
+
raise IpayError, message
|
32
|
+
when 400..599
|
33
|
+
raise Error, message
|
29
34
|
when "fe2707etr5s4wq"
|
30
35
|
raise FailedTransactionError
|
31
36
|
when "bdi6p2yy76etrs"
|
data/lib/ipay/rest/version.rb
CHANGED
data/lib/ipay/rest.rb
CHANGED
@@ -4,7 +4,7 @@ require "ipay/rest/constants"
|
|
4
4
|
module Ipay
|
5
5
|
module Rest
|
6
6
|
autoload :Client, "ipay/rest/client"
|
7
|
-
autoload :
|
7
|
+
autoload :IpayError, "ipay/rest/error"
|
8
8
|
autoload :Object, "ipay/rest/object"
|
9
9
|
autoload :Resource, "ipay/rest/resource"
|
10
10
|
|
@@ -14,5 +14,11 @@ module Ipay
|
|
14
14
|
autoload :UssdPush, 'ipay/rest/objects/ussd_push'
|
15
15
|
|
16
16
|
autoload :TransactionResource, 'ipay/rest/resources/transaction'
|
17
|
+
|
18
|
+
autoload :FailedTransactionError, 'ipay/rest/errors/failed_transaction'
|
19
|
+
autoload :OverPaymentError, 'ipay/rest/errors/over_payment'
|
20
|
+
autoload :PaymentDeficitError, 'ipay/rest/errors/payment_deficit'
|
21
|
+
autoload :PendingTransactionError, 'ipay/rest/errors/pending_transaction'
|
22
|
+
autoload :UsedCodeError, 'ipay/rest/errors/used_code'
|
17
23
|
end
|
18
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipay-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Ralak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -49,6 +49,11 @@ files:
|
|
49
49
|
- lib/ipay/rest/client.rb
|
50
50
|
- lib/ipay/rest/constants.rb
|
51
51
|
- lib/ipay/rest/error.rb
|
52
|
+
- lib/ipay/rest/errors/failed_transaction.rb
|
53
|
+
- lib/ipay/rest/errors/over_payment.rb
|
54
|
+
- lib/ipay/rest/errors/payment_deficit.rb
|
55
|
+
- lib/ipay/rest/errors/pending_transaction.rb
|
56
|
+
- lib/ipay/rest/errors/used_code.rb
|
52
57
|
- lib/ipay/rest/object.rb
|
53
58
|
- lib/ipay/rest/objects/initiator.rb
|
54
59
|
- lib/ipay/rest/objects/transaction.rb
|