Test Setup Failed
Push — main ( 619eb5...304cab )
by Acho
02:39
created

mtnmomo.*DisbursementTransactionStatus.IsFailed   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
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
package mtnmomo
2
3
// TransferParams is the set of parameters for transferring money to a payee account
4
type TransferParams struct {
5
	Amount       string         `json:"amount"`
6
	Currency     string         `json:"currency"`
7
	ExternalID   string         `json:"externalId"`
8
	Payee        *AccountHolder `json:"payee"`
9
	PayerMessage string         `json:"payerMessage"`
10
	PayeeNote    string         `json:"payeeNote"`
11
}
12
13
// DisbursementTransactionStatus is the status of a request to pay request.
14
type DisbursementTransactionStatus struct {
15
	Amount                 string         `json:"amount"`
16
	Currency               string         `json:"currency"`
17
	ExternalID             string         `json:"externalId"`
18
	ReferenceID            string         `json:"referenceId"`
19
	Payee                  *AccountHolder `json:"payee"`
20
	Status                 string         `json:"status"`
21
	FinancialTransactionID *string        `json:"financialTransactionId,omitempty"`
22
	PayerMessage           string         `json:"payerMessage"`
23
	PayeeNote              string         `json:"payeeNote"`
24
}
25
26
// IsPending checks if a transaction is in pending status
27
func (status *DisbursementTransactionStatus) IsPending() bool {
28
	return status.Status == "PENDING"
29
}
30
31
// IsFailed checks if a transaction is in failed status
32
func (status *DisbursementTransactionStatus) IsFailed() bool {
33
	return status.Status == "FAILED"
34
}
35
36
// IsCancelled checks if a transaction is cancelled
37
func (status *DisbursementTransactionStatus) IsCancelled() bool {
38
	return status.Status == "CANCELLED"
39
}
40
41
// IsSuccessful checks if a transaction is successful
42
func (status *DisbursementTransactionStatus) IsSuccessful() bool {
43
	return status.Status == "SUCCESSFUL"
44
}
45