paypal/sale_test.go

50 lines
924 B
Go
Raw Normal View History

2015-12-17 04:56:49 +01:00
package paypalsdk
2015-12-17 08:50:25 +01:00
import (
"fmt"
"testing"
)
2015-12-17 04:56:49 +01:00
func TestGetSale(t *testing.T) {
c, _ := NewClient("clid", "secret", APIBaseSandBox)
c.GetAccessToken()
_, err := c.GetSale("1")
if err == nil {
t.Errorf("GetSale must be failed")
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 04:56:49 +01:00
}
}
func TestRefundSale(t *testing.T) {
c, _ := NewClient("clid", "secret", APIBaseSandBox)
c.GetAccessToken()
_, err := c.RefundSale("1", nil)
if err == nil {
t.Errorf("RefundSale must be failed")
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 04:56:49 +01:00
}
_, err = c.RefundSale("1", &Amount{Total: "100", Currency: "USD"})
if err == nil {
t.Errorf("RefundSale must be failed")
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 04:56:49 +01:00
}
}
2015-12-17 05:28:26 +01:00
func TestGetRefund(t *testing.T) {
c, _ := NewClient("clid", "secret", APIBaseSandBox)
c.GetAccessToken()
_, err := c.GetRefund("1")
if err == nil {
t.Errorf("GetRefund must be failed")
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 05:28:26 +01:00
}
}