forked from LiveCarta/PayPal-PHP-SDK
Adding apiContext arg for static methods
This commit is contained in:
@@ -249,14 +249,17 @@ class CreditCard extends Resource implements IResource {
|
||||
* @path /v1/vault/credit-card/:credit-card-id
|
||||
* @method GET
|
||||
* @param string $creditcardid
|
||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||
*/
|
||||
public static function get( $creditcardid) {
|
||||
if (($creditcardid == null) || (strlen($creditcardid) <= 0)) {
|
||||
throw new \InvalidArgumentException("creditcardid cannot be null or empty");
|
||||
}
|
||||
$payLoad = "";
|
||||
|
||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
||||
if($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new \PPRestCall();
|
||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||
"/v1/vault/credit-card/$creditcardid",
|
||||
"GET", $payLoad);
|
||||
|
||||
@@ -177,12 +177,15 @@ class Payment extends Resource implements IResource {
|
||||
* sort_by,
|
||||
* sort_order,
|
||||
* All other keys in the map are ignored by the SDK
|
||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||
*/
|
||||
public static function all($params) {
|
||||
$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, );
|
||||
|
||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
||||
if($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new \PPRestCall();
|
||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||
"/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||
"GET", $payLoad);
|
||||
@@ -215,14 +218,17 @@ class Payment extends Resource implements IResource {
|
||||
* @path /v1/payments/payment/:payment-id
|
||||
* @method GET
|
||||
* @param string $paymentid
|
||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||
*/
|
||||
public static function get( $paymentid) {
|
||||
if (($paymentid == null) || (strlen($paymentid) <= 0)) {
|
||||
throw new \InvalidArgumentException("paymentid cannot be null or empty");
|
||||
}
|
||||
$payLoad = "";
|
||||
|
||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
||||
if($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new \PPRestCall();
|
||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||
"/v1/payments/payment/$paymentid",
|
||||
"GET", $payLoad);
|
||||
|
||||
@@ -182,14 +182,17 @@ class Refund extends Resource implements IResource {
|
||||
* @path /v1/payments/refund/:refund-id
|
||||
* @method GET
|
||||
* @param string $refundid
|
||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||
*/
|
||||
public static function get( $refundid) {
|
||||
if (($refundid == null) || (strlen($refundid) <= 0)) {
|
||||
throw new \InvalidArgumentException("refundid cannot be null or empty");
|
||||
}
|
||||
$payLoad = "";
|
||||
|
||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
||||
if($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new \PPRestCall();
|
||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||
"/v1/payments/refund/$refundid",
|
||||
"GET", $payLoad);
|
||||
|
||||
@@ -134,14 +134,17 @@ class Sale extends Resource implements IResource {
|
||||
* @path /v1/payments/sale/:sale-id
|
||||
* @method GET
|
||||
* @param string $saleid
|
||||
* @param PayPal\Rest\ApiContext $apiContext optional
|
||||
*/
|
||||
public static function get( $saleid) {
|
||||
if (($saleid == null) || (strlen($saleid) <= 0)) {
|
||||
throw new \InvalidArgumentException("saleid cannot be null or empty");
|
||||
}
|
||||
$payLoad = "";
|
||||
|
||||
$apiContext = new ApiContext(self::$credential); $call = new \PPRestCall();
|
||||
if($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
}
|
||||
$call = new \PPRestCall();
|
||||
$json = $call->execute($apiContext, array('PayPal\Rest\RestHandler'),
|
||||
"/v1/payments/sale/$saleid",
|
||||
"GET", $payLoad);
|
||||
|
||||
Reference in New Issue
Block a user