public CreditCardAuthorizeDotNetViewModel(PaymentProfile creditCard, IPaymentProcessing paymentProcessing, Action removeCreditCardFromList)
        {
            CreditCard                    = creditCard;
            this.paymentProcessing        = paymentProcessing;
            this.removeCreditCardFromList = removeCreditCardFromList;

            RemoveCreditCardCommand = new MvxCommand(async() => { await RemoveCreditCardAsync(); });
        }
Beispiel #2
0
        private static void UpdateProfile()
        {
            Console.WriteLine("Creating Payment Profile... ");

            Gateway beanstream = new Gateway()
            {
                MerchantId      = 300200578,
                PaymentsApiKey  = "4BaD82D9197b4cc4b70a221911eE9f70",
                ReportingApiKey = "4e6Ff318bee64EA391609de89aD4CF5d",
                ProfilesApiKey  = "D97D3BE1EE964A6193D17A571D9FBC80",
                ApiVersion      = "1"
            };

            ProfileResponse response = beanstream.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = beanstream.Profiles.GetProfile(response.Id);

            Console.WriteLine("Profile.billing.city: " + profile.Billing.City);


            Console.WriteLine("Updating profile's billing address: city");
            profile.Billing.City = "penticton";
            response             = beanstream.Profiles.UpdateProfile(profile);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            profile = beanstream.Profiles.GetProfile(response.Id);
            Assert.IsNotNull(profile);
            Assert.AreEqual(response.Id, profile.Id);
            Assert.AreEqual("penticton", profile.Billing.City);
            Console.WriteLine("Profile.billing.city: " + profile.Billing.City);
            // delete it so when we create a profile again with the same card we won't get an error
            beanstream.Profiles.DeleteProfile(response.Id);
        }
 public async Task SendManualProcessingEmail(PaymentTransaction paymentTransaction,
                                             PaymentProfile paymentProfile)
 {
     RegisterPaymentTransactionCall(nameof(SendManualProcessingEmail), paymentTransaction, paymentProfile);
     if (TestCallResponseType == TestCallResponseType.Exception)
     {
         throw new Exception();
     }
 }
