# 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
# This file is part of Yith Library Server.
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.





class PayPalPayload(dict):

    def __init__(self, request, method):
        self['METHOD'] = method
        self['VERSION'] = '72.0'
        self['USER'] = request.registry.settings['paypal_user']
        self['PWD'] = request.registry.settings['paypal_password']
        self['SIGNATURE'] = request.registry.settings['paypal_signature']

    def add_payment_info(self, amount):
        self['PAYMENTREQUEST_0_AMT'] = amount

# 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

# This file is part of Yith Library Server.
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Yith Library Server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Yith Library Server.  If not, see <http://www.gnu.org/licenses/>.





class PayPalPayload(dict):

    def __init__(self, request, method):
        self['METHOD'] = method
        self['VERSION'] = '72.0'
        self['USER'] = request.registry.settings['paypal_user']
        self['PWD'] = request.registry.settings['paypal_password']
        self['SIGNATURE'] = request.registry.settings['paypal_signature']

    def add_payment_info(self, amount):
        self['PAYMENTREQUEST_0_AMT'] = amount

        self['PAYMENTREQUEST_0_ITEMAMT'] = amount