|
|
|
|
@ -36,19 +36,24 @@ def periodic_billing(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def repeat_card_payment(invoice): |
|
|
|
|
resp = requests.post(settings.YANDEX_MONEY_MWS_URL + 'repeatCardPayment', |
|
|
|
|
data={ |
|
|
|
|
'clientOrderId': invoice.id, # уникальное возрастающее целое число |
|
|
|
|
'invoiceId': invoice.key, |
|
|
|
|
'amount': invoice.price, |
|
|
|
|
'orderNumber': invoice.yandex_pay.order_number |
|
|
|
|
}, |
|
|
|
|
cert=( |
|
|
|
|
os.path.join(settings.SSL_ROOT, 'skillbox.cer'), |
|
|
|
|
os.path.join(settings.SSL_ROOT, 'skillbox.key') |
|
|
|
|
), |
|
|
|
|
verify=os.path.join(settings.SSL_ROOT, 'yamoney_chain.cer')) |
|
|
|
|
|
|
|
|
|
logger_yandex.info('periodic billing finish', exc_info=True, extra={ |
|
|
|
|
'response': resp.text |
|
|
|
|
}) |
|
|
|
|
try: |
|
|
|
|
resp = requests.post(settings.YANDEX_MONEY_MWS_URL + 'repeatCardPayment', |
|
|
|
|
data={ |
|
|
|
|
'clientOrderId': invoice.id, # уникальное возрастающее целое число |
|
|
|
|
'invoiceId': invoice.key, |
|
|
|
|
'amount': invoice.price, |
|
|
|
|
'orderNumber': invoice.yandex_pay.order_number |
|
|
|
|
}, |
|
|
|
|
cert=( |
|
|
|
|
os.path.join(settings.SSL_ROOT, 'skillbox.cer'), |
|
|
|
|
os.path.join(settings.SSL_ROOT, 'skillbox.key') |
|
|
|
|
), |
|
|
|
|
verify=os.path.join(settings.SSL_ROOT, 'yamoney_chain.cer')) |
|
|
|
|
except Exception as exc: |
|
|
|
|
logger_yandex.error('periodic billing Exception', exc_info=True, extra={ |
|
|
|
|
'exc': exc |
|
|
|
|
}) |
|
|
|
|
else: |
|
|
|
|
logger_yandex.info('periodic billing finish', exc_info=True, extra={ |
|
|
|
|
'response': resp.text |
|
|
|
|
}) |
|
|
|
|
|