Beispiel #4
0
        private static void GetAllCardsFromProfile()
        {
            Console.WriteLine("Get all Cards from Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            response = profile.AddCard(_bambora.Profiles, new Card {
                Name        = "Jane Doe",
                Number      = "4030000010001234",
                ExpiryMonth = "03",
                ExpiryYear  = "22",
                Cvd         = "123"
            });
            Console.WriteLine("Added card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            // get all cards
            IList <Card> cards = profile.getCards(_bambora.Profiles);

            Assert.NotNull(cards);
            Assert.AreEqual(2, cards.Count);
            Assert.AreEqual(1, cards[0].Id);
            Assert.AreEqual(2, cards[1].Id);
            Console.WriteLine("Retrieved " + cards.Count + " cards from profile.");
            Console.WriteLine("Card 1 expiry year: " + cards[0].ExpiryYear);
            Console.WriteLine("Card 2 expiry year: " + cards[1].ExpiryYear);

            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
Beispiel #5
0
        //Default PaymentMethod Profile
        public async Task <dynamic> SetDefaultPaymentMethodProfile(PaymentProfile model)
        {
            Response      response = new Response();
            SecurityToken token    = await GetSecurityToken();

            var client = new PaymentGateway.IeBizServiceClient();
            var result = await client.SetDefaultCustomerPaymentMethodProfileAsync(token, model.customerToken, model.paymentMethod);

            return(result);
        }
Beispiel #6
0
        public PaymentProfileViewModel(int id, ApplicationDbContext context)
        {
            PaymentProfile profileToEdit = context.PaymentProfiles.Single(p => p.Id == id);

            Name              = profileToEdit.Name;
            PayPerArticle     = profileToEdit.PayPerArticle;
            ArticleBonus      = profileToEdit.ArticleBonus;
            MinimumPVForBonus = profileToEdit.MinimumPVForBonus;
            PaymentProfileId  = id;
        }
 private void VerifyPaymentTransactionCall(string methodName, PaymentTransaction verificationPaymentTransaction,
                                           PaymentProfile verificationPaymentProfile, int numberOfCalls)
 {
     //for simplicity, only check some fields on these objects
     Assert.Equal(numberOfCalls,
                  _calls.Count(c => c.Key == methodName &&
                               c.Value.Any(v => v is PaymentTransaction pt &&
                                           pt.PaymentTransactionId == verificationPaymentTransaction.PaymentTransactionId &&
                                           pt.AuthorizationNumber == verificationPaymentTransaction.AuthorizationNumber) &&
                               c.Value.Any(v => v is PaymentProfile pp && pp.AccountId == verificationPaymentProfile.AccountId)));
 }
Beispiel #8
0
        private static void AddAndRemoveCardFromProfile()
        {
            Console.WriteLine("Adding Card to Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);


            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            response = profile.AddCard(_bambora.Profiles, new Card {
                Name        = "Jane Doe",
                Number      = "4030000010001234",
                ExpiryMonth = "03",
                ExpiryYear  = "22",
                Cvd         = "123"
            });
            Console.WriteLine("Added card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            // delete the card
            response = profile.RemoveCard(_bambora.Profiles, 2);              // delete card #2
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            Console.WriteLine("Removed card from profile");

            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
        public void UpdatePaymentProfileTest_eCheckMask()
        {
            //check login / password
            string sError = CheckLoginPassword();

            Assert.IsTrue(sError == "", sError);

            string responseString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><updateCustomerPaymentProfileResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages></updateCustomerPaymentProfileResponse>";

            LocalRequestObject.ResponseString = responseString;

            CustomerGateway target = new CustomerGateway(ApiLogin, TransactionKey);

            string profileID = "24236276";
            customerPaymentProfileMaskedType apiType = new customerPaymentProfileMaskedType();

            PaymentProfile profile = new PaymentProfile(apiType);

            profile.ProfileID         = "24287458";
            profile.eCheckBankAccount = new BankAccount()
            {
                routingNumber = "XXXX0024",
                accountNumber = "XXXX3456",
                nameOnAccount = "Sue Zhu"
            };

            profile.BillingAddress = new Address()
            {
                First   = "Sue",
                Last    = "Zhu",
                Company = "Visa",
                Street  = "123 Elm Street",
                City    = "Bellevue",
                State   = "WA",
                Country = "US",
                Zip     = "98006"
            };

            bool actual = false;

            // if choose "USELOCAL", the test should pass with no exception
            // Otherwise, the test might fail for error, i.e. duplicated request.
            try
            {
                actual = target.UpdatePaymentProfile(profileID, profile);
            }
            catch (Exception e)
            {
                string s = e.Message;
            }

            Assert.IsTrue(actual);
        }
Beispiel #10
0
 public IActionResult Edit(PaymentProfileViewModel paymentProfileViewModel)
 {
     if (ModelState.IsValid)
     {
         PaymentProfile.RetrieveAndEditPaymentProfile(paymentProfileViewModel, _context);
         _context.SaveChanges();
         return(Redirect("/PaymentProfile/Index"));
     }
     else
     {
         return(View(paymentProfileViewModel));
     }
 }
Beispiel #11
0
 public IActionResult New(PaymentProfileViewModel paymentProfileViewModel)
 {
     if (ModelState.IsValid)
     {
         PaymentProfile newPaymentProfile = new PaymentProfile(paymentProfileViewModel);
         _context.PaymentProfiles.Add(newPaymentProfile);
         _context.SaveChanges();
         return(Redirect("/PaymentProfile/Index"));
     }
     else
     {
         return(View(paymentProfileViewModel));
     }
 }
Beispiel #12
0
        private static void UpdateCardInProfile()
        {
            Console.WriteLine("Update a Card in a Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            Assert.IsNotNull(profile);

            // get card
            Card card = profile.getCard(_bambora.Profiles, 1);

            Console.WriteLine("Retrieved card with expiry year: " + card.ExpiryYear);
            Assert.IsNotNull(card);
            Assert.AreEqual("18", card.ExpiryYear);
            card.ExpiryYear = "20";
            profile.UpdateCard(_bambora.Profiles, card);
            Console.WriteLine("Updated card expiry");
            card = profile.getCard(_bambora.Profiles, 1);
            Assert.IsNotNull(card);
            Assert.AreEqual("20", card.ExpiryYear);
            Console.WriteLine("Retrieved updated card with expiry year: " + card.ExpiryYear);

            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
Beispiel #13
0
        private static void UpdateProfile()
        {
            Console.WriteLine("Creating Payment Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            Console.WriteLine("Profile.billing.city: " + profile.Billing.City);


            Console.WriteLine("Updating profile's billing address: city");
            profile.Billing.City = "penticton";
            response             = _bambora.Profiles.UpdateProfile(profile);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            profile = _bambora.Profiles.GetProfile(response.Id);
            Assert.IsNotNull(profile);
            Assert.AreEqual(response.Id, profile.Id);
            Assert.AreEqual("penticton", profile.Billing.City);
            Console.WriteLine("Profile.billing.city: " + profile.Billing.City);
            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
Beispiel #14
0
 public async Task <IActionResult> DefaultPaymentMethodProfile([FromBody] PaymentProfile model)
 {
     try
     {
         if (string.IsNullOrEmpty(model.paymentMethod))
         {
             string msg = "paymentMethod should not be null or empty";
             return(BadRequest(msg));
         }
         var response = await new PaymentManager().SetDefaultPaymentMethodProfile(model);
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
        public async Task <PaymentTransaction> RefundTransaction(PaymentTransaction paymentTransaction,
                                                                 PaymentProfile paymentProfile)
        {
            RegisterPaymentTransactionCall(nameof(RefundTransaction), paymentTransaction, paymentProfile);
            switch (TestCallResponseType)
            {
            case TestCallResponseType.Succcess:
                paymentTransaction.IsApproved = true;
                break;

            case TestCallResponseType.Failure:
                paymentTransaction.IsApproved = false;
                break;

            default:
                throw new Exception();
            }
            return(paymentTransaction);
        }
        public void UpdatePaymentProfileMinTest()
        {
            //check login / password
            string sError = CheckLoginPassword();

            Assert.IsTrue(sError == "", sError);

            string responseString = "<?xml version=\"1.0\" encoding=\"utf-8\"?><updateCustomerPaymentProfileResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages></updateCustomerPaymentProfileResponse>";

            LocalRequestObject.ResponseString = responseString;

            CustomerGateway target = new CustomerGateway(ApiLogin, TransactionKey);

            string profileID = "24232683";
            customerPaymentProfileMaskedType apiType = new customerPaymentProfileMaskedType();

            PaymentProfile profile = new PaymentProfile(apiType);

            profile.ProfileID      = "22804148";
            profile.CardNumber     = "4111111111111112";
            profile.CardExpiration = "2016-02";

            bool actual = false;

            // if choose "USELOCAL", the test should pass with no exception
            // Otherwise, the test might fail for error, i.e. duplicated request.
            try
            {
                actual = target.UpdatePaymentProfile(profileID, profile);
            }
            catch (Exception e)
            {
                string s = e.Message;
            }

            Assert.IsTrue(actual);
        }
 public async Task SendManualProcessingEmail(PaymentMethod paymentMethod,
                                             PaymentTransaction paymentTransaction, PaymentProfile paymentProfile)
 {
     await _externalPaymentFactory.GetPaymentService(paymentMethod)
     .SendManualProcessingEmail(paymentTransaction, paymentProfile);
 }
 public async Task <PaymentTransaction> RefundTransaction(PaymentMethod paymentMethod,
                                                          PaymentTransaction paymentTransaction, PaymentProfile paymentProfile)
 {
     return(await _externalPaymentFactory.GetPaymentService(paymentMethod)
            .RefundTransaction(paymentTransaction, paymentProfile));
 }
Beispiel #19
0
        private static void AddTokenizedCardToProfileAndMakePayment()
        {
            Console.WriteLine("Adding Tokenized Card to Profile... ");

            ProfileResponse response = _bambora.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = _bambora.Profiles.GetProfile(response.Id);

            // get a legato token representing the credit card
            string url  = "https://web.na.bambora.com/scripts/tokenization/tokens";
            var    data = new {
                number       = "4030000010001234",
                expiry_month = "12",
                expiry_year  = "18",
                cvd          = "123"
            };

            var requestInfo             = new RequestObject(HttpMethod.Post, url, null, data);
            var command                 = new ExecuteWebRequest(requestInfo);
            WebCommandExecuter executer = new WebCommandExecuter();
            var result = executer.ExecuteCommand(command);

            LegatoTokenResponse token = JsonConvert.DeserializeObject <LegatoTokenResponse>(result.Response);

            response = profile.AddCard(_bambora.Profiles, new Token {
                Name = "Jane Doe",
                Code = token.Token
            });
            Console.WriteLine("Added tokenized card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentResponse pResp = _bambora.Payments.MakePayment(new ProfilePaymentRequest {
                Amount         = 7.91M,
                OrderNumber    = getRandomOrderId("profile"),
                PaymentProfile = new PaymentProfileField()
                {
                    CardId       = 2,
                    CustomerCode = response.Id
                }
            });

            Assert.IsNotNull(pResp);

            // delete it so when we create a profile again with the same card we won't get an error
            _bambora.Profiles.DeleteProfile(response.Id);
        }
Beispiel #20
0
        //Retorna todos os perfis de pagamento
        public async Task <IEnumerable <PaymentProfile> > GetByAnythingAsync(PaymentProfile PaymentProfile, IDictionary <FilterSearch, String> Query = null, Int32 Page = 1, Int32 PerPage = 20, FilterSearch filterSearch = FilterSearch.id, SortOrder sortOrder = SortOrder.asc)
        {
            var list = await SearchByAnythingAsync("payment_profiles", Query, Page, PerPage, filterSearch, sortOrder);

            return(FromDynamicTo <IEnumerable <PaymentProfile> >(list?.payment_profiles));
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {

            ContactDetails PayerInformation = new ContactDetails();
            AddressDetails address = new AddressDetails();
            AddPaymentProfileRequest requestDetails = new AddPaymentProfileRequest();
          

            if (string.Format("{0}", Request.Form["BillingAddressFirstName"]) != null)
            {

                if (string.Format("{0}", Request.Form["BillingAddressCity"]) != null)
                {
                    
                    //Address data of customer paying the bill


                    address.FirstName = string.Format("{0}", Request.Form["BillingAddressFirstName"]);
                    address.LastName = string.Format("{0}", Request.Form["BillingAddressLastName"]);
                    address.StreetAddress1 = string.Format("{0}", Request.Form["BillingAddressAddress"]);

                    if (string.Format("{0}", Request.Form["BillingAddressAddress2"]) == null)
                        address.StreetAddress2 = "";
                    else
                        address.StreetAddress2 = string.Format("{0}", Request.Form["BillingAddressAddress2"]);

                    address.City = string.Format("{0}", Request.Form["BillingAddressCity"]);
                    address.State = string.Format("{0}", Request.Form["BillingAddressState"]);
                    address.PostalCode = string.Format("{0}", Request.Form["BillingAddressZip"]);
                    address.Country = string.Format("{0}", Request.Form["BillingAddressCountry"]);

                    PayerInformation.AddressInfo = address; //Set the payers contact information in the Cntact details construct
                    //Phone numbe profileId and email of customer paying the bill  Set the other information in the contact details construct.
                    PayerInformation.EmailAddress = string.Format("{0}", Request.Form["BillingAddressPhone"]);
                    PayerInformation.PhoneNumber = string.Format("{0}", Request.Form["BillingAddressEmail"]);
                    PayerInformation.Id = string.Format("{0}", Request.Form["PaymentProfileId"]);

                    //Set the value of Account holder details
                    requestDetails.AccountHolderDetails = PayerInformation;
                    //Agency data
                    requestDetails.ProfileName = ""; //TODO figure out where this comes from
                    //This is the final page in the sequence so you want to indicate success or failure clearly page needs to process URI provided data.
                    requestDetails.ResponsePostUrl = "https://http://accela-sf-kla.cloudapp.net/testapps/YouSubmitted.aspx";
                    //This is an account Identifier that should be unique to your implementation.
                    requestDetails.PaymentGatewayAccountIdentifier = "";
                    //This should Identify who is submitting the payment for the client
                    requestDetails.PaymentProcessor = "";

                    requestDetails.UserToken = ""; //TODO figure out how to pupulate this locally
                    requestDetails.GatewayName = "NMI";
                    //The only payment gateway currently supported is NMI

                    //Currently hardcoded  TODO expose on form and put in a default value; 
                    //implementers should hardcode their agency Identifier and retrieve application ID from the application.
                    requestDetails.ApplicationIdentifier = "00000001";
                    requestDetails.AgencyIdentifier = "00000001";

                    WebPaymentsClient client = new WebPaymentsClient();
                    PaymentProfile AddPaymentProfile = new PaymentProfile(client);


                    AddPaymentProfile.AddPaymentProfileByRequest(requestDetails);

                }
                else
                { Response.Redirect("YouSubmitted.aspx?text=NOTHING"); }
            }
            else
            { Response.Redirect("YouSubmitted.aspx?text=Masterpage content Not Found"); }
        }//close button submit
Beispiel #22
0
        private static void AddTokenizedCardToProfileAndMakePayment()
        {
            Console.WriteLine("Adding Tokenized Card to Profile... ");

            Gateway beanstream = new Gateway()
            {
                MerchantId      = 300200578,
                PaymentsApiKey  = "4BaD82D9197b4cc4b70a221911eE9f70",
                ReportingApiKey = "4e6Ff318bee64EA391609de89aD4CF5d",
                ProfilesApiKey  = "D97D3BE1EE964A6193D17A571D9FBC80",
                ApiVersion      = "1"
            };

            ProfileResponse response = beanstream.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = beanstream.Profiles.GetProfile(response.Id);

            // get a legato token representing the credit card
            string url  = "https://www.beanstream.com/scripts/tokenization/tokens";
            var    data = new {
                number       = "4030000010001234",
                expiry_month = "12",
                expiry_year  = "18",
                cvd          = "123"
            };

            var requestInfo             = new RequestObject(HttpMethod.Post, url, null, data);
            var command                 = new ExecuteWebRequest(requestInfo);
            WebCommandExecuter executer = new WebCommandExecuter();
            var result = executer.ExecuteCommand(command);

            LegatoTokenResponse token = JsonConvert.DeserializeObject <LegatoTokenResponse>(result.Response);

            response = profile.AddCard(beanstream.Profiles, new Token {
                Name = "Jane Doe",
                Code = token.Token
            });
            Console.WriteLine("Added tokenized card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentResponse pResp = beanstream.Payments.MakePayment(new ProfilePaymentRequest {
                Amount         = 7.91,
                OrderNumber    = getRandomOrderId("profile"),
                PaymentProfile = new PaymentProfileField()
                {
                    CardId       = 2,
                    CustomerCode = response.Id
                }
            });

            Assert.IsNotNull(pResp);

            // delete it so when we create a profile again with the same card we won't get an error
            beanstream.Profiles.DeleteProfile(response.Id);
        }
Beispiel #23
0
        private static void GetAllCardsFromProfile()
        {
            Console.WriteLine("Get all Cards from Profile... ");

            Gateway beanstream = new Gateway()
            {
                MerchantId      = 300200578,
                PaymentsApiKey  = "4BaD82D9197b4cc4b70a221911eE9f70",
                ReportingApiKey = "4e6Ff318bee64EA391609de89aD4CF5d",
                ProfilesApiKey  = "D97D3BE1EE964A6193D17A571D9FBC80",
                ApiVersion      = "1"
            };

            ProfileResponse response = beanstream.Profiles.CreateProfile(
                new Card()
            {
                Name        = "Jane Doe",
                Number      = "5100000010001004",
                ExpiryMonth = "12",
                ExpiryYear  = "18",
                Cvd         = "123"
            },
                new Address()
            {
                Name         = "Jane Doe",
                AddressLine1 = "123 Fake St.",
                City         = "victoria",
                Province     = "bc",
                Country      = "ca",
                PostalCode   = "v9t2g6",
                PhoneNumber  = "12501234567",
                EmailAddress = "*****@*****.**"
            });

            Console.WriteLine("Created profile with ID: " + response.Id);
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            PaymentProfile profile = beanstream.Profiles.GetProfile(response.Id);

            response = profile.AddCard(beanstream.Profiles, new Card {
                Name        = "Jane Doe",
                Number      = "4030000010001234",
                ExpiryMonth = "03",
                ExpiryYear  = "22",
                Cvd         = "123"
            });
            Console.WriteLine("Added card to profile");
            Assert.IsNotNull(response);
            Assert.AreEqual("Operation Successful", response.Message);

            // get all cards
            IList <Card> cards = profile.getCards(beanstream.Profiles);

            Assert.NotNull(cards);
            Assert.AreEqual(2, cards.Count);
            Assert.AreEqual(1, cards[0].Id);
            Assert.AreEqual(2, cards[1].Id);
            Console.WriteLine("Retrieved " + cards.Count + " cards from profile.");
            Console.WriteLine("Card 1 expiry year: " + cards[0].ExpiryYear);
            Console.WriteLine("Card 2 expiry year: " + cards[1].ExpiryYear);

            // delete it so when we create a profile again with the same card we won't get an error
            beanstream.Profiles.DeleteProfile(response.Id);
        }
Beispiel #24
0
        //Cadastra um perfil de pagamento de um cliente passando sua entidade (PaymentProfile)
        public async Task <PaymentProfile> CreateAnythingAsync(PaymentProfile NewPaymentProfile)
        {
            var result = await PostByAnythingAsync("payment_profiles", NewPaymentProfile);

            return(FromDynamicTo <PaymentProfile>(result?.payment_profile));
        }
 public void VerifyRefundTransactionCalls(PaymentTransaction verificationPaymentTransaction,
                                          PaymentProfile verificationPaymentProfile, int numberOfCalls = 1)
 {
     VerifyPaymentTransactionCall(nameof(RefundTransaction), verificationPaymentTransaction,
                                  verificationPaymentProfile, numberOfCalls);
 }
Beispiel #26
0
 public async Task <PaymentTransaction> RefundTransaction(PaymentTransaction paymentTransaction,
                                                          PaymentProfile paymentProfile)
 {
     return(paymentTransaction);
 }
Beispiel #27
0
 public async Task SendManualProcessingEmail(PaymentTransaction paymentTransaction,
                                             PaymentProfile paymentProfile)
 {
 }
Beispiel #28
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            //Designate variable to get ahold of the Masterpage controls
            ContentPlaceHolder MpContentPlaceHolder;
            //Set variables for each of the Masterpage textboxs' so they can each be addressed.
            TextBox MpCustomerVaultIdTextBox;
            TextBox MpBillingAddressFirstNameTextBox;
            TextBox MpBillingAddressLastNameTextBox;
            TextBox MpBillingAddressAddressTextBox;
            TextBox MpBillingAddressAddress2TextBox;
            TextBox MpBillingAddressCityTextBox;
            TextBox MpBillingAddressStateTextBox;
            TextBox MpBillingAddressZipTextBox;
            TextBox MpBillingAddressCountryTextBox;
            TextBox MpBillingAddressPhoneTextBox;
            TextBox MpBillingAddressEmailTextBox;


            ContactDetails PayerInformation = new ContactDetails();
            AddressDetails address = new AddressDetails();
            AddPaymentProfileRequest requestDetails = new AddPaymentProfileRequest();

            MpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("MainContent");

            if (MpContentPlaceHolder != null)
            {
                MpCustomerVaultIdTextBox = (TextBox)MpContentPlaceHolder.FindControl("CustomerVaultId"); //In web payments this ID is the same as PaymentProfileID
                MpBillingAddressFirstNameTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressFirstName");
                MpBillingAddressLastNameTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressLastName");
                MpBillingAddressAddressTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressAddress");
                MpBillingAddressAddress2TextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressAddress2");
                MpBillingAddressCityTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressCity");
                MpBillingAddressStateTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressState");
                MpBillingAddressZipTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressZip");
                MpBillingAddressCountryTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressCountry");
                MpBillingAddressPhoneTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressPhone");
                MpBillingAddressEmailTextBox = (TextBox)MpContentPlaceHolder.FindControl("BillingAddressEmail");

                if (MpBillingAddressFirstNameTextBox != null && MpBillingAddressCityTextBox != null)
                {
                    //Trouble shooting code allowed me to make sure that I was grabbing the correct data.
                    /*
                           string text = MpCustomerVaultIdTextBox.Text + 
                               MpBillingAddressFirstNameTextBox.Text + 
                               MpBillingAddressLastNameTextBox.Text +
                                MpBillingAddressAddressTextBox.Text + 
                                MpBillingAddressCityTextBox.Text + 
                                MpBillingAddressStateTextBox.Text + 
                                MpBillingAddressZipTextBox.Text +
                                MpBillingAddressCountryTextBox.Text + 
                                MpBillingAddressPhoneTextBox.Text + 
                                MpBillingAddressEmailTextBox.Text;
                           Response.Redirect("YouSubmitted.aspx?text=" + text);
                      */

                    //Address data of customer paying the bill


                    address.FirstName = MpBillingAddressFirstNameTextBox.Text;
                    address.LastName = MpBillingAddressLastNameTextBox.Text;
                    address.StreetAddress1 = MpBillingAddressAddressTextBox.Text;

                    if (MpBillingAddressAddress2TextBox.Text == null)
                        address.StreetAddress2 = "";
                    else
                        address.StreetAddress2 = MpBillingAddressAddress2TextBox.Text;

                    address.City = MpBillingAddressCityTextBox.Text;
                    address.State = MpBillingAddressStateTextBox.Text;
                    address.PostalCode = MpBillingAddressZipTextBox.Text;
                    address.Country = MpBillingAddressCountryTextBox.Text;

                    PayerInformation.AddressInfo = address; //Set the payers contact information in the Cntact details construct
                    //Phone numbe profileId and email of customer paying the bill  Set the other information in the contact details construct.
                    PayerInformation.EmailAddress = MpBillingAddressEmailTextBox.Text;
                    PayerInformation.PhoneNumber = MpBillingAddressPhoneTextBox.Text;
                    PayerInformation.Id = MpCustomerVaultIdTextBox.Text;

                    //Set the value of Account holder details
                    requestDetails.AccountHolderDetails = PayerInformation;
                    //Agency data
                    requestDetails.ProfileName = ""; //TODO figure out where this comes from
                    //This is the final page in the sequence so you want to indicate success or failure clearly page needs to process URI provided data.
                    requestDetails.ResponsePostUrl = "https://http://accela-sf-kla.cloudapp.net/testapps/YouSubmitted.aspx";
                    //This is an account Identifier that should be unique to your implementation.
                    requestDetails.PaymentGatewayAccountIdentifier = "";
                    //This should Identify who is processing the payment for the client  NMI etc..
                    requestDetails.PaymentProcessor = "";

                    requestDetails.UserToken = "token1"; //TODO figure out how to pupulate this locally
                    requestDetails.GatewayName = "NMI";
                    //The only payment gateway currently supported is NMI

                    //Currently hardcoded  TODO expose on form and put in a default value; 
                    //implementers should hardcode their agency Identifier and retrieve application ID from the application.
                    requestDetails.ApplicationIdentifier = "00000001";
                    requestDetails.AgencyIdentifier = "00000001";

                    //Initialize a webpayments client
                    WebPaymentsClient client = new WebPaymentsClient();
                    PaymentProfile AddPaymentProfile = new PaymentProfile(client);

                    //Blindly send out an addpayment request.
                    AddPaymentProfile.AddPaymentProfileByRequest(requestDetails);

                }
                else
                { Response.Redirect("YouSubmitted.aspx?text=NOTHING"); }
            }
            else
            { Response.Redirect("YouSubmitted.aspx?text=Masterpage content Not Found"); }
        }//close button submit
Beispiel #29
0
        //Retorna o perfil de pagamento pelo id informado
        public async Task <PaymentProfile> GetByIdAnythingAsync(PaymentProfile PaymentProfile)
        {
            var result = await SearchByIdAsync("payment_profiles", PaymentProfile.Id);

            return(FromDynamicTo <PaymentProfile>(result?.payment_profile));
        }
 public void VerifySendManualProcessingEmailCalls(PaymentTransaction verificationPaymentTransaction,
                                                  PaymentProfile verificationPaymentProfile, int numberOfCalls = 1)
 {
     VerifyPaymentTransactionCall(nameof(SendManualProcessingEmail), verificationPaymentTransaction,
                                  verificationPaymentProfile, numberOfCalls);
 }
Beispiel #31
0
        //Deleta o perfil de pagamento pelo id informado.
        public async Task <PaymentProfile> DeleteAnythingAsync(PaymentProfile DeletePaymentProfile)
        {
            var result = await DeleteByIdAsync("payment_profiles", DeletePaymentProfile.Id);

            return(FromDynamicTo <PaymentProfile>(result?.payment_profile));
        }
Beispiel #32
0
        static void Main(string[] args)
        {
            try {
                Vindi VindiSdk = new Vindi()
                {
                    Config = new Configuration("https://app.vindi.com.br", 1, "XlZBPa4zUhX1In4T9yHloj83WNaJf0i7V386V_Q2xQk")
                };
                PaymentMethods PayMethodsEdit;

                /*int d = 5000;
                 *
                 * var result = SearchByIdAsync().GetAwaiter().GetResult();
                 *
                 * async Task<dynamic> SearchByIdAsync() {
                 *  ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return true; };
                 *  ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                 *
                 *  return await $@"{VindiSdk.Config.UrlApi + "/api/v1"}/{"products"}/{479020}"
                 * .WithBasicAuth(Convert.ToString(VindiSdk.Config.Authorization), "")
                 * .GetJsonAsync();
                 * };*/

                //Metodo de Pagamento Debito Automatico

                /*PayMethodsEdit = new PaymentMethods() {
                 *  Code = "bank_debit"
                 * };*/

                //Metodo de Pagamento Cartão de Credito
                PayMethodsEdit = new PaymentMethods()
                {
                    Code = "credit_card"
                };

                Product NewProduct = new Product();
                NewProduct.Code          = "5375556";
                NewProduct.Name          = "Mensalidade 51,90";
                NewProduct.PricingSchema = new PricingSchema()
                {
                    Price = "51.9"
                };

                var Find2 = VindiSdk.GetByAnythingAsync(NewProduct, true);

                var Find = VindiSdk.GetByAnythingAsync(NewProduct);
                NewProduct = (Product)VindiSdk.CreateAnythingAsync(NewProduct);

                Console.WriteLine();
                Console.ReadKey();

                var            Products    = VindiSdk.GetByAnythingAsync(NewProduct, true);
                List <Product> FindProduct = (List <Product>)Products;
                foreach (Product ProductEdit in FindProduct)
                {
                    NewProduct = ProductEdit;
                    break;
                }

                Customer Cliente = new Customer();
                Cliente.RegistryCode = "79089806008";
                Cliente.Name         = "Carlos Duarte";
                Cliente.Code         = "777888";
                Cliente.Email        = "*****@*****.**";
                Cliente.Phones       = new Phone[] {
                    new Phone()
                    {
                        Number = "81985665588"
                    }
                };

                var re = VindiSdk.CreateAnythingAsync(Cliente);

                Customer Cliente2 = new Customer();
                Cliente2.RegistryCode = "09177350480";
                Cliente2.Code         = "6685855";

                var findCliente2 = VindiSdk.GetByAnythingAsync(Cliente2, true);

                PlanItems planItems = new PlanItems();
                planItems.Product = NewProduct;

                Plan Plan = new Plan();
                Plan.Name               = "Anual livre 54,90";
                Plan.Code               = "79299";
                Plan.BillingCycles      = 12;
                Plan.BillingTriggerType = "beginning_of_period";
                Plan.Interval           = "months";
                Plan.IntervalName       = "Mensalidade";
                Plan.IntervalCount      = 1;
                Plan.Installments       = "1";
                Plan.BillingTriggerDay  = "0";
                Plan.PlanItems          = new PlanItems[] { planItems };

                /*CreatePlanRequester createPlan = new CreatePlanRequester();
                 * createPlan.Plan = Plan;*/
                /*
                 * var Re = VindiSdk.CreateAnythingAsync(createPlan);*/

                PaymentCompany Pc = new PaymentCompany();
                Pc.Code = "visa";

                PaymentProfile Pf = new PaymentProfile();
                Pf.RegistryCode   = "79089806008";
                Pf.HolderName     = "Carlos Duarte";
                Pf.Customer       = Cliente;
                Pf.PaymentCompany = Pc;
                Pf.CardNumber     = "4444444444444448";
                Pf.CardExpiration = "12/2019";
                Pf.CardCvv        = "123";
                Pf.PaymentMethod  = PayMethodsEdit;

                //var Result2 = VindiSdk.DeleteSubscription(Cliente2);
                var Result = VindiSdk.CreateSubscriptionRequester(Cliente2, Plan, Pf);

                Subscription        Sub  = (Subscription)Result;
                List <Subscription> LSub = new List <Subscription>()
                {
                    Sub
                };
                Console.WriteLine(LSub.ToString());
                Console.WriteLine("Hello World!");
                Console.ReadKey();
            } catch (Exception Except) {
                Console.WriteLine(Except.Message);
            }
        }