forked from LiveCarta/PayPal-PHP-SDK
Adding apiContext arg for static methods
This commit is contained in:
@@ -230,7 +230,7 @@ class CreditCard extends Resource implements IResource {
|
|||||||
* @path /v1/vault/credit-card
|
* @path /v1/vault/credit-card
|
||||||
* @method POST
|
* @method POST
|
||||||
|
|
||||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public function create( $apiContext=null) {
|
public function create( $apiContext=null) {
|
||||||
$payLoad = $this->toJSON();
|
$payLoad = $this->toJSON();
|
||||||
@@ -248,15 +248,18 @@ class CreditCard extends Resource implements IResource {
|
|||||||
/**
|
/**
|
||||||
* @path /v1/vault/credit-card/:credit-card-id
|
* @path /v1/vault/credit-card/:credit-card-id
|
||||||
* @method GET
|
* @method GET
|
||||||
* @param string $creditcardid
|
* @param string $creditcardid
|
||||||
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public static function get( $creditcardid) {
|
public static function get( $creditcardid) {
|
||||||
if (($creditcardid == null) || (strlen($creditcardid) <= 0)) {
|
if (($creditcardid == null) || (strlen($creditcardid) <= 0)) {
|
||||||
throw new \InvalidArgumentException("creditcardid cannot be null or empty");
|
throw new \InvalidArgumentException("creditcardid cannot be null or empty");
|
||||||
}
|
}
|
||||||
$payLoad = "";
|
$payLoad = "";
|
||||||
|
if($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
$apiContext = new ApiContext(self::$credential);
|
||||||
|
}
|
||||||
|
$call = new \PPRestCall();
|
||||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||||
"/v1/vault/credit-card/$creditcardid",
|
"/v1/vault/credit-card/$creditcardid",
|
||||||
"GET", $payLoad);
|
"GET", $payLoad);
|
||||||
|
|||||||
@@ -176,13 +176,16 @@ class Payment extends Resource implements IResource {
|
|||||||
* payee_id,
|
* payee_id,
|
||||||
* sort_by,
|
* sort_by,
|
||||||
* sort_order,
|
* sort_order,
|
||||||
* All other keys in the map are ignored by the SDK
|
* All other keys in the map are ignored by the SDK
|
||||||
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public static function all($params) {
|
public static function all($params) {
|
||||||
$payLoad = "";
|
$payLoad = "";
|
||||||
$allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1, );
|
$allowedParams = array('count' => 1, 'start_id' => 1, 'start_index' => 1, 'start_time' => 1, 'end_time' => 1, 'payee_id' => 1, 'sort_by' => 1, 'sort_order' => 1, );
|
||||||
|
if($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
$apiContext = new ApiContext(self::$credential);
|
||||||
|
}
|
||||||
|
$call = new \PPRestCall();
|
||||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||||
"/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
"/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||||
"GET", $payLoad);
|
"GET", $payLoad);
|
||||||
@@ -196,7 +199,7 @@ class Payment extends Resource implements IResource {
|
|||||||
* @path /v1/payments/payment
|
* @path /v1/payments/payment
|
||||||
* @method POST
|
* @method POST
|
||||||
|
|
||||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public function create( $apiContext=null) {
|
public function create( $apiContext=null) {
|
||||||
$payLoad = $this->toJSON();
|
$payLoad = $this->toJSON();
|
||||||
@@ -214,15 +217,18 @@ class Payment extends Resource implements IResource {
|
|||||||
/**
|
/**
|
||||||
* @path /v1/payments/payment/:payment-id
|
* @path /v1/payments/payment/:payment-id
|
||||||
* @method GET
|
* @method GET
|
||||||
* @param string $paymentid
|
* @param string $paymentid
|
||||||
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public static function get( $paymentid) {
|
public static function get( $paymentid) {
|
||||||
if (($paymentid == null) || (strlen($paymentid) <= 0)) {
|
if (($paymentid == null) || (strlen($paymentid) <= 0)) {
|
||||||
throw new \InvalidArgumentException("paymentid cannot be null or empty");
|
throw new \InvalidArgumentException("paymentid cannot be null or empty");
|
||||||
}
|
}
|
||||||
$payLoad = "";
|
$payLoad = "";
|
||||||
|
if($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
$apiContext = new ApiContext(self::$credential);
|
||||||
|
}
|
||||||
|
$call = new \PPRestCall();
|
||||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||||
"/v1/payments/payment/$paymentid",
|
"/v1/payments/payment/$paymentid",
|
||||||
"GET", $payLoad);
|
"GET", $payLoad);
|
||||||
@@ -236,7 +242,7 @@ class Payment extends Resource implements IResource {
|
|||||||
* @path /v1/payments/payment/:payment-id/execute
|
* @path /v1/payments/payment/:payment-id/execute
|
||||||
* @method POST
|
* @method POST
|
||||||
* @param PaymentExecution $payment_execution
|
* @param PaymentExecution $payment_execution
|
||||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public function execute( $payment_execution, $apiContext=null) {
|
public function execute( $payment_execution, $apiContext=null) {
|
||||||
if ($payment_execution == null) {
|
if ($payment_execution == null) {
|
||||||
|
|||||||
@@ -181,15 +181,18 @@ class Refund extends Resource implements IResource {
|
|||||||
/**
|
/**
|
||||||
* @path /v1/payments/refund/:refund-id
|
* @path /v1/payments/refund/:refund-id
|
||||||
* @method GET
|
* @method GET
|
||||||
* @param string $refundid
|
* @param string $refundid
|
||||||
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public static function get( $refundid) {
|
public static function get( $refundid) {
|
||||||
if (($refundid == null) || (strlen($refundid) <= 0)) {
|
if (($refundid == null) || (strlen($refundid) <= 0)) {
|
||||||
throw new \InvalidArgumentException("refundid cannot be null or empty");
|
throw new \InvalidArgumentException("refundid cannot be null or empty");
|
||||||
}
|
}
|
||||||
$payLoad = "";
|
$payLoad = "";
|
||||||
|
if($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
$apiContext = new ApiContext(self::$credential);
|
||||||
|
}
|
||||||
|
$call = new \PPRestCall();
|
||||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||||
"/v1/payments/refund/$refundid",
|
"/v1/payments/refund/$refundid",
|
||||||
"GET", $payLoad);
|
"GET", $payLoad);
|
||||||
|
|||||||
@@ -133,15 +133,18 @@ class Sale extends Resource implements IResource {
|
|||||||
/**
|
/**
|
||||||
* @path /v1/payments/sale/:sale-id
|
* @path /v1/payments/sale/:sale-id
|
||||||
* @method GET
|
* @method GET
|
||||||
* @param string $saleid
|
* @param string $saleid
|
||||||
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public static function get( $saleid) {
|
public static function get( $saleid) {
|
||||||
if (($saleid == null) || (strlen($saleid) <= 0)) {
|
if (($saleid == null) || (strlen($saleid) <= 0)) {
|
||||||
throw new \InvalidArgumentException("saleid cannot be null or empty");
|
throw new \InvalidArgumentException("saleid cannot be null or empty");
|
||||||
}
|
}
|
||||||
$payLoad = "";
|
$payLoad = "";
|
||||||
|
if($apiContext == null) {
|
||||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
$apiContext = new ApiContext(self::$credential);
|
||||||
|
}
|
||||||
|
$call = new \PPRestCall();
|
||||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||||
"/v1/payments/sale/$saleid",
|
"/v1/payments/sale/$saleid",
|
||||||
"GET", $payLoad);
|
"GET", $payLoad);
|
||||||
@@ -155,7 +158,7 @@ class Sale extends Resource implements IResource {
|
|||||||
* @path /v1/payments/sale/:sale-id/refund
|
* @path /v1/payments/sale/:sale-id/refund
|
||||||
* @method POST
|
* @method POST
|
||||||
* @param Refund $refund
|
* @param Refund $refund
|
||||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||||
*/
|
*/
|
||||||
public function refund( $refund, $apiContext=null) {
|
public function refund( $refund, $apiContext=null) {
|
||||||
if ($refund == null) {
|
if ($refund == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user