コード例 #1
0
    def create_webhook(events, url, mode, client_id, client_secret):
        webhook = Webhook(
            {
                'url': url,
                'event_types': [{
                    'name': event
                } for event in events]
            },
            api=Api({
                'mode': mode,
                'client_id': client_id,
                'client_secret': client_secret
            }))

        if webhook.create():
            print("Webhook[%s] created successfully" % (webhook.id))
        else:
            print(webhook.error)
コード例 #2
0
ファイル: delete.py プロジェクト: fsiddi/PayPal-Python-SDK
from paypalrestsdk import Webhook
import logging
logging.basicConfig(level=logging.INFO)

webhook = Webhook.find("8TJ12214WP9291246")

if webhook.delete():
  print("Webhook deleted")
else:
  print(webhook.error)
コード例 #3
0
from paypalrestsdk import Webhook, ResourceNotFound
import logging

logging.basicConfig(level=logging.INFO)

try:
    webhook = Webhook.find("70Y03947RF112050J")
    print("Got Webhook Details for Webhook[%s]" % (webhook.id))

    webhook_replace_attributes = [
        {
            "op": "replace",
            "path": "/url",
            "value": "https://www.yeowza.com/paypal_webhook_url"
        },
        {
            "op": "replace",
            "path": "/event_types",
            "value": [
                {
                    "name": "PAYMENT.SALE.REFUNDED"
                }
            ]
        }
    ]

    if webhook.replace(webhook_replace_attributes):
        webhook = Webhook.find("70Y03947RF112050J")
        print("Webhook [%s] url changed to [%s]" % (webhook.id, webhook.url))
    else:
        print(webhook.error)
コード例 #4
0
from paypalrestsdk import Webhook, ResourceNotFound
import logging

logging.basicConfig(level=logging.INFO)

try:
    webhook = Webhook.find("70Y03947RF112050J")
    print(("Got Webhook Details for Webhook[%s]" % (webhook.id)))

    webhook_replace_attributes = [{
        "op":
        "replace",
        "path":
        "/url",
        "value":
        "https://www.yeowza.com/paypal_webhook_url"
    }, {
        "op": "replace",
        "path": "/event_types",
        "value": [{
            "name": "PAYMENT.SALE.REFUNDED"
        }]
    }]

    if webhook.replace(webhook_replace_attributes):
        webhook = Webhook.find("70Y03947RF112050J")
        print(("Webhook [%s] url changed to [%s]" % (webhook.id, webhook.url)))
    else:
        print((webhook.error))

except ResourceNotFound as error:
コード例 #5
0
ファイル: get_all.py プロジェクト: sroberts3612/sa
from paypalrestsdk import Webhook
import logging
logging.basicConfig(level=logging.INFO)

history = Webhook.all()
print(history)

print("List Webhook:")
for webhook in history:
    print("  -> Webhook[%s]" % (webhook.name))
コード例 #6
0
from paypalrestsdk import Webhook
import logging

logging.basicConfig(level=logging.INFO)

webhook = Webhook({
    "url":
    "https://www.yeowza.com/paypal_webhook",
    "event_types": [{
        "name": "PAYMENT.AUTHORIZATION.CREATED"
    }, {
        "name": "PAYMENT.AUTHORIZATION.VOIDED"
    }]
})

if webhook.create():
    print(("Webhook[%s] created successfully" % (webhook.id)))
else:
    print((webhook.error))
コード例 #7
0
ファイル: get.py プロジェクト: Python3pkg/PayPal-Python-SDK
from paypalrestsdk import Webhook
import logging
logging.basicConfig(level=logging.INFO)

try:
    webhook = Webhook.find("8TJ12214WP9291246")
    print(("Got Details for Webhook[%s]" % (webhook.id)))

except ResourceNotFound as error:
    print("Webhook Not Found")
コード例 #8
0
    'client_secret':
    'EI-dMlYlcd7Zykf4vJRpizh-a2EnpfVxdFBl4EbzzHYxa9qP8LkwKwOoReBofFWvpSn6w02sBCLFPhPY'
})

webhook = Webhook({
    "url":
    "https://budget-track.herokuapp.com/webhook",
    "event_types": [{
        "name": "PAYMENT.SALE.COMPLETED"
    }, {
        "name": "PAYMENT.SALE.DENIED"
    }, {
        "name": "PAYMENT.SALE.REFUNDED"
    }, {
        "name": "PAYMENT.SALE.REVERSED"
    }, {
        "name": "PAYMENT.SALE.PENDING"
    }, {
        "name": "PAYMENT.AUTHORIZATION.CREATED"
    }, {
        "name": "PAYMENT.AUTHORIZATION.VOIDED"
    }, {
        "name": "PAYMENT.ORDER.CANCELLED"
    }, {
        "name": "PAYMENT.ORDER.CREATED"
    }]
})

if webhook.create():
    print("Webhook[%s] created successfully" % (webhook.id))
else:
コード例 #9
0
ファイル: create.py プロジェクト: fsiddi/PayPal-Python-SDK
from paypalrestsdk import Webhook
import logging

logging.basicConfig(level=logging.INFO)

webhook = Webhook({
    "url": "https://www.yeowza.com/paypal_webhook",
    "event_types": [
        {
            "name": "PAYMENT.AUTHORIZATION.CREATED"
        },
        {
            "name": "PAYMENT.AUTHORIZATION.VOIDED"
        }
    ]
})

if webhook.create():
    print("Webhook[%s] created successfully"%(webhook.id))
else:
    print(webhook.error)