private void btnAction3_Click(object sender, EventArgs e) { if (btnAction3.Text == ButtonCaption.Cancel) { SpiClient.CancelTransaction(); } }
private void SpiActions() { if (SpiClient.CurrentFlow != SpiFlow.Pairing) { Invoke(new Action(() => this.Enabled = true)); return; } // checking for confirmation code if (SpiClient.CurrentPairingFlowState.AwaitingCheckFromPos) { var result = MessageBox.Show($@"Confirm Pairing Code : {SpiClient.CurrentPairingFlowState.ConfirmationCode}", @"Please confirm pairing", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SpiClient.PairingConfirmCode(); } else { SpiClient.PairingCancel(); } } // paired if (SpiClient.CurrentStatus == SpiStatus.PairedConnecting && SpiClient.CurrentFlow == SpiFlow.Idle) { Invoke(new Action(() => this.Enabled = true)); btnPair.Text = "Unpair"; } }
/// <summary> /// This will trigger auto address resolution /// </summary> private void btnSave_Click(object sender, EventArgs e) { if (!AreControlsValid(false)) { return; } SpiClient.SetTestMode(chkTestMode.Checked); SpiClient.SetAutoAddressResolution(AutoAddressEnabled); // trigger auto address SpiClient.SetSerialNumber(SerialNumber); // trigger auto address }
private void DoLastTx() { var coRes = SpiClient.InitiateGetLastTx(); if (coRes.Initiated) { listBoxFlow.Items.Add("# Last Transaction Initiated. Will be updated with Progress."); } else { Console.WriteLine($"# Could not initiate last transaction: {coRes.Message}. Please Retry."); } }
private void DoRefund() { int.TryParse(txtAction1.Text, out int amount); var refund = SpiClient.InitiateRefundTx("rfnd-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"), amount, cboxAction1.Checked, Options); if (refund.Initiated) { listBoxFlow.Items.Add("# Refund Initiated. Will be updated with Progress."); } else { listBoxFlow.Items.Add("# Could not initiate refund: " + refund.Message + ". Please Retry."); } }
private void btnPair_Click(object sender, EventArgs e) { if (!AreControlsValid(true)) { return; } SpiClient.SetPosId(PosId); SpiClient.SetSerialNumber(SerialNumber); SpiClient.SetEftposAddress(EftposAddress); SpiClient.Pair(); this.Enabled = false; }
private void DoCashout() { int.TryParse(txtAction1.Text, out int amount); int.TryParse(txtAction2.Text, out int surchargeAmount); var coRes = SpiClient.InitiateCashoutOnlyTx("cshout-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"), amount, surchargeAmount, Options); if (coRes.Initiated) { listBoxFlow.Items.Add("# Cashout Initiated. Will be updated with Progress."); } else { Console.WriteLine($"# Could not initiate cashout: {coRes.Message}. Please Retry."); } }
private void DoMoto() { int.TryParse(txtAction1.Text, out int amount); int.TryParse(txtAction2.Text, out int surchargeAmount); var motoRes = SpiClient.InitiateMotoPurchaseTx("moto-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"), amount, surchargeAmount, cboxAction1.Checked, Options); if (motoRes.Initiated) { listBoxFlow.Items.Add("# Moto Initiated. Will be updated with Progress."); } else { Console.WriteLine($"# Could not initiate moto: {motoRes.Message}. Please Retry."); } }
private void DoPurchase() { int.TryParse(txtAction1.Text, out int amount); int.TryParse(txtAction2.Text, out int tipAmount); int.TryParse(txtAction3.Text, out int cashoutAmount); int.TryParse(txtAction4.Text, out int surchargeAmount); var purchase = SpiClient.InitiatePurchaseTxV2("prchs-" + DateTime.Now.ToString("dd-MM-yyyy-HH-mm-ss"), amount, tipAmount, cashoutAmount, cboxAction1.Checked, Options, surchargeAmount); if (purchase.Initiated) { listBoxFlow.Items.Add("# Purchase Initiated. Will be updated with Progress."); } else { listBoxFlow.Items.Add("# Could not initiate purchase: " + purchase.Message + ". Please Retry."); } }
private void DoRecovery() { if (txtAction1.Text == "") { MessageBox.Show("Recovery", "Reference Id is missing", MessageBoxButtons.OK); return; } var coRes = SpiClient.InitiateRecovery(txtAction1.Text.Trim(), TransactionType.Purchase); if (coRes.Initiated) { listBoxFlow.Items.Add("# Recovery Initiated. Will be updated with Progress."); } else { Console.WriteLine($"# Could not initiate recovery: {coRes.Message}. Please Retry."); } }
private void btnSettle_Click(object sender, EventArgs e) { ActionsForm.btnAction1.Visible = false; ActionsForm.btnAction2.Visible = false; ActionsForm.btnAction3.Visible = false; ActionsForm.lblAction1.Visible = false; ActionsForm.txtAction1.Visible = false; ActionsForm.lblAction2.Visible = false; ActionsForm.txtAction2.Visible = false; ActionsForm.lblAction3.Visible = false; ActionsForm.txtAction3.Visible = false; ActionsForm.lblAction4.Visible = false; ActionsForm.txtAction4.Visible = false; ActionsForm.cboxAction1.Visible = false; TransactionForm.Enabled = false; var settleRes = SpiClient.InitiateSettleTx(RequestIdHelper.Id("settle"), Options); ActionsForm.listBoxFlow.Items.Add(settleRes.Initiated ? "# Settle Initiated. Will be updated with Progress." : "# Could not initiate settlement: " + settleRes.Message + ". Please Retry."); ActionsForm.Show(); }
private void btnAction2_Click(object sender, EventArgs e) { switch (btnAction2.Text) { case ButtonCaption.CancelPairing: SpiClient.PairingCancel(); break; case ButtonCaption.DeclineSignature: SpiClient.AcceptSignature(false); break; case ButtonCaption.Cancel: SpiClient.AckFlowEndedAndBackToIdle(); listBoxFlow.Items.Clear(); MainForm.SpiStatusAndActions(); TransactionForm.Enabled = true; Hide(); break; default: break; } }
private void btnTerminalSettings_Click(object sender, EventArgs e) { SpiClient.GetTerminalConfiguration(); }
private void btnTerminalStatus_Click(object sender, EventArgs e) { SpiClient.GetTerminalStatus(); }
private void btnAction1_Click(object sender, EventArgs e) { switch (btnAction1.Text) { case ButtonCaption.ConfirmCode: SpiClient.PairingConfirmCode(); break; case ButtonCaption.CancelPairing: btnAction1.Enabled = false; SpiClient.PairingCancel(); TransactionForm.lblStatus.BackColor = Color.Red; break; case ButtonCaption.Cancel: btnAction1.Enabled = false; SpiClient.CancelTransaction(); break; case ButtonCaption.OK: SpiClient.AckFlowEndedAndBackToIdle(); MainForm.SpiStatusAndActions(); MainForm.Enabled = true; TransactionForm.Enabled = true; Hide(); break; case ButtonCaption.OKUnpaired: SpiClient.AckFlowEndedAndBackToIdle(); MainForm.btnMain.Text = ButtonCaption.Pair; TransactionForm.lblStatus.BackColor = Color.Red; MainForm.grpSecrets.Enabled = true; MainForm.grpAutoAddressResolution.Enabled = true; MainForm.grpSettings.Enabled = true; MainForm.cboxSecrets.Checked = false; MainForm.Enabled = true; TransactionForm.Hide(); MainForm.Show(); Hide(); break; case ButtonCaption.AcceptSignature: SpiClient.AcceptSignature(true); break; case ButtonCaption.Retry: SpiClient.AckFlowEndedAndBackToIdle(); listBoxFlow.Items.Clear(); switch (SpiClient.CurrentTxFlowState.Type) { case TransactionType.Purchase: DoPurchase(); break; case TransactionType.Refund: DoRefund(); break; case TransactionType.MOTO: DoMoto(); break; case TransactionType.CashoutOnly: DoCashout(); break; default: lblFlowMessage.Text = "Retry by selecting from the options below"; MainForm.SpiStatusAndActions(); break; } break; case ButtonCaption.Purchase: DoPurchase(); break; case ButtonCaption.Refund: DoRefund(); break; case ButtonCaption.MOTO: DoMoto(); break; case ButtonCaption.CashOut: DoCashout(); break; case ButtonCaption.Recovery: DoRecovery(); break; case ButtonCaption.LastTx: DoLastTx(); break; case ButtonCaption.Set: DoHeaderFooter(); break; case ButtonCaption.Print: SpiClient.PrintReport(txtAction1.Text.Trim(), SanitizePrintText(txtAction2.Text)); break; default: break; } }