paypal/sale_test.go

50 lines
1.0 KiB
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) {
2015-12-22 05:31:12 +01:00
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
2015-12-17 04:56:49 +01:00
c.GetAccessToken()
2015-12-22 05:31:12 +01:00
_, err := c.GetSale(testSaleID)
2015-12-17 04:56:49 +01:00
if err == nil {
2016-09-19 06:39:05 +02:00
t.Errorf("404 must be returned for ID=%s", testSaleID)
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) {
2015-12-22 05:31:12 +01:00
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
2015-12-17 04:56:49 +01:00
c.GetAccessToken()
2015-12-22 05:31:12 +01:00
_, err := c.RefundSale(testSaleID, nil)
2015-12-17 04:56:49 +01:00
if err == nil {
2016-09-19 06:39:05 +02:00
t.Errorf("404 must be returned for ID=%s", testSaleID)
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 04:56:49 +01:00
}
2015-12-22 05:31:12 +01:00
_, err = c.RefundSale(testSaleID, &Amount{Total: "7.00", Currency: "USD"})
2015-12-17 04:56:49 +01:00
if err == nil {
2016-09-19 06:39:05 +02:00
t.Errorf("404 must be returned for ID=%s", testSaleID)
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) {
2015-12-22 05:31:12 +01:00
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
2015-12-17 05:28:26 +01:00
c.GetAccessToken()
_, err := c.GetRefund("1")
if err == nil {
2016-09-19 06:39:05 +02:00
t.Errorf("404 must be returned for ID=%s", testSaleID)
2015-12-17 08:50:25 +01:00
} else {
fmt.Println(err.Error())
2015-12-17 05:28:26 +01:00
}
}