private Voucher PrepareVoucher() { List <VoucherPaymentDetails> voucherPaymentDetailsList = new List <VoucherPaymentDetails>(); foreach (DataRow dr in _ClaimPaymentDetails.Rows) { VoucherPaymentDetails voucherPaymentDetails = new VoucherPaymentDetails() { CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name), PaymentModeId = Convert.ToInt32(dr["PaymentModeId"].ToString()), PaymentAmount = Convert.ToDecimal(dr["Amount"].ToString()), PaymentModeName = dr["PaymentModeName"].ToString(), Description = dr["PaymentDetails"].ToString() }; voucherPaymentDetailsList.Add(voucherPaymentDetails); } VoucherPayment voucherPayment = new VoucherPayment() { VoucherPaymentDetailsList = voucherPaymentDetailsList, TotalAmount = Convert.ToDecimal(lblTotalApprovedAmount.Text.Trim()), CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name), }; Voucher voucher = new Voucher() { VoucherPayment = voucherPayment, CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name) }; voucher.VoucherJson = PrepareVoucherJson(); return(voucher); }
/// <summary> /// Api for retriving Use Voucher - Use Voucher /// </summary> /// <param name="apipaymentvoucherusepostrequestcontent"></param> /// <returns>ApiPaymentVoucherUsePostOKResponseContent</returns> public async Task <IHttpActionResult> Post(Models.ApiPaymentVoucherUsePostRequestContent apipaymentvoucherusepostrequestcontent) { // TODO: implement Post -route: api / Payment / Voucher / Use / // var result = new ApiPaymentVoucherUsePostOKResponseContent(); //return Ok(result); var resultinPmtDetails = new VoucherPaymentDetails(); var securityData = new model.SecurityData(); object securityObj; Request.Properties.TryGetValue("securityData", out securityObj); securityData = (model.SecurityData)securityObj; // securityData.RadixxToken = "4caf1207-c744-417d-8053-5a835f7d6a00"; try { resultinPmtDetails = this._paymentTasks.AddVoucher(apipaymentvoucherusepostrequestcontent.VoucherRefNo.Trim(), apipaymentvoucherusepostrequestcontent.VoucherPin.Trim(), securityData); //this.UserSessionTasks.UserSession.VoucherSequenceNumber++; } //return this.VoucherInput(); catch (RadixxVoucherException ex) { throw new Exception(); } PaymentBuilder useVoucherBuilder = new PaymentBuilder(); return(Ok(useVoucherBuilder.BuildUseVoucherResponse(resultinPmtDetails))); }