Commit 17fe842e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_wechat: Make Lint Happy

parent 1bf10285
...@@ -5,7 +5,7 @@ if REQUEST is not None: ...@@ -5,7 +5,7 @@ if REQUEST is not None:
portal = context.getPortalObject() portal = context.getPortalObject()
integration_site = portal.restrictedTraverse(portal.portal_preferences.getPreferredWechatIntegrationSite()) integration_site = portal.restrictedTraverse(portal.portal_preferences.getPreferredWechatIntegrationSite())
transaction_date, transaction_id = context.PaymentTransaction_getWechatId() _, transaction_id = context.PaymentTransaction_getWechatId()
if transaction_id is not None: if transaction_id is not None:
# XXX raise? # XXX raise?
return None, None return None, None
...@@ -15,7 +15,7 @@ if transaction_id is not None: ...@@ -15,7 +15,7 @@ if transaction_id is not None:
mapping_id = context.getId() mapping_id = context.getId()
try: try:
mapping = integration_site.getCategoryFromMapping( integration_site.getCategoryFromMapping(
'Causality/%s' % context.getId().replace('-', '_'), 'Causality/%s' % context.getId().replace('-', '_'),
create_mapping_line=True, create_mapping_line=True,
create_mapping=True) create_mapping=True)
......
...@@ -6,7 +6,7 @@ def wrapWithShadow(payment_transaction, web_site, person_relative_url): ...@@ -6,7 +6,7 @@ def wrapWithShadow(payment_transaction, web_site, person_relative_url):
vads_url_dict = payment_transaction.PaymentTransaction_getVADSUrlDict(web_site) vads_url_dict = payment_transaction.PaymentTransaction_getVADSUrlDict(web_site)
# ??? # ???
_ , transaction_id = payment_transaction.PaymentTransaction_getPayzenId() #_ , transaction_id = payment_transaction.PaymentTransaction_getWechatId()
# vads_url_already_registered = vads_url_dict.pop('vads_url_already_registered') # vads_url_already_registered = vads_url_dict.pop('vads_url_already_registered')
# if transaction_id is not None: # if transaction_id is not None:
# return context.REQUEST.RESPONSE.redirect(vads_url_already_registered) # return context.REQUEST.RESPONSE.redirect(vads_url_already_registered)
......
from DateTime import DateTime
portal = context.getPortalObject()
state = context.getSimulationState() state = context.getSimulationState()
if (state != 'started') or (context.getPaymentMode() != 'wechat'): if (state != 'started') or (context.getPaymentMode() != 'wechat'):
return "state not started (%s)" % state return "state not started (%s)" % state
else: else:
# ??? # ???
transaction_date, transaction_id = context.PaymentTransaction_getWechatId() _, transaction_id = context.PaymentTransaction_getWechatId()
if transaction_id is not None: if transaction_id is not None:
# so the payment is registered in wechat # so the payment is registered in wechat
......
...@@ -5,7 +5,7 @@ payment_transaction = wechat_event.getDestinationValue(portal_type="Payment Tran ...@@ -5,7 +5,7 @@ payment_transaction = wechat_event.getDestinationValue(portal_type="Payment Tran
now = DateTime() now = DateTime()
payment_transaction.AccountingTransaction_updateStartDate(now) payment_transaction.AccountingTransaction_updateStartDate(now)
transaction_date, transaction_id = payment_transaction.PaymentTransaction_generateWechatId() _, transaction_id = payment_transaction.PaymentTransaction_generateWechatId()
if transaction_id is None: if transaction_id is None:
raise ValueError, "Transaction already registered" raise ValueError, "Transaction already registered"
......
...@@ -30,6 +30,15 @@ payzen_dict.update( ...@@ -30,6 +30,15 @@ payzen_dict.update(
data_kw, signature, sent_text, received_text = payment_service.soap_duplicate(**payzen_dict) data_kw, signature, sent_text, received_text = payment_service.soap_duplicate(**payzen_dict)
sent = wechat_event.newContent(title='Sent SOAP', portal_type='Wechat Event Message', text_content=sent_text) # SENT
received = wechat_event.newContent(title='Received SOAP', text_content=received_text, predecessor_value=sent, portal_type='Wechat Event Message') sent = wechat_event.newContent(title='Sent SOAP',
portal_type='Wechat Event Message',
text_content=sent_text)
# RECEIVED
wechat_event.newContent(title='Received SOAP',
text_content=received_text,
predecessor_value=sent,
portal_type='Wechat Event Message')
context.WechatEvent_processUpdate(state_change, data_kw, signature) context.WechatEvent_processUpdate(state_change, data_kw, signature)
wechat_event = state_change['object'] wechat_event = state_change['object']
#raise NotImplementedError(wechat_event, "In WechatEvent_updateStatus") #raise NotImplementedError(wechat_event, "In WechatEvent_updateStatus")
payment_transaction = wechat_event.getDestinationValue(portal_type="Payment Transaction") payment_transaction = wechat_event.getDestinationValue(portal_type="Payment Transaction")
portal = payment_transaction.getPortalObject()
transaction_date, transaction_id = payment_transaction.PaymentTransaction_getWechatId() _, transaction_id = payment_transaction.PaymentTransaction_getWechatId()
if transaction_id is None: if transaction_id is None:
raise ValueError('Transaction not registered in wechat integration tool') raise ValueError('Transaction not registered in wechat integration tool')
...@@ -12,11 +11,14 @@ payment_service = wechat_event.getSourceValue(portal_type="Wechat Service") ...@@ -12,11 +11,14 @@ payment_service = wechat_event.getSourceValue(portal_type="Wechat Service")
query_dict = {'out_trade_no': transaction_id} query_dict = {'out_trade_no': transaction_id}
wechat_answer_dict = payment_service.queryWechatOrderStatus(query_dict) wechat_answer_dict = payment_service.queryWechatOrderStatus(query_dict)
# SENT over query
sent = wechat_event.newContent( sent = wechat_event.newContent(
title='Query Order Status', title='Query Order Status',
portal_type='Wechat Event Message', portal_type='Wechat Event Message',
text_content=query_dict) text_content=query_dict)
received = wechat_event.newContent(
# Received
wechat_event.newContent(
title='Received Order Status', title='Received Order Status',
portal_type='Wechat Event Message', portal_type='Wechat Event Message',
text_content=wechat_answer_dict, text_content=wechat_answer_dict,
......
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