| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package campay |
||
| 2 | |||
| 3 | // AirtimeTransferParams are parameters for transferring airtime |
||
| 4 | type AirtimeTransferParams struct { |
||
| 5 | Amount string `json:"amount"` |
||
| 6 | To string `json:"to"` |
||
| 7 | ExternalReference string `json:"external_reference"` |
||
| 8 | } |
||
| 9 | |||
| 10 | // AirtimeTransferResponse is gotten after transferring airtime |
||
| 11 | type AirtimeTransferResponse struct { |
||
| 12 | Reference string `json:"reference"` |
||
| 13 | Status string `json:"status"` |
||
| 14 | } |
||
| 15 | |||
| 16 | // UtilitiesTransaction represent a utility transaction |
||
| 17 | type UtilitiesTransaction struct { |
||
| 18 | Reference string `json:"reference"` |
||
| 19 | ExternalReference string `json:"external_reference"` |
||
| 20 | Status string `json:"status"` |
||
| 21 | Amount float64 `json:"amount"` |
||
| 22 | Currency string `json:"currency"` |
||
| 23 | Operator string `json:"operator"` |
||
| 24 | Code string `json:"code"` |
||
| 25 | Type string `json:"type"` |
||
| 26 | Reason interface{} `json:"reason"` |
||
| 27 | } |
||
| 28 | |||
| 29 | // IsPending checks if a transaction is pending |
||
| 30 | func (transaction *UtilitiesTransaction) IsPending() bool { |
||
| 31 | return transaction.Status == "PENDING" |
||
| 32 | } |
||
| 33 | |||
| 34 | // IsSuccessfull checks if a transaction is successfull |
||
| 35 | func (transaction *UtilitiesTransaction) IsSuccessfull() bool { |
||
| 36 | return transaction.Status == "SUCCESSFUL" |
||
| 37 | } |
||
| 38 |