Exemplo n.º 1
0
    def get_paypal(self, project_id):
        paypal = AdaptivePayments(
            config[project_id].PAYPAL_USER_ID, 
            config[project_id].PAYPAL_PASSWORD, 
            config[project_id].PAYPAL_SIGNATURE,
            config[project_id].PAYPAL_APPLICATION_ID,
            config[project_id].PAYPAL_RECEIVER_EMAIL,
            config[project_id].PAYPAL_SANDBOX)

        paypal.debug = False
        
        return paypal
from django.conf import settings
from paypalx import AdaptivePayments, PaypalError
from urllib import urlencode
from urllib2 import urlopen, Request
from core.services import mail_services
import logging

logger = logging.getLogger(__name__)

paypal = AdaptivePayments(settings.PAYPAL_API_USERNAME, 
                          settings.PAYPAL_API_PASSWORD,
                          settings.PAYPAL_API_SIGNATURE,
                          settings.PAYPAL_API_APPLICATION_ID,
                          settings.PAYPAL_API_EMAIL,
                          sandbox=settings.PAYPAL_USE_SANDBOX)
paypal.debug = settings.PAYPAL_DEBUG

if settings.PAYPAL_USE_SANDBOX:
    WEBSCR_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
else:
    WEBSCR_URL = 'https://www.paypal.com/cgi-bin/webscr'


def generate_paypal_payment(payment):
    receivers = []
    for part in payment.getParts():
        receivers.append({'amount': str(part.price), 'email': part.programmer.getUserInfo().paypalEmail})
    receivers.append({'amount': "%.2f" % payment.fee, 'email': settings.PAYPAL_FRESPO_RECEIVER_EMAIL})
    response = paypal.pay(
        actionType='PAY',
        cancelUrl=settings.PAYPAL_CANCEL_URL,
from django.conf import settings
from paypalx import AdaptivePayments
from urllib import urlencode
from urllib2 import urlopen, Request
import logging

logger = logging.getLogger(__name__)

paypal = AdaptivePayments(settings.PAYPAL_API_USERNAME,
                          settings.PAYPAL_API_PASSWORD,
                          settings.PAYPAL_API_SIGNATURE,
                          settings.PAYPAL_API_APPLICATION_ID,
                          settings.PAYPAL_API_EMAIL,
                          sandbox=settings.PAYPAL_USE_SANDBOX)
paypal.debug = settings.PAYPAL_DEBUG

if (settings.PAYPAL_USE_SANDBOX):
    WEBSCR_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
else:
    WEBSCR_URL = 'https://www.paypal.com/cgi-bin/webscr'


def generate_paypal_payment(payment):
    receivers = []
    for part in payment.getParts():
        receivers.append({
            'amount': str(part.realprice),
            'email': part.programmer.email
        })
    receivers.append({
        'amount': "%.2f" % payment.fee,