Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

اشکال در پکیج زرین پال با تغییر تنظیمات پیش‌فرض Newtonsoft.Json #383

Open
mrmashal opened this issue Jan 22, 2024 · 0 comments
Assignees

Comments

@mrmashal
Copy link
Contributor

Bug description (wIthout specifiing the sensitive data)
توضیح خطا (بدون ذکر کردن اطلاعات خصوصی درگاه بانکی)

هنگامی که تنظیمات پیش‌فرض جیسون به شکل زیر انجام شده باشد:

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver(),
            };

هنگام بازگشت از درگاه زرین پال، قبل از وریفای شدن، خطای زیر رخ می‌دهد و (با وجود کسر مبلغ از حساب مشتری توسط زرین پال) تراکنش در اپلیکیشن ما وریفای نمیشه:

Authority not found in the Transaction record.

به نظر میاد مشکل از این بخش از کد
ZarinPalHelper
باشه که کلید استفاده شده برای جیسون با حرف بزرگ شروع میشه ولی با تنظیمات فوق، چیزی که در رکورد تراکنش ذخیره شده به شکل زیر هست:

{"authority":"A0000..."}

        private const string AuthorityDatabaseKey = "Authority";
...
            var additionalData = JsonConvert.DeserializeObject<IDictionary<string, string>>(transaction.AdditionalData);
            if (!additionalData.ContainsKey(AuthorityDatabaseKey))
            {
                throw new InvalidOperationException($"Authority not found in the Transaction record.");
            }

Package name and version
نام و نسخه پکیج

  • Package Name: Parbad.Gateway.ZarinPal
  • Version: 1.4.1

Web application type:
نوع برنامه وب

  • ASP.NET CORE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants