public void CreateFromPaymentMethodNonce() { Result <Customer> result = gateway.Customer.Create(new CustomerRequest()); Assert.IsTrue(result.IsSuccess()); string nonce = Braintree.Test.Nonce.SamsungPayDiscover; var request = new PaymentMethodRequest { CustomerId = result.Target.Id, PaymentMethodNonce = nonce, CardholderName = "Jenny Block", BillingAddress = new PaymentMethodAddressRequest { CountryName = "Chad", } }; Result <PaymentMethod> paymentMethodResult = gateway.PaymentMethod.Create(request); Assert.IsTrue(paymentMethodResult.IsSuccess()); Assert.IsInstanceOf(typeof(SamsungPayCard), paymentMethodResult.Target); SamsungPayCard samsungPayCard = (SamsungPayCard)paymentMethodResult.Target; Assert.IsNotNull(samsungPayCard.BillingAddress); Assert.IsNotNull(samsungPayCard.Bin); Assert.IsNotNull(samsungPayCard.CardholderName); Assert.IsNotNull(samsungPayCard.CardType); Assert.IsNotNull(samsungPayCard.Commercial); Assert.IsNotNull(samsungPayCard.CountryOfIssuance); Assert.IsNotNull(samsungPayCard.CreatedAt); Assert.IsNotNull(samsungPayCard.CustomerId); Assert.IsNotNull(samsungPayCard.CustomerLocation); Assert.IsNotNull(samsungPayCard.Debit); Assert.IsNotNull(samsungPayCard.IsDefault); Assert.IsNotNull(samsungPayCard.DurbinRegulated); Assert.IsNotNull(samsungPayCard.ExpirationDate); Assert.IsNotNull(samsungPayCard.ExpirationMonth); Assert.IsNotNull(samsungPayCard.ExpirationYear); Assert.IsNotNull(samsungPayCard.IsExpired); Assert.IsNotNull(samsungPayCard.Healthcare); Assert.IsNotNull(samsungPayCard.ImageUrl); Assert.IsNotNull(samsungPayCard.IssuingBank); Assert.IsNotNull(samsungPayCard.LastFour); Assert.IsNotNull(samsungPayCard.SourceCardLastFour); Assert.IsNotNull(samsungPayCard.MaskedNumber); Assert.IsNotNull(samsungPayCard.Payroll); Assert.IsNotNull(samsungPayCard.Prepaid); Assert.IsNotNull(samsungPayCard.ProductId); Assert.IsNotNull(samsungPayCard.Subscriptions); Assert.IsNotNull(samsungPayCard.Token); Assert.IsNotNull(samsungPayCard.UniqueNumberIdentifier); Assert.IsNotNull(samsungPayCard.UpdatedAt); }
public void CreateFromPaymentMethodNonceWithNameAndAddress() { Result <Customer> result = gateway.Customer.Create(new CustomerRequest()); Assert.IsTrue(result.IsSuccess()); string nonce = Braintree.Test.Nonce.SamsungPayDiscover; var request = new PaymentMethodRequest { CustomerId = result.Target.Id, PaymentMethodNonce = nonce, CardholderName = "Jenny Block", BillingAddress = new PaymentMethodAddressRequest { FirstName = "Gronk", CountryName = "Chad", CountryCodeAlpha2 = "TD", CountryCodeAlpha3 = "TCD", CountryCodeNumeric = "148" } }; Result <PaymentMethod> paymentMethodResult = gateway.PaymentMethod.Create(request); Assert.IsTrue(paymentMethodResult.IsSuccess()); SamsungPayCard samsungPayCard = (SamsungPayCard)paymentMethodResult.Target; Assert.AreEqual("Jenny Block", samsungPayCard.CardholderName); Address billingAddress = samsungPayCard.BillingAddress; Assert.AreEqual("Chad", billingAddress.CountryName); Assert.AreEqual("TD", billingAddress.CountryCodeAlpha2); Assert.AreEqual("TCD", billingAddress.CountryCodeAlpha3); }