Reputation: 83
i use python-redsys : https://pypi.org/project/python-redsys/
I'm stuck at the step 4. Communication step
This is my view :
@login_required
def redsys_start(request):
secret_key = DS_SECRET_KEY
client = RedirectClient(secret_key)
parameters = {
"merchant_code": DS_MERCHANT_MERCHANTCODE,
"terminal": DS_MERCHANT_TERMINAL,
"transaction_type": STANDARD_PAYMENT,
"currency": EUR,
"order": "000000001",
"amount": D("10.56489").quantize(D(".01"), ROUND_HALF_UP),
"merchant_data": "test merchant data",
"merchant_name": "Example Commerce",
"titular": "Example Ltd.",
"product_description": "Products of Example Commerce",
"merchant_url": reverse('front:shop_cart_payment_callback'),
}
args = client.prepare_request(parameters)
print(f"args = {args}")
context = {'args': args, 'BANK_PAIEMENT_URL': BANK_PAIEMENT_URL}
# STEP 3
args = client.prepare_request(parameters)
What i have to do after that fo redirect my customer to the red sys payement system ?
That is wahat the doc say :
4. Communication step
Redirect the user-agent to the corresponding Redsys' endpoint using the post parameters given in the previous step.
After the payment process is finished, Redsys will respond making a request to the merchant_url defined in step 2.
5. Create and check the response
Create the response object using the received parameters from Redsys. The method create_response() throws a ValueError in case the received signature is not equal to the calculated one using the given merchant_parameters. This normally means that the response is not coming from Redsys or that it has been compromised.
EDIT As requested my args variable content :
args = {'Ds_SignatureVersion': 'HMAC_SHA256_V1', 'Ds_MerchantParameters': b'SOMETHING', 'Ds_Signature': b'SOMETHING'}
Upvotes: 0
Views: 259