public void Update_ReturnsAnErrorIfTokenForAccountIsUsedToAttemptUpdate()
{
var customer = gateway.Customer.Create().Target;
var firstToken = string.Format("paypal-account-{0}", DateTime.Now.Ticks + 1);
var secondToken = string.Format("paypal-account-{0}", DateTime.Now.Ticks + 2);
var firstNonce = TestHelper.GetNonceForPayPalAccount(
gateway,
new Params
{
{ "consent_code", "consent-code" },
{ "token", firstToken }
});
gateway.PaymentMethod.Create(new PaymentMethodRequest
{
PaymentMethodNonce = firstNonce,
CustomerId = customer.Id
});
var secondNonce = TestHelper.GetNonceForPayPalAccount(
gateway,
new Params
{
{ "consent_code", "consent-code" },
{ "token", secondToken }
});
gateway.PaymentMethod.Create(new PaymentMethodRequest
{
PaymentMethodNonce = secondNonce,
CustomerId = customer.Id
});
var updatedResult = gateway.PaymentMethod.Update(
firstToken,
new PaymentMethodRequest { Token = secondToken });
Assert.IsFalse(updatedResult.IsSuccess());
Assert.AreEqual("92906", ((int)updatedResult.Errors.DeepAll().First().Code).ToString());
}