2015-11-02 10:39:07 +01:00
|
|
|
package paypalsdk
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCreateDirectPaypalPayment(t *testing.T) {
|
|
|
|
c, _ := NewClient("clid", "secret", APIBaseSandBox)
|
|
|
|
c.Token = &TokenResponse{
|
|
|
|
Token: "invalidtoken",
|
|
|
|
}
|
|
|
|
|
|
|
|
amount := Amount{
|
|
|
|
Total: 15.1111,
|
|
|
|
Currency: "USD",
|
|
|
|
}
|
|
|
|
|
2015-11-16 06:11:27 +01:00
|
|
|
_, err := c.CreateDirectPaypalPayment(amount, "http://example.com")
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
t.Errorf("Error must be returned for invalid token")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExecuteApprovedPayment(t *testing.T) {
|
|
|
|
c, _ := NewClient("clid", "secret", APIBaseSandBox)
|
|
|
|
c.Token = &TokenResponse{
|
|
|
|
Token: "invalidtoken",
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err := c.ExecuteApprovedPayment("PAY-6RV70583SB702805EKEYSZ6Y", "7E7MGXCWTTKK2")
|
2015-11-02 10:39:07 +01:00
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
t.Errorf("Error must be returned for invalid token")
|
|
|
|
}
|
|
|
|
}
|