Esempio n. 1
0
        public async Task <PayPros> Post(int id, [FromBody] PayPros payment)
        {
            //Get item to be paid from id
            var item = new { id = id, balance = 1.00 };

            #region PayPros
            //Process Payment
            EFContext _dbContext = new EFContext();

            //Be secure, remove full CC from persistent storage record
            string FullCCNum = payment.CreditCardNumber;
            payment = PaymentProcessing.EncryptCreditCardNumber(payment);
            //Save payment attempt to persistent storage
            _dbContext.PayPros.Add(payment);
            await _dbContext.SaveChangesAsync();

            //Process with paypros
            PaymentProcessing payProcessing = new PaymentProcessing(PaymentAccounts.Judicial, PaymentMethods.Web);
            payment = payProcessing.Initiate(payment, FullCCNum);
            //Save updated payment attempt to persistent storage
            _dbContext.PayPros.Update(payment);
            await _dbContext.SaveChangesAsync();

            #endregion

            //Update item if payment is successful
            if (payment.responseCode == 1)
            {
                item.balance = 0.00;
            }

            return(payment);
        }
Esempio n. 2
0
        public async Task ShouldSuccessIfBankAuthorizeAsync()
        {
            var bank = new Mock <IBankClient>();
            var repo = new Mock <IPaymentRepository>();

            var request = ValidPaymentRequest.Create(new PaymentRequest(
                                                         cardNumber: "0000-0000-0000-0000",
                                                         expiry: new DateTimeOffset(2020, 01, 01, 0, 0, 0, TimeSpan.Zero),
                                                         amount: 100,
                                                         currency: "USD",
                                                         cvv: "000")).Value;

            var bankRequest = new BankRequest("data");

            bank.Setup(m => m.CreateBankRequestAsync(
                           It.Is <ValidPaymentRequest>(d => d.CardNumber == request.CardNumber)))
            .ReturnsAsync(bankRequest);

            bank.Setup(m => m.AuthorizeAsync(
                           It.Is <BankRequest>(r => r.Data == bankRequest.Data)))
            .ReturnsAsync(Result <BankAuthorizationId> .CreateSuccess(new BankAuthorizationId("Id")));

            var sut    = new PaymentProcessing(bank.Object, repo.Object);
            var actual = await sut.ProcessAsync(request);

            Assert.True(actual.IsSuccess);
        }
Esempio n. 3
0
        public void ProgramValidTest()
        {
            int paymentType = 1;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.IsNotNull(result);
        }
Esempio n. 4
0
        public void ProgramPaymentType1()
        {
            int paymentType = 1;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.Contains(result, "packing slip for Shipping");
        }
Esempio n. 5
0
        public void ProgramPaymentType4()
        {
            int paymentType = 4;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.Contains(result, "upgraded to membership successfully");
        }
Esempio n. 6
0
        public void ProgramPaymentType5()
        {
            int paymentType = 5;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.Contains(result, "Added free First Aid video");
        }
Esempio n. 7
0
        public void ProgramPaymentType3()
        {
            int paymentType = 3;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.Contains(result, "activated successfully");
        }
Esempio n. 8
0
        public void ProgramPaymentType2()
        {
            int paymentType = 2;
            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(paymentType);

            Assert.Contains(result, "for Royalty");
        }
Esempio n. 9
0
        public async Task <PaymentJson> ProcessPayment([FromBody] PaymentModel model)
        {
            var payProcessing = new PaymentProcessing(_context, _acquirerApi, _accountApi, _log);
            var payment       = model.Map();

            if (!await payProcessing.Process(payment, model.AuthToken))
            {
                return(new PaymentErrorJson(payProcessing));
            }

            await _context.SaveChangesAsync();

            return(new PaymentJson(payment));
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            string paymentType = string.Empty;

            Console.Write("Please enter any one of the payment processing type: \n " +
                          "1: For Physical Product \n " +
                          "2: For a Book \n " +
                          "3: For Membership \n " +
                          "4: For Upgrade MemberShip \n " +
                          "5: For Video \n ");
            Console.WriteLine();
            Console.Write("Enter payment processing type: ");
            paymentType = Console.ReadLine();

            PaymentProcessing objPaymentProcessing = new PaymentProcessing();
            string            result = objPaymentProcessing.ProcessPayment(Convert.ToInt32(paymentType));

            Console.WriteLine(result);
            Console.ReadLine();
        }
Esempio n. 11
0
 public PaymentErrorJson(PaymentProcessing cardTransactionProcessing)
 {
     this._cardTransactionProcessing = cardTransactionProcessing;
 }
Esempio n. 12
0
 public ReceivesAllCredit()
 {
     paymentProcessing = new PaymentProcessing();
 }
