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

airtime.go   A

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 22
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A afrikpay.AirtimeResponse.IsSuccessful 0 2 1
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