-
Notifications
You must be signed in to change notification settings - Fork 2
/
mpesa_urls.go
72 lines (45 loc) · 1.41 KB
/
mpesa_urls.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package yuri
const MpesaLiveUrl = "https://api.safaricom.co.ke/"
const MpesaSandboxUrl = "https://sandbox.safaricom.co.ke/"
const tokenUrl = "oauth/v1/generate?grant_type=client_credentials"
const b2cUrl = "mpesa/b2c/v1/paymentrequest"
const b2bUrl = "mpesa/b2b/v1/paymentrequest"
const balance = "mpesa/accountbalance/v1/query"
const transactionStatus = "mpesa/transactionstatus/v1/query"
const registerUrl = "mpesa/c2b/v1/registerurl"
const simulateC2BUrl = "mpesa/c2b/v1/simulate"
const stkPush = "mpesa/stkpush/v1/processrequest"
const stkPushQuery = "mpesa/stkpushquery/v1/query"
func (m *Mpesa) getStkPush() string {
return m.getBaseUrl() + stkPush
}
func (m *Mpesa) getStkPushQuery() string {
return m.getBaseUrl() + stkPushQuery
}
func (m *Mpesa) getAccessTokenUrl() string {
return m.getBaseUrl() + tokenUrl
}
func (m *Mpesa) getB2CUrl() string {
return m.getBaseUrl() + b2cUrl
}
func (m *Mpesa) getB2BUrl() string {
return m.getBaseUrl() + b2bUrl
}
func (m *Mpesa) getBalanceUrl() string {
return m.getBaseUrl() + balance
}
func (m *Mpesa) getTransactionStatusUrl() string {
return m.getBaseUrl() + transactionStatus
}
func (m *Mpesa) getC2BRegisterUrl() string {
return m.getBaseUrl() + registerUrl
}
func (m *Mpesa) getC2BSimulationUrl() string {
return m.getBaseUrl() + simulateC2BUrl
}
func (m *Mpesa) getBaseUrl() string {
if !m.Live {
return MpesaSandboxUrl
}
return MpesaLiveUrl
}