-
Notifications
You must be signed in to change notification settings - Fork 1
/
esewa_test.go
40 lines (34 loc) · 1.22 KB
/
esewa_test.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
package main
import (
"fmt"
"github.com/mukezhz/pay-np/esewa"
)
func main() {
secret := "8gBm/:&EnhH.1/q"
payload := &esewa.EsewaPayload{
Amount: "100",
TaxAmount: "13",
TotalAmount: "133",
TransactionUUID: "1234567890",
ProductServiceCharge: "10",
ProductDeliveryCharge: "10",
ProductCode: "EPAYTEST",
SuccessURL: "http://localhost:8000/success",
FailureURL: "http://localhost:8000/failure",
SignedFieldNames: "total_amount,transaction_uuid,product_code",
Signature: "",
}
e, err := esewa.New(secret, payload)
if err != nil {
fmt.Println(err)
}
// s, err := e.GenerateSignature()
// if err != nil {
// fmt.Println(err)
// }
// fmt.Println(s)
err = e.VerifySignature("eyJ0cmFuc2FjdGlvbl9jb2RlIjoiMDAwNlRZMyIsInN0YXR1cyI6IkNPTVBMRVRFIiwidG90YWxfYW1vdW50IjoiMTMzLjAiLCJ0cmFuc2FjdGlvbl91dWlkIjoiMTIzNDU2Nzg5MCIsInByb2R1Y3RfY29kZSI6IkVQQVlURVNUIiwic2lnbmVkX2ZpZWxkX25hbWVzIjoidHJhbnNhY3Rpb25fY29kZSxzdGF0dXMsdG90YWxfYW1vdW50LHRyYW5zYWN0aW9uX3V1aWQscHJvZHVjdF9jb2RlLHNpZ25lZF9maWVsZF9uYW1lcyIsInNpZ25hdHVyZSI6Ik1GRWNNWi8zMFdWZXphblZaSEg0SDFuSVY4cEd3eXpaeGdndGt5ZTJWWHc9In0=")
if err != nil {
fmt.Println(err)
}
}