1
|
|
|
package mtnmomo |
2
|
|
|
|
3
|
|
|
// RequestToPayParams is the set of parameters used when creating a payment request |
4
|
|
|
type RequestToPayParams struct { |
5
|
|
|
Amount string `json:"amount"` |
6
|
|
|
Currency string `json:"currency"` |
7
|
|
|
ExternalID string `json:"externalId"` |
8
|
|
|
Payer *RequestToPayPayer `json:"payer"` |
9
|
|
|
PayerMessage string `json:"payerMessage"` |
10
|
|
|
PayeeNote string `json:"payeeNote"` |
11
|
|
|
} |
12
|
|
|
|
13
|
|
|
// RequestToPayStatus is the status of a request to pay request. |
14
|
|
|
type RequestToPayStatus struct { |
15
|
|
|
Amount string `json:"amount"` |
16
|
|
|
Currency string `json:"currency"` |
17
|
|
|
ExternalID string `json:"externalId"` |
18
|
|
|
ReferenceID string `json:"referenceId"` |
19
|
|
|
Payer *RequestToPayPayer `json:"payer"` |
20
|
|
|
Status string `json:"status"` |
21
|
|
|
FinancialTransactionID *string `json:"financialTransactionId,omitempty"` |
22
|
|
|
Reason *string `json:"reason,omitempty"` |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
// IsPending checks if a transaction is in pending status |
26
|
|
|
func (status *RequestToPayStatus) IsPending() bool { |
27
|
|
|
return status.Status == "PENDING" |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
// IsFailed checks if a transaction is in failed status |
31
|
|
|
func (status *RequestToPayStatus) IsFailed() bool { |
32
|
|
|
return status.Status == "FAILED" |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
// IsCancelled checks if a transaction is cancelled |
36
|
|
|
func (status *RequestToPayStatus) IsCancelled() bool { |
37
|
|
|
return status.Status == "CANCELLED" |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
// IsSuccessful checks if a transaction is successful |
41
|
|
|
func (status *RequestToPayStatus) IsSuccessful() bool { |
42
|
|
|
return status.Status == "SUCCESSFUL" |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
// RequestToPayPayer identifies an account holder in the wallet platform. |
46
|
|
|
type RequestToPayPayer struct { |
47
|
|
|
PartyIDType string `json:"partyIdType"` |
48
|
|
|
PartyID string `json:"partyId"` |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
// AccountBalance is available balance of the account |
52
|
|
|
type AccountBalance struct { |
53
|
|
|
AvailableBalance string `json:"availableBalance"` |
54
|
|
|
Currency string `json:"currency"` |
55
|
|
|
} |
56
|
|
|
|