-
Notifications
You must be signed in to change notification settings - Fork 5
/
payment.go
48 lines (45 loc) · 1.91 KB
/
payment.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
package ravepay
// Payment is a type that encapsulates rave's concept of payment
// together with PaymentVerfication it contains required implementations for interacting with the payment APIs
type Payment struct {
Amount int `json:"amount"`
Country string `json:"country"`
Currency string `json:"currency"`
CustomDescription string `json:"custom_description"`
CustomLogo string `json:"custom_logo"`
CustomTitle string `json:"custom_title"`
CustomerEmail string `json:"customer_email"`
CustomerFirstname string `json:"customer_firstname"`
CustomerLastname string `json:"customer_lastname"`
CustomerPhone string `json:"customer_phone"`
PaymentMethod string `json:"payment_method"`
TxRef string `json:"txref"`
}
// NewTxnVerificationChecklist returns a new paymentVerificationChecklist object with the given params
func NewTxnVerificationChecklist(amount int, flwRef, currency string) *TxnVerificationChecklist {
return &TxnVerificationChecklist{
Amount: amount,
Done: false,
FlwRef: flwRef,
TransactionCurrency: currency,
SECKEY: SecretKey,
VerificationURL: buildURL(txnVerificationURL),
}
}
// NewXRQTxnVerificationChecklist returns a new paymentVerificationChecklist object with the given params
// It sets up the checklist to use the rave's xrequery transaction verification endpoint
func NewXRQTxnVerificationChecklist(amount int, flwRef, txRef, currency string) *TxnVerificationChecklist {
return &TxnVerificationChecklist{
Amount: amount,
Done: false,
LastAttempt: "1",
OnlySuccessful: "1",
FlwRef: flwRef,
Flwref: flwRef,
TransactionCurrency: currency,
TxRef: txRef,
Txref: txRef,
SECKEY: SecretKey,
VerificationURL: buildURL(txnVerificationRequeryURL),
}
}