Commit 1bf10285 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_payzen: Make Pylint Happy

parent 8c7f556e
......@@ -23,7 +23,7 @@ select_kw.update(
default_source_uid=portal.restrictedTraverse('account_module/receivable').getUid()
movement_list = []
id = 1
_id = 1
for invoice in portal.portal_catalog(**select_kw):
invoice.getObject().serialize() # in order to avoid selection on concurrent transactions
......@@ -51,21 +51,21 @@ for invoice in portal.portal_catalog(**select_kw):
source_payment='%s/bank_account' % invoice.getSourceSection(), # the other place defnied: business process
)
temp_movement_rec = newTempSimulationMovement(
temp_object=True, id=str(id),
temp_object=True, id=str(_id),
quantity=-1 * quantity,
source='account_module/receivable',
destination='account_module/payable',
**temp_movement_kw
)
id += 1
_id += 1
temp_movement_bank = newTempSimulationMovement(
temp_object=True, id=str(id),
temp_object=True, id=str(_id),
quantity=1 * quantity,
source='account_module/bank',
destination='account_module/bank',
**temp_movement_kw
)
id += 1
_id += 1
movement_list.extend([temp_movement_rec, temp_movement_bank])
return movement_list
......@@ -5,7 +5,7 @@ if REQUEST is not None:
portal = context.getPortalObject()
integration_site = portal.restrictedTraverse(portal.portal_preferences.getPreferredPayzenIntegrationSite())
transaction_date, transaction_id = context.PaymentTransaction_getPayzenId()
_, transaction_id = context.PaymentTransaction_getPayzenId()
if transaction_id is not None:
# XXX raise?
return None, None
......@@ -28,10 +28,11 @@ mapping_id = '%s_%s' % (today, transaction_id)
# raise ValueError, "Payzen transaction_id already exists"
try:
mapping = integration_site.getCategoryFromMapping(
'Causality/%s' % context.getId().replace('-', '_'),
create_mapping_line=True,
create_mapping=True)
# Init for use later.
integration_site.getCategoryFromMapping(
'Causality/%s' % context.getId().replace('-', '_'),
create_mapping_line=True,
create_mapping=True)
except ValueError:
pass
integration_site.Causality[context.getId().replace('-', '_')].setDestinationReference(mapping_id)
......
from DateTime import DateTime
portal = context.getPortalObject()
state = context.getSimulationState()
if (state != 'started') or (context.getPaymentMode() != 'payzen'):
return
else:
transaction_date, transaction_id = context.PaymentTransaction_getPayzenId()
_, transaction_id = context.PaymentTransaction_getPayzenId()
if transaction_id is not None:
# so the payment is registered in payzen
......
......@@ -9,7 +9,6 @@ def storeWorkflowComment(ctx, comment):
payzen_event = context
transaction = payzen_event.getDestinationValue()
portal = transaction.getPortalObject()
assert signature in (True, False)
if signature is False:
......@@ -21,7 +20,7 @@ isTransitionPossible = context.getPortalObject().portal_workflow.isTransitionPos
error_code = data_kw['errorCode']
if error_code == '2':
transaction_date, payzen_id = transaction.PaymentTransaction_getPayzenId()
transaction_date, _ = transaction.PaymentTransaction_getPayzenId()
# Mark on payment transaction history log that transaction was not processed yet
payzen_event.confirm()
payzen_event.acknowledge(comment='Transaction not found on payzen side.')
......@@ -61,8 +60,6 @@ elif error_code == '0':
payzen_event.confirm(comment='Unknown transactionStatus %r' % transaction_status)
return
doActionFor = context.getPortalObject().portal_workflow.doActionFor
if transaction_status in mark_transaction_id_list:
# Mark on payment transaction history log that transaction was not processed yet
storeWorkflowComment(transaction, 'Transaction status %s (%s) did not changed the document state' % (transaction_status, transaction_status_description))
......
......@@ -100,24 +100,28 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,24 +100,28 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,25 +100,28 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
<none/>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,24 +100,28 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -20,11 +20,10 @@ payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Tran
now = DateTime()
payment_transaction.AccountingTransaction_updateStartDate(now)
transaction_date, transaction_id = payment_transaction.PaymentTransaction_generatePayzenId()
_, transaction_id = payment_transaction.PaymentTransaction_generatePayzenId()
if transaction_id is None:
raise ValueError, "Transaction already registered"
today = now.toZone('UTC').asdatetime().strftime('%Y%m%d')
payzen_dict = {
'vads_currency': payment_transaction.getResourceValue().Currency_getIntegrationMapping(),
'vads_amount': str(int(round((payment_transaction.PaymentTransaction_getTotalPayablePrice() * -100), 0))),
......
......@@ -6,7 +6,6 @@ payzen related transaction for destination_section and doing its duplicate"""
from DateTime import DateTime
payzen_event = state_change['object']
transaction = payzen_event.getDestinationValue()
portal = transaction.getPortalObject()
payment_service = payzen_event.getSourceValue(portal_type="Payzen Service")
previous_id = transaction.PaymentTransaction_getPreviousPayzenId()
......@@ -31,6 +30,15 @@ payzen_dict.update(
data_kw, signature, sent_text, received_text = payment_service.soap_duplicate(**payzen_dict)
sent = payzen_event.newContent(title='Sent SOAP', portal_type='Payzen Event Message', text_content=sent_text)
received = payzen_event.newContent(title='Received SOAP', text_content=received_text, predecessor_value=sent, portal_type='Payzen Event Message')
# SENT
sent = payzen_event.newContent(title='Sent SOAP',
portal_type='Payzen Event Message',
text_content=sent_text)
# RECEIVED
payzen_event.newContent(title='Received SOAP',
text_content=received_text,
predecessor_value=sent,
portal_type='Payzen Event Message')
context.PayzenEvent_processUpdate(state_change, data_kw, signature)
payzen_event = state_change['object']
payment_transaction = payzen_event.getDestinationValue(portal_type="Payment Transaction")
portal = payment_transaction.getPortalObject()
transaction_date, transaction_id = payment_transaction.PaymentTransaction_getPayzenId()
if transaction_id is None:
......@@ -11,11 +10,14 @@ data_kw, signature, sent_text, received_text = payment_service.soap_getInfo(
transaction_date.toZone('UTC').asdatetime(),
transaction_id)
# SENT
sent = payzen_event.newContent(
title='Sent SOAP',
portal_type='Payzen Event Message',
text_content=sent_text)
received = payzen_event.newContent(
# RECEIVED
payzen_event.newContent(
title='Received SOAP',
portal_type='Payzen Event Message',
text_content=received_text,
......
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