# Path: yithlibraryserver/compat.py
# PY3 = sys.version_info[0] == 3
#     def encode_header(obj):  # pragma: no cover
#     def encode_header(obj):  # pragma: no cover


import requests
from yithlibraryserver.compat import urlparse
        payload.add_token(token, payerid)

        response = requests.post(self.nvp_url, data=payload)

        if response.ok:
            data = urlparse.parse_qs(response.text)
            ack = data['ACK'][0]
            if ack == 'Success':
                amount = data['AMT'][0]
                amount = int(amount.split('.')[0])
                return {
                    'amount': amount,
                    'firstname': data['FIRSTNAME'][0],
                    'lastname': data['LASTNAME'][0],
                    'city': data['SHIPTOCITY'][0],
                    'country': data['SHIPTOCOUNTRYNAME'][0],
                    'state': data['SHIPTOSTATE'][0],
                    'street': data['SHIPTOSTREET'][0],
                    'zip': data['SHIPTOZIP'][0],
                    'email': data['EMAIL'][0],
                }

    def do_express_checkout_payment(self, token, payerid, amount):
        payload = PayPalPayload(self.request, 'DoExpressCheckoutPayment')
        payload.add_payment_info(amount)
        payload.add_token(token, payerid)

        response = requests.post(self.nvp_url, data=payload)

        if response.ok:

# Path: yithlibraryserver/compat.py
# PY3 = sys.version_info[0] == 3
#     def encode_header(obj):  # pragma: no cover
#     def encode_header(obj):  # pragma: no cover


# Path: yithlibraryserver/contributions/paypal.py
import requests
from yithlibraryserver.compat import urlparse

        payload.add_token(token, payerid)

        response = requests.post(self.nvp_url, data=payload)

        if response.ok:
            data = urlparse.parse_qs(response.text)
            ack = data['ACK'][0]
            if ack == 'Success':
                amount = data['AMT'][0]
                amount = int(amount.split('.')[0])
                return {
                    'amount': amount,
                    'firstname': data['FIRSTNAME'][0],
                    'lastname': data['LASTNAME'][0],
                    'city': data['SHIPTOCITY'][0],
                    'country': data['SHIPTOCOUNTRYNAME'][0],
                    'state': data['SHIPTOSTATE'][0],
                    'street': data['SHIPTOSTREET'][0],
                    'zip': data['SHIPTOZIP'][0],
                    'email': data['EMAIL'][0],
                }

    def do_express_checkout_payment(self, token, payerid, amount):
        payload = PayPalPayload(self.request, 'DoExpressCheckoutPayment')
        payload.add_payment_info(amount)
        payload.add_token(token, payerid)

        response = requests.post(self.nvp_url, data=payload)

        if response.ok:

            data = urlparse.parse_qs(response.text)