generated from NdoleStudio/go-http-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairtime.go
35 lines (30 loc) · 1.08 KB
/
airtime.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
package afrikpay
import "net/http"
// AirtimeTransferParams parameters for airtime transfer request
type AirtimeTransferParams struct {
Operator string
PhoneNumber string
PurchaseReference string
Amount string
Mode Mode
}
// AirtimeResponse is returned from airtime api requests
type AirtimeResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Result *AirtimeTransaction `json:"result,omitempty"`
}
// AirtimeTransaction is the details for an aitime transaction
type AirtimeTransaction struct {
OperatorID string `json:"operatorid"`
TransactionID string `json:"txnid"`
Status string `json:"status"`
Date string `json:"date"`
Ticket interface{} `json:"ticket,omitempty"`
ReferenceID string `json:"referenceid"`
ProcessingNumber string `json:"processingnumber"`
}
// IsSuccessful determines if the transaction was successful
func (response AirtimeResponse) IsSuccessful() bool {
return response.Code == http.StatusOK
}