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

خطای آدرس ارجاع دهنده دریافت نشد. (پارامترهای ارسال شده نامعتبر است.) #109

Closed
HamedMirzaeiOfficial opened this issue May 16, 2024 · 3 comments

Comments

@HamedMirzaeiOfficial
Copy link

HamedMirzaeiOfficial commented May 16, 2024

سلام روزتون بخیر.

def go_to_gateway_view(request):
amount = 100000
factory = bankfactories.BankFactory()
try:
bank = factory.auto_create()
bank.set_request(request)
bank.set_amount(amount)
bank.set_client_callback_url(request.build_absolute_uri(reverse("payment:callback_gateway")))

    bank_record = bank.ready()

    # Log the parameters being sent to the bank gateway for debugging
    print(bank.get_pay_data())
    print("verify: ", bank.get_verify_data())
    print(bank.get_transaction_status_text())

    # Redirect the user to the bank gateway
    return bank.redirect_gateway()
except AZBankGatewaysException as e:
    logging.critical(e)
    # TODO: Redirect to a failed page or handle the error appropriately
    raise e

def callback_gateway_view(request):
tracking_code = request.GET.get(settings.TRACKING_CODE_QUERY_PARAM)
if not tracking_code:
logging.debug('Valid referral address not received.')
raise Http404

try:
    bank_record = bank_models.Bank.objects.get(tracking_code=tracking_code)
except bank_models.Bank.DoesNotExist:
    logging.debug('Valid referral address not received.')
    raise Http404

# Process the bank record and handle the transaction result accordingly
if bank_record.is_success:
    return HttpResponse('Transaction successful.')
else:
    return HttpResponse('Transaction failed.')

من به این شکل دارم درخواستمو برای بانک سامان میفرستم.
تنظیمات هم به این شکله:

AZ_IRANIAN_BANK_GATEWAYS = {
'GATEWAYS': {
'SEP': {
'MERCHANT_CODE': '',
'TERMINAL_CODE': '
',
},
},
'DEFAULT': 'SEP',
'BANK_PRIORITIES': [
'SEP',
],
}

ولی با این خطا مواجه میشم: آدرس ارجاع دهنده دریافت نشد. (پارامترهای ارسال شده نامعتبر است.)
دیتای ارسالی هم به شکل زیره:

{'Action': 'Token', 'Amount': 100000, 'Wage': 0, 'TerminalId': '****', 'ResNum': 8726260414971983, 'RedirectURL': 'https://app.safirmall.com/bankgateways/callback/?bank_type=SEP&identifier=1', 'CellNumber': None}

ممنون میشم راهنمایی کنید مشکل از کجاس

@ali-zahedi
Copy link
Owner

@HamedMirzaeiOfficial
امکانش هست با این هم امتحان بفرمایید؟
IS_SAMPLE_FORM_ENABLE
فعال کنید
اطلاعات بیشتر https://github.com/ali-zahedi/az-iranian-bank-gateways/blob/main/README.md شماره هشت تنظیمات

@apidemy
Copy link
Contributor

apidemy commented Aug 1, 2024

درود
من هم با بانک سامان تست کردم و همین خطا برام پیش میاد.

@ali-zahedi
Copy link
Owner

@apidemy

بنظر میاد توسط @birddevelper این مشکل حل شده (با تشکر ازشون) و #113 هم مرج شده. میتونین آپگرید کنین پکیج رو و تنظیمات مورد نظر بانک سامان رو انجام بدید.

README
رو مجدد مطالعه کنین و تنظیمات مربوط به سامان رو برید جلو.

پارامتر SECURE_REFERRER_POLICY باید تنظیم بشه.

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

4 participants
@apidemy @ali-zahedi @HamedMirzaeiOfficial and others