def on_billing_trx_failed(sender, signal_type, obj, **kwargs): from billing.billing_backend import get_custom_message trx = obj sbj, msg = "Billing Failed [%s]" % sender, u"" for att_name in ["id", "provider_status", "comments", "order", "passenger", "debug"]: msg += u"trx.%s: %s\n" % (att_name, getattr(trx, att_name)) msg += u"custom msg: %s" % get_custom_message(trx.provider_status, trx.comments) logging.error(u"%s\n%s" % (sbj, msg)) notify_by_email(sbj, msg=msg)
def transaction_error(request): if request.GET.get("lang") == u"HE": request.encoding = "cp1255" error_code = request.GET.get("ErrorCode") error_text = get_custom_message(error_code, request.GET.get("ErrorText")) ga_track_event(request, "registration", "credit_card_validation", "not_approved", int(error_code)) request.session['credit_card_error'] = error_text account_url = reverse(mobile_account_view if request.mobile else web_account_view) return HttpResponseRedirect(account_url)
def get_trx_status(request, passenger): trx_id = request.GET.get("trx_id") trx = BillingTransaction.by_id(trx_id) if trx and trx.passenger == passenger: response = {'status': trx.status} if trx.status == BillingStatus.FAILED: msg = get_custom_message(trx.provider_status, trx.comments) if msg: response.update({'error_message': msg}) return JSONResponse(response) return JSONResponse({'status': BillingStatus.FAILED})