コード例 #1
0
ファイル: payments.py プロジェクト: zahidmitha/web-app
def get_paypal_interface():
    '''
	Returns a paypal interface handle
	'''
    CONFIG = PayPalConfig(API_USERNAME=PAYPAL_API_USERNAME,
                          API_PASSWORD=PAYPAL_API_PASSWORD,
                          API_SIGNATURE=PAYPAL_API_SIGNATURE,
                          API_ENVIRONMENT="production",
                          DEBUG_LEVEL=0)

    return PayPalInterface(config=CONFIG)
コード例 #2
0
    def get_paypal_interface_obj(self):
        context = self.context
        props = getToolByName(context, 'portal_properties').paypal_properties

        #TODO: Need to be moved in configlet with description
        # Enter your test account's API details here. You'll need the 3-token
        # credentials, not the certificate stuff.
        #CONFIG = PayPalConfig(API_USERNAME = "******",
        #                      API_PASSWORD = "******",
        #                      API_SIGNATURE = "AuyTYUFGIfqpMeM0seVte",
        #                      DEBUG_LEVEL=0)

        CONFIG = PayPalConfig(API_USERNAME=props.api_username,
                              API_PASSWORD=props.api_password,
                              API_SIGNATURE=props.api_signature,
                              API_ENVIRONMENT=props.test and 'SANDBOX'
                              or 'PRODUCTION',
                              DEBUG_LEVEL=0)

        return PayPalInterface(config=CONFIG)
コード例 #3
0
import paypal
from paypal import PayPalConfig
from unittest import TestCase
__author__ = 'paulnaoki'

default_dict = {
    'API_ENVIRONMENT': 'SANDBOX',
    'API_AUTHENTICATION_MODE': '3TOKEN',
    'API_USERNAME': '******',
    'API_PASSWORD': '******',
    'API_SIGNATURE': 'AFcWxV21C7fd0v3bYYYRCpSSRl31AveX6CrHoCvMaN31RGX4mxlV2LkH'
}
# PayPalConfig.API_USERNAME = '******'
# PayPalConfig.API_PASSWORD = '******'
# PayPalConfig.API_SIGNATURE = 'AFcWxV21C7fd0v3bYYYRCpSSRl31AveX6CrHoCvMaN31RGX4mxlV2LkH'
default_config = PayPalConfig(**default_dict)

default_buyer = {
    'PAYERID': '*****@*****.**',
    'PROFILESTARTDATE': '2016-01-27T00:00:00Z',
    'DESC': 'Enroll for subscription.',
    'BILLINGPERIOD': 'Month',
    'BILLINGFREQUENCY': 1,
    'AMT': 10,
    'CURRENCYCODE': 'USD',
    'COUNTRYCODE': 'GB',
    'MAXFAILEDPAYMENTS': 3
}

interface = paypal.PayPalInterface(config=default_config)
コード例 #4
0
from django.core.management.base import BaseCommand, CommandError
from paypal_integration.models import Transaction
from paypal import PayPalConfig, PayPalInterface
from datetime import datetime, timedelta
from pprint import pprint
import pytz
from moneyed import Money

CONFIG = PayPalConfig(
    API_USERNAME="",
    API_PASSWORD="",
    API_SIGNATURE="",
    API_ENVIRONMENT="PRODUCTION",
    DEBUG_LEVEL=0,
)


class Command(BaseCommand):
    def handle(self, *args, **options):
        now = datetime.now() - timedelta(days=30)

        try:
            latest = Transaction.objects.latest('timestamp').timestamp
        except Transaction.DoesNotExist:
            latest = datetime.now() - timedelta(days=365 * 5)

        pprint(latest)
        paypal = PayPalInterface(CONFIG)
        result = paypal.transaction_search(startdate=latest)
        print "grabbed %d items" % len(result.items())
        for item in result.items():
コード例 #5
0
from paypal import PayPalConfig
from paypal import PayPalInterface

config = PayPalConfig(
    API_USERNAME="******",
    API_PASSWORD="******",
    API_SIGNATURE="ARJ3i6R11uqkA7Oilyp9Gg-y3foBAXzMhlvgGUVkmd2KXZQsVtuWvNAy",
    DEBUG_LEVEL=0)

interface = PayPalInterface(config=config)
コード例 #6
0
from flask_mail import Message

import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

# stripe_keys = {
# 	'secret_key': "sk_test_zJuSsNUL5yB4Vy0irwY0urHe",
# 	'publishable_key': "pk_test_9h0f2uum2Ym96ZlIky9Cbuwh"
# }

# stripe.api_key = stripe_keys['secret_key']

config = PayPalConfig(
    API_USERNAME="******",
    API_PASSWORD="******",
    API_SIGNATURE="ARfxBoFTKjG9iqDKA3aAlDEk9ElWADpqZqgjMJcJ17PUADfIUh1kgrXp",
    DEBUG_LEVEL=0,
    API_ENVIRONMENT="PRODUCTION")

