paymentsds-mpesa 0.1.0.pre.alpha.34 → 0.1.0.pre.alpha.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paymentsds/mpesa/errors/constants.rb +55 -45
- data/lib/paymentsds/mpesa/service.rb +50 -49
- data/lib/paymentsds/mpesa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ebd087bdf21b24354c8653a5e3070ec9490c11d0b59ceb6e688fbc51a406d5e
|
4
|
+
data.tar.gz: fe818b365af4c18c30b4e5e4eb28332feaf06789516f04f391bdec53b73f7e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4ad16210640bc9567eeaf6ba81957d9ff649b46976c3b8bee73dbaf2a67a76378a81981bb2c2670ebfaa572711bff8c3661969aa01e9d6f2353187852025814
|
7
|
+
data.tar.gz: 3556093055377ab17b865a4003ebbe609405c9abcaa42e21d4a5ae53ced802ccfa45f382a079492e81176462e553f14b08132f5eb55587d6f91449c3f0abf6c4
|
@@ -1,50 +1,60 @@
|
|
1
1
|
module Paymentsds
|
2
2
|
module MPesa
|
3
|
-
INS0 = "INS-0"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
INS0 = "INS-0".to_sym
|
4
|
+
INS1 = "INS-1".to_sym
|
5
|
+
INS5 = "INS-5".to_sym
|
6
|
+
INS6 = "INS-6".to_sym
|
7
|
+
INS9 = "INS-9".to_sym
|
8
|
+
INS10 = "INS-10".to_sym
|
9
|
+
INS13 = "INS-13".to_sym
|
10
|
+
INS14 = "INS-14".to_sym
|
11
|
+
INS15 = "INS-15".to_sym
|
12
|
+
INS16 = "INS-16".to_sym
|
13
|
+
INS17 = "INS-17".to_sym
|
14
|
+
INS18 = "INS-18".to_sym
|
15
|
+
INS19 = "INS-19".to_sym
|
16
|
+
INS20 = "INS-20".to_sym
|
17
|
+
INS21 = "INS-21".to_sym
|
18
|
+
INS22 = "INS-22".to_sym
|
19
|
+
INS23 = "INS-23".to_sym
|
20
|
+
INS24 = "INS-24".to_sym
|
21
|
+
INS25 = "INS-25".to_sym
|
22
|
+
INS993 = "INS-993".to_sym
|
23
|
+
INS994 = "INS-994".to_sym
|
24
|
+
INS995 = "INS-995".to_sym
|
25
|
+
INS996 = "INS-996".to_sym
|
26
|
+
INS997 = "INS-997".to_sym
|
27
|
+
INS998 = "INS-998".to_sym
|
28
|
+
INS2001 = "INS-2001".to_sym
|
29
|
+
INS2002 = "INS-2002".to_sym
|
30
|
+
INS2051 = "INS-2051".to_sym
|
31
|
+
INS2057 = "INS-2057".to_sym
|
22
32
|
|
23
|
-
DIRECT_DEBT = "DIRECT_DEBT"
|
24
|
-
DUPLICATE_TRANSACTION = "DUPLICATE_TRANSACTION"
|
25
|
-
INSUFICIENT_BALANCE = "INSUFICIENT_BALANCE"
|
26
|
-
INVALID_AMOUNT = "INVALID_AMOUNT"
|
27
|
-
INVALID_MISSING_PROPERTIES = "INVALID_MISSING_PROPERTIES"
|
28
|
-
INVALID_RECEIVER = "INVALID_RECEIVER"
|
29
|
-
INVALID_REFERENCE = "INVALID_REFERENCE"
|
30
|
-
INVALID_SECURITY_CREDENTIAL = "INVALID_SECURITY_CREDENTIAL"
|
31
|
-
INVALID_SHORTCODE = "INVALID_SHORTCODE"
|
32
|
-
INVALID_THIRDPARTY_REFERENCE = "INVALID_THIRDPARTY_REFERENCE"
|
33
|
-
INVALID_TRANSACTION_ID = "INVALID_TRANSACTION_ID"
|
34
|
-
INVALID_TRANSACTION_REFERENCE = "INVALID_TRANSACTION_INVALID_TRANSACTION_REFERENCE"
|
35
|
-
REQUEST_TIMEOUT = "REQUEST_TIMEOUT"
|
36
|
-
TRANSACTION_CANCELLED = "TRANSACTION_CANCELLED"
|
37
|
-
TRANSACTION_FAILED = "TRANSACTION_FAILED"
|
38
|
-
UNAVAILABLE_SERVER = "UNAVAILABLE_SERVER"
|
39
|
-
UNKNOWN_STATUS = "UNKNOWN_STATUS"
|
40
|
-
UNKNOWN = "UNKNOWN"
|
41
|
-
VALIDATION = "VALIDATION"
|
42
|
-
INVALID_INITIATOR_IDENTIFIER = "INVALID_INITIATOR_IDENTIFIER"
|
43
|
-
INVALID_LANGUAGE_CODE = "INVALID_LANGUAGE_CODE"
|
44
|
-
INVALID_MARKET = "INVALID_MARKET"
|
45
|
-
INVALID_MSISDN = "INVALID_MSISDN"
|
46
|
-
PROFILE_PROBLEMS = "PROFILE_PROBLEMS"
|
47
|
-
INACTIVE_ACCOUNT = "INACTIVE_ACCOUNT"
|
48
|
-
INITIATOR_AUTHENTICATION = "INITIATOR_AUTHENTICATION"
|
33
|
+
DIRECT_DEBT = "DIRECT_DEBT".freeze
|
34
|
+
DUPLICATE_TRANSACTION = "DUPLICATE_TRANSACTION".freeze
|
35
|
+
INSUFICIENT_BALANCE = "INSUFICIENT_BALANCE".freeze
|
36
|
+
INVALID_AMOUNT = "INVALID_AMOUNT".freeze
|
37
|
+
INVALID_MISSING_PROPERTIES = "INVALID_MISSING_PROPERTIES".freeze
|
38
|
+
INVALID_RECEIVER = "INVALID_RECEIVER".freeze
|
39
|
+
INVALID_REFERENCE = "INVALID_REFERENCE".freeze
|
40
|
+
INVALID_SECURITY_CREDENTIAL = "INVALID_SECURITY_CREDENTIAL".freeze
|
41
|
+
INVALID_SHORTCODE = "INVALID_SHORTCODE".freeze
|
42
|
+
INVALID_THIRDPARTY_REFERENCE = "INVALID_THIRDPARTY_REFERENCE".freeze
|
43
|
+
INVALID_TRANSACTION_ID = "INVALID_TRANSACTION_ID".freeze
|
44
|
+
INVALID_TRANSACTION_REFERENCE = "INVALID_TRANSACTION_INVALID_TRANSACTION_REFERENCE".freeze
|
45
|
+
REQUEST_TIMEOUT = "REQUEST_TIMEOUT".freeze
|
46
|
+
TRANSACTION_CANCELLED = "TRANSACTION_CANCELLED".freeze
|
47
|
+
TRANSACTION_FAILED = "TRANSACTION_FAILED".freeze
|
48
|
+
UNAVAILABLE_SERVER = "UNAVAILABLE_SERVER".freeze
|
49
|
+
UNKNOWN_STATUS = "UNKNOWN_STATUS".freeze
|
50
|
+
UNKNOWN = "UNKNOWN".freeze
|
51
|
+
VALIDATION = "VALIDATION".freeze
|
52
|
+
INVALID_INITIATOR_IDENTIFIER = "INVALID_INITIATOR_IDENTIFIER".freeze
|
53
|
+
INVALID_LANGUAGE_CODE = "INVALID_LANGUAGE_CODE".freeze
|
54
|
+
INVALID_MARKET = "INVALID_MARKET".freeze
|
55
|
+
INVALID_MSISDN = "INVALID_MSISDN".freeze
|
56
|
+
PROFILE_PROBLEMS = "PROFILE_PROBLEMS".freeze
|
57
|
+
INACTIVE_ACCOUNT = "INACTIVE_ACCOUNT".freeze
|
58
|
+
INITIATOR_AUTHENTICATION = "INITIATOR_AUTHENTICATION".freeze
|
49
59
|
end
|
50
60
|
end
|
@@ -63,7 +63,7 @@ module Paymentsds
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
raise InvalidDestination
|
66
|
+
raise Paymentsds::MPesa::InvalidDestination
|
67
67
|
end
|
68
68
|
|
69
69
|
def detect_missing_properties(opcode, intent)
|
@@ -180,126 +180,127 @@ module Paymentsds
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def build_response(result)
|
183
|
+
puts result.body.inspect
|
183
184
|
|
184
185
|
case result.status
|
185
186
|
when 200
|
186
|
-
case result.body[
|
187
|
+
case result.body["output_ResponseCode"].to_sym
|
187
188
|
when Paymentsds::MPesa::INS0
|
188
189
|
response = Paymentsds::MPesa::Result.new(result.success?, nil, result.body)
|
189
190
|
else
|
190
|
-
raise UnknownError
|
191
|
+
raise Paymentsds::MPesa::UnknownError
|
191
192
|
end
|
192
193
|
|
193
194
|
when 201
|
194
|
-
case result.body[
|
195
|
+
case result.body["output_ResponseCode"].to_sym
|
195
196
|
when Paymentsds::MPesa::INS0
|
196
197
|
response = Paymentsds::MPesa::Result.new(result.success?, nil, result.body)
|
197
198
|
else
|
198
|
-
raise UnknownError
|
199
|
+
raise Paymentsds::MPesa::UnknownError
|
199
200
|
end
|
200
201
|
|
201
202
|
when 400
|
202
|
-
case result.body[
|
203
|
+
case result.body["output_ResponseCode"].to_sym
|
203
204
|
when Paymentsds::MPesa::INS13
|
204
|
-
raise InvalidShortcodeError
|
205
|
+
raise Paymentsds::MPesa::InvalidShortcodeError
|
205
206
|
when Paymentsds::MPesa::INS14
|
206
|
-
raise InvalidReferenceError
|
207
|
+
raise Paymentsds::MPesa::InvalidReferenceError
|
207
208
|
when Paymentsds::MPesa::INS15
|
208
|
-
raise InvalidAmountError
|
209
|
+
raise Paymentsds::MPesa::InvalidAmountError
|
209
210
|
when Paymentsds::MPesa::INS17
|
210
|
-
raise InvalidTransactionReferenceError
|
211
|
+
raise Paymentsds::MPesa::InvalidTransactionReferenceError
|
211
212
|
when Paymentsds::MPesa::INS18
|
212
|
-
raise InvalidTransactionIdError
|
213
|
+
raise Paymentsds::MPesa::InvalidTransactionIdError
|
213
214
|
when Paymentsds::MPesa::INS19
|
214
|
-
raise InvalidThirdPartyReferenceError
|
215
|
+
raise Paymentsds::MPesa::InvalidThirdPartyReferenceError
|
215
216
|
when Paymentsds::MPesa::INS20
|
216
|
-
raise InvalidMissingPropertiesError
|
217
|
+
raise Paymentsds::MPesa::InvalidMissingPropertiesError
|
217
218
|
when Paymentsds::MPesa::INS21
|
218
|
-
raise ValidationError
|
219
|
+
raise Paymentsds::MPesa::ValidationError
|
219
220
|
when Paymentsds::MPesa::INS22
|
220
|
-
raise InvalidOperationPartError
|
221
|
+
raise Paymentsds::MPesa::InvalidOperationPartError
|
221
222
|
when Paymentsds::MPesa::INS23
|
222
|
-
raise UnknownStatusError
|
223
|
+
raise Paymentsds::MPesa::UnknownStatusError
|
223
224
|
when Paymentsds::MPesa::INS24
|
224
|
-
raise InvalidInitiatorIdentifierError
|
225
|
+
raise Paymentsds::MPesa::InvalidInitiatorIdentifierError
|
225
226
|
when Paymentsds::MPesa::INS25
|
226
|
-
raise InvalidSecurityCredentialError
|
227
|
+
raise Paymentsds::MPesa::InvalidSecurityCredentialError
|
227
228
|
when Paymentsds::MPesa::INS993
|
228
|
-
raise DirectDebtMissingError
|
229
|
+
raise Paymentsds::MPesa::DirectDebtMissingError
|
229
230
|
when Paymentsds::MPesa::INS994
|
230
|
-
raise DuplicatedDirectDebtError
|
231
|
+
raise Paymentsds::MPesa::DuplicatedDirectDebtError
|
231
232
|
when Paymentsds::MPesa::INS995
|
232
|
-
raise ProfileProblemsError
|
233
|
+
raise Paymentsds::MPesa::ProfileProblemsError
|
233
234
|
when Paymentsds::MPesa::INS996
|
234
|
-
raise InactiveAccountError
|
235
|
+
raise Paymentsds::MPesa::InactiveAccountError
|
235
236
|
when Paymentsds::MPesa::INS997
|
236
|
-
raise InvalidLanguageCodeError
|
237
|
+
raise Paymentsds::MPesa::InvalidLanguageCodeError
|
237
238
|
when Paymentsds::MPesa::INS998
|
238
|
-
raise InvalidMarketError
|
239
|
+
raise Paymentsds::MPesa::InvalidMarketError
|
239
240
|
when Paymentsds::MPesa::INS2001
|
240
|
-
raise InitiatorAuthenticationError
|
241
|
+
raise Paymentsds::MPesa::InitiatorAuthenticationError
|
241
242
|
when Paymentsds::MPesa::INS2002
|
242
|
-
raise InvalidReceiverError
|
243
|
+
raise Paymentsds::MPesa::InvalidReceiverError
|
243
244
|
when Paymentsds::MPesa::INS2051
|
244
|
-
raise InvalidMSISDNError
|
245
|
+
raise Paymentsds::MPesa::InvalidMSISDNError
|
245
246
|
when Paymentsds::MPesa::INS2057
|
246
|
-
raise InvalidLanguageCodeError
|
247
|
+
raise Paymentsds::MPesa::InvalidLanguageCodeError
|
247
248
|
else
|
248
|
-
raise UnknownError
|
249
|
+
raise Paymentsds::MPesa::UnknownError
|
249
250
|
end
|
250
251
|
|
251
252
|
when 401
|
252
|
-
case result.body[
|
253
|
+
case result.body["output_ResponseCode"].to_sym
|
253
254
|
when Paymentsds::MPesa::INS5
|
254
|
-
raise TransactionCancelledError
|
255
|
+
raise Paymentsds::MPesa::TransactionCancelledError
|
255
256
|
when Paymentsds::MPesa::INS6
|
256
|
-
raise TransactionFailedError
|
257
|
+
raise Paymentsds::MPesa::TransactionFailedError
|
257
258
|
else
|
258
|
-
raise UnknownError
|
259
|
+
raise Paymentsds::MPesa::UnknownError
|
259
260
|
end
|
260
261
|
|
261
262
|
when 408
|
262
|
-
case result.body[
|
263
|
+
case result.body["output_ResponseCode"].to_sym
|
263
264
|
when Paymentsds::MPesa::INS9
|
264
|
-
raise RequestTimeoutError
|
265
|
+
raise Paymentsds::MPesa::RequestTimeoutError
|
265
266
|
else
|
266
|
-
raise UnknownError
|
267
|
+
raise Paymentsds::MPesa::UnknownError
|
267
268
|
end
|
268
269
|
|
269
270
|
when 409
|
270
|
-
case result.body[
|
271
|
+
case result.body["output_ResponseCode"].to_sym
|
271
272
|
when Paymentsds::MPesa::INS10
|
272
|
-
raise DuplicateTransactionError
|
273
|
+
raise Paymentsds::MPesa::DuplicateTransactionError
|
273
274
|
else
|
274
|
-
raise UnknownError
|
275
|
+
raise Paymentsds::MPesa::UnknownError
|
275
276
|
end
|
276
277
|
|
277
278
|
when 422
|
278
|
-
case result.body[
|
279
|
+
case result.body["output_ResponseCode"].to_sym
|
279
280
|
when Paymentsds::MPesa::INS2006
|
280
|
-
raise InsufficientBalanceError
|
281
|
+
raise Paymentsds::MPesa::InsufficientBalanceError
|
281
282
|
else
|
282
|
-
raise UnknownError
|
283
|
+
raise Paymentsds::MPesa::UnknownError
|
283
284
|
end
|
284
285
|
|
285
286
|
when 500
|
286
|
-
case result.body[
|
287
|
+
case result.body["output_ResponseCode"].to_sym
|
287
288
|
when Paymentsds::MPesa::INS1
|
288
|
-
raise InternalError
|
289
|
+
raise Paymentsds::MPesa::InternalError
|
289
290
|
else
|
290
|
-
raise UnknownError
|
291
|
+
raise Paymentsds::MPesa::UnknownError
|
291
292
|
end
|
292
293
|
|
293
294
|
when 503
|
294
|
-
case result.body[
|
295
|
+
case result.body["output_ResponseCode"].to_sym
|
295
296
|
when Paymentsds::MPesa::INS16
|
296
|
-
raise UnavailableServerError
|
297
|
+
raise Paymentsds::MPesa::UnavailableServerError
|
297
298
|
else
|
298
|
-
raise UnknownError
|
299
|
+
raise Paymentsds::MPesa::UnknownError
|
299
300
|
end
|
300
301
|
|
301
302
|
else
|
302
|
-
raise UnknownError
|
303
|
+
raise Paymentsds::MPesa::UnknownError
|
303
304
|
end
|
304
305
|
end
|
305
306
|
|