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