本文整理汇总了PHP中PayPal::isError方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::isError方法的具体用法?PHP PayPal::isError怎么用?PHP PayPal::isError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::isError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteProfile
function deleteProfile($id)
{
$retval = $this->validateParams();
if (PayPal::isError($retval)) {
return $retval;
}
$delete_file = $this->_getFileName($id);
if (!@unlink($delete_file)) {
return PayPal::raiseError("Could not delete the Profile file '{$delete_file}'");
}
return true;
}
示例2: sendDirectPaymentRequest
public function sendDirectPaymentRequest($authorization = true, array $options = null)
{
if ($options != null) {
$this->setOptions($options);
}
$this->buildDirectPaymentRequest($authorization);
$caller =& PayPal::getCallerServices($this->profile);
$isError = true;
if (method_exists($caller, 'DoDirectPayment')) {
$response = $caller->DoDirectPayment($this->request);
$isError = PayPal::isError($response);
$this->buildErrors($response);
}
if (!$isError && $response->getAck() == 'Success') {
$this->transactionID = $response->TransactionID;
return true;
} else {
$this->transactionID = -1;
return false;
}
}
示例3: SampleLogger
$was_submitted = false;
$logger = new SampleLogger('CaptureReceipt.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$capture_request =& PayPal::getType('DoCaptureRequestType');
if (PayPal::isError($capture_request)) {
$logger->_log('Error in request: ' . $capture_request);
} else {
$logger->_log('Create request: ' . $capture_request);
}
// Set request fields
$authorization_id = $_POST['authorization_id'];
if (isset($authorization_id)) {
$capture_request->setAuthorizationID($authorization_id, 'iso-8859-1');
}
$complete_code_type = $_POST['CompleteCodeType'];
$capture_request->setCompleteType($complete_code_type);
$invoice_id = $_POST['invoice_id'];
if (isset($invoice_id)) {
$capture_request->setInvoiceID($invoice_id);
}
示例4: getInstance
/**
* Factory for creating instances of the EWPProfile. Used when
* providing an existing Profile ID to load from
*
* @param string The Profile ID of this instance
* @param object A valid Profile Handler instance
* @return object A new instance of EWPProfile for the given ID or a PayPal error object on failure
*/
function getInstance($id, &$handler)
{
$classname = __CLASS__;
$inst = new $classname($id, $handler);
$result = $inst->_load();
if (PayPal::isError($result)) {
return $result;
}
return $inst;
}
示例5: getValidEnvironments
/**
* Returns an array of valid Environments
*
* @return array An array of valid environment names
*/
function getValidEnvironments()
{
if (empty($this->_validEnvironments)) {
$res = $this->loadEnvironments();
if (PayPal::isError($res)) {
return $res;
}
}
return $this->_validEnvironments;
}
示例6: SampleLogger
$was_submitted = false;
$logger = new SampleLogger('VoidReceipt.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$void_request =& PayPal::getType('DoVoidRequestType');
if (PayPal::isError($void_request)) {
$logger->_log('Error in request: ' . print_r($void_request, true));
} else {
$logger->_log('Create request: ' . print_r($void_request, true));
}
// Set request fields
$authorization_id = $_POST['authorization_id'];
if (isset($authorization_id)) {
$void_request->setAuthorizationID($authorization_id, 'iso-8859-1');
}
$note = $_POST['note'];
if (isset($note)) {
$void_request->setNote($note);
}
$logger->_log('Initial request: ' . print_r($void_request, true));
$caller =& PayPal::getCallerServices($profile);
示例7: getCaller
/**
* Get an instance of a caller
*
* @return bool
*/
private function getCaller()
{
$handler =& ProfileHandler_Array::getInstance(array('username' => $this->api_username, 'certificateFile' => $this->api_certificate, 'signature' => $this->api_signature, 'subject' => $this->api_subject, 'environment' => $this->api_test ? 'Sandbox' : 'Live'));
$profile =& APIProfile::getInstance($this->api_username, $handler);
$profile->setAPIPassword($this->api_password);
$this->api_caller =& PayPal::getCallerServices($profile);
if (PayPal::isError($this->api_caller)) {
$this->api_error_string = $this->api_caller->getMessage();
return false;
}
return true;
}
示例8: SampleLogger
$was_submitted = false;
$logger = new SampleLogger('RefundReceipt.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$refund_request =& PayPal::getType('RefundTransactionRequestType');
if (PayPal::isError($refund_request)) {
$logger->_log('Error in request: ' . print_r($refund_request, true));
} else {
$logger->_log('Create request: ' . print_r($refund_request, true));
}
// Transaction ID is required
$tran_id = $_POST['transactionID'];
if (isset($tran_id)) {
$refund_request->setTransactionId($tran_id, 'iso-8859-1');
} else {
// Error: transaction ID is required
$location = 'RefundTransaction.php';
header("Location: {$location}");
}
// refundType is optional and must be translated
// amount is optional
示例9: SampleLogger
$logger = new SampleLogger('TransactionDetails.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
header("Location: index.php");
exit;
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
// $trans_details = new TransactionSearchRequestType();
$trans_details =& PayPal::getType('GetTransactionDetailsRequestType');
if (PayPal::isError($trans_details)) {
$logger->_log('Error in request: ' . print_r($trans_details, true));
} else {
$logger->_log('Create request: ' . print_r($trans_details, true));
}
// Set request fields
$tran_id = $_GET['transactionID'];
if (isset($tran_id)) {
$trans_details->setTransactionId($tran_id, 'iso-8859-1');
} else {
// Error: transaction ID was not set
$location = 'GetTransactionDetails.php';
header("Location: {$location}");
exit;
}
$logger->_log('Initial request: ' . print_r($trans_details, true));
示例10: SampleLogger
$logger = new SampleLogger('GetRPProfileDetails.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// $caller = $_SESSION['caller'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = '../index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$grppd_request =& PayPal::getType('GetRecurringPaymentsProfileDetailsRequestType');
if (PayPal::isError($crpp_request)) {
$logger->_log('Error in request: ' . print_r($grppd_request, true));
} else {
$logger->_log('Create request: ' . print_r($grppd_request, true));
}
$logger->_log('Initial request: ' . print_r($grppd_request, true));
/**
* Get posted request values
*/
$profileID = $_POST['profileID'];
$grppd_request->setProfileID($profileID);
$caller =& PayPal::getCallerServices($profile);
// Execute SOAP request
$response = $caller->GetRecurringPaymentsProfileDetails($grppd_request);
$ack = $response->getAck();
$logger->_log('Ack=' . $ack);
示例11: header
<?php
// error_reporting(E_ALL);
header('Content-Type: text/plain');
require_once 'PayPal.php';
require_once 'PayPal/Profile/Handler/Array.php';
require_once 'PayPal/Profile/API.php';
require_once 'lib/constants.inc.php';
// Settings.
$certfile = dirname(__FILE__) . '/sdk-seller_cert_key_pem.txt';
$certpass = '';
$apiusername = 'sdk-seller_api1.sdk.com';
$apipassword = '12345678';
$subject = null;
$environment = ENVIRONMENT;
$handler =& ProfileHandler_Array::getInstance(array('username' => $apiusername, 'certificateFile' => $certfile, 'subject' => $subject, 'environment' => $environment));
$profile =& APIProfile::getInstance($apiusername, $handler);
$profile->setAPIUsername($apiusername);
$profile->setAPIPassword($apipassword);
$profile->setCertificateFile($certfile);
$profile->setSignature(null);
$profile->setEnvironment($environment);
$caller =& PayPal::getCallerServices($profile);
if (PayPal::isError($caller)) {
print "Could not create CallerServices instance: " . $caller->getMessage();
exit;
}
示例12: SampleLogger
$was_submitted = false;
$logger = new SampleLogger('AuthorizationReceipt.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$authorization_request =& PayPal::getType('DoAuthorizationRequestType');
if (PayPal::isError($authorization_request)) {
$logger->_log('Error in request: ' . print_r($authorization_request, true));
}
// Set request fields
$authorization_request->setTransactionID($_POST['order_id']);
$authorization_request->setTransactionEntity('Order');
$amtType =& PayPal::getType('BasicAmountType');
$amtType->setattr('currencyID', $_POST['currency']);
$amtType->setval($_POST['amount'], 'iso-8859-1');
$authorization_request->setAmount($amtType);
$logger->_log('Initial request: ' . print_r($authorization_request, true));
$caller =& PayPal::getCallerServices($profile);
$response = $caller->DoAuthorization($authorization_request);
$ack = $response->getAck();
$logger->_log('Ack=' . $ack);
switch ($ack) {
示例13: str_pad
$creditCardNumber = $_POST['creditCardNumber'];
$expDateMonth = $_POST['expDateMonth'];
// Month must be padded with leading zero
$padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
$expDateYear = $_POST['expDateYear'];
$cvv2Number = $_POST['cvv2Number'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$amount = $_POST['amount'];
// Populate SOAP request information
// Payment details
$OrderTotal =& PayPal::getType('BasicAmountType');
if (PayPal::isError($OrderTotal)) {
var_dump($OrderTotal);
exit;
}
$OrderTotal->setattr('currencyID', 'USD');
$OrderTotal->setval($amount, 'iso-8859-1');
$PaymentDetails =& PayPal::getType('PaymentDetailsType');
$PaymentDetails->setOrderTotal($OrderTotal);
$shipTo =& PayPal::getType('AddressType');
$shipTo->setName($firstName . ' ' . $lastName);
$shipTo->setStreet1($address1);
$shipTo->setStreet2($address2);
$shipTo->setCityName($city);
$shipTo->setStateOrProvince($state);
$shipTo->setCountry(UNITED_STATES);
$shipTo->setPostalCode($zip);
示例14: SampleLogger
$was_submitted = false;
$logger = new SampleLogger('MassPayReceipt.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
} else {
$logger->_log('Profile from session: ' . print_r($profile, true));
}
// Build our request from $_POST
$masspay_request =& PayPal::getType('MassPayRequestType');
if (PayPal::isError($masspay_request)) {
$logger->_log('Error in request: ' . print_r($masspay_request, true));
} else {
$logger->_log('Create request: ' . print_r($masspay_request, true));
}
// Set request fields
$emailSubject = $_POST['emailSubject'];
$receiverType = $_POST['receiverType'];
for ($i = 0, $j = 0; $i < count($_POST["receiveremail"]); $i++) {
if (isset($_POST['receiveremail'][$i]) && $_POST['receiveremail'][$i] != '') {
$massPayItems[$j] =& PayPal::getType('MassPayRequestItemType');
$massPayItems[$j]->setReceiverEmail($_POST["receiveremail"][$i]);
$massPayItems[$j]->setNote($_POST["note"][$i]);
$massPayItems[$j]->setUniqueId($_POST["uniqueID"][$i]);
$amtType =& PayPal::getType('BasicAmountType');
$amtType->setattr('currencyID', 'USD');
示例15: session_start
session_start();
set_time_limit(60);
$was_submitted = false;
$logger = new SampleLogger('TransactionSearchResults.php', PEAR_LOG_DEBUG);
$logger->_log('POST variables: ' . print_r($_POST, true));
$profile = $_SESSION['APIProfile'];
// Verify that user is logged in
if (!isset($profile)) {
// Not logged in -- Back to the login page
$logger->_log('You are not logged in; return to index.php');
$location = 'index.php';
header("Location: {$location}");
}
// Build our request from $_POST
$trans_search =& PayPal::getType('TransactionSearchRequestType');
if (PayPal::isError($trans_search)) {
$logger->_log('Error in request: ' . $trans_search);
} else {
$logger->_log('Create request: ' . $trans_search);
}
// Set request fields
$start_date_str = $_POST['startDateStr'];
if (isset($start_date_str)) {
$start_time = strtotime($start_date_str);
$iso_start = date('Y-m-d\\T00:00:00\\Z', $start_time);
$trans_search->setStartDate($iso_start, 'iso-8859-1');
}
$end_date_str = $_POST['endDateStr'];
if (isset($end_date_str)) {
$end_time = strtotime($end_date_str);
$iso_end = date('Y-m-d\\T24:00:00\\Z', $end_time);