/// <summary> /// Displays the formatted receipt using the receipt data from the response. /// </summary> /// <param name="response"> /// The response object /// </param> private void DisplayReceipt(SaleResponse response) { // Set Receipt date time string dateTime = response.TransactionDateTime; try { DateTime dt = Convert.ToDateTime(dateTime); this.labelReceiptDateTime.Text = dt.ToString("MM/dd/yy hh:mm:ss"); } catch (FormatException) { this.labelReceiptDateTime.Text = string.Empty; } // Set Receipt transaction data this.labelReceiptTransactionID.Text = response.TransactionId; this.labelReceiptTerminalId.Text = response.TerminalId; this.labelReceiptStatus.Text = response.StatusCode; this.labelReceiptApprovalNumber.Text = response.ApprovalNumber; this.labelReceiptAccountNumber.Text = response.AccountNumber; this.labelReceiptEntryMode.Text = response.EntryMode; this.labelReceiptPaymentType.Text = response.PaymentType; this.labelReceiptSubtotal.Text = string.Format("{0:C}", response.SubTotalAmount); this.labelReceiptCashBack.Text = string.Format("{0:C}", response.CashbackAmount); this.labelReceiptTip.Text = string.Format("{0:C}", response.TipAmount); this.labelReceiptTotalAmount.Text = string.Format("{0:C}", response.TotalAmount); this.labelReceiptApprovedAmount.Text = string.Format("{0:C}", response.ApprovedAmount); // Determine what to display on receipt regarding signature this.DetermineSignature(response); }
private void storeSplitPaymentInfo(SaleResponse response) { if (!_order._orderHeader.iSplitCount.HasValue) { _order._orderHeader.iSplitCount = ReceiptSplits.Count; } StringBuilder sb = new StringBuilder(); if (_order._orderHeader.vSplitPayment != null) { sb.Append(";"); } sb.Append(PaymentType == SplitPaymentType.Card ? "cash" : "card"); sb.Append(","); if (response != null) { sb.Append(response.Resp_CardNum); } sb.Append(","); sb.Append(_activeSplit.Amount.ToString("0.##")); sb.Append(","); sb.AppendFormat("split{0}", (ReceiptSplits.IndexOf(_activeSplit) + 1)); _order._orderHeader.vSplitPayment += sb.ToString(); GConfig.DAL.SaveChanges(); }
public SaleResponse Sale(int amount, int ticket) { if (_configured) { try { SaleResponse response = new SaleResponse(TransbankWrap.sale(amount, ticket, false)); if (response.Success) { return(response); } else { throw new TransbankSaleException("Sale returned an error: " + response.ResponseMessage, response); } } catch (TransbankSaleException) { throw; } catch (Exception e) { throw new TransbankException("Unable to execute Sale on pos", e); } } else { throw new TransbankException("Port not Configured"); } }
public override void OnSaleResponse(SaleResponse response) { base.OnSaleResponse(response); saleDone = true; paymentId = response.Payment.id; orderId = response.Payment.order.id; }
public void OnSaleResponse(SaleResponse response) { OnSaleResponseMessage message = new OnSaleResponseMessage(); message.payload = response; WebSocket.Send(JsonUtils.serialize(message)); }
/// <summary> /// Liste sayfası için tüm order listesi dto olarak doldurulur. /// </summary> /// <returns></returns> public SaleResponse GetOrder() { var result = new SaleResponse(); try { var serviceResult = GetSalesHelp(); result.Orders = serviceResult.Orders.Select(x => new OrderDTO() { Address = x.Address, City = x.City, District = x.District, Fullname = x.Fullname, TaxNumber = x.TaxNumber, IntegrationOrderCode = x.IntegrationOrderCode, OrderDate = x.OrderDate.ToString("dd/MM/yyyy"), OrderId = x.OrderId, OrderStatus = x.OrderStatus, Telephone = x.Telephone, PersonalIdentification = x.PersonalIdentification, PostalCode = x.PostalCode, TaxAuthority = x.TaxAuthority }).ToList(); } catch (Exception ex) { result.Status = Status.Error; result.Message = $"İşlem sırasında hata alındı. Detayları : {ex.Message}"; logger.ExtendedError("TokenError", new { response = JsonConvert.SerializeObject(ex) }); } return(result); }
// POST: api/BankSale public HttpResponseMessage Post([FromBody] SaleRequest saleRequest) { //json formatında data gelcek //formatlıcak //dbye token oluşturup kayıt atcak SaleResponse saleResponse = new SaleResponse(); SalePersistence sp = new SalePersistence(); long bankguid = 0; bankguid = sp.insertTransaction(saleRequest); //token algorihm string token_data = new Utilities().generateToken(saleRequest, bankguid.ToString()); sp.updateTransactionTokenByGuid(token_data, bankguid); saleResponse.token_data = token_data; JObject payLoad = new JObject( new JProperty("error_code", "0000000"), new JProperty("error_desc", "Basarili"), new JProperty("token_data", saleResponse.token_data), new JProperty("bank_transaction_guid", bankguid) ); return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(payLoad.ToString()) }); }
private void Pay_btn_Click(object sender, EventArgs e) { try{ if (total > 0 && ShopingList_lst.Items.Count > 0) { int ticket = new Random().Next(1, 999999); SaleResponse response = POS.Instance.Sale(total, ticket); MessageBox.Show(response.ToString()); Clean_btn_Click(sender, e); } else { MessageBox.Show("No hay elementos para cobrar o el total es 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (TransbankSaleException a) { MessageBox.Show("Error Procesando el Pago" + "\n" + a.SaleResponse.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (TransbankException a) { MessageBox.Show(a.Message + "\n" + a.Data.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void OnSaleResponse(SaleResponse response) { OnSaleResponseMessage onSaleResponse = new OnSaleResponseMessage(); onSaleResponse.payload = response; WebSocket.Send(Serialize(onSaleResponse)); }
public async Task <SaleResponse> ProccessSale(SaleRequest saleRequest) { SaleResponse saleResponse = null; try { var order = new Orders() { Custid = saleRequest.Custid, Empid = saleRequest.Empid, Freight = saleRequest.Freight, Orderdate = saleRequest.Orderdate, Requireddate = saleRequest.Requireddate, Shipaddress = saleRequest.Shipaddress, Shipcity = saleRequest.Shipcity, Shipcountry = saleRequest.Shipcountry, Shipname = saleRequest.Shipname, Shippeddate = saleRequest.Shippeddate, Shipperid = saleRequest.Shipperid, Shippostalcode = saleRequest.Shippostalcode, Shipregion = saleRequest.Shipregion, }; _shopContext.Orders.Add(order); saleRequest.OrderDetails.ForEach((orderDetails) => { order.OrderDetails.Add(new OrderDetails() { Orderid = order.Orderid, Discount = orderDetails.Discount, Productid = orderDetails.Productid, Qty = orderDetails.Qty, Unitprice = orderDetails.Unitprice }); }); await _shopContext.SaveChangesAsync(); saleResponse = new SaleResponse() { Success = true, Message = "Sales Proccess.." }; } catch (Exception ex) { string message = "Error procesing the sale"; _logger.LogError($"{message} {ex.Message}", ex); saleResponse = new SaleResponse() { Message = "Error procesing the sale", Success = false }; } return(saleResponse); }
public override void OnSaleResponse(SaleResponse response) { System.Console.WriteLine("BlockableSaleResponse: " + response.Result); //this.cloverConnector.Sales.Remove(this); this.cloverConnector = null; this.saleResponse = response; this.hasResponse = true; }
public IActionResult List() { SaleResponse result = new SaleResponse(); result = SalesService.GetOrder(); return(View(result)); }
private bool LinkCreditCardResponseToOrder(SaleResponse CCsaleResponse) { _order._orderHeader.vOrderAcct = CCsaleResponse.Resp_CardNum; _order._orderHeader.vOrderSubAcct = CCsaleResponse.Resp_TxnId; _order._orderHeader.vOrderRef = CCsaleResponse.Resp_ApprovalCode; _order._orderHeader.vOrderPaymentRef = CCsaleResponse.Resp_Msg; return(true); }
private void Listener_SaleResponse(SaleResponse response) { SaleComplete?.Invoke(response.Success, response); if (response.Success) { LogSale?.Invoke(response.Payment.amount, DateTime.Now, response.Payment.externalPaymentId, response); } }
public int updateTransactionfromBank(long guid, SaleResponse saleResponse) { string sqlString = "Update MERCHANT_TRANSACTION set bank_transaction_guid =" + saleResponse.bank_transaction_guid + ", token_data = '" + saleResponse.token_data + "' where guid =" + guid; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn); int result = cmd.ExecuteNonQuery(); return(result); }
public void SaleResponse(HttpListenerContext context) { SaleResponse response = ParseResponse <SaleResponse>(context); if (response != null) { connectorListener.ForEach(listener => listener.OnSaleResponse(response)); } SendTextResponse(context, ""); }
public void OnSaleResponse(SaleResponse response) { if (TransactionResponse.SUCCESS.Equals(response.Code)) { cloverConnector.ShowThankYouScreen(); Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED; POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount); payment.PaymentStatus = POSPayment.Status.PAID; Store.CurrentOrder.AddPayment(payment); uiThread.Send(delegate(object state) { if (payment.CashBackAmount > 0) { //cloverConnector.OpenCashDrawer("Cash Back"); // not needed here, as the device will automatically open cash drawer with cash back MessageBox.Show(this, "Cash Back" + (payment.CashBackAmount / 100.0).ToString("C2"), "Cash Back"); } RegisterTabs.SelectedIndex = 0; PaymentReset(); NewOrder(); }, null); BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler( delegate(object o, DoWorkEventArgs args) { Thread.Sleep(3000); // wait for 3 seconds, then switch to the welcome screen unless the next order has items if (Store.CurrentOrder.Items.Count == 0) { cloverConnector.ShowWelcomeScreen(); } } ); bgWorker.RunWorkerAsync(); } else if (TransactionResponse.FAIL.Equals(response.Code)) { uiThread.Send(delegate(object state) { MessageBox.Show("Card authentication failed or was declined."); PaymentReset(); }, null); } else if (TransactionResponse.CANCEL.Equals(response.Code)) { uiThread.Send(delegate(object state) { MessageBox.Show("User canceled transaction."); PaymentReset(); }, null); } }
private void Clover_LogSale(long amount, DateTime date, string externalId, SaleResponse response) { // Clover notifications happen on background threads, invoke a call on the ui thread if (InvokeRequired) { BeginInvoke((Action <long, DateTime, string, SaleResponse>)Clover_LogSale, amount, date, externalId, response); } else { Log.AddItem(date, SaleKeypadControl.BuildDisplayString(amount.ToString()), externalId, response?.Payment?.id ?? "", response?.Success ?? false, response?.Payment?.cardTransaction?.last4 ?? ""); } }
private void SwitchSplitPaymentProccess(SaleResponse response) { _inScale = null; if (!IsSplitInitialized) { IsSplitInitialized = true; } var currentindex = ReceiptSplits.IndexOf(_activeSplit); _activeSplit.IsPaid = true; _activeSplit.IsActive = false; RemainedAmount -= _activeSplit.Amount; _activeSplit.PaymentType = PaymentType; //payed storeSplitPaymentInfo(response); if (currentindex + 1 < ReceiptSplits.Count) { var nextsplit = ReceiptSplits[currentindex + 1]; nextsplit.IsActive = true; _order.PaymentType = Model.OrderPaymentTypes.Split; if (IsAmountSplitType && ReceiptSplits.IndexOf(nextsplit) == ReceiptSplits.Count - 1) { nextsplit.Amount = RemainedAmount; nextsplit.IsAmountLocked = true; } _activeSplit = nextsplit; } else { _order.PaymentType = Model.OrderPaymentTypes.Split; _order.OrderStatus = Model.OrderStatuses.Completed; _parent.Release(); MainVM.Main.SaveOrderCommand.Execute(_order); MainVM.Main.SwitchToView(Model.SectionType.Dashboard); } }
/// <summary> /// Displays signature image on receipt. /// </summary> /// <param name="response"> /// The response object /// </param> private void DisplaySignature(SaleResponse response) { var signature = new SignatureFiles.Signature(); signature.SetFormat(response.Signature.SignatureFormat); byte[] bytes = response.Signature.SignatureData; signature.SetData(bytes); Bitmap signatureImage = signature.GetSignatureBitmap(10); this.pictureBoxSignature.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBoxSignature.Image = signatureImage; this.pictureBoxSignature.Show(); }
public async Task <ActionResult <BaseResponse> > Put([FromForm] SaleResponse infoEnter) { // Cập nhật phiếu nhập mới var list = infoEnter.listSaleDetailInfo; for (int i = 0; i < list.Count; i++) { // Kiểm tra dữ liệu nhập bị trống if (string.IsNullOrEmpty(list[i].name) || string.IsNullOrEmpty(list[i].kind) || list[i].amount == 0 || list[i].price == 0) { return(new BaseResponse { //ErrorCode = Roles.Empty_Book_Input, Message = "Some field is empty!", Data = null }); } else { var saleDetail = await _context.SALEDETAILS.Where(x => x.saleId == infoEnter.saleId && x.stt == list[i].stt).FirstOrDefaultAsync(); if (saleDetail == null) { return(new BaseResponse { ErrorCode = Roles.NotFound, Message = "Book's name: " + list[i].name + " is not found!" }); } else { saleDetail.bookId = list[i].bookId; saleDetail.amount = list[i].amount; saleDetail.totalPrice = list[i].price * list[i].amount; _context.SALEDETAILS.Update(saleDetail); await _context.SaveChangesAsync(); } } } return(new BaseResponse { ErrorCode = Roles.Success, Message = "Book sale bill is update!" }); }
public static void testPaymentAndVoid(CloverConnector cloverConnector, TestConnectorListener connListener) { //BEGIN: Test Void SaleRequest paymentRequest = new SaleRequest(); paymentRequest.ExternalId = ExternalIDUtil.GenerateRandomString(13); paymentRequest.Amount = 1324; paymentRequest.TipAmount = 123; System.Console.WriteLine("Preparing To Test Sale: $" + paymentRequest.Amount * 100.00); System.Console.WriteLine("Press Any Key to Continue..."); System.Console.ReadKey(); //cloverConnector.Sales += paymentListener; cloverConnector.Sale(paymentRequest); while (!connListener.hasResponse) { System.Console.WriteLine("Waiting for paymentResponse"); System.Threading.Thread.Sleep(1000); } SaleResponse response = connListener.saleResponse; string paymentId = response.Payment.id; string orderId = response.Payment.order.id; string employeeId = response.Payment.employee.id; VoidPaymentRequest voidRequest = new VoidPaymentRequest(); voidRequest.OrderId = orderId; voidRequest.PaymentId = paymentId; voidRequest.EmployeeId = employeeId; voidRequest.VoidReason = VoidReason.USER_CANCEL.ToString(); cloverConnector.VoidPayment(voidRequest); while (!connListener.hasResponse) { System.Console.WriteLine("Waiting for voidResponse"); System.Threading.Thread.Sleep(1000); } VoidPaymentResponse voidResponse = connListener.voidPaymentResponse; System.Console.WriteLine(voidResponse.Result); //END: Test Void }
public SaleResponse AddSale(SaleRequest saleRequest) { SaleResponse saleResponse = new SaleResponse(); try { IsaleR.AddSale(saleRequest.Sale); saleResponse.Success = true; } catch (Exception e) { saleResponse.Exception = e; saleResponse.Success = false; } return(saleResponse); }
public SaleResponse Convert(Sale source) { if (source == null) { return(null); } var result = new SaleResponse { ISBN = source.ISBN, Date = source.Date, Seller = source.Seller }; return(result); }
public void AddSalePresenter() { SaleRequest saleRequest = new SaleRequest(); saleRequest.Sale = _view.sale; SaleResponse saleResponse = saleService.AddSale(saleRequest); if (saleResponse.Success) { _view.SuccessSale("Se inserto la venta"); } else { _view.ErrorSale(string.Format("{0}", saleResponse.Exception.Message)); } }
public SaleResponse Sale(int amount, string ean) { var request = new SaleRequest { Amount = amount, Card = new Card { EAN = ean } }; var xml = request.ToString(); var resultXML = ""; try { using (var client = new HttpClient()) { var url = $"{ConfigurationManager.AppSettings["EPayApi"]}"; using (var stringContent = new StringContent(xml, Encoding.UTF8, "application/xml")) { var resp = client.PostAsync(url, stringContent).Result; resp.EnsureSuccessStatusCode(); resultXML = resp.Content.ReadAsStringAsync().Result; var response = SaleResponse.LoadFromXML(resultXML); if (response.Result != "0") { throw new Exception($"ERRO AO CHAMAR DE VENDAS EPAY - " + response.ResultText); } return(response); } } } catch (Exception ex) { var path = Path.Combine(Environment.CurrentDirectory, "Logs", DateTime.Now.ToString("yyyyMMdd") + ".log"); var sb = new StringBuilder(); sb.AppendLine(ex.ToString()); sb.AppendLine("Request"); sb.AppendLine(xml); sb.AppendLine("Response"); sb.AppendLine(resultXML); File.WriteAllText(path, sb.ToString(), Encoding.UTF8); throw new Exception($"ERRO AO CHAMAR DE VENDAS EPAY", ex); } }
public void SaleResponse(HttpListenerContext context) { try { SaleResponse response = ParseResponse <SaleResponse>(context); if (response != null) { connectorListener.ForEach(listener => listener.OnSaleResponse(response)); } SendTextResponse(context, ""); } catch (Exception e) { context.Response.StatusCode = 400; context.Response.StatusDescription = e.Message; SendTextResponse(context, "error processing request"); } }
public override void OnSaleResponse(SaleResponse response) { string cloverMessage = ""; output = ""; if (response.Success) { // payment was successful // do something with response.Payment output = "APPROVED\t" + response.Payment.amount + "\t" + response.Payment.id + "\t" + response.Payment.order.id + "\t"; cloverMessage = "TRANSACTION APPROVED"; } else { output = "FAILED\t" + response.Result + "\t" + response.Message; cloverMessage = "TRANSACTION " + response.Result; } if (deviceOffline) { output = "FAILED\tOFFLINE\t"; cloverMessage = "TRANSACTION FAILED:\nDEVICE OFFLINE"; } if (!String.IsNullOrEmpty(output)) { if (!hasSignature) { output += "NONE\t"; } File.WriteAllText(SaleFilePath, output); File.Delete(startFilePath); } cloverConnector.ShowMessage(cloverMessage); Thread.Sleep(3000); cloverConnector.ShowWelcomeScreen(); hasSignature = false; isBusy = false; }
public async Task <IActionResult> Add(SaleRequest saleRequest) { SaleResponse response = null; try { response = await _saleService.ProccessSale(saleRequest); if (!response.Success) { return(BadRequest(response)); } } catch (Exception ex) { _logger.LogError("Error processing sale", ex); } return(Ok(response)); }
public void OnSaleResponse(SaleResponse response) { if (response.Success) { uiThread.Send(delegate(object state) { }, null); } else if (response.Result.Equals(ResponseCode.FAIL)) { uiThread.Send(delegate(object state) { }, null); } else if (response.Result.Equals(ResponseCode.CANCEL)) { uiThread.Send(delegate(object state) { }, null); } }
public void OnSaleResponse(SaleResponse response) { Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED; POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount); payment.PaymentStatus = POSPayment.Status.PAID; Store.CurrentOrder.AddPayment(payment); Store.CreateOrder(); uiThread.Send(delegate (object state) { PaymentFinished(); }, null); }
public void OnSaleResponse(SaleResponse response) { if (TransactionResponse.SUCCESS.Equals(response.Code)) { cloverConnector.ShowThankYouScreen(); Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED; POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount); payment.PaymentStatus = POSPayment.Status.PAID; Store.CurrentOrder.AddPayment(payment); uiThread.Send(delegate (object state) { if (payment.CashBackAmount > 0) { //cloverConnector.OpenCashDrawer("Cash Back"); // not needed here, as the device will automatically open cash drawer with cash back MessageBox.Show(this, "Cash Back" + (payment.CashBackAmount / 100.0).ToString("C2"), "Cash Back"); } RegisterTabs.SelectedIndex = 0; PaymentReset(); NewOrder(); }, null); BackgroundWorker bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler( delegate (object o, DoWorkEventArgs args) { Thread.Sleep(3000);// wait for 3 seconds, then switch to the welcome screen unless the next order has items if(Store.CurrentOrder.Items.Count == 0) { cloverConnector.ShowWelcomeScreen(); } } ); bgWorker.RunWorkerAsync(); } else if (TransactionResponse.FAIL.Equals(response.Code)) { uiThread.Send(delegate (object state) { MessageBox.Show("Card authentication failed or was declined."); PaymentReset(); }, null); } else if (TransactionResponse.CANCEL.Equals(response.Code)) { uiThread.Send(delegate (object state) { MessageBox.Show("User canceled transaction."); PaymentReset(); }, null); } }
public void OnSaleResponse(SaleResponse response) { }
public void OnSaleResponse(SaleResponse response) { System.Console.WriteLine("BlockableSaleResponse: " + response.Result); //this.cloverConnector.Sales.Remove(this); this.cloverConnector = null; this.saleResponse = response; this.hasResponse = true; }
public void OnSaleResponse(SaleResponse response) { if (response.Success) { POSPayment payment = new POSPayment(response.Payment.id, response.Payment.order.id, response.Payment.employee.id, response.Payment.amount, response.Payment.tipAmount, response.Payment.cashbackAmount); if (response.IsAuth) //Tip Adjustable { Store.CurrentOrder.Status = POSOrder.OrderStatus.AUTHORIZED; payment.PaymentStatus = POSPayment.Status.AUTHORIZED; } else { Store.CurrentOrder.Status = POSOrder.OrderStatus.CLOSED; payment.PaymentStatus = POSPayment.Status.PAID; } Store.CurrentOrder.AddPayment(payment); uiThread.Send(delegate (object state) { if (payment.CashBackAmount > 0) { ShowCashBackForm(payment.CashBackAmount); } RegisterTabs.SelectedIndex = 0; NewOrder(); }, null); } else if (response.Result.Equals(ResponseCode.FAIL)) { uiThread.Send(delegate (object state) { AlertForm.Show(this, response.Reason, response.Message); PaymentReset(); }, null); } else if (response.Result.Equals(ResponseCode.CANCEL)) { uiThread.Send(delegate (object state) { AlertForm.Show(this, response.Reason, response.Message); PaymentReset(); }, null); } }
public void OnSaleResponse(SaleResponse response) { Send("/SaleResponse", Serialize(response)); }