33 lines
611 B
Go
33 lines
611 B
Go
package payssion
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateOrder(t *testing.T) {
|
|
client := Client{
|
|
ApiKey: "",
|
|
PmId: "",
|
|
SecretKey: "",
|
|
QueryUrl: "http://sandbox.payssion.com/api/v1/payment/getDetail",
|
|
CreateUrl: "http://sandbox.payssion.com/api/v1/payments",
|
|
}
|
|
order := Order{
|
|
Name: "shop",
|
|
OrderNo: "123",
|
|
Amount: 1000,
|
|
}
|
|
createOrder, err := client.CreateOrder(order)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
fmt.Println(createOrder)
|
|
queryOrder, err := client.QueryOrder(order.OrderNo)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
fmt.Println(queryOrder.Transaction.State)
|
|
}
|