Skip to content

Commit

Permalink
Merge pull request #207 from angelleye/PPL-170
Browse files Browse the repository at this point in the history
Ppl 170
  • Loading branch information
Drew Angell authored Feb 2, 2020
2 parents c7fcb1e + 809a028 commit dba94d6
Show file tree
Hide file tree
Showing 8 changed files with 2,589 additions and 0 deletions.
31 changes: 31 additions & 0 deletions samples/rest/invoice_v2/CancelInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);
$PayPal = new InvoiceAPIv2($configArray);

$cancelNotification = array(
'subject' => 'Past due', // Subject of the notification.
'note' => 'Canceling invoice', // Note to the payer.
'send_to_invoicer' => true, // Indicates whether to send a copy of the notification to the merchant.
'send_to_recipient' => true, // Indicates whether to send a copy of the notification to the payer.
'additional_recipients' => array(), // Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported.
);

$InvoiceID = 'INV2-YZZF-D7VN-P2YM-9ZH2'; // Required. Specify the ID of the invoice to cancel.

$returnArray = $PayPal->CancelInvoice($cancelNotification,$InvoiceID);
echo "<pre>";
print_r($returnArray);
23 changes: 23 additions & 0 deletions samples/rest/invoice_v2/DeleteInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);
$PayPal = new InvoiceAPIv2($configArray);

$InvoiceID = 'INV2-YZZF-D7VN-P2YM-9ZH2'; // Required. The ID of the invoice for which to show details.

$returnArray = $PayPal->DeleteInvoice($InvoiceID);
echo "<pre>";
print_r($returnArray);
23 changes: 23 additions & 0 deletions samples/rest/invoice_v2/GetInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);

$PayPal = new InvoiceAPIv2($configArray);;
$InvoiceID = 'INV2-9LG8-P8ZN-4MPN-F5PA'; //Required. The ID of the invoice for which to show details.

$returnArray = $PayPal->GetInvoice($InvoiceID);
echo "<pre>";
print_r($returnArray);

21 changes: 21 additions & 0 deletions samples/rest/invoice_v2/GetNextInvoiceNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);
$PayPal = new InvoiceAPIv2($configArray);

$returnArray = $PayPal->GetNextInvoiceNumber();
echo "<pre>";
print_r($returnArray);
27 changes: 27 additions & 0 deletions samples/rest/invoice_v2/ListInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);
$PayPal = new InvoiceAPIv2($configArray);

$parameters = array(
'page' => '0', // A zero-relative index of the list of merchant invoices.
'page_size' => '4', // The number of invoices to list beginning with the specified page.
'total_count_required ' => 'true', // Indicates whether the total count appears in the response. Default is false.
);

$returnArray = $PayPal->ListInvoice($parameters);
echo "<pre>";
print_r($returnArray);
23 changes: 23 additions & 0 deletions samples/rest/invoice_v2/SendInvoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use angelleye\PayPal\rest\invoice\InvoiceAPIv2;

// Include required library files.
require_once('../../../autoload.php');
require_once('../../../includes/config.php');

$configArray = array(
'Sandbox' => $sandbox,
'ClientID' => $rest_client_id,
'ClientSecret' => $rest_client_secret,
'LogResults' => $log_results,
'LogPath' => $log_path,
'LogLevel' => $log_level
);
$PayPal = new InvoiceAPIv2($configArray);

$InvoiceID = 'INV2-YZZF-D7VN-P2YM-9ZH2'; // Required. The ID of the invoice to send.

$returnArray = $PayPal->SendInvoice($InvoiceID);
echo "<pre>";
print_r($returnArray);
Loading

0 comments on commit dba94d6

Please sign in to comment.