public void Update_CanMakePayPalAccountsTheDefaultPaymentMethod()
{
var customer = gateway.Customer.Create().Target;
var result = gateway.CreditCard.Create(new CreditCardRequest
{
CustomerId = customer.Id,
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2009",
Options = new CreditCardOptionsRequest
{
MakeDefault = true
}
});
Assert.IsTrue(result.IsSuccess());
var nonce = TestHelper.GetNonceForPayPalAccount(gateway, new Params {{ "consent_code", "consent-code" }});
var originalToken = gateway.PaymentMethod.Create(new PaymentMethodRequest
{
PaymentMethodNonce = nonce,
CustomerId = customer.Id
}).Target.Token;
var updatedResult = gateway.PaymentMethod.Update(
originalToken,
new PaymentMethodRequest { Options = new PaymentMethodOptionsRequest { MakeDefault = true }});
Assert.IsTrue(updatedResult.IsSuccess());
var updatedPaypalAccount = gateway.PayPalAccount.Find(originalToken);
Assert.IsTrue(updatedPaypalAccount.IsDefault.Value);
}