当前位置: 首页>>代码示例>>C#>>正文


C# VoidPaymentResult.AddError方法代码示例

本文整理汇总了C#中Nop.Services.Payments.VoidPaymentResult.AddError方法的典型用法代码示例。如果您正苦于以下问题:C# VoidPaymentResult.AddError方法的具体用法?C# VoidPaymentResult.AddError怎么用?C# VoidPaymentResult.AddError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nop.Services.Payments.VoidPaymentResult的用法示例。


在下文中一共展示了VoidPaymentResult.AddError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Void

 /// <summary>
 /// Voids a payment
 /// </summary>
 /// <param name="voidPaymentRequest">Request</param>
 /// <returns>Result</returns>
 public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
 {
     var result = new VoidPaymentResult();
     result.AddError("Void method not supported");
     return result;
 }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:11,代码来源:CheckMoneyOrderPaymentProcessor.cs

示例2: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            string transactionId = voidPaymentRequest.Order.AuthorizationTransactionId;
            if (String.IsNullOrEmpty(transactionId))
                transactionId = voidPaymentRequest.Order.CaptureTransactionId;

            var req = new DoVoidReq();
            req.DoVoidRequest = new DoVoidRequestType();
            req.DoVoidRequest.Version = GetApiVersion();
            req.DoVoidRequest.AuthorizationID = transactionId;


            using (var service2 = new PayPalAPIAASoapBinding())
            {
                if (!_paypalDirectPaymentSettings.UseSandbox)
                    service2.Url = "https://api-3t.paypal.com/2.0/";
                else
                    service2.Url = "https://api-3t.sandbox.paypal.com/2.0/";

                service2.RequesterCredentials = new CustomSecurityHeaderType();
                service2.RequesterCredentials.Credentials = new UserIdPasswordType();
                service2.RequesterCredentials.Credentials.Username = _paypalDirectPaymentSettings.ApiAccountName;
                service2.RequesterCredentials.Credentials.Password = _paypalDirectPaymentSettings.ApiAccountPassword;
                service2.RequesterCredentials.Credentials.Signature = _paypalDirectPaymentSettings.Signature;
                service2.RequesterCredentials.Credentials.Subject = "";

                DoVoidResponseType response = service2.DoVoid(req);

                string error = "";
                bool success = PaypalHelper.CheckSuccess(response, out error);
                if (success)
                {
                    result.NewPaymentStatus = PaymentStatus.Voided;
                    //result.VoidTransactionID = response.RefundTransactionID;
                }
                else
                {
                    result.AddError(error);
                }
            }
            return result;
        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:49,代码来源:PayPalDirectPaymentProcessor.cs

示例3: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            string transactionId = voidPaymentRequest.Order.AuthorizationTransactionId;
            if (String.IsNullOrEmpty(transactionId))
                transactionId = voidPaymentRequest.Order.CaptureTransactionId;

            var req = new DoVoidReq();
            req.DoVoidRequest = new DoVoidRequestType();
            req.DoVoidRequest.Version = GetApiVersion();
            req.DoVoidRequest.AuthorizationID = transactionId;

            var service = GetService();
            DoVoidResponseType response = service.DoVoid(req);

            string error;
            bool success = PaypalHelper.CheckSuccess(response, out error);
            if (success)
            {
                result.NewPaymentStatus = PaymentStatus.Voided;
                //result.VoidTransactionID = response.RefundTransactionID;
            }
            else
            {
                result.AddError(error);
            }
            return result;
        }
开发者ID:NALSS,项目名称:grandnode,代码行数:34,代码来源:PayPalDirectPaymentProcessor.cs

示例4: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            var config = new HpsServicesConfig();
            config.SecretApiKey = _secureSubmitPaymentSettings.SecretApiKey;
            config.DeveloperId = "002914";
            config.VersionNumber = "1513";

            var creditService = new HpsCreditService(config);

            try
            {
                if (string.IsNullOrEmpty(voidPaymentRequest.Order.CaptureTransactionId))
                {
                    creditService.Void(Convert.ToInt32(voidPaymentRequest.Order.AuthorizationTransactionId));
                }
                else
                {
                    creditService.Void(Convert.ToInt32(voidPaymentRequest.Order.CaptureTransactionId));
                }

                result.NewPaymentStatus = PaymentStatus.Voided;
            }
            catch (HpsException ex)
            {
                result.AddError(ex.Message);
            }

            return result;
        }
开发者ID:JacobSteelsmith,项目名称:heartland-nopcommerce-plugin,代码行数:36,代码来源:SecureSubmitPaymentProcessor.cs

