paypale/sale_test.go
Aliaksandr Pliutau 447b062aec IT
2015-12-22 11:31:12 +07:00

50 lines
1.0 KiB
Go

package paypalsdk
import (
"fmt"
"testing"
)
func TestGetSale(t *testing.T) {
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
c.GetAccessToken()
_, err := c.GetSale(testSaleID)
if err == nil {
t.Errorf("404 must be returned for ID=" + testSaleID)
} else {
fmt.Println(err.Error())
}
}
func TestRefundSale(t *testing.T) {
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
c.GetAccessToken()
_, err := c.RefundSale(testSaleID, nil)
if err == nil {
t.Errorf("404 must be returned for ID=" + testSaleID)
} else {
fmt.Println(err.Error())
}
_, err = c.RefundSale(testSaleID, &Amount{Total: "7.00", Currency: "USD"})
if err == nil {
t.Errorf("404 must be returned for ID=" + testSaleID)
} else {
fmt.Println(err.Error())
}
}
func TestGetRefund(t *testing.T) {
c, _ := NewClient(testClientID, testSecret, APIBaseSandBox)
c.GetAccessToken()
_, err := c.GetRefund("1")
if err == nil {
t.Errorf("404 must be returned for ID=" + testSaleID)
} else {
fmt.Println(err.Error())
}
}