-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.go
37 lines (32 loc) · 1.21 KB
/
utilities.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
package campay
// AirtimeTransferParams are parameters for transferring airtime
type AirtimeTransferParams struct {
Amount string `json:"amount"`
To string `json:"to"`
ExternalReference string `json:"external_reference"`
}
// AirtimeTransferResponse is gotten after transferring airtime
type AirtimeTransferResponse struct {
Reference string `json:"reference"`
Status string `json:"status"`
}
// UtilitiesTransaction represent a utility transaction
type UtilitiesTransaction struct {
Reference string `json:"reference"`
ExternalReference string `json:"external_reference"`
Status string `json:"status"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Operator string `json:"operator"`
Code string `json:"code"`
Type string `json:"type"`
Reason string `json:"reason"`
}
// IsPending checks if a transaction is pending
func (transaction *UtilitiesTransaction) IsPending() bool {
return transaction.Status == "PENDING"
}
// IsSuccessfull checks if a transaction is successfull
func (transaction *UtilitiesTransaction) IsSuccessfull() bool {
return transaction.Status == "SUCCESSFUL"
}