示例5: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            var webClient = new WebClient();
            var form = new NameValueCollection();
            form.Add("x_login", _authorizeNetPaymentSettings.LoginId);
            form.Add("x_tran_key", _authorizeNetPaymentSettings.TransactionKey);

            form.Add("x_delim_data", "TRUE");
            form.Add("x_delim_char", "|");
            form.Add("x_encap_char", "");
            form.Add("x_version", GetApiVersion());
            form.Add("x_relay_response", "FALSE");

            form.Add("x_method", "CC");
            form.Add("x_currency_code", _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode);

            string[] codes = voidPaymentRequest.Order.CaptureTransactionId == null ?
                voidPaymentRequest.Order.AuthorizationTransactionCode.Split(',') : voidPaymentRequest.Order.CaptureTransactionId.Split(',');
            //x_trans_id. When x_test_request (sandbox) is set to a positive response,
            //or when Test mode is enabled on the payment gateway, this value will be "0".
            form.Add("x_trans_id", codes[0]);

            string maskedCreditCardNumberDecrypted = _encryptionService.DecryptText(voidPaymentRequest.Order.MaskedCreditCardNumber);
            if (String.IsNullOrEmpty(maskedCreditCardNumberDecrypted) || maskedCreditCardNumberDecrypted.Length < 4)
            {
                result.AddError("Last four digits of Credit Card Not Available");
                return result;
            }
            var lastFourDigitsCardNumber = maskedCreditCardNumberDecrypted.Substring(maskedCreditCardNumberDecrypted.Length - 4);
            form.Add("x_card_num", lastFourDigitsCardNumber); // only last four digits are required for doing a credit
            form.Add("x_type", "VOID");

            // Send Request to Authorize and Get Response
            var responseData = webClient.UploadValues(GetAuthorizeNetUrl(), form);
            var reply = Encoding.ASCII.GetString(responseData);

            if (!String.IsNullOrEmpty(reply))
            {
                string[] responseFields = reply.Split('|');
                switch (responseFields[0])
                {
                    case "1":
                        result.NewPaymentStatus = PaymentStatus.Voided;
                        break;
                    case "2":
                        result.AddError(string.Format("Declined ({0}: {1})", responseFields[2], responseFields[3]));
                        break;
                    case "3":
                        result.AddError(string.Format("Error: {0}", reply));
                        break;
                }
            }
            else
            {
                result.AddError("Authorize.NET unknown error");
            }

            return result;
        }
开发者ID:Rustemt,项目名称:Nopcommerce-with-Couchbase,代码行数:66,代码来源:AuthorizeNetPaymentProcessor.cs

示例6: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            // Check license
            bool isLicensed = this._licenseService.IsLicensed(HttpContext.Current.Request.Url.Host);
            if (!isLicensed && voidPaymentRequest.Order.OrderTotal > 5.00M)
            {
                result.AddError("The trial license can be used to submit order of $5.00 or less. Please purchase a full license at our website.");
                return result;
            }

            string transactionId = voidPaymentRequest.Order.AuthorizationTransactionId;
            if (String.IsNullOrEmpty(transactionId))
                transactionId = voidPaymentRequest.Order.CaptureTransactionId;

            // Create the Payflow Data Objects.
            // Create the User data object with the required user details.
            UserInfo payflowUser = _payPalHelper.GetUserInfo();

            // Create the Payflow Connection data object with the required connection details.                        
            PayflowConnectionData payflowConn = new PayflowConnectionData(_payPalHelper.GetPayflowProHost());

            // Create a new Void Transaction.
            // The ORIGID is the PNREF no. for a previous transaction.
            VoidTransaction trans = new VoidTransaction(transactionId, payflowUser, payflowConn, PayflowUtility.RequestId);

            // Submit the Transaction
            Response resp = trans.SubmitTransaction();

            // Process the Payflow response.
            if (resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse trxResp = resp.TransactionResponse;
                if (trxResp != null)
                {
                    if (trxResp.Result == 0)
                    {
                        result.NewPaymentStatus = PaymentStatus.Voided;
                    }
                    else
                    {
                        result.AddError(string.Format("Void RESULT: {0}-{1}", trxResp.Result, trxResp.RespMsg));
                    }
                }
            }

            return result;
        }
开发者ID:CloudberrySoftware,项目名称:PayPalAdvanced-Payments-Plugin,代码行数:55,代码来源:PayPalAdvancedPaymentProcessor.cs

示例7: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            var voidResult = _sagePayServerWorkflowService.VoidTransaction(voidPaymentRequest.Order.OrderGuid.ToString());

            if (!voidResult.Success)
            {
                result.AddError(voidResult.Message);
            }
            else
            {
                result.NewPaymentStatus = PaymentStatus.Voided;
            }

            return result;
        }
开发者ID:seanrockster,项目名称:NopCommerce-Sagepay,代码行数:22,代码来源:SagePayServerPaymentPlugin.cs

