public void PaymentDetailsValidResults()
        {
            var inModel = new PaymentsModel {
                PaymentId = 439457997, PaymentSeqNo = 0
            };
            var request  = MappingEngine.Map <ClmPaymentDtlGetRequest>(inModel);
            var response = new ClmPaymentDtlGetResponse {
                OutHistoryGroup = new List <OutHistoryGroup> {
                    new OutHistoryGroup {
                        PchAmount = 12345678
                    }
                }.ToArray()
            };
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmPaymentDtlGetRequest>(inModel)).Returns(request);
            mockPaymentHistoryWcf.Setup(m => m.GetPaymentDetails(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            var result = SystemUnderTest().GetPaymentDetails(inModel);

            Assert.IsTrue(result.ListOfPayments.Count() == outModel.ListOfPayments.Count());
            Assert.IsTrue(result.ListOfPayments.First().StatusCode == outModel.ListOfPayments.First().StatusCode);
            mockMappingEngine.Verify(m => m.Map <ClmPaymentDtlGetRequest>(inModel), Times.Once());
            mockPaymentHistoryWcf.Verify(m => m.GetPaymentDetails(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once());
        }
Пример #2
0
 // PAYMENT SAVE BUTTON  // PAYMENT SAVE BUTTON
 private void buPaymentSave_Click_1(object sender, EventArgs e)
 {
     if (IsValidData())
     {
         VBRAsiaCusModel        c  = FillModel();
         List <VBRAsiaCusModel> lc = VBRAsia_CustomersDA.GetVBRAsiaCustomer(Config.VBR4000Connection, c.Customer_No);
         if (lc.Count > 0)
         {
             if (IsValidPaymentData())
             {
                 PaymentsModel m = PaymentFillModel();
                 int           i = PaymentDetailsDA.UpdatePaymentDetails(Config.VBR4000Connection, m);
                 i = PaymentDetailsDA.InsertPaymentDetails(Config.VBR4000Connection, m);
                 if (i == 1)
                 {
                     MessageBox.Show("Saved");
                     lc = VBRAsia_CustomersDA.GetVBRAsiaCustomer(Config.VBR4000Connection, m.Customer_No);
                     if (lc.Count > 0)
                     {
                         FillForm(lc[0]);
                     }
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Please First save the customer");
     }
 }
        public void GeneralPaymentsThrowsFaultExceptionThrowsPaymentsFault()
        {
            var exception = new FaultException <PaymentsFault>(new PaymentsFault {
                Message = "Exception"
            });

            var inModel = new PaymentsModel {
                ContractId = "0205885C"
            };
            var request  = MappingEngine.Map <claimgeneralGetRequest>(inModel);
            var response = new claimgeneralGetResponse {
                OutGroup4Claim = new List <outGroup4Claim> {
                    new outGroup4Claim {
                        OutGrp4ClaimId = 12345678
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().ListGeneralPayments(inModel);
        }
        public void GeneralPaymentsValidResults()
        {
            var inModel = new PaymentsModel {
                ContractId = "0205885C"
            };
            var request  = MappingEngine.Map <claimgeneralGetRequest>(inModel);
            var response = new claimgeneralGetResponse {
                OutGroup4Claim = new List <outGroup4Claim> {
                    new outGroup4Claim {
                        OutGrp4ClaimId = 12345678
                    }
                }.ToArray()
            };
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            var result = SystemUnderTest().ListGeneralPayments(inModel);

            Assert.IsTrue(result.ListOfPayments.Count() == outModel.ListOfPayments.Count());
            Assert.IsTrue(result.ListOfPayments.First().ClaimId == outModel.ListOfPayments.First().ClaimId);
            mockMappingEngine.Verify(m => m.Map <claimgeneralGetRequest>(inModel), Times.Once());
            mockGeneralPaymentsWcf.Verify(m => m.claimgeneralGetEXECUTE(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once());
        }
        public void AcquittalsValidResults()
        {
            var inModel = new PaymentsModel {
                PaymentId = 1234567890
            };
            var request  = MappingEngine.Map <ClmAcqReadRequest>(inModel);
            var response = new ClmAcqReadResponse
            {
                OutGroupAcquittalList = new List <OutGroupAcquittalList>
                {
                    new OutGroupAcquittalList
                    {
                        AcqAcquitalAmount = 110.99,
                        AcqAquittalDate   = new DateTime(2012, 10, 10)
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmAcqReadRequest>(inModel)).Returns(request);
            mockAcquittalsService.Setup(m => m.ClmAcqReadExecute(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            var result = SystemUnderTest().ListOffsets(inModel);

            Assert.IsTrue(result.ListOfPayments.Count() == outModel.ListOfPayments.Count());
            Assert.IsTrue(Math.Abs(result.ListOfPayments.First().Amount - outModel.ListOfPayments.First().Amount) < double.Epsilon);
            mockMappingEngine.Verify(m => m.Map <ClmAcqReadRequest>(inModel), Times.Once());
            mockAcquittalsService.Verify(m => m.ClmAcqReadExecute(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once());
        }
        public void CommentsWcfThrowsFaultExceptionThrowsServiceValidationException()
        {
            var exception = new FaultException(new FaultReason("reason"), new FaultCode("code"));

            var inModel = new PaymentsModel {
                PaymentId = 4615912790, PaymentSeqNo = 1
            };
            var request  = MappingEngine.Map <ClmcommentGetRequest>(inModel);
            var response = new ClmcommentGetResponse
            {
                OutClmStatusItem = new List <OutClmStatusItem>
                {
                    new OutClmStatusItem
                    {
                        CreationUserId = "EY2500",
                        YpyStatusCode  = "RECF"
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmcommentGetRequest>(inModel)).Returns(request);
            mockPaymentHistoryWcf.Setup(m => m.GetPaymentDetailsComments(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().ListComments(inModel);
        }
        public void AcquittalsWcfThrowsFaultExceptionThrowsServiceValidationException()
        {
            var exception = new FaultException(new FaultReason("reason"), new FaultCode("code"));

            var inModel = new PaymentsModel {
                PaymentId = 1234567890
            };
            var request  = MappingEngine.Map <ClmAcqReadRequest>(inModel);
            var response = new ClmAcqReadResponse
            {
                OutGroupAcquittalList = new List <OutGroupAcquittalList>
                {
                    new OutGroupAcquittalList
                    {
                        AcqAcquitalAmount = 110.99,
                        AcqAquittalDate   = new DateTime(2012, 10, 10)
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmAcqReadRequest>(inModel)).Returns(request);
            mockAcquittalsService.Setup(m => m.ClmAcqReadExecute(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().ListOffsets(inModel);
        }
        public void PaymentDetailsWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException()
        {
            var exception = new FaultException <ValidationFault>(new ValidationFault {
                Details = new List <ValidationDetail> {
                    new ValidationDetail {
                        Key = "Key", Message = "Message"
                    }
                }
            });

            var inModel = new PaymentsModel {
                PaymentId = 439457997, PaymentSeqNo = 0
            };
            var request  = MappingEngine.Map <ClmPaymentDtlGetRequest>(inModel);
            var response = new ClmPaymentDtlGetResponse {
                OutHistoryGroup = new List <OutHistoryGroup>().ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmPaymentDtlGetRequest>(inModel)).Returns(request);
            mockPaymentHistoryWcf.Setup(m => m.GetPaymentDetails(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().GetPaymentDetails(inModel);
        }
Пример #9
0
        public List <RepaymentsModel> CalculateRepaymentValues(PaymentsModel payments, ChargesModel charges)
        {
            var monthsInYear      = 12;
            var repaymentList     = new List <RepaymentsModel>();
            var numberOfPaymonths = payments.YearsOfAgreement * monthsInYear;
            var repaymentPerMonth = decimal.Round((payments.BorrowAmount - payments.DepositAmount) / numberOfPaymonths, 2);
            var payMonth          = payments.DeliveryDate.AddMonths(1);



            for (int i = 0; i < numberOfPaymonths; i++)
            {
                DateTime startDatePayMonth = new DateTime(payMonth.Year, payMonth.Month, 1);

                while (startDatePayMonth.DayOfWeek.ToString() != "Monday")
                {
                    startDatePayMonth = startDatePayMonth.AddDays(1);
                }
                repaymentList.Add(new RepaymentsModel {
                    RepaymentDate = startDatePayMonth, RepaymentAmount = repaymentPerMonth
                });

                payMonth = payMonth.AddMonths(1);
            }

            repaymentList.First().RepaymentAmount = repaymentList.First().RepaymentAmount + charges.ArrangementFee;
            repaymentList.Last().RepaymentAmount  = repaymentList.Last().RepaymentAmount + charges.CompletionFee;
            return(repaymentList);
        }
        public void GeneralPaymentsWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException()
        {
            var exception = new FaultException <ValidationFault>(new ValidationFault {
                Details = new List <ValidationDetail> {
                    new ValidationDetail {
                        Key = "Key", Message = "Message"
                    }
                }
            });

            var inModel = new PaymentsModel {
                ContractId = "0205885C"
            };
            var request  = MappingEngine.Map <claimgeneralGetRequest>(inModel);
            var response = new claimgeneralGetResponse {
                OutGroup4Claim = new List <outGroup4Claim> {
                    new outGroup4Claim {
                        OutGrp4ClaimId = 12345678
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().ListGeneralPayments(inModel);
        }
Пример #11
0
        public string Post(PaymentsModel value)
        {
            ChargesModel           Charges     = _additionalCharges.Get();
            List <RepaymentsModel> PaymentList = _repay.CalculateRepaymentValues(value, Charges);
            string body = JsonConvert.SerializeObject(PaymentList, Formatting.Indented);

            return(body);
        }
Пример #12
0
        public JsonResult Ajax_GetDetails(Guid id)
        {
            UserAccountRolesModel access = UserAccountsController.getUserAccess(Session);

            List <PaymentItemsModel> models = PaymentItemsController.get(null, id);
            string content = string.Format(@"
                    <div class='table-responsive'>
                        <table class='table table-striped table-bordered'>
                            <thead>
                                <tr>
                                    <th>Invoice</th>
                                    <th class='text-right'>Due before</th>
                                    <th class='text-right'>Payment</th>
                                    <th class='text-right'>Due now</th>
                                </tr>
                            </thead>
                            <tbody>
                ");

            string saleInvoiceLink;

            foreach (PaymentItemsModel model in models)
            {
                saleInvoiceLink = !access.SaleInvoices_View ? model.SaleInvoices_No :
                                  string.Format("<a href='/SaleInvoices?FILTER_chkDateFrom=false&FILTER_chkDateTo=false&FILTER_Keyword={0}' target='_blank'>{0}</a>", model.SaleInvoices_No);

                content += string.Format(@"
                            <tr>
                                <td style='width:50px;'>{0}</td>
                                <td class='text-right'>{1:N0}</td>
                                <td class='text-right'><strong>{2:N0}</strong></td>
                                <td class='text-right'>{3:N0}</td>
                            </tr>
                        ",
                                         saleInvoiceLink,
                                         model.DueBefore,
                                         model.Amount,
                                         model.DueAfter
                                         );
            }

            PaymentsModel payment = get(id);

            content += string.Format(@"
                        </tbody></table></div>
                        <div class='mt-2'>
                            <div class='h3 ml-2 float-right font-weight-bold'>TOTAL: {0:N0}</div>
                        </div>
                    ",
                                     payment.CashAmount + payment.DebitAmount + payment.ConsignmentAmount
                                     );

            return(Json(new { content = content }, JsonRequestBehavior.AllowGet));
        }
Пример #13
0
        public IActionResult Payments(string page)
        {
            int pageNumber = int.Parse(page);

            pageNumber++;
            int pageSize = 10;

            PaymentsModel model        = new PaymentsModel();
            User          loggedInUser = this.context.Users.Find(this.userManager.GetUserId(User));

            model.Orders     = this.context.order.Where(order => order.userId == loggedInUser.Id).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
            model.pageNumber = pageNumber;
            return(View(model));
        }
Пример #14
0
        /// <summary>
        /// A basic add example
        /// </summary>
        /// <param name="transaction">This is the value from the AR005_TSM column in AR005_TRANS_TYPES.  This sets the default for various fields in the background</param>
        public PaymentsModel Add(string orgCode, string accountCode, string noteText, string transaction, int paidAmount, int orderNumber)
        {
            var myPayment = new PaymentsModel
            {
                Organization = orgCode,
                Account      = accountCode,
                Note         = noteText,
                Transaction  = transaction,
                PaidAmount   = paidAmount,
                OrderNumber  = orderNumber //Note that Event information is defaulted in from the order
            };

            return(APIUtil.AddPayment(USISDKClient, myPayment));
        }
Пример #15
0
        public MainViewModel()
        {
            var now = DateTime.Now;

            Model = new PaymentsModel
            {
                DateStart = new DateTime(now.Year, now.Month, 1),
                DateEnd   = new DateTime(now.Year, now.Month, 1).AddMonths(1).AddDays(-1),
            };

            GetPayments();

            SaveCommand = new RelayCommand(OnSave);
        }
Пример #16
0
        public void DoesReturnRepaymentValues()
        {
            var model = new PaymentsModel()
            {
                BorrowAmount = 1000.00M, DepositAmount = 150.00M, DeliveryDate = new System.DateTime(), YearsOfAgreement = 1
            };
            var charges = new ChargesModel()
            {
                ArrangementFee = 88, CompletionFee = 20
            };
            var result = _repay.CalculateRepaymentValues(model, charges);

            Assert.IsNotNull(result, $"{result.Count} is not null");
        }
Пример #17
0
    public static List <PaymentsModel> GetInvoiceTotal(string Connection, string Customer_No)
    {
        List <PaymentsModel> lm = new List <PaymentsModel>();
        string sql = "";

        #region SQL
        sql += "select Customer_No,sum(GrandTotal) GrandTotal from VBRAsia_Customers_Payments ";
        sql += "where Customer_No= @Customer_No ";
        sql += "group by Customer_No ";
        #endregion SQL
        using (SqlConnection conn = new SqlConnection(Connection))
        {
            conn.Open();
            using (SqlCommand command = new SqlCommand(sql, conn))
            {
                SqlParameter param = new SqlParameter();
                param.ParameterName = "@Customer_No";
                param.Value         = Customer_No;
                param.DbType        = DbType.String;
                param.Size          = 20;
                command.Parameters.Add(param);

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        PaymentsModel m = new PaymentsModel();
                        #region Fill Model
                        for (int i = 0; i < reader.FieldCount; i++)
                        {
                            if (i == 0)
                            {
                                try { m.Customer_No = reader.GetString(i); }
                                catch { }
                            }
                            if (i == 1)
                            {
                                try { m.GrandTotal = reader.GetDecimal(i); }
                                catch { }
                            }
                        }
                        #endregion Fill Model
                        lm.Add(m);
                    }
                }
            }
        }
        return(lm);
    }
Пример #18
0
        /// <summary>
        /// How to add a payment tied to an invoice
        /// </summary>
        /// <param name="transaction">This is the value from the AR005_TSM column in AR005_TRANS_TYPES.  This sets the default for various fields in the background</param>
        /// <param name="invoiceNumber">This is the sequence of the invoice (This is found in v20 under Invoices window -> Sequence column in grid.  Also in database as AR030_INVOICE)</param>
        public PaymentsModel AddInvoicePayment(string orgCode, string accountCode, string noteText, string transaction, int paidAmount, int invoiceNumber)
        {
            var myPayment = new PaymentsModel
            {
                Organization = orgCode,
                Account      = accountCode,
                Note         = noteText,
                Transaction  = transaction,
                PaidAmount   = paidAmount,
                Invoice      = invoiceNumber,
                Date         = System.DateTime.Now
            };

            return(APIUtil.AddPayment(USISDKClient, myPayment));
        }
Пример #19
0
        public ResponseModel Add(PaymentsModel payment)
        {
            //**************************
            // add di-api code here ^-^
            //**************************


            var response = new ResponseModel {
                Id      = payment.DocEntry,
                Status  = "Sucesso",
                Message = "Pagamento cadastrado",
                Objects = payment
            };

            return(response);
        }
Пример #20
0
        public ActionResult <ResponseModel> Post([FromBody] PaymentsModel entity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                return(Created("", _paymentsService.Add(entity)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #21
0
        // Payment Details FillModel
        private PaymentsModel PaymentFillModel()
        {
            PaymentsModel m = new PaymentsModel();

            m.Customer_No        = txtCustomer_No.Text.Trim();
            m.JobDetails         = txtJobDetails.Text.Trim();
            m.Amount             = Convert.ToDecimal(txtAmount.Text.Trim());
            m.Vat                = Convert.ToDecimal(txtVat.Text.Trim());
            m.ExtraCharge        = Convert.ToDecimal(txtExtraCharge.Text.Trim());
            m.ExtraChargeDetails = txtEChargeDetails.Text.Trim();
            m.Discounts          = Convert.ToDecimal(txtDiscounts.Text.Trim());
            m.GrandTotal         = Convert.ToDecimal(txtGrandTotal.Text.Trim());
            m.InitailAmount      = Convert.ToDecimal(txtInitailAmount.Text.Trim());
            m.OutStanding        = Convert.ToDecimal(txtOutStanding.Text.Trim());
            m.IsPaid             = cbPaid.Checked;
            return(m);
        }
        public void WithdrawPaymentThrowsFaultExceptionThrowsServiceValidationException()
        {
            var exception = new FaultException(new FaultReason("fault reason"), new FaultCode("fault code"));

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }
Пример #23
0
        public async Task <PaymentsModel> GetByNumber(int number)
        {
            PaymentsModel num = null;

            if (number < 0)
            {
                throw new InvalidOperationException("Number can't be 0");
            }

            num = await uploader.GetByNumber(number).ConfigureAwait(false);

            if (num == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(num);
        }
        public void WithdrawPaymentThrowsFaultExceptionThrowsPaymentsFault()
        {
            var exception = new FaultException <PaymentsFault>(new PaymentsFault {
                Message = "Service validation exception"
            });

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }
Пример #25
0
        /* PRINT **********************************************************************************************************************************************/

        // GET: Payments/Print
        public ActionResult Print(Guid?id)
        {
            if (id == null || !UserAccountsController.getUserAccess(Session).Payments_View)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            PaymentsModel model = get((Guid)id);

            ViewBag.InvoiceHeaderText    = new BranchesController().get(Helper.getActiveBranchId(Session)).InvoiceHeaderText;
            ViewData["SaleInvoiceItems"] = SaleInvoiceItemsController.get(null, null, null, model.Id, null, null, null, null, null, null)
                                           .OrderBy(x => x.SaleInvoices_No)
                                           .ThenBy(x => x.RowNo)
                                           .ToList();
            ViewData["PaymentItems"] = PaymentItemsController.get(null, model.Id);
            ViewBag.TotalAmount      = model.CashAmount + model.ConsignmentAmount + model.DebitAmount;

            return(View(model));
        }
        public void WithdrawPaymentValidResults()
        {
            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            var result = SystemUnderTest().WithdrawGeneralPayment(inModel);

            Assert.IsTrue(result.PaymentId == outModel.PaymentId);
            mockMappingEngine.Verify(m => m.Map <claimgeneralWithdrawRequest>(inModel), Times.Once());
            mockGeneralPaymentsWcf.Verify(m => m.claimgeneralWithdrawEXECUTE(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once());
        }
Пример #27
0
 //FillPayment HeaderCard
 private void FillPaymentHeaderCard()
 {
     laJobID.Text = "";
     if ((NoOfPayments > 0) && (CurrentIndex >= 0) && (CurrentIndex < NoOfPayments))
     {
         PaymentsModel m = paymentsList[CurrentIndex];
         txtCustomer_No.Text    = m.Customer_No;
         txtJobDetails.Text     = m.JobDetails;
         txtAmount.Text         = String.Format("{0:0.00}", m.Amount);
         txtVat.Text            = String.Format("{0:0.00}", m.Vat);
         txtExtraCharge.Text    = String.Format("{0:0.00}", m.ExtraCharge);
         txtEChargeDetails.Text = m.ExtraChargeDetails;
         txtDiscounts.Text      = String.Format("{0:0.00}", m.Discounts);
         txtGrandTotal.Text     = String.Format("{0:0.00}", m.GrandTotal);
         txtInitailAmount.Text  = String.Format("{0:0.00}", m.InitailAmount);
         txtOutStanding.Text    = String.Format("{0:0.00}", m.OutStanding);
         laJobID.Text           = m.JobID.ToString();
         cbPaid.Checked         = m.IsPaid;
     }
 }
        public void PaymentDetailsThrowsFaultExceptionThrowsServiceValidationException()
        {
            var exception = new FaultException(new FaultReason("reason"), new FaultCode("code"));

            var inModel = new PaymentsModel {
                PaymentId = 439457997, PaymentSeqNo = 0
            };
            var request  = MappingEngine.Map <ClmPaymentDtlGetRequest>(inModel);
            var response = new ClmPaymentDtlGetResponse {
                OutHistoryGroup = new List <OutHistoryGroup>().ToArray()
            };

            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <ClmPaymentDtlGetRequest>(inModel)).Returns(request);
            mockPaymentHistoryWcf.Setup(m => m.GetPaymentDetails(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().GetPaymentDetails(inModel);
        }
Пример #29
0
        public bool pay(PaymentsModel model, int membershipSubscriptionStatus, string username, string ipAddress, String custIp)
        {
            Member member = memberDao.findMember(username);
            double amount = subscriptionTypeDao.findAmount(membershipSubscriptionStatus) - Convert.ToDouble(member.MemberSubscriptionType.amount);
            SetcomPaymentTransactionManager PayMan = new SetcomPaymentTransactionManager();

            PurchaseTransactionRequest purchaseTransactionRequest = new PurchaseTransactionRequest();

            purchaseTransactionRequest.CCNumber            = model.CardNumber;
            purchaseTransactionRequest.CCCVV               = model.CVCNumber;
            purchaseTransactionRequest.ExYear              = (model.ExpiryDateY.Trim().Length > 2) ? model.ExpiryDateY : "20" + model.ExpiryDateY;
            purchaseTransactionRequest.ExMonth             = model.ExpiryDateM;
            purchaseTransactionRequest.CCName              = HttpUtility.UrlEncode(model.NameOnCard);
            purchaseTransactionRequest.MemberInGameID      = null;
            purchaseTransactionRequest.buyer_id            = "";
            purchaseTransactionRequest.bill_first_name     = HttpUtility.UrlEncode(member.FirstName);
            purchaseTransactionRequest.bill_last_name      = HttpUtility.UrlEncode(member.LastName);
            purchaseTransactionRequest.bill_street1        = "";
            purchaseTransactionRequest.bill_street2        = "";
            purchaseTransactionRequest.bill_city           = "";
            purchaseTransactionRequest.bill_state          = "";
            purchaseTransactionRequest.bill_country        = "";
            purchaseTransactionRequest.bill_zip            = "";
            purchaseTransactionRequest.EmailAddress        = HttpUtility.UrlEncode(member.EmailAddress);
            purchaseTransactionRequest.CC_Amount           = amount.ToString();
            purchaseTransactionRequest.ip_address          = custIp;
            purchaseTransactionRequest.transactionDateTime = DateTime.Now;

            PurchaseTransactionResponse ptRes = PayMan.PerformPaymentTransaction(purchaseTransactionRequest);

            if (ptRes.outcome.ToUpper() == "APPROVED")
            {
                member.MemberSubscriptionTypeID = membershipSubscriptionStatus;
                memberDao.save(member);
                this.sendUpgradeEmail(member.FirstName + ' ' + member.LastName, member.EmailAddress);
                return(true);
            }
            log.Info("PaymentService: error processing payment: " + ptRes.outcome + ", " + ptRes.responseIndicator);
            return(false);
        }
        public void WithdrawPaymentWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException()
        {
            var exception = new FaultException <ValidationFault>(new ValidationFault {
                Details = new List <ValidationDetail> {
                    new ValidationDetail {
                        Key = "Key", Message = "Message"
                    }
                }
            });

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }
Пример #31
0
 /// <summary>
 /// Displays the payments.
 /// </summary>
 /// <param name="shippingMethod">The shipping method.</param>
 /// <returns>ActionResult.</returns>
 public ActionResult DisplayPayments(string shippingMethod)
 {
     var payments = new PaymentsModel { Payments = GetPayments(shippingMethod).ToArray() };
     return PartialView("Payments", payments);
 }