Esempio n. 13
0
        public void TicketTesting(IDictionary <string, string> data)
        {
            MasterData = new objMasterData(data);
            MasterData.TestResultPathStem = pathStem;
            className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
            Step step = new Step();

            step.Action         = string.Format("Test: {0}", MasterData.TestDescription);
            step.ExpectedResult = string.Format("");
            step.ActualResult   = string.Format("");
            step.Status         = "Pass";
            step.Time           = DateTime.Now.ToString();

            try
            {
                AttachToProcess(Processes.Encompass, 5);

                #region VA Appraisals: 2015 Itemization (loan has already clicked Generate Estimated Closing Dates and Standard Fees)

                //1 unit (set address)
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("1")
                .txt_SubjectProperty_ZipCode_SendKeys(MasterData.Zip);
                //.ChangeSubjectProperty(MasterData.County, MasterData.City, MasterData.State, MasterData.Zip);

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " 1 unit");

                TransmittalSummary
                .OpenForm_FromFormsTab()
                .cmb_PropertyType_SendKeys("Detached");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " Detached");

                DisclosurePrep
                .OpenForm_FromFormsTab()
                .btn_GenerateEstimatedClosingDatesandStandardFees_Click();

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDownToAppraisal_Click();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + "Detached 1 unit " + MasterData.TestDescription);

                //2 unit
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("2");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " 2 unit");

                DisclosurePrep
                .OpenForm_FromFormsTab()
                .btn_GenerateEstimatedClosingDatesandStandardFees_Click();

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDownToAppraisal_Click();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + "Detached 2 unit " + MasterData.TestDescription);

                //3 unit
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("3");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " 3 unit");

                DisclosurePrep
                .OpenForm_FromFormsTab()
                .btn_GenerateEstimatedClosingDatesandStandardFees_Click();

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDownToAppraisal_Click();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + "Detached 3 unit " + MasterData.TestDescription);

                //4 unit
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("4");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " 4 unit");

                DisclosurePrep
                .OpenForm_FromFormsTab()
                .btn_GenerateEstimatedClosingDatesandStandardFees_Click();

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDownToAppraisal_Click();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + "Detached 4 unit " + MasterData.TestDescription);

                //Condo
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("1");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " 1 unit condo");

                TransmittalSummary
                .OpenForm_FromFormsTab()
                .cmb_PropertyType_SendKeys("Condominium");

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + " condo");

                DisclosurePrep
                .OpenForm_FromFormsTab()
                .btn_GenerateEstimatedClosingDatesandStandardFees_Click();

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDownToAppraisal_Click();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "2015 Itemization " + MasterData.TestID + "condo " + MasterData.TestDescription);


                #endregion


                #region VA Appraisals: Appraisal Order and Tracking (loan must have Intent to Proceed)

                //1 unit (set address)
                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_SubjectProperty_ZipCode_SendKeys(MasterData.Zip);
                //.ChangeSubjectProperty(MasterData.County, MasterData.City, MasterData.State, MasterData.Zip);

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID);

                AppraisalOrderAndTracking
                .OpenForm_FromFormsTab()
                .cmb_PropertyType_SendKeys("Detached")
                .txt_NoUnits_SendKeys("1")
                .chk_EnterPaymentInfoForBorrower_Check(false)
                .chk_EnterPaymentInfoForBorrower_Check(true)
                .DragPaymentProcessingWindow();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID + " 1 unit " + MasterData.TestDescription);

                PaymentProcessing
                .Initialize()
                .btn_Close_Click();

                //2 unit
                AppraisalOrderAndTracking
                .Initialize()
                .cmb_PropertyType_SendKeys("Detached")
                .txt_NoUnits_SendKeys("2")
                .chk_EnterPaymentInfoForBorrower_Check(false)
                .chk_EnterPaymentInfoForBorrower_Check(true)
                .DragPaymentProcessingWindow();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID + " 2 unit " + MasterData.TestDescription);

                PaymentProcessing
                .Initialize()
                .btn_Close_Click();

                //3 unit
                AppraisalOrderAndTracking
                .OpenForm_FromFormsTab()
                .cmb_PropertyType_SendKeys("Detached")
                .txt_NoUnits_SendKeys("3")
                .chk_EnterPaymentInfoForBorrower_Check(false)
                .chk_EnterPaymentInfoForBorrower_Check(true)
                .DragPaymentProcessingWindow();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID + " 3 unit " + MasterData.TestDescription);

                PaymentProcessing
                .Initialize()
                .btn_Close_Click();

                //4 unit
                AppraisalOrderAndTracking
                .OpenForm_FromFormsTab()
                .txt_NoUnits_SendKeys("4")
                .chk_EnterPaymentInfoForBorrower_Check(false)
                .chk_EnterPaymentInfoForBorrower_Check(true)
                .DragPaymentProcessingWindow();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID + " 4 unit " + MasterData.TestDescription);

                PaymentProcessing
                .Initialize()
                .btn_Close_Click();

                //condo
                AppraisalOrderAndTracking
                .OpenForm_FromFormsTab()
                .cmb_PropertyType_SendKeys("Condominium")
                .txt_NoUnits_SendKeys("1")
                .chk_EnterPaymentInfoForBorrower_Check(false)
                .chk_EnterPaymentInfoForBorrower_Check(true)
                .DragPaymentProcessingWindow();

                Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), @"C:\Users\hcharls\Desktop\Test Screenshots\" + "Payment Processing " + MasterData.TestID + " condo " + MasterData.TestDescription);

                PaymentProcessing
                .Initialize()
                .btn_Close_Click();

                #endregion
            }

            catch (Exception ex)
            {
                step.ModalText          = ex.ToString();
                step.Status             = "Fail";
                step.ScreenShotLocation = Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format("Failure\\{0}", System.Reflection.MethodBase.GetCurrentMethod().Name));
                Assert.Fail(ex.ToString());
            }
            finally
            {
                Report.addStep(step);
            }
        }