Commit 5eeadcf7 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_wechat: Cancel the Payment if the invoice is open for more them 24 hours

This means the user gave up, so we cancel so the new payment is created or Subscription Request is cancelled.
parent 013c7ff7
......@@ -54,6 +54,11 @@ elif error_code == 'SUCCESS':
if isTransitionPossible(transaction, 'confirm'):
transaction.confirm(comment='Confirmed as really saw in WeChat.')
transaction_date, _ = transaction.PaymentTransaction_getWechatId()
if transaction_status == "NOTPAY" and int(DateTime()) - int(transaction_date) > 86400:
if isTransitionPossible(transaction, 'cancel'):
transaction.cancel(comment='Aborting failing wechat payment.')
elif transaction_status in continue_transaction_id_list:
# Check authAmount and authDevise and if match, stop transaction
auth_amount = int(data_kw['total_fee'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment