Example #1
0
        if 'checkout_id' in create_result:
            donation.checkout_id = create_result['checkout_id']
            donation.save()

        if 'checkout_uri' in create_result:
            return donation, create_result['checkout_uri']
        else:
            return donation, None

    def donation_confirm(self, donation, **kwargs):
        pass

    def donation_update(self, donation):
        result = self.wepay.call(
            '/checkout', {
                'checkout_id': donation.checkout_id
            },
            token=donation.payee.userservice.data['access_token']
        )

        if 'error' in result:
            return False

        donation.state = result['state']
        donation.save()

        return True

if settings.FRUCTUS_KEYS:  # Only register if website.keys is available.
    registry.register(WePayPaymentPlatform())
Example #2
0
    def donation_confirm(self, donation, **kwargs):
        if not 'request' in kwargs:
            raise TypeError()

        self.configure_payee(donation.payee)

        result = braintree.TransparentRedirect.confirm(
            kwargs['request'].META['QUERY_STRING']
        )

        if 'id' in kwargs['request'].GET:
            donation.checkout_id = result.transaction.id

        donation.state = self.from_transaction_status(result.transaction.status)
        donation.save()

    def donation_update(self, donation):
        self.configure_payee(donation.payee)
        result = braintree.Transaction.find(donation.checkout_id)

        if 'status' in result:
            donation.state = self.from_transaction_status(result.status)
            donation.save()
            return True

        return False


if settings.FRUCTUS_KEYS:
    registry.register(BraintreePaymentPlatform())