summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei MIHAI <smihai@entrouvert.com>2014-09-09 12:34:40 (GMT)
committerSerghei MIHAI <smihai@entrouvert.com>2014-09-09 12:34:40 (GMT)
commit58992ae40c2a0cfb92263e9500f4f14e11948b4c (patch)
treecfbae31b02b99f957cfc9de4cc1ad55c1b1d4d83
parent612c6dd80c10997f0e8a573efe1008bc7dd14caa (diff)
downloadfacturier-58992ae40c2a0cfb92263e9500f4f14e11948b4c.zip
facturier-58992ae40c2a0cfb92263e9500f4f14e11948b4c.tar.gz
facturier-58992ae40c2a0cfb92263e9500f4f14e11948b4c.tar.bz2
fixing url while tipi payment
-rw-r--r--facturier/views.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/facturier/views.py b/facturier/views.py
index 404d0bd..926dc6a 100644
--- a/facturier/views.py
+++ b/facturier/views.py
@@ -134,9 +134,13 @@ class TransactionView(DetailView):
return context
- def invoice_rest_request(self, data_source_url, context):
- data = Data(data_source_url, RequestContext(self.request, context),
- limit=None, refresh=None)
+ def invoice_rest_request(self, url_func, context):
+ data = Data(self.object.slug, {'limit': None, 'refresh': None},
+ {'url': url_func(RequestContext(self.request, context)),
+ 'content_type': 'application/json',
+ 'parser_type': 'json',
+ 'slug': 'invoice'},
+ context)
return data.update_content().get('data').get('invoice')
def get_context_data(self, **kwargs):
@@ -159,7 +163,8 @@ class TransactionView(DetailView):
'invoice_hash': invoice_hash,
'slug': slug,
'paid': False,})
- invoice_data = self.invoice_rest_request(self.object.get_url, context)
+ invoice_data = self.invoice_rest_request(self.object.get_invoice_url,
+ context)
invoice.update(invoice_data)
# invoice can be overriden by request.GET parameters
@@ -243,10 +248,9 @@ class TransactionView(DetailView):
logger.debug('payment response: close transaction %s' % event.transaction_id)
self.create_event(event.transaction_id, invoice_id, status,
response=True, message='response', details=response.__dict__)
- update_url = self.object.get_invoice_update_url(context)
logger.debug('payment response: update invoice PAID %s -- context %s' %
(update_url, context))
- self.invoice_rest_request(update_url, context)
+ self.invoice_rest_request(self.object.get_invoice_update_url, context)
# ok !
logger.debug('payment response: OK invoice %s', invoice_id)