From d6575b49aec2bcb6a7ccebe0baf9d7947825b4d9 Mon Sep 17 00:00:00 2001
From: japatel
Date: Fri, 12 Dec 2014 16:32:16 -0600
Subject: [PATCH] Functional Tests Improvements and Refactoring
- Updated Functional Tests to refactor common code in one file
- Re-sets the credentials to make sure previous tests doesnt change it for testing
---
sample/doc/assets/behavior.js | 471 ++++++++++++++++++
.../doc/notifications/DeleteAllWebhooks.html | 15 +
sample/doc/notifications/DeleteWebhook.html | 14 +
sample/doc/notifications/GetWebhook.html | 17 +
.../ListSubscribedWebhookEventTypes.html | 16 +
sample/doc/notifications/ListWebhooks.html | 16 +
.../notifications/SearchWebhookEvents.html | 19 +
sample/doc/notifications/UpdateWebhook.html | 43 ++
.../notifications/WebhookEventTypesList.html | 13 +
sample/doc/notifications/createWebhook.html | 54 ++
sample/doc/payments/ExecutePayment.html | 12 +
.../PayPal/Test/Api/WebhookEventTypeTest.php | 4 +-
.../Api/BillingAgreementsFunctionalTest.php | 21 +-
.../Api/BillingPlansFunctionalTest.php | 20 +-
.../Functional/Api/InvoiceFunctionalTest.php | 18 +-
.../Functional/Api/PaymentsFunctionalTest.php | 21 +-
.../Api/WebProfileFunctionalTest.php | 18 +-
tests/PayPal/Test/Functional/Setup.php | 49 ++
18 files changed, 757 insertions(+), 84 deletions(-)
create mode 100644 sample/doc/notifications/DeleteAllWebhooks.html
create mode 100644 sample/doc/notifications/DeleteWebhook.html
create mode 100644 sample/doc/notifications/GetWebhook.html
create mode 100644 sample/doc/notifications/ListSubscribedWebhookEventTypes.html
create mode 100644 sample/doc/notifications/ListWebhooks.html
create mode 100644 sample/doc/notifications/SearchWebhookEvents.html
create mode 100644 sample/doc/notifications/UpdateWebhook.html
create mode 100644 sample/doc/notifications/WebhookEventTypesList.html
create mode 100644 sample/doc/notifications/createWebhook.html
create mode 100644 tests/PayPal/Test/Functional/Setup.php
diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js
index 1047527..b5c5960 100644
--- a/sample/doc/assets/behavior.js
+++ b/sample/doc/assets/behavior.js
@@ -1226,6 +1226,477 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
]
}
]
+ }, {
+ "type": "folder",
+ "data": {
+ "path": "notifications",
+ "title": "notifications"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/DeleteAllWebhooks.php",
+ "projectPath": "notifications/DeleteAllWebhooks.php",
+ "targetPath": "notifications/DeleteAllWebhooks",
+ "pageTitle": "notifications/DeleteAllWebhooks",
+ "title": "DeleteAllWebhooks"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Delete All Webhook Sample",
+ "slug": "delete-all-webhook-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "Get Webhook Instance",
+ "slug": "get-webhook-instance"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Delete Webhook",
+ "slug": "delete-webhook"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/DeleteWebhook.php",
+ "projectPath": "notifications/DeleteWebhook.php",
+ "targetPath": "notifications/DeleteWebhook",
+ "pageTitle": "notifications/DeleteWebhook",
+ "title": "DeleteWebhook"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Delete Webhook Sample",
+ "slug": "delete-webhook-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "Get Webhook Instance",
+ "slug": "get-webhook-instance"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Delete Webhook",
+ "slug": "delete-webhook"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/GetWebhook.php",
+ "projectPath": "notifications/GetWebhook.php",
+ "targetPath": "notifications/GetWebhook",
+ "pageTitle": "notifications/GetWebhook",
+ "title": "GetWebhook"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Get Webhook Sample",
+ "slug": "get-webhook-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "Get Webhook ID.",
+ "slug": "get-webhook-id"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Get Webhook",
+ "slug": "get-webhook"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/ListSubscribedWebhookEventTypes.php",
+ "projectPath": "notifications/ListSubscribedWebhookEventTypes.php",
+ "targetPath": "notifications/ListSubscribedWebhookEventTypes",
+ "pageTitle": "notifications/ListSubscribedWebhookEventTypes",
+ "title": "ListSubscribedWebhookEventTypes"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Get Webhook Sample",
+ "slug": "get-webhook-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "List Subscribed Event Types",
+ "slug": "list-subscribed-event-types"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Get List of Subscribed Event Types",
+ "slug": "get-list-of-subscribed-event-types"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/ListWebhooks.php",
+ "projectPath": "notifications/ListWebhooks.php",
+ "targetPath": "notifications/ListWebhooks",
+ "pageTitle": "notifications/ListWebhooks",
+ "title": "ListWebhooks"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Get All Webhooks Sample",
+ "slug": "get-all-webhooks-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "List Webhooks",
+ "slug": "list-webhooks"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Get List of All Webhooks",
+ "slug": "get-list-of-all-webhooks"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/SearchWebhookEvents.php",
+ "projectPath": "notifications/SearchWebhookEvents.php",
+ "targetPath": "notifications/SearchWebhookEvents",
+ "pageTitle": "notifications/SearchWebhookEvents",
+ "title": "SearchWebhookEvents"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Search Webhook Events Sample",
+ "slug": "search-webhook-events-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "Get Webhook Instance",
+ "slug": "get-webhook-instance"
+ },
+ "depth": 2
+ }, {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "PLEASE NOTE:",
+ "slug": "please-note"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Search Webhook events",
+ "slug": "search-webhook-events"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/UpdateWebhook.php",
+ "projectPath": "notifications/UpdateWebhook.php",
+ "targetPath": "notifications/UpdateWebhook",
+ "pageTitle": "notifications/UpdateWebhook",
+ "title": "UpdateWebhook"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Update Webhook Sample",
+ "slug": "update-webhook-sample"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 2,
+ "title": "Get Webhook ID.",
+ "slug": "get-webhook-id"
+ },
+ "depth": 2,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Get Webhook",
+ "slug": "get-webhook"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/WebhookEventTypesList.php",
+ "projectPath": "notifications/WebhookEventTypesList.php",
+ "targetPath": "notifications/WebhookEventTypesList",
+ "pageTitle": "notifications/WebhookEventTypesList",
+ "title": "WebhookEventTypesList"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Get Reference List of all Webhook Event Types",
+ "slug": "get-reference-list-of-all-webhook-event-types"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Get List of all Webhook event types",
+ "slug": "get-list-of-all-webhook-event-types"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }, {
+ "type": "file",
+ "data": {
+ "language": {
+ "nameMatchers": [{}, ".fbp"],
+ "pygmentsLexer": "php",
+ "singleLineComment": ["//"],
+ "ignorePrefix": "}",
+ "foldPrefix": "^",
+ "name": "PHP"
+ },
+ "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/PayPal-PHP-SDK/sample/notifications/createWebhook.php",
+ "projectPath": "notifications/createWebhook.php",
+ "targetPath": "notifications/createWebhook",
+ "pageTitle": "notifications/createWebhook",
+ "title": "createWebhook"
+ },
+ "depth": 2,
+ "outline": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Create Webhook Sample",
+ "slug": "create-webhook-sample"
+ },
+ "depth": 1
+ }, {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Basic Information",
+ "slug": "basic-information"
+ },
+ "depth": 1
+ }, {
+ "type": "heading",
+ "data": {
+ "level": 1,
+ "title": "Event Types",
+ "slug": "event-types"
+ },
+ "depth": 1,
+ "children": [
+ {
+ "type": "heading",
+ "data": {
+ "level": 3,
+ "title": "Create Webhook",
+ "slug": "create-webhook"
+ },
+ "depth": 3
+ }
+ ]
+ }
+ ]
+ }
+ ]
}, {
"type": "folder",
"data": {
diff --git a/sample/doc/notifications/DeleteAllWebhooks.html b/sample/doc/notifications/DeleteAllWebhooks.html
new file mode 100644
index 0000000..ae3732c
--- /dev/null
+++ b/sample/doc/notifications/DeleteAllWebhooks.html
@@ -0,0 +1,15 @@
+notifications/DeleteAllWebhooks
+$webhookList = require 'ListWebhooks.php' ;
try {
+ foreach ($webhookList ->getWebhooks() as $webhook ) {
+ $webhook ->delete($apiContext );
+ }
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Deleted all Webhooks" , "WebhookList" , null , null , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Delete all Webhook, as it may have exceed the maximum count." , "WebhookList" , null , null , null );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/DeleteWebhook.html b/sample/doc/notifications/DeleteWebhook.html
new file mode 100644
index 0000000..58a5568
--- /dev/null
+++ b/sample/doc/notifications/DeleteWebhook.html
@@ -0,0 +1,14 @@
+notifications/DeleteWebhook
+$webhook = require 'CreateWebhook.php' ;
try {
+ $output = $webhook ->delete($apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Delete a Webhook" , "Webhook" , null , $webhookId , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Delete a Webhook" , "Webhook" , $webhook ->getId(), null , null );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/GetWebhook.html b/sample/doc/notifications/GetWebhook.html
new file mode 100644
index 0000000..effe762
--- /dev/null
+++ b/sample/doc/notifications/GetWebhook.html
@@ -0,0 +1,17 @@
+notifications/GetWebhook
+$webhook = require 'CreateWebhook.php' ;
+$webhookId = $webhook ->getId();
try {
+ $output = \PayPal\Api\Webhook::get($webhookId , $apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Get a Webhook" , "Webhook" , null , $webhookId , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Get a Webhook" , "Webhook" , $output ->getId(), null , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/ListSubscribedWebhookEventTypes.html b/sample/doc/notifications/ListSubscribedWebhookEventTypes.html
new file mode 100644
index 0000000..85262c9
--- /dev/null
+++ b/sample/doc/notifications/ListSubscribedWebhookEventTypes.html
@@ -0,0 +1,16 @@
+notifications/ListSubscribedWebhookEventTypes
+$webhook = require 'CreateWebhook.php' ;
+$webhookId = $webhook ->getId();
try {
+ $output = \PayPal\Api\WebhookEventType::subscribedEventTypes($webhookId , $apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("List subscribed webhook event types" , "WebhookEventTypeList" , null , $webhookId , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("List subscribed webhook event types" , "WebhookEventTypeList" ,null , null , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/ListWebhooks.html b/sample/doc/notifications/ListWebhooks.html
new file mode 100644
index 0000000..a001b39
--- /dev/null
+++ b/sample/doc/notifications/ListWebhooks.html
@@ -0,0 +1,16 @@
+notifications/ListWebhooks
+$webhook = require_once __DIR__ . '/../bootstrap.php' ;
try {
+ $output = \PayPal\Api\Webhook::getAll($apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("List all webhooks" , "WebhookList" , null , $webhookId , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("List all webhooks" , "WebhookList" ,null , null , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/SearchWebhookEvents.html b/sample/doc/notifications/SearchWebhookEvents.html
new file mode 100644
index 0000000..e446d18
--- /dev/null
+++ b/sample/doc/notifications/SearchWebhookEvents.html
@@ -0,0 +1,19 @@
+notifications/SearchWebhookEvents
+$webhook = require 'CreateWebhook.php' ;
+
+$params = array ();
try {
+ $output = \PayPal\Api\WebhookEvent::all($params , $apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Search Webhook events" , "WebhookEventList" , null , $webhookId , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Search Webhook events" , "WebhookEventList" , $webhook ->getId(), $params , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/UpdateWebhook.html b/sample/doc/notifications/UpdateWebhook.html
new file mode 100644
index 0000000..cd52035
--- /dev/null
+++ b/sample/doc/notifications/UpdateWebhook.html
@@ -0,0 +1,43 @@
+notifications/UpdateWebhook
+$webhook = require 'CreateWebhook.php' ;
$patch = new \PayPal\Api\Patch();
+$patch ->setOp("replace" )
+ ->setPath("/url" )
+ ->setValue("https://requestb.in/10ujt3c1?uniqid=" . uniqid());
+
+$patch2 = new \PayPal\Api\Patch();
+$patch2 ->setOp("replace" )
+ ->setPath("/event_types" )
+ ->setValue(json_decode('[{"name":"PAYMENT.SALE.REFUNDED"}]' ));
+
+$patchRequest = new \PayPal\Api\PatchRequest();
+$patchRequest ->addPatch($patch )->addPatch($patch2 );
try {
+ $output = $webhook ->update($patchRequest , $apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Updated a Webhook" , "Webhook" , null , $patchRequest , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Updated a Webhook" , "Webhook" , $output ->getId(), $patchRequest , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/WebhookEventTypesList.html b/sample/doc/notifications/WebhookEventTypesList.html
new file mode 100644
index 0000000..554a027
--- /dev/null
+++ b/sample/doc/notifications/WebhookEventTypesList.html
@@ -0,0 +1,13 @@
+notifications/WebhookEventTypesList $apiContext = require __DIR__ . '/../bootstrap.php' ;
try {
+ $output = \PayPal\Api\WebhookEventType::availableEventTypes($apiContext );
+} catch (Exception $ex ) {
+ ResultPrinter::printError("Get List of All Webhook Event Types" , "WebhookEventTypeList" , null , null , $ex );
+ exit (1 );
+}
+
+ResultPrinter::printResult("Get List of All Webhook Event Types" , "WebhookEventTypeList" , null , null , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/notifications/createWebhook.html b/sample/doc/notifications/createWebhook.html
new file mode 100644
index 0000000..16fcb90
--- /dev/null
+++ b/sample/doc/notifications/createWebhook.html
@@ -0,0 +1,54 @@
+notifications/createWebhook require __DIR__ . '/../bootstrap.php' ;
$webhook = new \PayPal\Api\Webhook();
$webhook ->setUrl("https://requestb.in/10ujt3c1?uniqid=" . uniqid());
$webhookEventTypes = array ();
+$webhookEventTypes [] = new \PayPal\Api\WebhookEventType(
+ '{
+ "name":"PAYMENT.AUTHORIZATION.CREATED"
+ }'
+);
+$webhookEventTypes [] = new \PayPal\Api\WebhookEventType(
+ '{
+ "name":"PAYMENT.AUTHORIZATION.VOIDED"
+ }'
+);
+$webhook ->setEventTypes($webhookEventTypes );
$request = clone $webhook ;
try {
+ $output = $webhook ->create($apiContext );
+} catch (Exception $ex ) {
// Ignore workflow code segment
+ if ($ex instanceof \PayPal\Exception \PPConnectionException) {
+ $data = $ex ->getData();
+ ResultPrinter::printError("Created Webhook Failed. Checking if it is Webhook Number Limit Exceeded. Trying to delete all existing webhooks" , "Webhook" , "Please Use <a style='color: red;' href='DeleteAllWebhooks.php' >Delete All Webhooks</a> Sample to delete all existing webhooks in sample" , $request , $ex );
+ if (strpos($data ,'WEBHOOK_NUMBER_LIMIT_EXCEEDED' ) !== false ) {
+ require 'DeleteAllWebhooks.php' ;
+ try {
+ $output = $webhook ->create($apiContext );
+ } catch (Exception $ex ) {
+ ResultPrinter::printError("Created Webhook" , "Webhook" , null , $request , $ex );
+ exit (1 );
+ }
+ } else {
+ ResultPrinter::printError("Created Webhook" , "Webhook" , null , $request , $ex );
+ exit (1 );
+ }
+ } else {
+ ResultPrinter::printError("Created Webhook" , "Webhook" , null , $request , $ex );
+ exit (1 );
+ }
}
+
+ResultPrinter::printResult("Created Webhook" , "Webhook" , $output ->getId(), $request , $output );
+
+return $output ;
\ No newline at end of file
diff --git a/sample/doc/payments/ExecutePayment.html b/sample/doc/payments/ExecutePayment.html
index 9693d74..ba7c7e5 100644
--- a/sample/doc/payments/ExecutePayment.html
+++ b/sample/doc/payments/ExecutePayment.html
@@ -24,6 +24,18 @@ when the user is redirected from paypal back to your site
"Executed Payment", "Payment" , $payment ->getId(), $execution , $result );
+ try {
+ $payment = Payment::get($paymentId , $apiContext );
+ } catch (Exception $ex ) {
+ ResultPrinter::printError("Get Payment" , "Payment" , null , null , $ex );
+ exit (1 );
+ }
+
+ ResultPrinter::printResult("Get Payment" , "Payment" , $payment ->getId(), null , $payment );
+
+ return $payment ;
+
+
} else {
ResultPrinter::printResult("User Cancelled the Approval" , null );
}
Delete All Webhook Sample
+This is a sample helper method, to delete all existing webhooks, because of limited number of webhooks that are allowed per app. +To properly use the sample, change the clientId and Secret from bootstrap.php file with your own app ClientId and Secret.