示例8: Void

        /// <summary>
        /// Voids a payment
        /// </summary>
        /// <param name="voidPaymentRequest">Request</param>
        /// <returns>Result</returns>
        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var result = new VoidPaymentResult();

            var orderGuid = voidPaymentRequest.Order.OrderGuid;

            if (orderGuid == Guid.NewGuid())
            {
                result.AddError("Order Unique identifier code does not exist!");
                return result;
            }

            var transx = _sagePayServerTransactionService.GetSagePayServerTransactionByVendorTxCode(orderGuid.ToString());

            if (transx == null)
            {
                result.AddError(String.Format("SagePay Server vendor transaction code {0} does not exist.", orderGuid.ToString()));
                return result;
            }

            var webClient = new WebClient();

            var data = new NVPCodec();

            data.Add("VPSProtocol", SagePayHelper.GetProtocol());
            data.Add("TxType", "VOID");
            data.Add("Vendor", _sagePayServerPaymentSettings.VendorName);

            var voidGuid = Guid.NewGuid();
            data.Add("VendorTxCode", voidGuid.ToString());

            data.Add("VPSTxId", transx.VPSTxId);
            data.Add("SecurityKey", transx.SecurityKey);
            data.Add("TxAuthNo", transx.TxAuthNo);

            var postURL = SagePayHelper.GetSageSystemUrl(_sagePayServerPaymentSettings.ConnectTo, "void");

            string strResponse = string.Empty;

            try
            {

                Byte[] responseData = webClient.UploadValues(postURL, data);

                strResponse = Encoding.ASCII.GetString(responseData);


            }
            catch (WebException ex)
            {

                result.AddError(String.Format(
                    @"Your server was unable to release this transaction with Sage Pay.
                    Check that you do not have a firewall restricting the POST and 
                    that your server can correctly resolve the address {0}. <br/>
                    The Status Number is: {1}<br/>
                    The Description given is: {2}", postURL, ex.Status, ex.Message));
                return result;
            }

            if (string.IsNullOrWhiteSpace(strResponse))
            {
                result.AddError(String.Format(
                    @"Your server was unable to register this transaction with Sage Pay.
                    Check that you do not have a firewall restricting the POST and 
                    that your server can correctly resolve the address {0}.", postURL));
                return result;
            }
            var strStatus = SagePayHelper.FindField("Status", strResponse);
            var strStatusDetail = SagePayHelper.FindField("StatusDetail", strResponse);

            switch (strStatus)
            {
                case "OK":

                    result.NewPaymentStatus = PaymentStatus.Voided;

                    break;

                case "MALFORMED":
                    result.AddError(string.Format("Error ({0}: {1}) <br/> {2}", strStatus, strStatusDetail, data.Encode()));
                    return result;

                case "INVALID":
                    result.AddError(string.Format("Error ({0}: {1}) <br/> {2}", strStatus, strStatusDetail, data.Encode()));
                    return result;

                default:
                    result.AddError(string.Format("Error ({0}: {1})", strStatus, strStatusDetail));
                    return result;

            }

            return result;
        }
开发者ID:philipengland,项目名称:albionextrusions.co.uk,代码行数:100,代码来源:SagePayServerPaymentProcessor.cs

示例9: Void

        public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest)
        {
            var order = voidPaymentRequest.Order;
            var result = new VoidPaymentResult();

            try
            {
                _klarnaCheckoutPaymentService.CancelPayment(order.AuthorizationTransactionId, order.Customer);

                result.NewPaymentStatus = PaymentStatus.Voided;

                order.OrderNotes.Add(new OrderNote
                {
                    Note = string.Format(CultureInfo.CurrentCulture, "KlarnaCheckout: The payment has been voided. Reservation: {0}",
                        order.AuthorizationTransactionId),
                    CreatedOnUtc = DateTime.UtcNow,
                    DisplayToCustomer = false
                });
                _orderService.UpdateOrder(order);
            }
            catch (KlarnaCheckoutException kce)
            {
                order.OrderNotes.Add(new OrderNote
                {
                    Note = "KlarnaCheckout: An error occurred when voiding the payment. See the error log for more information.",
                    CreatedOnUtc = DateTime.UtcNow,
                    DisplayToCustomer = false
                });
                _orderService.UpdateOrder(order);

                _logger.Error(string.Format(CultureInfo.CurrentCulture, "KlarnaCheckout: Error voiding payment. Order Id: {0}; Reservation: {1}",
                    order.Id, order.AuthorizationTransactionId),
                    exception: kce,
                    customer: order.Customer);

                result.AddError("An error occurred while voiding the order. See the error log for more information.");
            }

            return result;
        }
开发者ID:NicLars,项目名称:klarna-checkout-nopcommerce,代码行数:40,代码来源:KlarnaCheckoutProcessor.cs


注:本文中的Nop.Services.Payments.VoidPaymentResult.AddError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。