-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.go
42 lines (36 loc) · 1.03 KB
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package paymego
func handleErrorResponse(responseJson PaymeResponse) (PaymeResponse, error) {
var paymeError error
errorCode := responseJson.Error.Code
switch errorCode {
case P2PIndenticalCardsErrorCode:
paymeError = ErrP2PIdenticalCards
case InvalidAmoutErrorCode:
paymeError = ErrInvalidAmountError
case InvalidParamsErrorCode:
paymeError = ErrInvalidParamsError
case CardNotFoundErrorCode:
paymeError = ErrCardNotFoundError
case InvalidFormatTokenErrorCode:
paymeError = ErrInvalidFormatTokenError
case CardNumberNotFoundCode:
paymeError = ErrCardNotFoundError
case CardExpiredCode:
paymeError = ErrCardExpiredError
case ProcessingCenterNotAvailableCode:
paymeError = ErrProcessingCenterNotAvailableError
case PaycomServiceNotAvailableCode:
paymeError = ErrPaycomServiceNotAvailableError
default:
if errorCode != 0 {
paymeError = ErrPaymeError
}
}
return responseJson, paymeError
}
func FromSoumToTiyin(amount int) int {
return amount * 100
}
func FromTiyinToSoum(amount int) int {
return amount / 100
}