本文整理汇总了PHP中PayPal\Api\Payment::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::all方法的具体用法?PHP Payment::all怎么用?PHP Payment::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal\Api\Payment
的用法示例。
在下文中一共展示了Payment::all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList($count = 10, $index = 0)
{
$apiContext = $this->connectionService->getApiContext();
$dispatcher = $this->connectionService->getDispatcher();
$dispatcher->dispatch(PaymentEvent::GET_ALL_START);
$params = array('count' => $count, 'start_index' => $index);
$payments = Payment::all($params, $apiContext);
$dispatcher->dispatch(PaymentEvent::GET_ALL_END);
return $payments->getPayments();
}
示例2: testOperations
public function testOperations()
{
$p1 = $this->payments['new'];
$p1->create();
$this->assertNotNull($p1->getId());
$p2 = Payment::get($p1->getId());
$this->assertNotNull($p2);
$paymentHistory = Payment::all(array('count' => '10'));
$this->assertNotNull($paymentHistory);
}
示例3: all
public static function all($param, $apiContext = null)
{
if (isset($apiContext)) {
return Payment::all($param, $apiContext);
}
return Payment::all($param);
}
示例4: catch
// you've created using the Payments API.
// Note various query parameters that you can
// use to filter, and paginate through the
// payments list.
// API used: GET /v1/payments/payments
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Payment;
// ### Retrieve payment
// Retrieve the PaymentHistory object by calling the
// static `get` method on the Payment class,
// and pass a Map object that contains
// query parameters for paginations and filtering.
// Refer the method doc for valid values for keys
// (See bootstrap.php for more on `ApiContext`)
try {
$payments = Payment::all(array('count' => 10, 'start_index' => 5), $apiContext);
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<head>
<title>Lookup payment history</title>
</head>
<body>
<div>Got <?php
echo $payments->getCount();
?>
matching payments </div>
示例5: array
<?php
// #GetPaymentList
// This sample code demonstrate how you can
// retrieve a list of all Payment resources
// you've created using the Payments API.
// Note various query parameters that you can
// use to filter, and paginate through the
// payments list.
// API used: GET /v1/payments/payments
require 'CreatePayment.php';
use PayPal\Api\Payment;
// ### Retrieve payment
// Retrieve the PaymentHistory object by calling the
// static `get` method on the Payment class,
// and pass a Map object that contains
// query parameters for paginations and filtering.
// Refer the method doc for valid values for keys
// (See bootstrap.php for more on `ApiContext`)
try {
$params = array('count' => 10, 'start_index' => 5);
$payments = Payment::all($params, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("List Payments", "Payment", null, $params, $ex);
exit(1);
}
ResultPrinter::printResult("List Payments", "Payment", null, $params, $payments);
示例6: testList
/**
* @dataProvider mockProvider
* @param Payment $obj
*/
public function testList($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
$mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(PaymentHistoryTest::getJson()));
$params = array();
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
示例7: getPaymentList
/**
* Get payment list
*
* @param int $limit Limit number payment
* @param int $offset Start index payment
* @return mixed Object payment list
*/
public function getPaymentList($limit = 10, $offset = 0)
{
$params = ['count' => $limit, 'start_index' => $offset];
try {
$payments = Payment::all($params, $this->apiContext);
} catch (\PayPal\Exception\PPConnectionException $paypalException) {
throw new \Exception($paypalException->getMessage());
}
return $payments;
}
示例8: catch
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Payment;
// ### Authentication
// Pass in a `OAuthTokenCredential` object
// explicilty to authenticate the call.
// If you skip this step, the client id/secret
// set in the config file will be used.
Payment::setCredential($cred);
// ### Retrieve payment
// Retrieve the PaymentHistory object by calling the
// static `get` method on the Payment class,
// and pass a Map object that contains
// query parameters for paginations and filtering.
// Refer the method doc for valid values for keys
try {
$payments = Payment::all(array('count' => 10, 'start_index' => 5));
} catch (\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
?>
<html>
<body>
<div>Got <?php
echo $payments->getCount();
?>
matching payments </div>
<pre><?php
var_dump($payments->toArray());
?>
示例9: array
function get_payments($count, $offset)
{
// auth
$apiContext = $this->apiContext();
$params = array('count' => $count, 'start_index' => $offset);
try {
// Get the payment Object by passing paymentId
$PaymentHistory = Payment::all($params, $apiContext);
$valid = true;
} catch (Exception $ex) {
$this->LoggingManager->log(print_r($ex, true), 'DEBUG');
$valid = false;
}
$payment_array = array();
if ($valid === true) {
$payments = $PaymentHistory->getPayments();
for ($p = 0, $x = count($payments); $p < $x; $p++) {
$payment_array[$p] = $this->get_payment_details($payments[$p], true);
}
}
return $payment_array;
}