def create_paypal_payment(order_identifier): """ Create a paypal payment. :return: The payment id of the created payment. """ try: return_url = request.json['data']['attributes']['return-url'] cancel_url = request.json['data']['attributes']['cancel-url'] except TypeError: raise BadRequestError({'source': ''}, 'Bad Request Error') order = safe_query(Order, 'identifier', order_identifier, 'identifier') status, response = PayPalPaymentsManager.create_payment(order, return_url, cancel_url) if status: return jsonify(status=True, payment_id=response) return jsonify(status=False, error=response)
def create_paypal_payment(order_identifier): """ Create a paypal payment. :return: The payment id of the created payment. """ try: return_url = request.json['data']['attributes']['return-url'] cancel_url = request.json['data']['attributes']['cancel-url'] except TypeError: return BadRequestError({'source': ''}, 'Bad Request Error').respond() order = safe_query(db, Order, 'identifier', order_identifier, 'identifier') status, response = PayPalPaymentsManager.create_payment(order, return_url, cancel_url) if status: return jsonify(status=True, payment_id=response) else: return jsonify(status=False, error=response)
def create_paypal_payment_invoice(invoice_identifier): """ Create a paypal payment. :return: The payment id of the created payment. """ try: return_url = request.json['data']['attributes']['return-url'] cancel_url = request.json['data']['attributes']['cancel-url'] except TypeError: return BadRequestError({'source': ''}, 'Bad Request Error').respond() event_invoice = safe_query(db, EventInvoice, 'identifier', invoice_identifier, 'identifier') status, response = PayPalPaymentsManager.create_payment( event_invoice, return_url, cancel_url) if status: return jsonify(status=True, payment_id=response) else: return jsonify(status=False, error=response)
def create_paypal_payment_invoice(invoice_identifier): """ Create a paypal payment. :return: The payment id of the created payment. """ try: return_url = request.json['data']['attributes']['return-url'] cancel_url = request.json['data']['attributes']['cancel-url'] except TypeError: raise BadRequestError({'source': ''}, 'Bad Request Error') event_invoice = safe_query(EventInvoice, 'identifier', invoice_identifier, 'identifier') billing_email = get_settings()['admin_billing_paypal_email'] status, response = PayPalPaymentsManager.create_payment( event_invoice, return_url, cancel_url, payee_email=billing_email) if status: return jsonify(status=True, payment_id=response) return jsonify(status=False, error=response)