public string Payment(Double dollarAmount, String cardNumber, String expirationDate, String cardHoldersName, Int32 orderID, Int32 orderVersionID, String securityCode, Int32 employeeID) { if (dollarAmount == 0) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'dollarAmount' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'dollarAmount' is missing as a parameter in the Payeezy Payment API url.")); } if (cardNumber == null) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'cardNumber' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'cardNumber' is missing as a parameter in the Payeezy Payment API url.")); } if (expirationDate == null) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'expirationDate' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'expirationDate' is missing as a parameter in the Payeezy Payment API url.")); } if (cardHoldersName == null) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'cardHoldersName' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'cardHoldersName' is missing as a parameter in the Payeezy Payment API url.")); } if (orderID == 0) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'orderID' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'orderID' is missing as a parameter in the Payeezy Payment API url.")); } if (orderVersionID == 0) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'orderVersionID' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'orderVersionID' is missing as a parameter in the Payeezy Payment API url.")); } if (securityCode == null) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'securityCode' is missing as a parameter in the Payeezy Payment API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'securityCode' is missing as a parameter in the Payeezy Payment API url.")); } if (employeeID == 0) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.payeezy, "'employeeID' is missing as a parameter in the Payeezy Recharge API url.", "EXCEPTION"); return(PeakeyTools.Api.ToJSON(false, true, "Error: 'employeeID' is missing as a parameter in the Payeezy Recharge API url.")); } API.Payeezy.Payment.TransactionData transactionData = new API.Payeezy.Payment.TransactionData(); transactionData.dollarAmount = dollarAmount; transactionData.cardNumber = cardNumber; transactionData.expirationDate = expirationDate; transactionData.cardHoldersName = cardHoldersName; transactionData.orderID = orderID; transactionData.orderVersionID = orderVersionID; transactionData.securityCode = securityCode; transactionData.employeeID = employeeID; return(StairSupplies.API.Payeezy.Payment.SubmitPaymentTransaction(transactionData)); }
public static Boolean Run(DataTable apiStatuses) { try { // Payeezy Payment test data API.Payeezy.Payment.TransactionData paymentTransactionData = new API.Payeezy.Payment.TransactionData(); paymentTransactionData.dollarAmount = 1.00; paymentTransactionData.cardNumber = "4111111111111111"; paymentTransactionData.expirationDate = "1218"; paymentTransactionData.cardHoldersName = "First Last"; paymentTransactionData.orderID = 127761; paymentTransactionData.orderVersionID = 96714; paymentTransactionData.securityCode = "123"; paymentTransactionData.employeeID = 1; // Payeezy Recharge test data API.Payeezy.Recharge.TransactionData rechargeTransactionData = new API.Payeezy.Recharge.TransactionData(); rechargeTransactionData.paymentTransactionPayeezyID = 1; rechargeTransactionData.dollarAmount = 1.00; rechargeTransactionData.orderID = 127761; rechargeTransactionData.orderVersionID = 96714; rechargeTransactionData.employeeID = 1; // Payeezy Refund test data API.Payeezy.Refund.TransactionData refundTransactionData = new API.Payeezy.Refund.TransactionData(); refundTransactionData.cardHoldersName = "First Last"; refundTransactionData.cardEndingDigits = "1111"; refundTransactionData.cardExpiration = "1218"; refundTransactionData.dollarAmount = 1.00; refundTransactionData.orderID = 127761; refundTransactionData.customerID = 62055; refundTransactionData.orderVersionID = 96714; refundTransactionData.employeeID = 1; if (!Payment.Run(apiStatuses, paymentTransactionData)) { return(false); } if (!Recharge.Run(apiStatuses, rechargeTransactionData)) { return(false); } if (!Refund.Run(apiStatuses, refundTransactionData)) { return(false); } return(true); } catch (Exception ex) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.quickbooks, "Could not run Payeezy integration tests.", ex, "TESTING"); throw new Exception("Could not run Payeezy integration tests.", ex); } }
public static Boolean Run(DataTable apiStatuses, API.Payeezy.Payment.TransactionData transactionData) { try { Boolean failure = false; failure = failure | !TestCaseSubmitPaymentTransaction(apiStatuses, transactionData); return(!failure); } catch (Exception ex) { PeakeyTools.Api.Log(PeakeyTools.Api.ApiName.quickbooks, "Could not run Payeezy integration tests for payment transaction.", ex, "TESTING"); throw new Exception("Could not run Payeezy integration tests for payment transaction.", ex); } }
private static Boolean TestCaseSubmitPaymentTransaction(DataTable apiStatuses, API.Payeezy.Payment.TransactionData transactionData) { var methodInfo = System.Reflection.MethodBase.GetCurrentMethod(); var fullMethodName = string.Format("{0}.{1}()", methodInfo.ReflectedType.FullName.Replace("+", "."), methodInfo.Name); try { dynamic response = JsonConvert.DeserializeObject(StairSupplies.API.Payeezy.Payment.SubmitPaymentTransaction(transactionData)); if (response.successful.Value == "false") { CreateDataRow(apiStatuses, fullMethodName, DateTime.Now, "failed", "Could not submit payment transaction to Payeezy. " + response.apiResponse.Value); return(false); } CreateDataRow(apiStatuses, fullMethodName, DateTime.Now, "success", ""); return(true); } catch (Exception ex) { CreateDataRow(apiStatuses, fullMethodName, DateTime.Now, "failed", ex.Message + "" + ex.StackTrace); return(false); } }