NopCommerce - 如何在插件

时间:2017-05-28 20:19:13

标签: asp.net-mvc web-services wsdl nopcommerce service-reference

最近,我正在为zarinpal.com门户的付款插件工作。 我必须通过此URL添加服务引用:

  

https://sandbox.zarinpal.com/pg/services/WebGate/wsdl

每件事都没问题,但在PostProcessPayment中,我面临错误:

Could not find default endpoint element that references contract
 'ServiceReference.PaymentGatewayImplementationServicePortType' 
  in the ServiceModel client configuration section. This might be 
  because no configuration file was found for your application, 
  or because no endpoint element matching this contract could be found
  in the client element.

这是我的PostProcessPayment方法:

    public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
    {
        string urlToRedirect = "";
        var zarinpal = 
              new ServiceReference.PaymentGatewayImplementationServicePortTypeClient();
        string outResult = "";
        int code = zarinpal.PaymentRequest("5607e960-d64c-4a8b-b03b-0e645bef37d4"
                   , 2500, "Our Test Store Name"
                   , "test@gmail.com", "0999999999"
                   , "http://" + _webHelper.GetStoreLocation(false) 
                     + "/Plugins/ZarinPal/PDTHandler", out outResult);// test
        if (code == 100)
        {
            urlToRedirect = string.Concat("https://sandbox.zarinpal.com/pg/StartPay/"
           , outResult);
        }
        _httpContext.Response.Redirect(urlToRedirect);

    }

我最好提一下,如果我也将服务引用添加到Nop.Web项目中,它运行良好,但我想将其构建为模块并将服务引用手动添加到Nop.Web是不愉快的。 你能帮帮我吗?

0 个答案:

没有答案