Passed
Push — main ( 53329a...1d4b72 )
by Acho
02:01
created

afrikpay.AirtimeResponse.IsSuccessful   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
nop 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