def create_payment(self, project_id, sponsorship, return_url):
        """
        Returns authorization URL
        """
        if not return_url:
            raise Error('return_url cannot be blank')

        receiver_email = config[project_id].PAYPAL_RECEIVER_EMAIL

        args = {
            "cmd": "_donations",
            "business": receiver_email,
            "item_name": "Bounty",
            "amount": sponsorship.amount,
            "currency_code": "EUR",
            "no_note": 1,
            "no_shipping": 1,
            "return": return_url,
            "cancel_return": return_url
        }
        redirect_url = get_paypal_url(project_id) + "?" + urllib.urlencode(args)

        payment = Payment(sponsorship.project_id, sponsorship.sponsorship_id, PaymentGateway.PAYPAL_STANDARD)
        payment.url = redirect_url
        return payment
Example #2
0
    def create_payment(self, project_id, sponsorship, return_url):
        if not return_url:
            raise Error('return_url cannot be blank')

        receiver_email = config[project_id].PAYPAL_RECEIVER_EMAIL
        receivers = [{'amount': sponsorship.amount, 'email': receiver_email}]
        
        paypal = self.get_paypal(project_id)
        response = paypal.pay(
            actionType='PAY',
            reverseAllParallelPaymentsOnError=True,
            currencyCode="EUR",
            feesPayer='SENDER',
            receiverList={'receiver': receivers},
            returnUrl=return_url,
            cancelUrl=return_url,
        )

        pay_key = response['payKey']
        redirect_url = get_paypal_url(project_id) + '?cmd=_ap-payment&paykey=' + pay_key

        payment = Payment(sponsorship.project_id, sponsorship.sponsorship_id, PaymentGateway.PAYPAL_ADAPTIVE)
        payment.url = redirect_url
        payment.gateway_id = pay_key
        return payment
Example #3
0
    def create_payment(self, project_id, sponsorship, return_url):
        """
        Returns authorization URL
        """
        if not return_url:
            raise Error('return_url cannot be blank')

        receiver_email = config[project_id].PAYPAL_RECEIVER_EMAIL

        args = {
            "cmd": "_donations",
            "business": receiver_email,
            "item_name": "Bounty",
            "amount": sponsorship.amount,
            "currency_code": "EUR",
            "no_note": 1,
            "no_shipping": 1,
            "return": return_url,
            "cancel_return": return_url
        }
        redirect_url = get_paypal_url(project_id) + "?" + urllib.urlencode(
            args)

        payment = Payment(sponsorship.project_id, sponsorship.sponsorship_id,
                          PaymentGateway.PAYPAL_STANDARD)
        payment.url = redirect_url
        return payment
Example #4
0
 def create_payment(self, project_id, sponsorship, return_url):
     payment = Payment(project_id, sponsorship.sponsorship_id,
                       PaymentGateway.DUMMY)
     return payment