本文整理汇总了PHP中Mage_Payment_Model_Method_Cc类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Cc类的具体用法?PHP Mage_Payment_Model_Method_Cc怎么用?PHP Mage_Payment_Model_Method_Cc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Payment_Model_Method_Cc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignData
/**
* overwrites the method of Mage_Payment_Model_Method_Cc
* Assign data to info model instance
*
* @param mixed $data
* @return Mage_Payment_Model_Info
*/
public function assignData($data)
{
if (!$data instanceof Varien_Object) {
$data = new Varien_Object($data);
}
parent::assignData($data);
$info = $this->getInfoInstance();
$info->setCcSsIssue($data->getCcSsIssue())->setCcSsStartMonth($data->getCcSsStartMonth())->setCcSsStartYear($data->getCcSsStartYear());
return $this;
}
示例2: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
if ($this->getConfigData('active') == 1) {
$this->_initEnvironment(null);
}
}
示例3: isAvailable
public function isAvailable($quote = null)
{
if ($quote && $quote->getBaseGrandTotal() < $this->_minOrderTotal) {
return false;
}
return $this->getConfigData('api_key', $quote ? $quote->getStoreId() : null) && parent::isAvailable($quote);
}
示例4: isAvailable
/**
* Check if we're on a secure page and run
* the parent verification
*
* @param Mage_Sales_Model_Quote|null $quote
*
* @return bool
*/
public function isAvailable($quote = null)
{
$isSecure = (bool) Mage::app()->getStore()->isCurrentlySecure();
if (!$isSecure) {
return false;
}
return parent::isAvailable($quote);
}
示例5: validate
public function validate()
{
$info = $this->getInfoInstance();
if ($info->getCcType() == "DIN" || $info->getCcType() == "ELO") {
return $this;
} else {
parent::validate();
}
return $this;
}
示例6: validate
public function validate()
{
parent::validate();
$paymentInfo = $this->getInfoInstance();
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode();
} else {
$currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode();
}
return $this;
}
示例7: validate
public function validate()
{
/*
* calling parent validate function
*/
parent::validate();
$info = $this->getInfoInstance();
$errorMsg = false;
$availableTypes = explode(',', $this->getConfigData('cctypes'));
$ccNumber = $info->getCcNumber();
// remove credit card number delimiters such as "-" and space
$ccNumber = preg_replace('/[\\-\\s]+/', '', $ccNumber);
$info->setCcNumber($ccNumber);
$ccType = '';
if (in_array($info->getCcType(), $availableTypes)) {
if ($this->validateCcNum($ccNumber) || $this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber)) {
$ccType = 'OT';
$ccTypeRegExpList = array('SO' => '/(^(6334)[5-9](\\d{11}$|\\d{13,14}$))|(^(6767)(\\d{12}$|\\d{14,15}$))/', 'SM' => '/(^(5[0678])\\d{11,18}$)|(^(6[^05])\\d{11,18}$)|(^(601)[^1]\\d{9,16}$)|(^(6011)\\d{9,11}$)' . '|(^(6011)\\d{13,16}$)|(^(65)\\d{11,13}$)|(^(65)\\d{15,18}$)' . '|(^(49030)[2-9](\\d{10}$|\\d{12,13}$))|(^(49033)[5-9](\\d{10}$|\\d{12,13}$))' . '|(^(49110)[1-2](\\d{10}$|\\d{12,13}$))|(^(49117)[4-9](\\d{10}$|\\d{12,13}$))' . '|(^(49118)[0-2](\\d{10}$|\\d{12,13}$))|(^(4936)(\\d{12}$|\\d{14,15}$))/', 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', 'MC' => '/^5[1-5][0-9]{14}$/', 'AE' => '/^3[47][0-9]{13}$/', 'DN' => '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/');
foreach ($ccTypeRegExpList as $ccTypeMatch => $ccTypeRegExp) {
if (preg_match($ccTypeRegExp, $ccNumber)) {
$ccType = $ccTypeMatch;
break;
}
}
if (!$this->OtherCcType($info->getCcType()) && $ccType != $info->getCcType()) {
$errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
}
} else {
$errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
}
} else {
$errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
}
//validate credit card verification number
if ($errorMsg === false && $this->hasVerification()) {
$verifcationRegEx = $this->getVerificationRegEx();
$regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
if (!$info->getCcCid() || !$regExp || !preg_match($regExp, $info->getCcCid())) {
$errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
}
}
if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
$errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
}
if ($errorMsg) {
Mage::throwException($errorMsg);
}
//This must be after all validation conditions
if ($this->getIsCentinelValidationEnabled()) {
$this->getCentinelValidator()->validate($this->getCentinelValidationData());
}
return $this;
}
示例8: validate
/**
* validate the currency code is avaialable to use for Flo2Cash Basic or not
*
* @return bool
*/
public function validate()
{
parent::validate();
$paymentInfo = $this->getInfoInstance();
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode();
} else {
$currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode();
}
if (!in_array($currency_code, $this->_allowCurrencyCode)) {
Mage::throwException(Mage::helper('flo2cash')->__('Selected currency code (%s) is not compatible with Flo2Cash', $currency_code));
}
return $this;
}
示例9: assignData
/**
* Assign data to info model instance
*
* @param mixed $data
* @return Mage_Payment_Model_Info
*/
public function assignData($data)
{
if (is_array($data)) {
$data = new Varien_Object($data);
}
try {
$paymentRequest = Mage::app()->getRequest()->getPost('payment');
$data->addData(array('cc_last4' => substr($data->cc_number, -4), 'cc_exp_year' => '', 'cc_exp_month' => ''));
$info = $this->getInfoInstance();
$this->_openpay_token = $paymentRequest['openpay_token'];
$this->_device_session_id = $paymentRequest['device_session_id'];
$info->setOpenpayToken($paymentRequest['openpay_token'])->setDeviceSessionId($paymentRequest['device_session_id']);
} catch (Exception $e) {
}
return parent::assignData($data);
}
示例10: assignData
/**
* Assign data to info model instance
* @param mixed $data
* @return Mage_Payment_Model_Info
*/
public function assignData($data)
{
Mage::log('Assign Data with Omise');
$result = parent::assignData($data);
if (is_array($data)) {
if (!isset($data['omise_token'])) {
Mage::throwException(Mage::helper('payment')->__('Need Omise\'s keys'));
}
Mage::log('Data that assign is Array');
$this->getInfoInstance()->setAdditionalInformation('omise_token', $data['omise_token']);
} elseif ($data instanceof Varien_Object) {
if (!$data->getData('omise_token')) {
Mage::throwException(Mage::helper('payment')->__('Need Omise\'s keys'));
}
Mage::log('Data that assign is Object');
$this->getInfoInstance()->setAdditionalInformation('omise_token', $data->getData('omise_token'));
}
return $result;
}
示例11: assignData
public function assignData($data)
{
if (!$data instanceof Varien_Object) {
$data = new Varien_Object($data);
}
if ($this->getConfigData('paypage_enabled')) {
$info = $this->getInfoInstance();
$info->setAdditionalInformation('paypage_enabled', $data->getPaypageEnabled());
$info->setAdditionalInformation('paypage_registration_id', $data->getPaypageRegistrationId());
$info->setAdditionalInformation('paypage_order_id', $data->getOrderId());
$info->setAdditionalInformation('cc_vaulted', $data->getCcVaulted());
$info->setAdditionalInformation('cc_should_save', $data->getCcShouldSave());
}
if ($this->getConfigData('vault_enable')) {
$info->setAdditionalInformation('cc_vaulted', $data->getCcVaulted());
$info->setAdditionalInformation('cc_should_save', $data->getCcShouldSave());
}
return parent::assignData($data);
}
示例12: validate
/**
* Validate payment method information object
*
* @param Mage_Payment_Model_Info $info
* @return Mage_Payment_Model_Abstract
*/
public function validate()
{
$info = $this->getInfoInstance();
$order_amount = 0;
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
$order_amount = (double) $info->getQuote()->getBaseGrandTotal();
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
$order_amount = (double) $info->getOrder()->getQuoteBaseGrandTotal();
}
$order_min = $this->getConfigData('min_order_total');
$order_max = $this->getConfigData('max_order_total');
if (!empty($order_max) && (double) $order_max < $order_amount) {
Mage::throwException("Order amount greater than permissible Maximum order amount.");
}
if (!empty($order_min) && (double) $order_min > $order_amount) {
Mage::throwException("Order amount less than required Minimum order amount.");
}
/*
* calling parent validate function
*/
parent::validate();
}
示例13: fetchTransactionInfo
/**
* Fetch transaction details info
*
* Update transaction info if there is one placing transaction only
*
* @param Mage_Payment_Model_Info $payment
* @param string $transactionId
* @return array
*/
public function fetchTransactionInfo(Mage_Payment_Model_Info $payment, $transactionId)
{
$cardsStorage = $this->getCardsStorage($payment);
if ($cardsStorage->getCardsCount() != 1) {
return parent::fetchTransactionInfo($payment, $transactionId);
}
$cards = $cardsStorage->getCards();
$card = array_shift($cards);
$transactionId = $card->getLastTransId();
$transaction = $payment->getTransaction($transactionId);
if (!$transaction->getAdditionalInformation($this->_isTransactionFraud)) {
return parent::fetchTransactionInfo($payment, $transactionId);
}
$response = $this->_getTransactionDetails($transactionId);
if ($response->getResponseCode() == self::RESPONSE_CODE_APPROVED) {
$transaction->setAdditionalInformation($this->_isTransactionFraud, false);
$payment->setIsTransactionApproved(true);
} elseif ($response->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_DECLINED) {
$payment->setIsTransactionDenied(true);
}
return parent::fetchTransactionInfo($payment, $transactionId);
}
示例14: isAvailable
/**
* Check whether payment method can be used
*
* @param Mage_Sales_Model_Quote
* @return bool
*/
public function isAvailable($quote = null)
{
$storeId = Mage::app()->getStore($this->getStore())->getId();
$config = Mage::getModel('paypal/config')->setStoreId($storeId);
if (parent::isAvailable($quote) && $config->isMethodAvailable($this->getCode())) {
return true;
}
return false;
}
示例15: getOriginalCode
/**
* Retrieve original payment method code
*
* @return string
*/
public function getOriginalCode()
{
return parent::getCode();
}