Пример #1
0
 public ZarinPalPaymentProcessor
 (
     IWebHelper webHelper,
     ITaxService taxService,
     IWorkContext workContext,
     IStoreContext storeContext,
     IStoreService storeService,
     IAddressService addressService,
     ISettingService settingService,
     IPaymentService paymentService,
     ICustomerService customerService,
     ICurrencyService currencyService,
     ILanguageService languageService,
     IHttpContextAccessor httpContextAccessor,
     ILocalizationService localizationService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IGenericAttributeService genericAttributeService,
     IOrderTotalCalculationService orderTotalCalculationService,
     CustomerSettings customerSettings,
     CurrencySettings currencySettings,
     ZarinpalPaymentSettings zarinPalPaymentSettings
 )
 {
     _webHelper                    = webHelper;
     _taxService                   = taxService;
     _workContext                  = workContext;
     _storeService                 = storeService;
     _storeContext                 = storeContext;
     _addressService               = addressService;
     _paymentService               = paymentService;
     _settingService               = settingService;
     _customerService              = customerService;
     _languageService              = languageService;
     _currencyService              = currencyService;
     _currencySettings             = currencySettings;
     _customerSettings             = customerSettings;
     _httpContextAccessor          = httpContextAccessor;
     _localizationService          = localizationService;
     _checkoutAttributeParser      = checkoutAttributeParser;
     _genericAttributeService      = genericAttributeService;
     _zarinPalPaymentSettings      = zarinPalPaymentSettings;
     _orderTotalCalculationService = orderTotalCalculationService;
 }
Пример #2
0
        public override async Task InstallAsync()
        {
            //settings
            var settings = new ZarinpalPaymentSettings
            {
                UseSandbox    = true,
                RialToToman   = true,
                UseZarinGate  = false,
                BlockOverseas = false,
                Method        = EnumMethod.REST,
                ZarinGateType = EnumZarinGate.ZarinGate,
                MerchantID    = "99999999-9999-9999-9999-999999999999",
            };
            await _settingService.SaveSettingAsync(settings);

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Use", "Use ZarinGate");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Use", "استفاده از زرین گیت", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Type", "Select ZarinGate Type");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Type", "انتخاب نوع زرین گیت", languageCulture : "fa-IR");

            var zarinGateLink = "https://www.zarinpal.com/blog/زرین-گیت،-درگاهی-اختصاصی-به-نام-وبسایت/";
            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Instructions", $"Read About the <a href=\"{zarinGateLink}\">Zarin Gate</a> Then Select the ZarinGateLink type from below :");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.ZarinGate.Instructions",
                                                                      string.Concat("لطفا اول شرایط استفاده از زرین گیت را در ", $"<a href=\"{zarinGateLink}\"> در این قسمت </a>", "مطالعه نموده و سپس نوع آن را انتخاب نمایید")
                                                                      , languageCulture : "fa-IR");


            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.Method", "Communication Method");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.Method", "روش پرداخت", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.Method.REST", "REST(recommanded)");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.Method.SOAP", "SOAP");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.UseSandbox", "Use Snadbox for testing payment GateWay without real paying.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.UseSandbox", "تست درگاه زرین پال بدون پرداخت هزینه", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.MerchantID", "GateWay Merchant ID");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Fields.MerchantID", "کد پذیرنده", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Instructions",
                                                                      string.Concat("You can use Zarinpal.com GateWay as a payment gateway. Zarinpal is not a bank but it is an interface which customers can pay with.",
                                                                                    "<br/>", "Please consider that if you leave MerchantId field empty the Zarinpal Gateway will be hidden and not choosable when checking out"));

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.ZarinPal.Instructions",
                                                                      string.Concat("شما می توانید از زرین پال به عنوان یک درگاه پرداخت استفاده نمایید، زرین پال یک بانک نیست بلکه یک واسط بانکی است که کاربران میتوانند از طریق آن مبلغ مورد نظر را پرداخت نمایند، باید آگاه باشید که درگاه زرین پال درصدی از پول پرداخت شده کاربران را به عنوان کارمزد دریافت میکند.",
                                                                                    "<br/>", "توجه داشته باشید که اگر فیلد کد پذیرنده خالی باشد درگاه زرین پال در هنگام پرداخت مخفی می شود و قابل انتخاب نیست"), languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("plugins.payments.zarinpal.PaymentMethodDescription", "ZarinPal, The Bank Interface");

            await _localizationService.AddOrUpdateLocaleResourceAsync("plugins.payments.zarinpal.PaymentMethodDescription", "درگاه واسط زرین پال", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RedirectionTip", "You will be redirected to ZarinPal site to complete the order.");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RedirectionTip", "هم اکنون به درگاه بانک زرین پال منتقل می شوید.", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.BlockOverseas", "Block oversease access (block non Iranians)");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.BlockOverseas", "قطع دسترسی برای آی پی های خارج از کشور", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RialToToman", "Convert Rial To Toman");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RialToToman", "تبدیل ریال به تومن", languageCulture : "fa-IR");

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RialToToman.Instructions",
                                                                      string.Concat(
                                                                          "The default currency of zarinpal is Toman", "<br/>",
                                                                          "Therefore if your website uses Rial before paying it should be converted to Toman", "<br/>",
                                                                          "please consider that to convert Rial to Toman system divides total to 10, so the last digit will be removed", "<br/>",
                                                                          "To do the stuff check this option"
                                                                          ));

            await _localizationService.AddOrUpdateLocaleResourceAsync("Plugins.Payments.Zarinpal.Fields.RialToToman.Instructions",
                                                                      string.Concat(
                                                                          "واحد ارزی پیش فرض درگاه پرداخت زرین پال تومان می باشد.", "<br/>",
                                                                          "لذا در صورتی که وبسایت شما از واحد ارزی ریال استفاده می کند باید قبل از پرداخت مبلغ نهایی به تومان تبدیل گردد", "<br/>",
                                                                          "لطفا در نظر داشته باشید که جهت تبدیل ریال به تومان عدد تقسیم بر 10 شده و در واقع رقم آخر حذف می گردد", "<br/>",
                                                                          "در صورتی که مایل به تغییر از ریال به تومان هنگام پرداخت می باشید این گزینه را فعال نمایید"
                                                                          ), languageCulture : "fa-IR");

            await base.InstallAsync();
        }