Commit b700d12f authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slapos_payzen: Fix transaction_id issues.

* transaction_id is the combination of the transaction_date and the transaction number of the day
parent c13f23fe
......@@ -20,15 +20,17 @@ payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Tran
now = DateTime()
payment_transaction.AccountingTransaction_updateStartDate(now)
_, transaction_id = payment_transaction.PaymentTransaction_generatePayzenId()
if transaction_id is None:
transaction_date, transaction_number = payment_transaction.PaymentTransaction_generatePayzenId()
if transaction_number is None:
raise ValueError, "Transaction already registered"
transaction_id = transaction_date.Date().replace("/", "") + "-" + transaction_number
payzen_dict = {
'vads_currency': payment_transaction.getResourceValue().Currency_getIntegrationMapping(),
'vads_amount': str(int(round((payment_transaction.PaymentTransaction_getTotalPayablePrice() * -100), 0))),
'vads_trans_date': now.toZone('UTC').asdatetime().strftime('%Y%m%d%H%M%S'),
'vads_trans_id': transaction_id,
'vads_trans_id': transaction_number,
'vads_order_id': transaction_id,
'vads_language': 'en',
'vads_url_cancel': vads_url_cancel,
......
payzen_event = state_change['object']
payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Transaction")
transaction_date, transaction_id = payment_transaction.PaymentTransaction_getPayzenId()
if transaction_id is None:
transaction_date, transaction_number = payment_transaction.PaymentTransaction_getPayzenId()
if transaction_number is None:
raise ValueError('Transaction not registered in payzen integration tool')
transaction_id = transaction_date.Date().replace("/", "") + "-" + transaction_number
payment_service = payzen_event.getSourceValue(portal_type="Payzen Service")
data_kw, sent_text, received_text = payment_service.rest_getInfo(
transaction_date.toZone('UTC').asdatetime(),
......
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