本文整理汇总了PHP中PagSeguroHelper::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP PagSeguroHelper::isEmpty方法的具体用法?PHP PagSeguroHelper::isEmpty怎么用?PHP PagSeguroHelper::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagSeguroHelper
的用法示例。
在下文中一共展示了PagSeguroHelper::isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public static function getData($authorization)
{
$data = null;
// Reference
if ($authorization->getReference() != null) {
$data['reference'] = $authorization->getReference();
}
// RedirectURL
if ($authorization->getRedirectURL() != null) {
$data['redirectURL'] = $authorization->getRedirectURL();
}
// NotificationURL
if ($authorization->getNotificationURL() != null) {
$data['notificationURL'] = $authorization->getNotificationURL();
}
// Permissions
if ($authorization->getPermissions()->getPermissions() != null) {
$data['permissions'] = implode(',', $authorization->getPermissions()->getPermissions());
}
// parameter
if (count($authorization->getParameter()->getItems()) > 0) {
foreach ($authorization->getParameter()->getItems() as $item) {
if ($item instanceof PagSeguroParameterItem) {
if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) {
if (!PagSeguroHelper::isEmpty($item->getGroup())) {
$data[$item->getKey() . '' . $item->getGroup()] = $item->getValue();
} else {
$data[$item->getKey()] = $item->getValue();
}
}
}
}
}
return $data;
}
示例2: __construct
/**
* @param null $group
* @param null $name
*/
public function __construct($group = null, $name = null)
{
if (isset($name) && !PagSeguroHelper::isEmpty($name)) {
$this->setName($name);
}
if (isset($group) && !PagSeguroHelper::isEmpty($group)) {
$this->setGroup($group);
}
}
示例3: __construct
public function __construct($key, $value, $group = null)
{
if (isset($key) && !PagSeguroHelper::isEmpty($key)) {
$this->setKey($key);
}
if (isset($value) && !PagSeguroHelper::isEmpty($value)) {
$this->setValue($value);
}
if (isset($group) && !PagSeguroHelper::isEmpty($group)) {
$this->setGroup($group);
}
}
示例4: addItem
public function addItem(PagSeguroParameterItem $parameterItem)
{
if (!PagSeguroHelper::isEmpty($parameterItem->getKey())) {
if (!PagSeguroHelper::isEmpty($parameterItem->getValue())) {
$this->items[] = $parameterItem;
} else {
die('requered parameterValue.');
}
} else {
die('requered parameterKey.');
}
}
示例5: getData
//.........这里部分代码省略.........
if ($items[$key]->getAmount() != null) {
$amount = PagSeguroHelper::decimalFormat($items[$key]->getAmount());
$data["itemAmount{$i}"] = $amount;
}
if ($items[$key]->getWeight() != null) {
$data["itemWeight{$i}"] = $items[$key]->getWeight();
}
if ($items[$key]->getShippingCost() != null) {
$data["itemShippingCost{$i}"] = PagSeguroHelper::decimalFormat($items[$key]->getShippingCost());
}
}
}
// extraAmount
if ($payment->getExtraAmount() != null) {
$data['extraAmount'] = PagSeguroHelper::decimalFormat($payment->getExtraAmount());
}
// shipping
if ($payment->getShipping() != null) {
if ($payment->getShipping()->getType() != null && $payment->getShipping()->getType()->getValue() != null) {
$data['shippingType'] = $payment->getShipping()->getType()->getValue();
}
if ($payment->getShipping()->getCost() != null && $payment->getShipping()->getCost() != null) {
$data['shippingCost'] = $payment->getShipping()->getCost();
}
// address
if ($payment->getShipping()->getAddress() != null) {
if ($payment->getShipping()->getAddress()->getStreet() != null) {
$data['shippingAddressStreet'] = $payment->getShipping()->getAddress()->getStreet();
}
if ($payment->getShipping()->getAddress()->getNumber() != null) {
$data['shippingAddressNumber'] = $payment->getShipping()->getAddress()->getNumber();
}
if ($payment->getShipping()->getAddress()->getComplement() != null) {
$data['shippingAddressComplement'] = $payment->getShipping()->getAddress()->getComplement();
}
if ($payment->getShipping()->getAddress()->getCity() != null) {
$data['shippingAddressCity'] = $payment->getShipping()->getAddress()->getCity();
}
if ($payment->getShipping()->getAddress()->getState() != null) {
$data['shippingAddressState'] = $payment->getShipping()->getAddress()->getState();
}
if ($payment->getShipping()->getAddress()->getDistrict() != null) {
$data['shippingAddressDistrict'] = $payment->getShipping()->getAddress()->getDistrict();
}
if ($payment->getShipping()->getAddress()->getPostalCode() != null) {
$data['shippingAddressPostalCode'] = $payment->getShipping()->getAddress()->getPostalCode();
}
if ($payment->getShipping()->getAddress()->getCountry() != null) {
$data['shippingAddressCountry'] = $payment->getShipping()->getAddress()->getCountry();
}
}
}
// maxAge
if ($payment->getMaxAge() != null) {
$data['maxAge'] = $payment->getMaxAge();
}
// maxUses
if ($payment->getMaxUses() != null) {
$data['maxUses'] = $payment->getMaxUses();
}
// redirectURL
if ($payment->getRedirectURL() != null) {
$data['redirectURL'] = $payment->getRedirectURL();
}
// notificationURL
if ($payment->getNotificationURL() != null) {
$data['notificationURL'] = $payment->getNotificationURL();
}
// metadata
if (count($payment->getMetaData()->getItems()) > 0) {
$i = 0;
foreach ($payment->getMetaData()->getItems() as $item) {
if ($item instanceof PagSeguroMetaDataItem) {
if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) {
$i++;
$data['metadataItemKey' . $i] = $item->getKey();
$data['metadataItemValue' . $i] = $item->getValue();
if (!PagSeguroHelper::isEmpty($item->getGroup())) {
$data['metadataItemGroup' . $i] = $item->getGroup();
}
}
}
}
}
// parameter
if (count($payment->getParameter()->getItems()) > 0) {
foreach ($payment->getParameter()->getItems() as $item) {
if ($item instanceof PagSeguroParameterItem) {
if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) {
if (!PagSeguroHelper::isEmpty($item->getGroup())) {
$data[$item->getKey() . '' . $item->getGroup()] = $item->getValue();
} else {
$data[$item->getKey()] = $item->getValue();
}
}
}
}
}
return $data;
}
示例6: isNotificationEmpty
/**
* Check if notification post is empty
* @param array $notification_data
* @return boolean
*/
public static function isNotificationEmpty(array $notification_data)
{
$isEmpty = true;
if (isset($notification_data['notificationCode']) && isset($notification_data['notificationType'])) {
$isEmpty = PagSeguroHelper::isEmpty($notification_data['notificationCode']) || PagSeguroHelper::isEmpty($notification_data['notificationType']);
}
return $isEmpty;
}
示例7: getNotificationUrl
/**
* Gets notification url
* @return string
*/
public function getNotificationUrl()
{
return !PagSeguroHelper::isEmpty(Configuration::get('PAGSEGURO_NOTIFICATION_URL')) ? Configuration::get('PAGSEGURO_NOTIFICATION_URL') : $this->_notificationURL();
}
示例8: _doUpdateByNotification
/**
* Perform update by received PagSeguro notification
* @param string $notificationCode
*/
private function _doUpdateByNotification($statuses, $notificationCode)
{
try {
// getting credentials data
$credentials = new PagSeguroAccountCredentials($this->payment_params->pagseguro_email, $this->payment_params->pagseguro_token);
// getting transaction data object
$transaction = PagSeguroNotificationService::checkTransaction($credentials, $notificationCode);
// getting PagSeguro status number
$statusPagSeguro = $transaction->getStatus()->getValue();
$array_status = array(0 => 'Initiated', 1 => 'Waiting payment', 2 => 'In analysis', 3 => 'Paid', 4 => 'Available', 5 => 'In dispute', 6 => 'refunded', 7 => 'cancelled');
// performing update status
if (!PagSeguroHelper::isEmpty($statusPagSeguro) && (int) $statusPagSeguro == 3) {
$orderClass = hikashop_get('class.order');
$dbOrder = $orderClass->get((int) $transaction->getReference());
$email = new stdClass();
$history = new stdClass();
$order_status = $this->payment_params->verified_status;
$history->notified = 1;
if ($dbOrder->order_status == $order_status) {
return true;
}
$url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id=' . $dbOrder->order_id;
$order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE);
$order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
$mail_status = $statuses[$order_status];
$email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER', 'Pagseguro', $array_status[$statusPagSeguro], $dbOrder->order_number);
$email->body = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', 'Pagseguro', $array_status[$statusPagSeguro])) . ' ' . JText::sprintf('ORDER_STATUS_CHANGED', $mail_status) . "\r\n\r\n" . $order_text;
$this->modifyOrder($dbOrder->order_id, $order_status, $history, $email);
} elseif ((int) $statusPagSeguro == 7) {
$orderClass = hikashop_get('class.order');
$dbOrder = $orderClass->get((int) $transaction->getReference());
$email = new stdClass();
$history = new stdClass();
$order_status = $this->payment_params->invalid_status;
$history->notified = 0;
if ($dbOrder->order_status == $order_status) {
return true;
}
$url = HIKASHOP_LIVE . 'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id=' . $dbOrder->order_id;
$order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE);
$order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
$mail_status = $statuses[$order_status];
$email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER', 'Pagseguro', $array_status[$statusPagSeguro], $dbOrder->order_number);
$email->body = str_replace('<br/>', "\r\n", JText::sprintf('PAYMENT_NOTIFICATION_STATUS', 'Pagseguro', $array_status[$statusPagSeguro])) . ' ' . JText::sprintf('ORDER_STATUS_CHANGED', $mail_status) . "\r\n\r\n" . $order_text;
$this->modifyOrder($dbOrder->order_id, $order_status, $history, $email);
}
} catch (PagSeguroServiceException $e) {
LogPagSeguro::error("Error trying get transaction [" . $e->getMessage() . "]");
}
return true;
}
示例9: _getParamsData
/**
* Gets the PagSeguro plugin configured values
* @return array
*/
private function _getParamsData()
{
$paramsData = array();
$db = JFactory::getDBO();
$db->setQuery('SELECT `payment_params` FROM `#__virtuemart_paymentmethods` WHERE `payment_element`="pagseguro" ');
$data = explode('|', $db->loadResult());
foreach ($data as $param) {
if (!PagSeguroHelper::isEmpty($param)) {
$array_temp = explode('=', $param);
$paramsData[$array_temp[0]] = str_replace('"', '', $array_temp[1]);
}
}
return $paramsData;
}