public void Find_ExposesNullThreeDSecureInfoIfBlank() { string nonce = TestHelper.GenerateUnlockedNonce(gateway); PaymentMethodNonce foundNonce = gateway.PaymentMethodNonce.Find(nonce); Assert.IsNull(foundNonce.ThreeDSecureInfo); }
public async Task FindAsync_ExposesBinDataPrepaidValue() { string inputNonce = Nonce.TransactablePrepaid; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Prepaid, Braintree.CreditCardPrepaid.YES); }
public async Task FindAsync_ExposesBinDataIssuingBank() { string inputNonce = Nonce.TransactableIssuingBankNetworkOnly; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.IssuingBank, "NETWORK ONLY"); }
public async Task FindAsync_ExposesBinDataCountryOfIssuance() { string inputNonce = Nonce.TransactableCountryOfIssuanceUSA; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.CountryOfIssuance, "USA"); }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) { // Send this nonce to your server string nonce = paymentMethodNonce.Nonce; mBraintreeFragment.RemoveListener(this); OnTokenizationSuccessful?.Invoke(this, nonce); payTcs?.TrySetResult(nonce); }
public async Task FindAsync_ExposesBinDataCommercial() { string inputNonce = Nonce.TransactableCommercial; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Commercial, Braintree.CreditCardCommercial.YES); }
public async Task FindAsync_ExposesBinDataDurbinRegulated() { string inputNonce = Nonce.TransactableDurbinRegulated; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.DurbinRegulated, Braintree.CreditCardDurbinRegulated.YES); }
public async Task FindAsync_ExposesBinDataHealthcare() { string inputNonce = Nonce.TransactableHealthcare; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Healthcare, Braintree.CreditCardHealthcare.YES); Assert.AreEqual(nonce.BinData.ProductId, "J3"); }
public async Task FindAsync_ExposesBinDataPayroll() { string inputNonce = Nonce.TransactablePayroll; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Payroll, Braintree.CreditCardPayroll.YES); Assert.AreEqual(nonce.BinData.ProductId, "MSA"); }
public void Find_ExposesDetailsForVenmoNonce() { string nonce = "fake-venmo-account-nonce"; PaymentMethodNonce foundNonce = gateway.PaymentMethodNonce.Find(nonce); Assert.IsNotNull(foundNonce); Assert.AreEqual(foundNonce.Nonce, nonce); Assert.IsNotNull(foundNonce.Details); Assert.AreEqual(foundNonce.Details.Username, "venmojoe"); Assert.AreEqual(foundNonce.Details.LastTwo, "99"); Assert.AreEqual(foundNonce.Details.VenmoUserId, "Venmo-Joe-1"); }
public void Find_ExposesDetailsForCreditCardNonce() { string nonce = "fake-valid-nonce"; PaymentMethodNonce foundNonce = gateway.PaymentMethodNonce.Find(nonce); Assert.IsNotNull(foundNonce); Assert.AreEqual(foundNonce.Nonce, nonce); Assert.AreEqual(foundNonce.Type, "CreditCard"); Assert.IsNotNull(foundNonce.Details); Assert.AreEqual(foundNonce.Details.CardType, "Visa"); Assert.AreEqual(foundNonce.Details.LastTwo, "81"); }
public void Find_ExposesThreeDSecureInfo() { PaymentMethodNonce nonce = gateway.PaymentMethodNonce.Find("threedsecurednonce"); ThreeDSecureInfo info = nonce.ThreeDSecureInfo; Assert.AreEqual(nonce.Nonce, "threedsecurednonce"); Assert.AreEqual(nonce.Type, "CreditCard"); Assert.AreEqual(info.Enrolled, "Y"); Assert.AreEqual(info.Status, "authenticate_successful"); Assert.AreEqual(info.LiabilityShifted, true); Assert.AreEqual(info.LiabilityShiftPossible, true); }
async void SendNonceToServer(PaymentMethodNonce nonce) { SetMessage(new Java.Lang.String("SendNonceToServer")); //Task<Transaction> task; //if (Settings.isThreeDSecureEnabled(this) && Settings.isThreeDSecureRequired(this)) //{ // task = DemoApplication.getApiClient(this).CreateTransaction(nonce.Nonce, Settings.GetThreeDSecureMerchantAccountId(this), true); //} //else if (Settings.isThreeDSecureEnabled(this)) //{ // task = DemoApplication.getApiClient(this).CreateTransaction(nonce.Nonce, Settings.GetThreeDSecureMerchantAccountId(this)); //} //else if (nonce is CardNonce && ((CardNonce)nonce).CardType.Equals("UnionPay")) //{ // task = DemoApplication.getApiClient(this).CreateTransaction(nonce.Nonce, Settings.GetUnionPayMerchantAccountId(this)); //} //else //{ // task = DemoApplication.getApiClient(this).CreateTransaction(nonce.Nonce, Settings.GetMerchantAccountId(this)); //} //var transaction = await task; //if (transaction == null) //{ // SetStatus(Resource.String.transaction_failed); // SetMessage(new Java.Lang.String("Unable to create a transaction")); // return; //} //if (transaction.Message != null && // transaction.Message.StartsWith("created")) //{ // SetStatus(Resource.String.transaction_complete); // SetMessage(new Java.Lang.String(transaction.Message)); //} //else //{ // SetStatus(Resource.String.transaction_failed); // if (TextUtils.IsEmpty(transaction.Message)) // { // SetMessage(new Java.Lang.String("Server response was empty or malformed")); // } // else // { // SetMessage(new Java.Lang.String(transaction.Message)); // } //} }
public void FindAsync_ExposesBinDataIssuingBank() { Task.Run(async () => #endif { string inputNonce = Nonce.TransactableIssuingBankNetworkOnly; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.IssuingBank, "NETWORK ONLY"); } #if net452 ).GetAwaiter().GetResult(); }
public void FindAsync_ExposesBinDataDurbinRegulated() { Task.Run(async () => #endif { string inputNonce = Nonce.TransactableDurbinRegulated; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.DurbinRegulated, Braintree.CreditCardDurbinRegulated.YES); } #if net452 ).GetAwaiter().GetResult(); }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0) { try { if (Callback != null) { Callback(this, p0); } } catch (Exception e) { ExceptionHandler.Catch(e); } }
public void FindAsync_ExposesBinDataCountryOfIssuance() { Task.Run(async () => #endif { string inputNonce = Nonce.TransactableCountryOfIssuanceUSA; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.CountryOfIssuance, "USA"); } #if net452 ).GetAwaiter().GetResult(); }
public void FindAsync_ExposesBinDataPayroll() { Task.Run(async () => #endif { string inputNonce = Nonce.TransactablePayroll; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Payroll, Braintree.CreditCardPayroll.YES); Assert.AreEqual(nonce.BinData.ProductId, "MSA"); } #if net452 ).GetAwaiter().GetResult(); }
public void Find_ExposesDetailsForCreditCardNonce() { string nonce = "fake-valid-nonce"; PaymentMethodNonce foundNonce = gateway.PaymentMethodNonce.Find(nonce); Assert.IsNotNull(foundNonce); Assert.AreEqual(foundNonce.Nonce, nonce); Assert.AreEqual(foundNonce.Type, "CreditCard"); Assert.IsNotNull(foundNonce.Details); Assert.AreEqual(foundNonce.Details.Bin, "401288"); Assert.AreEqual(foundNonce.Details.CardType, "Visa"); Assert.AreEqual(foundNonce.Details.LastTwo, "81"); Assert.AreEqual(foundNonce.Details.LastFour, "1881"); Assert.AreEqual(foundNonce.Details.ExpirationMonth, "12"); Assert.AreEqual(foundNonce.Details.ExpirationYear, "2022"); }
public async Task FindAsync_ExposesBinData() { string inputNonce = Nonce.TransactableUnknownIndicators; PaymentMethodNonce nonce = await gateway.PaymentMethodNonce.FindAsync(inputNonce); Assert.AreEqual(nonce.Nonce, inputNonce); Assert.IsNotNull(nonce.BinData); Assert.AreEqual(nonce.BinData.Commercial, Braintree.CreditCardCommercial.UNKNOWN); Assert.AreEqual(nonce.BinData.Debit, Braintree.CreditCardDebit.UNKNOWN); Assert.AreEqual(nonce.BinData.DurbinRegulated, Braintree.CreditCardDurbinRegulated.UNKNOWN); Assert.AreEqual(nonce.BinData.Healthcare, Braintree.CreditCardHealthcare.UNKNOWN); Assert.AreEqual(nonce.BinData.Payroll, Braintree.CreditCardPayroll.UNKNOWN); Assert.AreEqual(nonce.BinData.Prepaid, Braintree.CreditCardPrepaid.UNKNOWN); Assert.AreEqual(nonce.BinData.CountryOfIssuance, "Unknown"); Assert.AreEqual(nonce.BinData.IssuingBank, "Unknown"); Assert.AreEqual(nonce.BinData.ProductId, "Unknown"); }
public void LookupThreeDSecure_IsSuccessful() { var gateway = GetGateway(); ThreeDSecureLookupAddress billingAddress = new ThreeDSecureLookupAddress { GivenName = "First", Surname = "Last", PhoneNumber = "1234567890", Locality = "Oakland", CountryCodeAlpha2 = "US", StreetAddress = "123 Address", ExtendedAddress = "Unit 2", PostalCode = "94112", Region = "CA" }; var clientData = GetClientDataString(gateway); ThreeDSecureLookupRequest request = new ThreeDSecureLookupRequest { Amount = "199.00", ClientData = clientData, Email = "*****@*****.**", BillingAddress = billingAddress }; ThreeDSecureLookupResponse result = gateway.ThreeDSecure.Lookup(request); PaymentMethodNonce paymentMethod = result.PaymentMethod; ThreeDSecureLookup lookup = result.Lookup; Assert.IsNull(result.Error); Assert.IsNotNull(result.PayloadString); Assert.IsNotNull(paymentMethod.Nonce); Assert.IsNotNull(paymentMethod.ThreeDSecureInfo); Assert.IsTrue(paymentMethod.ThreeDSecureInfo.LiabilityShiftPossible); Assert.IsFalse(paymentMethod.ThreeDSecureInfo.LiabilityShifted); Assert.IsNotNull(lookup.AcsUrl); Assert.IsNotNull(lookup.ThreeDSecureVersion); Assert.IsNotNull(lookup.TransactionId); }
public void Find_ExposesThreeDSecureInfo() { BraintreeService service = new BraintreeService(gateway.Configuration); CreditCardRequest creditCardRequest = new CreditCardRequest { Number = SandboxValues.CreditCardNumber.VISA, ExpirationMonth = "05", ExpirationYear = "2020" }; string nonce = TestHelper.Generate3DSNonce(service, creditCardRequest); PaymentMethodNonce foundNonce = gateway.PaymentMethodNonce.Find(nonce); ThreeDSecureInfo info = foundNonce.ThreeDSecureInfo; Assert.AreEqual(foundNonce.Nonce, nonce); Assert.AreEqual(foundNonce.Type, "CreditCard"); Assert.AreEqual(info.Enrolled, "Y"); Assert.AreEqual(info.Status, "authenticate_successful"); Assert.AreEqual(info.LiabilityShifted, true); Assert.AreEqual(info.LiabilityShiftPossible, true); }
public void LookupThreeDSecure_HasValidationError() { var gateway = GetGateway(); ThreeDSecureLookupAddress billingAddress = new ThreeDSecureLookupAddress { GivenName = "\x00", Surname = "Lést", PhoneNumber = "1234567890", Locality = "Oakland", CountryCodeAlpha2 = "US", StreetAddress = "123 Address", ExtendedAddress = "Unit 2", PostalCode = "94112", Region = "CA" }; var clientData = GetClientDataString(gateway); ThreeDSecureLookupRequest request = new ThreeDSecureLookupRequest { Amount = "199.00", ClientData = clientData, Email = "*****@*****.**", BillingAddress = billingAddress }; ThreeDSecureLookupResponse result = gateway.ThreeDSecure.Lookup(request); PaymentMethodNonce paymentMethod = result.PaymentMethod; ThreeDSecureLookup lookup = result.Lookup; Assert.IsNotNull(result.PayloadString); Assert.IsNull(paymentMethod); Assert.IsNull(lookup); Assert.IsNotNull(result.Error); StringAssert.Contains("format is invalid", (string)result.Error.message); }
private void sendNonceToServer(PaymentMethodNonce nonce) { Callback <Transaction> callback = null; }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0) { System.Console.WriteLine("Payment Method Nonce received: " + p0.TypeLabel); }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0) { throw new NotImplementedException(); }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) { System.Diagnostics.Debug.WriteLine("Payment Method Nonce received: " + paymentMethodNonce.TypeLabel); }
private void DisplayResult(PaymentMethodNonce paymentMethodNonce, string deviceData) { mNonce = paymentMethodNonce; //mPaymentMethodType = PaymentMethodType.ForType(mNonce); //mPaymentMethodIcon.SetImageResource(PaymentMethodType.ForType(mNonce).Drawable); mPaymentMethodTitle.Text = paymentMethodNonce.TypeLabel; mPaymentMethodDescription.Text = paymentMethodNonce.Description; mPaymentMethod.Visibility = Android.Views.ViewStates.Visible; mNonceString.Text = GetString(Resource.String.nonce) + ": " + mNonce.Nonce; mNonceString.Visibility = Android.Views.ViewStates.Visible; string details = ""; if (mNonce is CardNonce) { CardNonce cardNonce = (CardNonce)mNonce; details = "Card Last Two: " + cardNonce.LastTwo + "\n"; details += "3DS isLiabilityShifted: " + cardNonce.ThreeDSecureInfo.IsLiabilityShifted + "\n"; details += "3DS isLiabilityShiftPossible: " + cardNonce.ThreeDSecureInfo.IsLiabilityShiftPossible; } else if (mNonce is PayPalAccountNonce) { PayPalAccountNonce paypalAccountNonce = (PayPalAccountNonce)mNonce; details = "First name: " + paypalAccountNonce.FirstName + "\n"; details += "Last name: " + paypalAccountNonce.LastName + "\n"; details += "Email: " + paypalAccountNonce.Email + "\n"; details += "Phone: " + paypalAccountNonce.Phone + "\n"; details += "Payer id: " + paypalAccountNonce.PayerId + "\n"; details += "Client metadata id: " + paypalAccountNonce.ClientMetadataId + "\n"; details += "Billing address: " + formatAddress(paypalAccountNonce.BillingAddress) + "\n"; details += "Shipping address: " + formatAddress(paypalAccountNonce.ShippingAddress); } else if (mNonce is AndroidPayCardNonce) { AndroidPayCardNonce androidPayCardNonce = (AndroidPayCardNonce)mNonce; details = "Underlying Card Last Two: " + androidPayCardNonce.LastTwo + "\n"; details += "Email: " + androidPayCardNonce.Email + "\n"; details += "Billing address: " + formatAddress(androidPayCardNonce.BillingAddress) + "\n"; details += "Shipping address: " + formatAddress(androidPayCardNonce.ShippingAddress); } else if (mNonce is VenmoAccountNonce) { VenmoAccountNonce venmoAccountNonce = (VenmoAccountNonce)mNonce; details = "Username: "******"Device Data: " + deviceData; mDeviceData.Visibility = Android.Views.ViewStates.Visible; mAddPaymentMethodButton.Visibility = Android.Views.ViewStates.Gone; mPurchaseButton.Enabled = true; }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0) { _paymentMethodNonce.TrySetResult(p0); }
public ActionResult Create() { var gateway = config.GetGateway(); decimal amount; try { amount = Convert.ToDecimal(Request["amount"]); } catch (FormatException e) { TempData["Flash"] = "Error: 81503: Amount is an invalid format."; return(RedirectToAction("New")); } var nonce = Request["payment_method_nonce"]; //var nonce = "fake-processor-declined-visa-nonce"; var request = new TransactionRequest { Amount = amount, PaymentMethodNonce = nonce, Descriptor = new DescriptorRequest { Name = "KFC* LAB Aloha QSR", Phone = "", Url = "kfc.com.au" }, CustomFields = new Dictionary <string, string> { { "externalid", "7777" }, // LOCATED WITHIN ALOHA { "ordertype", "Web Orders Catering" }, // SUBJECT TO KFC REQUIREMENTS { "pickupdate", "1/10/2019" } //SUBJECT TO KFC REQUIREMENTS }, Options = new TransactionOptionsRequest { SubmitForSettlement = true } }; PaymentMethodNonce paymentMethodNonce = gateway.PaymentMethodNonce.Find(nonce); String type = paymentMethodNonce.Type; Result <Transaction> result = gateway.Transaction.Sale(request); if (result.IsSuccess()) { Transaction transaction = result.Target; return(RedirectToAction("Show", new { id = transaction.Id })); } else if (result.Transaction != null) { return(RedirectToAction("Show", new { id = result.Transaction.Id })); } else { string errorMessages = ""; foreach (ValidationError error in result.Errors.DeepAll()) { errorMessages += "Error: " + (int)error.Code + " - " + error.Message + "\n"; } TempData["Flash"] = errorMessages; return(RedirectToAction("New")); } }
public void OnPaymentMethodNonceCreated(PaymentMethodNonce p0) { _paymentMethodNonce.TrySetResult(p0); }