def payOffer(request, offer, payment): current_payment_id = dictOrEmpty(request.session, 'current_payment_id') if(current_payment_id): paypal_services.forget_payment(int(current_payment_id)) paypal_adapter.generate_paypal_payment(payment) payment.save() request.session['current_payment_id'] = payment.id if(settings.PAYPAL_USE_SANDBOX): # form_action = 'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey else: # form_action = 'https://www.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey return redirect(redirect_url)
def payOffer(request, offer, payment): current_payment_id = dictOrEmpty(request.session, 'current_payment_id') if(current_payment_id): paypal_services.forget_payment(int(current_payment_id)) try: paypal_adapter.generate_paypal_payment(payment) except BaseException as e: traceback.print_exc() messages.error(request, 'Error communicating with Paypal: %s' % e) mail_services.notify_admin('Error generating paypal payment', traceback.format_exc()) return redirect(offer.get_view_link()) payment.save() request.session['current_payment_id'] = payment.id if(settings.PAYPAL_USE_SANDBOX): # form_action = 'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey else: # form_action = 'https://www.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey return redirect(redirect_url)
def payOffer(request, offer, payment): current_payment_id = request.session.get('current_payment_id') if (current_payment_id): paypal_services.forget_payment(int(current_payment_id)) try: paypal_adapter.generate_paypal_payment(payment) except BaseException as e: traceback.print_exc() messages.error(request, 'Error communicating with Paypal: %s' % e) mail_services.notify_admin('Error generating paypal payment', traceback.format_exc()) return redirect(offer.get_view_link()) payment.save() request.session['current_payment_id'] = payment.id if settings.PAYPAL_USE_SANDBOX: # form_action = 'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey else: # form_action = 'https://www.paypal.com/webapps/adaptivepayment/flow/pay' redirect_url = 'https://www.paypal.com/webscr?cmd=_ap-payment&paykey=%s' % payment.paykey return redirect(redirect_url)