generated from NdoleStudio/go-http-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
disbursement.go
44 lines (38 loc) · 1.68 KB
/
disbursement.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
36
37
38
39
40
41
42
43
44
package mtnmomo
// TransferParams is the set of parameters for transferring money to a payee account
type TransferParams struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
ExternalID string `json:"externalId"`
Payee *AccountHolder `json:"payee"`
PayerMessage string `json:"payerMessage"`
PayeeNote string `json:"payeeNote"`
}
// DisbursementTransactionStatus is the status of a request to pay request.
type DisbursementTransactionStatus struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
ExternalID string `json:"externalId"`
ReferenceID string `json:"referenceId"`
Payee *AccountHolder `json:"payee"`
Status string `json:"status"`
FinancialTransactionID *string `json:"financialTransactionId,omitempty"`
PayerMessage string `json:"payerMessage"`
PayeeNote string `json:"payeeNote"`
}
// IsPending checks if a transaction is in pending status
func (status *DisbursementTransactionStatus) IsPending() bool {
return status.Status == "PENDING"
}
// IsFailed checks if a transaction is in failed status
func (status *DisbursementTransactionStatus) IsFailed() bool {
return status.Status == "FAILED"
}
// IsCancelled checks if a transaction is cancelled
func (status *DisbursementTransactionStatus) IsCancelled() bool {
return status.Status == "CANCELLED"
}
// IsSuccessful checks if a transaction is successful
func (status *DisbursementTransactionStatus) IsSuccessful() bool {
return status.Status == "SUCCESSFUL"
}