本文整理汇总了PHP中PayPal\Api\Payment::getCreateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::getCreateTime方法的具体用法?PHP Payment::getCreateTime怎么用?PHP Payment::getCreateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal\Api\Payment
的用法示例。
在下文中一共展示了Payment::getCreateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetters
/**
* @depends testSerializationDeserialization
* @param Payment $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getIntent(), "TestSample");
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
$this->assertEquals($obj->getCart(), "TestSample");
$this->assertEquals($obj->getTransactions(), TransactionTest::getObject());
$this->assertEquals($obj->getFailedTransactions(), ErrorTest::getObject());
$this->assertEquals($obj->getPaymentInstruction(), PaymentInstructionTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getExperienceProfileId(), "TestSample");
$this->assertEquals($obj->getRedirectUrls(), RedirectUrlsTest::getObject());
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
示例2: testGetters
/**
* @depends testSerializationDeserialization
* @param Payment $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getIntent(), "TestSample");
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
$this->assertEquals($obj->getPotentialPayerInfo(), PotentialPayerInfoTest::getObject());
$this->assertEquals($obj->getPayee(), PayeeTest::getObject());
$this->assertEquals($obj->getCart(), "TestSample");
$this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject()));
$this->assertEquals($obj->getFailedTransactions(), ErrorTest::getObject());
$this->assertEquals($obj->getBillingAgreementTokens(), array("TestSample"));
$this->assertEquals($obj->getCreditFinancingOffered(), CreditFinancingOfferedTest::getObject());
$this->assertEquals($obj->getPaymentInstruction(), PaymentInstructionTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getExperienceProfileId(), "TestSample");
$this->assertEquals($obj->getNoteToPayer(), "TestSample");
$this->assertEquals($obj->getRedirectUrls(), RedirectUrlsTest::getObject());
$this->assertEquals($obj->getFailureReason(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
示例3: createPayment
public function createPayment($orderid, $userid)
{
if ($orderid > 0) {
$orderid = (int) $orderid;
$paypalCredentials = $this->getPaypalCredentials();
$apiContext = new ApiContext(new OAuthTokenCredential($paypalCredentials["clientid"], $paypalCredentials["secret"]));
$apiContext->setConfig($this->paypalConfig);
$payer = new Payer();
$payer->setPayment_method("paypal");
$order = new Orders();
$orderdetail = $order->getOrderDetail($orderid);
//Setting up items for the paypal order detail
//On future version this will have multiple packages based on cart content
//When items were added api were responding abnormal
/*
$item = new Item();
$item->setName($orderdetail["title"]);
$item->setCurrency($orderdetail["currency"]);
$item->setQuantity($orderdetail["quantity"]);
$item->setPrice($orderdetail["package_price"]);
$item->setSku($orderdetail["package_guid"]);
$itemList = new ItemList();
$itemList->setItems(array($item));
*/
$amount = new Amount();
$amount->setCurrency($orderdetail["currency"]);
$amount->setTotal($orderdetail["total"]);
$orderDescription = "Qty: " . $orderdetail["quantity"] . " for " . $orderdetail["title"] . " - " . $orderdetail["title_summary"];
$transaction = new Transaction();
$transaction->setDescription($orderDescription);
$transaction->setAmount($amount);
//$transaction->setItemlist($itemList);
$redirectUrls = new RedirectUrls();
$humanorderid = $order->getHumanOrderId($orderid);
$redirectUrls->setReturn_url($paypalCredentials["returnurl"] . "&orderid=" . $humanorderid);
$redirectUrls->setCancel_url($paypalCredentials["cancelurl"] . "&orderid=" . $humanorderid);
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
$payment->setRedirect_urls($redirectUrls);
$payment->setTransactions(array($transaction));
try {
$payment->create($apiContext);
$this->setPaypalInfoOrder($orderid, $payment->getId(), $payment->getCreateTime(), $payment->getUpdateTime(), $payment->getState(), $userid);
// Retrieve buyer approval url from the `payment` object.
foreach ($payment->getLinks() as $link) {
if ($link->getRel() == 'approval_url') {
$approvalUrl = $link->getHref();
}
}
$result = array("status" => true, "approval_url" => $approvalUrl);
return $result;
} catch (PayPal\Exception\PPConnectionException $ex) {
//Logging error
$this->log->addError($ex->getMessage() . LOG_LINESEPARATOR . "TRACE: " . $ex->getTraceAsString() . LOG_LINESEPARATOR);
$result = array("status" => false, "approval_url" => "");
return $result;
}
} else {
//Logging error
$this->log->addWarning("Invalid or null order id." . LOG_LINESEPARATOR);
$result = array("status" => false, "approval_url" => "");
return $result;
}
}