public void PaymentMethodDataInitsWithNoArgs() { var paymentMethodData = new PaymentMethodData(); Assert.NotNull(paymentMethodData); Assert.IsType <PaymentMethodData>(paymentMethodData); }
private PaymentMethod GetPaymentMethod() { using (PurchasingContext Context = ContextHelper.GetDBContext()) { PaymentMethodData PayData = Context.PaymentCreditCardDatas.Where(c => c.credit_card_id == CreditCardID).FirstOrDefault().PaymentMethodDatas.FirstOrDefault(); return(new PaymentMethod(PayData)); } }
protected void Page_Load(object sender, EventArgs e) { //if (WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession) != null || Request["transactionId"] != null) { if (Request["transactionId"] != null) { WAFContext.Session.SetSetting("payment-transaction-id", Request["transactionId"].ToString(), PersistenceScope.UserSession); } PaymentMethodData pmd = new PaymentMethodData(); if (WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession) != null) { pmd.TransactionId = WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession).ToString(); } foreach (string key in Request.QueryString.Keys) { pmd.PaymentData.Add(key.ToLower(), Request.QueryString[key].ToLower()); } if (!string.IsNullOrWhiteSpace(pmd["orderref"])) { pmd.TransactionId = pmd["orderref"]; } IProcessPaymentResultHandler paymentResultHandler = new WebshopProcessPaymentResultHandler(); Order order = null; WebFormSubmit formSubmit = null; if (!string.IsNullOrEmpty(pmd.TransactionId)) { List<Order> orders = WAFContext.Session.Query<Order>().Where(AqlOrder.PaymentTransactionId == pmd.TransactionId).Execute(1); if (orders.Count > 0) { order = orders[0]; PaymentMethod pm = order.PaymentMethod.Get(); pmd.SetPropertiesFromOrder(order); } else { List<WebFormSubmit> formSubmits = WAFContext.Session.Query<WebFormSubmit>().Where(AqlWebFormSubmit.PaymentTransactionID == pmd.TransactionId).Execute(1); formSubmit = formSubmits[0]; paymentResultHandler = new WebFormProcessPaymentResultHandler(); pmd.SetPropertiesFromForm(formSubmit); } } if (paymentResultHandler != null) { PaymentMethod pm = WAFContext.Session.GetContent<PaymentMethod>(pmd.PaymentMethodNodeId); //all payment methods that return to this page is a credit card payment method: CreditCardPaymentMethod ccpm = (CreditCardPaymentMethod)pm; IWAFPaymentMethodProvider provider = ccpm.GetPaymentProvider(); //completeSale or Authorize; if (pm.TypeOfPayment == TypeOfPayment.OnePhase) { //sale PaymentActionResult result = provider.CompleteSale(pmd); paymentResultHandler.HandlePaymentReturnCallbackResult(result, pmd, PaymentTransactionType.Sale); } else { //authorize PaymentActionResult result = provider.AuthorizePayment(pmd); paymentResultHandler.HandlePaymentReturnCallbackResult(result, pmd, PaymentTransactionType.Authorize); } } else { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", Local.Text("Web.WAF.View.PaymentReturnPagePaymentTransactionId"), pmd.TransactionId, Local.Text("Web.WAF.View.PaymentReturnPagePaymentNoOrderFound")); //TODO_VIDAR: Redirect to a payment failure page. } }
public IHttpActionResult AddPaymentMethod(PaymentMethodData payment_method_data) { if (payment_method_data.payment_method_data_id > 0) { return(Ok("This payment method has already been added.")); } else { if (payment_method_data.cash_amount > 0) { return(Ok("Cannot add additional cash payment method.")); } } var ua = UserAccess.GetUserAccess(User.Identity.Name); if (!TransactionData.ValidateEdit(payment_method_data.transaction_id, ua)) { return(Unauthorized()); } payment_method_data.SetUserName(ua.user_name); if (ua.current_access == UserAccess.access_type.no_access) { return(Unauthorized()); } if (!TransactionData.ValidateEdit(payment_method_data.transaction_id, ua)) { return(Unauthorized()); } if (!payment_method_data.ValidateNew()) { if (payment_method_data.error_text.Length == 0) { payment_method_data.error_text = "There was an issue with validating the payment method."; } } else { payment_method_data.added_after_save = true; if (!payment_method_data.SavePaymentMethod()) { if (payment_method_data.error_text.Length == 0) { payment_method_data.error_text = "There was an issue saving the new payment method."; } } } return(Ok()); }
public PaymentMethodData GetPaymentMethodData() { PaymentMethodData data = new PaymentMethodData(); data["CreditCardNumber"] = txtCreditCardNumber.Text; data["CreditCardNameOnCard"] = txtNameOnCard.Text; data["CreditCardVerificationNumber"] = txtCreditCardVerificationNumber.Text; data["CreditCardType"] = ddlCreditCardType.SelectedValue; data["CreditCardExpirationMonth"] = ddlExpirationMonth.SelectedValue; data["CreditCardExpirationYear"] = ddlExpirationYear.SelectedValue; return data; }
public static IPaymentMethod Create(PaymentMethodData data) { switch (data) { case DebitCardData debit: return(create(debit)); case CreditCardData credit: return(create(credit)); case CheckData check: return(create(check)); default: return(new Cash()); } }
private static void copyDbRecords(PaymentMethodData to, PaymentMethodData from) { to.Address = from.Address; to.Code = from.Code; to.CurrencyID = from.CurrencyID; to.DailyLimit = from.DailyLimit; to.Issue = from.Issue; to.Name = from.Name; to.Number = from.Number; to.Organization = from.Organization; to.ValidFrom = from.ValidFrom; to.ValidTo = from.ValidTo; }
public void PaymentMethodDataInits() { var supportedMethods = new List <string> { "debit", "credit" }; var data = new { }; var paymentMethodData = new PaymentMethodData(supportedMethods, data); Assert.NotNull(paymentMethodData); Assert.IsType <PaymentMethodData>(paymentMethodData); Assert.Equal(supportedMethods, paymentMethodData.SupportedMethods); Assert.Equal(data, paymentMethodData.Data); }
public static void InsertIntoPayments(BillsPaymentSystemContext context) { var payments = new PaymentMethodData().GetPayments(); for (int i = 0; i < payments.Length; i++) { if (StartUp.IsValid(payments[i]) == true) { context.Add(payments[i]); } } context.SaveChanges(); }
public PaymentMethodData getPaymentMethod(string method_code) { PaymentMethodData paymentmethod_data = new PaymentMethodData(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From PAYMENT_METHOD Where METHOD_CODE='" + method_code + "'"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { paymentmethod_data.Method_Code = rowData["METHOD_CODE"].ToString(); paymentmethod_data.Method_Thainame = rowData["METHOD_THAINAME"].ToString(); paymentmethod_data.Method_Engname = rowData["METHOD_ENGNAME"].ToString(); } return(paymentmethod_data); }
public List <PaymentMethodData> getPaymentMethod() { List <PaymentMethodData> paymentmethodData = new List <PaymentMethodData>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); oracleObj.SelectCommand = "Select * From PAYMENT_METHOD Order By METHOD_CODE"; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { PaymentMethodData paymentmethod_data = new PaymentMethodData(); paymentmethod_data.Method_Code = rowData["METHOD_CODE"].ToString(); paymentmethod_data.Method_Thainame = rowData["METHOD_THAINAME"].ToString(); paymentmethod_data.Method_Engname = rowData["METHOD_ENGNAME"].ToString(); paymentmethodData.Add(paymentmethod_data); } return(paymentmethodData); }
public DataSet GetAllPaymentMethodDataSet() { PaymentMethodData data = new PaymentMethodData(); DataSet ds = new DataSet(); try { ds = data.GetAllPaymentMethodDataSet(); } catch (Exception ex) { log.Write(ex.Message, "GetAllPaymentMethodDataSet"); throw (ex); } finally { data = null; } return(ds); }
public PaymentMethodCollection GetAllPaymentMethodCollection() { PaymentMethodData data = new PaymentMethodData(); PaymentMethodCollection col = new PaymentMethodCollection(); try { col = data.GetAllPaymentMethodsCollection(); } catch (Exception ex) { log.Write(ex.Message, "GetAllPaymentMethodCollection"); throw (ex); } finally { data = null; } return(col); }
public DataSet GetPaymentsMethodDataSet(string whereExpression, string orderByExpression) { PaymentMethodData data = new PaymentMethodData(); DataSet ds = new DataSet(); try { ds = data.GetPaymentMethodDynamicDataSet(whereExpression, orderByExpression); } catch (Exception ex) { log.Write(ex.Message, "GetPaymentsMethodDataSet"); throw (ex); } finally { data = null; } return(ds); }
public PaymentMethodCollection GetPaymentsCollection(string whereExpression, string orderByExpression) { PaymentMethodData data = new PaymentMethodData(); PaymentMethodCollection col = new PaymentMethodCollection(); try { col = data.GetAllPaymentMethodsDynamicCollection(whereExpression, orderByExpression); } catch (Exception ex) { log.Write(ex.Message, "GetPaymentsCollection"); throw (ex); } finally { data = null; } return(col); }
public int AddPaymentMethod(PaymentMethod paymentmethod) { PaymentMethodData data = new PaymentMethodData(); int paymentMethodID = 0; try { paymentMethodID = data.AddPaymentMethod(paymentmethod); } catch (Exception ex) { log.Write(ex.Message, "AddPaymentMethod"); throw (ex); } finally { data = null; } return(paymentMethodID); }
public PaymentMethod GetPaymentMethods(int paymentMethodID) { PaymentMethodData data = new PaymentMethodData(); PaymentMethod paymentMethod = new PaymentMethod(); try { paymentMethod = data.GetPaymentMethod(paymentMethodID); } catch (Exception ex) { log.Write(ex.Message, "GetPaymentMethods"); throw (ex); } finally { data = null; } return(paymentMethod); }
public bool UpdatePaymentMethod(PaymentMethod paymentmethod) { PaymentMethodData data = new PaymentMethodData(); bool ret = false; try { data.UpdatePaymentMethod(paymentmethod); ret = true; } catch (Exception ex) { log.Write(ex.Message, "UpdatePaymentMethod"); throw (ex); } finally { data = null; } return(ret); }
public IHttpActionResult EditPaymentMethod(PaymentMethodData payment_method_data) { if (payment_method_data.payment_method_data_id == -1) { return(BadRequest()); } var ua = UserAccess.GetUserAccess(User.Identity.Name); if (!TransactionData.ValidateEdit(payment_method_data.transaction_id, ua)) { return(Unauthorized()); } //var user_ip_address = ((HttpContextWrapper)Request.Properties["MS_HttpContext"]).Request.UserHostAddress; payment_method_data.SetUserName(ua.user_name); if (ua.current_access == UserAccess.access_type.no_access) { return(Unauthorized()); } if (!payment_method_data.ValidateChange()) { if (payment_method_data.error_text.Length == 0) { return(Ok("There was an issue with validating the payment method.")); } } else { payment_method_data.added_after_save = false; if (!payment_method_data.SavePaymentMethod()) { if (payment_method_data.error_text.Length == 0) { return(Ok("There was an issue editing the payment method.")); } } } return(Ok()); }
public IHttpActionResult GetPaymentMethodHistory(long payment_method_data_id = -1, long transaction_id = -1) { var ua = UserAccess.GetUserAccess(User.Identity.Name); if (ua.current_access == UserAccess.access_type.no_access) { return(Unauthorized()); } if (payment_method_data_id == -1 || transaction_id == -1) { return(BadRequest()); } var pm = PaymentMethodData.GetPaymentMethodHistory(payment_method_data_id, transaction_id); if (pm == null) { return(InternalServerError()); } return(Ok(pm)); }
public PaymentMethodData GetPaymentData() { PaymentMethodData paymentMethodData = new PaymentMethodData(); foreach(RepeaterItem item in repPaymentMethods.Items) { if(item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { ConwayControls.Web.RadioButton rb = item.FindControl("radioPaymentMethod") as ConwayControls.Web.RadioButton; if(rb.Checked) { PlaceHolder placeHolder = item.FindControl("placeHolderPaymentMethodForm") as PlaceHolder; foreach(Control c in placeHolder.Controls) { if(c is IPaymentMethodControl) { IPaymentMethodControl pmc = (IPaymentMethodControl)c; paymentMethodData = pmc.GetPaymentMethodData(); break; } } int id = Utils.GetIntegerOnly(rb.Value); if(id > 0) { paymentMethodData.PaymentMethodNodeId = id; } } } } return paymentMethodData; }
private void Load(PaymentMethodData data) { Init(); if (data != null) { mPaymentMethodID = data.payment_method_id; mName = data.name; mDescription = data.description; if (data.credit_card_id == null) { mCreditCardID = 0; } else { mCreditCardID = (int)data.credit_card_id; } mCreatedByUserID = data.created_by; mModifiedByUserID = data.modified_by; mDateCreated = data.date_created; if (data.date_modified != null) { mDateModified = (DateTime)data.date_modified; } mActive = data.active; mOrganizationID = data.organization_id; if (mCreditCardID > 0) { mCreditCard = new CreditCard(data.PaymentCreditCardData); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["transact"] != null) { string transactionId = Request["transact"].ToString(); WAFContext.Session.SetSetting("payment-transaction-id", transactionId, PersistenceScope.UserSession); Order order = this.GetOrder(Request["http_cookie"].ToString()); if (order == null) { WAFLog.Insert("Webshop", "PaymentCallbackPage.aspx", Local.Text("Web.WAF.View.PaymentCallBackPageOrderNull"), Local.Text("Web.WAF.View.PaymentCallBackPagePaymentTransactionId"), transactionId); } else { order.PaymentTransactionId = transactionId; order.UpdateChanges(); int orderId = Utils.GetIntegerOnly(Request["orderid"].ToString()); //payment received successfully for this order CreditCardPaymentMethod ccPaymentMethod = (CreditCardPaymentMethod)order.PaymentMethod.Get(); IWAFPaymentMethodProvider provider = ccPaymentMethod.GetPaymentProvider(); PaymentMethodData pmd = new PaymentMethodData(); pmd.TransactionId = WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession).ToString(); pmd.SetPropertiesFromOrder(order); foreach (string key in Request.QueryString.Keys) { pmd.PaymentData.Add(key.ToLower(), Request.QueryString[key].ToLower()); } //added to stop redirect to OrderReceived page: pmd.PaymentData.Add("callback", "true"); //check to see if the order reference matches with the order id supplied: if (order.NodeId == orderId) { if (order.PaymentStatus != PaymentStatus.Reserved || order.PaymentStatus != PaymentStatus.Completed) { //payment status hasn't been changed. if (ccPaymentMethod.TypeOfPayment == TypeOfPayment.OnePhase) { PaymentActionResult result = provider.CompleteSale(pmd); if (result.Success) { WAFLog.Insert("Webshop", "PaymentCallbackPage.aspx", Local.Text("Web.WAF.View.PaymentCallBackPageOrderId"), orderId.ToString(), Local.Text("Web.WAF.View.PaymentCallBackPagePaymentTransactionId"), transactionId, "CompleteSale", Local.Text("Web.WAF.View.PaymentCallBackPageSuccess")); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Sale, "PaymentCallbackPage.aspx"); Shop shop = order.Shop.Get(); if (result.DeleteOrderCookies) { WAFShopHelper.DeleteOrderCookies(HttpContext.Current.Request, HttpContext.Current.Response); } Response.Redirect(WAFContext.GetUrl(shop.OrderReceivedPage.GetId(), "orderref=" + order.OrderReference)); } else { WAFLog.Insert("Webshop", "PaymentCallbackPage.aspx", Local.Text("Web.WAF.View.PaymentCallBackPageOrderId"), orderId.ToString(), Local.Text("Web.WAF.View.PaymentCallBackPagePaymentTransactionId"), transactionId, "CompleteSale", Local.Text("Web.WAF.View.PaymentCallBackPageFailed")); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Sale, "PaymentCallbackPage.aspx"); Response.Redirect(ccPaymentMethod.CancelUrl); } } else { PaymentActionResult result = provider.AuthorizePayment(pmd); if (result.Success) { WAFLog.Insert("Webshop", "PaymentCallbackPage.aspx", Local.Text("Web.WAF.View.PaymentCallBackPageOrderId"), orderId.ToString(), Local.Text("Web.WAF.View.PaymentCallBackPagePaymentTransactionId"), transactionId, "AuthorizePayment", Local.Text("Web.WAF.View.PaymentCallBackPageSuccess")); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Authorize, "PaymentCallbackPage.aspx"); Shop shop = order.Shop.Get(); if (result.DeleteOrderCookies) { WAFShopHelper.DeleteOrderCookies(HttpContext.Current.Request, HttpContext.Current.Response); } Response.Redirect(WAFContext.GetUrl(shop.OrderReceivedPage.GetId(), "orderref=" + order.OrderReference)); } else { WAFLog.Insert("Webshop", "PaymentCallbackPage.aspx", Local.Text("Web.WAF.View.PaymentCallBackPageOrderId"), orderId.ToString(), Local.Text("Web.WAF.View.PaymentCallBackPagePaymentTransactionId"), transactionId, "AuthorizePayment", Local.Text("Web.WAF.View.PaymentCallBackPageFailed")); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Authorize, "PaymentCallbackPage.aspx"); Response.Redirect(ccPaymentMethod.CancelUrl); } } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession) != null || Request["transactionId"] != null) { if (Request["transactionId"] != null) { WAFContext.Session.SetSetting("payment-transaction-id", Request["transactionId"].ToString(), PersistenceScope.UserSession); } PaymentMethodData pmd = new PaymentMethodData(); pmd.TransactionId = WAFContext.Session.GetSetting("payment-transaction-id", PersistenceScope.UserSession).ToString(); WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Payment Transaction Id", pmd.TransactionId); foreach (string key in Request.QueryString.Keys) { pmd.PaymentData.Add(key.ToLower(), Request.QueryString[key].ToLower()); } List<Order> orders = WAFContext.Session.Query<Order>().Where(AqlOrder.PaymentTransactionId == pmd.TransactionId).Execute(1); if (orders.Count > 0) { Order order = orders[0]; PaymentMethod pm = order.PaymentMethod.Get(); pmd.SetPropertiesFromOrder(order); //all payment methods that return to this page is a credit card payment method: CreditCardPaymentMethod ccpm = (CreditCardPaymentMethod)pm; IWAFPaymentMethodProvider provider = ccpm.GetPaymentProvider(); //completeSale or Authorize; if (pm.TypeOfPayment == TypeOfPayment.OnePhase) { //sale PaymentActionResult result = provider.CompleteSale(pmd); if (result.Success) { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Order:", order.NodeId.ToString() , "Payment Transaction Id:", pmd.TransactionId, "CompleteSale", "Success"); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Sale, "PaymentReturnPage.aspx"); Shop shop = order.Shop.Get(); if (result.DeleteOrderCookies) { WAFShopHelper.DeleteOrderCookies(HttpContext.Current.Request, HttpContext.Current.Response); } Response.Redirect(WAFContext.GetUrl(shop.OrderReceivedPage.GetId(), "orderref=" + order.OrderReference)); } else { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Order:", order.NodeId.ToString(), "Payment Transaction Id:", pmd.TransactionId, "CompleteSale", "Failed", result.Message); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Sale, "PaymentReturnPage.aspx"); Response.Redirect(ccpm.CancelUrl); } } else { //authorize PaymentActionResult result = provider.AuthorizePayment(pmd); if (result.Success) { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Order:", order.NodeId.ToString(), "Payment Transaction Id", pmd.TransactionId, "AuthorizePayment", "Success"); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Authorize, "PaymentReturnPage.aspx"); Shop shop = order.Shop.Get(); if (result.DeleteOrderCookies) { WAFShopHelper.DeleteOrderCookies(HttpContext.Current.Request, HttpContext.Current.Response); } Response.Redirect(WAFContext.GetUrl(shop.OrderReceivedPage.GetId(), "orderref=" + order.OrderReference)); } else { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Order:", order.NodeId.ToString(), "Payment Transaction Id", pmd.TransactionId, "AuthorizePayment", "Failed", result.Message); order.SaveStatusAfterPaymentAction(result, PaymentTransactionType.Authorize, "PaymentReturnPage.aspx"); Response.Redirect(ccpm.CancelUrl); } } } else { WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "Payment Transaction Id", pmd.TransactionId, "No order found for transaction id"); //TODO_VIDAR: Redirect to a payment failure page. } } else { string referrer = ""; if(HttpContext.Current.Request.UrlReferrer != null){ referrer = HttpContext.Current.Request.UrlReferrer.ToString(); } WAFLog.Insert("Webshop", "PaymentReturnPage.aspx", "No Payment Transaction Id found!", referrer); } }
public PaymentMethod(PaymentMethodData data) { Load(data); }
public void Save(string uid) { try { Dictionary <string, string> ValErrors = Validate(); if (ValErrors.Count > 0) { throw new RequisitionNotValidException("Payment Method is not valid.", ValErrors); } HistoryType UpdateType; PaymentMethod Original = null; using (PurchasingContext Context = ContextHelper.GetDBContext()) { PaymentMethodData Data = new PaymentMethodData(); if (PaymentMethodID == 0) { UpdateType = HistoryType.ADD; Data = new PaymentMethodData(); Data.date_created = DateTime.Now; Data.created_by = uid; Data.organization_id = 1; } else { Data = Context.PaymentMethodDatas.Where(x => x.payment_method_id == PaymentMethodID).FirstOrDefault(); Original = new PaymentMethod(Data); UpdateType = HistoryType.UPDATE; } Data.name = Name; if (String.IsNullOrEmpty(Description)) { Data.description = null; } else { Data.description = Description; } Data.date_modified = DateTime.Now; Data.modified_by = uid; Data.active = Active; if (CreditCard != null) { if (Data.PaymentCreditCardData == null) { Data.PaymentCreditCardData = new PaymentCreditCardData(); Data.PaymentCreditCardData.created_by = uid; Data.PaymentCreditCardData.date_created = DateTime.Now; } Data.PaymentCreditCardData.card_last_four = CreditCard.CardLastFour; Data.PaymentCreditCardData.card_expiration_date = CreditCard.CardExpirationDate; Data.PaymentCreditCardData.card_holder_id = CreditCard.CardHolderID; Data.PaymentCreditCardData.modified_by = uid; Data.PaymentCreditCardData.date_modified = DateTime.Now; } else { if (Data.PaymentCreditCardData != null) { PaymentCreditCardData CC = Data.PaymentCreditCardData; CC.active = false; CC.date_modified = DateTime.Now; CC.modified_by = uid; Data.PaymentCreditCardData = null; } } if (PaymentMethodID == 0) { Context.PaymentMethodDatas.InsertOnSubmit(Data); } Context.SubmitChanges(); Load(Data); SaveHistory(UpdateType, Original, uid); } } catch (Exception ex) { throw new PaymentMethodException("An error has occurred while saving Payment Method", ex); } }