Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package afrikpay |
||
2 | |||
3 | import "net/http" |
||
4 | |||
5 | // AirtimeTransferParams parameters for airtime transfer request |
||
6 | type AirtimeTransferParams struct { |
||
7 | Operator string |
||
8 | PhoneNumber string |
||
9 | PurchaseReference string |
||
10 | Amount string |
||
11 | Mode Mode |
||
12 | } |
||
13 | |||
14 | // AirtimeResponse is returned from airtime api requests |
||
15 | type AirtimeResponse struct { |
||
16 | Code int `json:"code"` |
||
17 | Message string `json:"message"` |
||
18 | Result *AirtimeTransaction `json:"result,omitempty"` |
||
19 | } |
||
20 | |||
21 | // AirtimeTransaction is the details for an aitime transaction |
||
22 | type AirtimeTransaction struct { |
||
23 | OperatorID string `json:"operatorid"` |
||
24 | TransactionID string `json:"txnid"` |
||
25 | Status string `json:"status"` |
||
26 | Date string `json:"date"` |
||
27 | Ticket interface{} `json:"ticket,omitempty"` |
||
28 | ReferenceID string `json:"referenceid"` |
||
29 | ProcessingNumber string `json:"processingnumber"` |
||
30 | } |
||
31 | |||
32 | // IsSuccessful determines if the transaction was successful |
||
33 | func (response AirtimeResponse) IsSuccessful() bool { |
||
34 | return response.Code == http.StatusOK |
||
35 | } |
||
36 |