def get_transaction_data(): # Get POST data try: data = json.loads(request.data) except JSONDecodeError: return abort(403) if 'api_secret' not in data or config_file['API_SECRET'] != data[ 'api_secret']: return abort(403) # Initilialize webpay configure_webpay() # ACK the transaction try: response = Transaction.commit(token=data['token']) except TransactionCommitError: # On error, return the status of the token try: response = Transaction.status(token=data['token']) except TransactionStatusError as e: # Invalid token return {"response_code": -1, "reason": e.message} return json.dumps(response, default=lambda x: x.__dict__)
def webpay_plus_commit(request): token = request.POST.get("token_ws") print("commit for token_ws: {}".format(token)) response = Transaction.commit(token=token) print("response: {}".format(response)) data = {'token': token, 'response': response} return render(request, 'Webpay/commit.html', data)
def webpay_plus_commit(): token = request.form.get("token_ws") print("commit for token_ws: {}".format(token)) response = Transaction.commit(token=token) print("response: {}".format(response)) return render_template('webpay/plus/commit.html', token=token, response=response)
def webpay_plus_commit(request): token = request.POST.get("token_ws") response = Transaction.commit(token) return render(request, 'core/terminal.html', {"response":response,"token":token})
def commit(cls, token: str, options: Options = None) -> TransactionCommitResponse: return T.commit(token, cls.build_options(options))