# paypalrestsdk.configure({
#   "mode": "live", # sandbox or live
#   "client_id": "AUtXI41eXk-7O6Eiam6s3p0wb08bd6nra4oOiRFPxFpFgJ_xgzqOtZ8gCZgvNPU_0icbcXfGw_mXC7W9",
#   "client_secret": "EOILOIjnfXX63VqwMMOYX1_sfyiS-RikxfNkoQa6fqOQaT4CzrNp-DSc_dYJhb2RjqJUEqiWVyxOAOSu" })

interface = PayPalInterface(config=config)

# Serializer for generating random tokens
ts = URLSafeTimedSerializer(app.config['SECRET_KEY'])

# Create a user blueprint
userbp = Blueprint('userbp', __name__, url_prefix='/user')
コード例 #7
0
"""
This file contains your PayPal test account credentials. If you are just
getting started, you'll want to copy api_details_blank.py to api_details.py,
and substitute the placeholders below with your PayPal test account details.
"""

from paypal import PayPalConfig

# Enter your test account's API details here. You'll need the 3-token
# credentials, not the certificate stuff.
CONFIG = PayPalConfig(
    API_USERNAME="******",
    API_PASSWORD="******",
    API_SIGNATURE="AFcWxV21C7fd0v3bYYYRCpSSRl31AcI2RF6hv3aYblstdcQgZQAXEBLt",
    DEBUG_LEVEL=0)

# The following values may be found by visiting https://developer.paypal.com/,
# clicking on the 'Applications' -> 'Sandbox accounts' link in the sandbox,
# and looking at the accounts listed there.
# You'll need a business and a personal account created to run these tests.

# The email address of your personal test account. This is typically the
# customer for these tests.
EMAIL_PERSONAL = '*****@*****.**'
# If you view the details of your personal account, you'll see credit card
# details. Enter the credit card number from there.
VISA_ACCOUNT_NO = 'xxxxxxxxxxxxxxxx'
# And the expiration date in the form of MMYYYY. Note that there are no slashes,
# and single-digit month numbers have a leading 0 (IE: 03 for march).
VISA_EXPIRATION = 'mmyyyy'
コード例 #8
0
"""
This file contains your PayPal test account credentials. If you are just
getting started, you'll want to copy api_details_blank.py to api_details.py,
and substitute the placeholders below with your PayPal test account details.
"""

from paypal import PayPalConfig

# Enter your test account's API details here. You'll need the 3-token
# credentials, not the certificate stuff.
CONFIG = PayPalConfig(API_USERNAME="******",
                      API_PASSWORD="******",
                      API_SIGNATURE="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

# The following values may be found by visiting https://developer.paypal.com/,
# clicking on the 'Applications' -> 'Sandbox accounts' link in the sandbox,
# and looking at the accounts listed there.
# You'll need a business and a personal account created to run these tests.

# The email address of your personal test account. This is typically the
# customer for these tests.
EMAIL_PERSONAL = '*****@*****.**'
# If you view the details of your personal account, you'll see credit card
# details. Enter the credit card number from there.
VISA_ACCOUNT_NO = 'xxxxxxxxxxxxxxxx'
# And the expiration date in the form of MMYYYY. Note that there are no slashes,
# and single-digit month numbers have a leading 0 (IE: 03 for march).
VISA_EXPIRATION = 'mmyyyy'
コード例 #9
0
from paypal import PayPalConfig
from paypal import PayPalInterface

config = PayPalConfig(
    API_USERNAME="******",
    API_PASSWORD="******",
    API_SIGNATURE="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    DEBUG_LEVEL=0)

interface = PayPalInterface(config=config)
コード例 #10
0
#         "custom_field" : "PayPal custom field",
#         "description" : "Description for PayPal email receipt"
#       },
#     }
# })
# if result.is_success:
#     "Success ID: ".format(result.transaction.id)
# else:
#     format(result.message)

from paypal import PayPalConfig
from paypal import PayPalInterface

config = PayPalConfig(
    API_USERNAME="******",
    API_PASSWORD="******",
    API_SIGNATURE="A5Q8Xsj7f-LN-LLYpJahUp1iNoCcAkbCIbqIxpx9steOH36jxT2EBCLS",
    DEBUG_LEVEL=0)

interface = PayPalInterface(config=config)

from flask import url_for


@PURCHASE.route('/purchase/payment-paypal/<int:transaction_id>',
                methods=['GET'])
@login.login_required
# @PURCHASE.route("/")
def payment_paypal(transaction_id):
    t = models.Transaction.query.get_or_404(transaction_id)
    form, hash, amount = paypal_logic.generate_payment_form(t)