本文整理汇总了PHP中Magento\Framework\DataObject::getCcCid方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::getCcCid方法的具体用法?PHP DataObject::getCcCid怎么用?PHP DataObject::getCcCid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DataObject
的用法示例。
在下文中一共展示了DataObject::getCcCid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRequest
/**
* Prepare request to gateway
*
* @param \Magento\Framework\DataObject|\Magento\Payment\Model\InfoInterface $payment
* @return \Magento\Authorizenet\Model\Request
* @link http://www.authorize.net/support/AIM_guide.pdf
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function buildRequest(\Magento\Framework\DataObject $payment)
{
/** @var \Magento\Sales\Model\Order $order */
$order = $payment->getOrder();
$this->setStore($order->getStoreId());
$request = $this->getRequest()->setXType($payment->getAnetTransType())->setXMethod(self::REQUEST_METHOD_CC);
if ($order && $order->getIncrementId()) {
$request->setXInvoiceNum($order->getIncrementId());
}
if ($payment->getAmount()) {
$request->setXAmount($payment->getAmount(), 2);
$request->setXCurrencyCode($order->getBaseCurrencyCode());
}
switch ($payment->getAnetTransType()) {
case self::REQUEST_TYPE_AUTH_CAPTURE:
$request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
break;
case self::REQUEST_TYPE_AUTH_ONLY:
$request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
break;
case self::REQUEST_TYPE_CREDIT:
/**
* Send last 4 digits of credit card number to authorize.net
* otherwise it will give an error
*/
$request->setXCardNum($payment->getCcLast4());
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_VOID:
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE:
$request->setXTransId($payment->getXTransId());
break;
case self::REQUEST_TYPE_CAPTURE_ONLY:
$request->setXAuthCode($payment->getCcAuthCode());
break;
}
if (!empty($order)) {
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$request->setXFirstName($billing->getFirstname())->setXLastName($billing->getLastname())->setXCompany($billing->getCompany())->setXAddress($billing->getStreetLine(1))->setXCity($billing->getCity())->setXState($billing->getRegion())->setXZip($billing->getPostcode())->setXCountry($billing->getCountry())->setXPhone($billing->getTelephone())->setXFax($billing->getFax())->setXCustId($order->getCustomerId())->setXCustomerIp($order->getRemoteIp())->setXCustomerTaxId($billing->getTaxId())->setXEmail($order->getCustomerEmail())->setXEmailCustomer($this->getConfigData('email_customer'))->setXMerchantEmail($this->getConfigData('merchant_email'));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$request->setXShipToFirstName($shipping->getFirstname())->setXShipToLastName($shipping->getLastname())->setXShipToCompany($shipping->getCompany())->setXShipToAddress($shipping->getStreetLine(1))->setXShipToCity($shipping->getCity())->setXShipToState($shipping->getRegion())->setXShipToZip($shipping->getPostcode())->setXShipToCountry($shipping->getCountry());
}
$request->setXPoNum($payment->getPoNumber())->setXTax($order->getBaseTaxAmount())->setXFreight($order->getBaseShippingAmount());
}
if ($payment->getCcNumber()) {
$request->setXCardNum($payment->getCcNumber())->setXExpDate(sprintf('%02d-%04d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setXCardCode($payment->getCcCid());
}
return $request;
}
示例2: _buildPlaceRequest
/**
* Return request object with information for 'authorization' or 'sale' action
*
* @param Object|Payment $payment
* @param float $amount
* @return DataObject
*/
protected function _buildPlaceRequest(DataObject $payment, $amount)
{
$request = $this->buildBasicRequest();
$request->setAmt(round($amount, 2));
$request->setAcct($payment->getCcNumber());
$request->setExpdate(sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), -2, 2));
$request->setCvv2($payment->getCcCid());
$order = $payment->getOrder();
$request->setCurrency($order->getBaseCurrencyCode());
$request = $this->fillCustomerContacts($order, $request);
return $request;
}
示例3: assignData
/**
* Assign data to info model instance
*
* @param \Magento\Framework\DataObject|mixed $data
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function assignData(\Magento\Framework\DataObject $data)
{
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
if (!is_object($additionalData)) {
$additionalData = new DataObject($additionalData ?: []);
}
/** @var DataObject $info */
$info = $this->getInfoInstance();
$info->addData(['cc_type' => $additionalData->getCcType(), 'cc_owner' => $additionalData->getCcOwner(), 'cc_last_4' => substr($additionalData->getCcNumber(), -4), 'cc_number' => $additionalData->getCcNumber(), 'cc_cid' => $additionalData->getCcCid(), 'cc_exp_month' => $additionalData->getCcExpMonth(), 'cc_exp_year' => $additionalData->getCcExpYear(), 'cc_ss_issue' => $additionalData->getCcSsIssue(), 'cc_ss_start_month' => $additionalData->getCcSsStartMonth(), 'cc_ss_start_year' => $additionalData->getCcSsStartYear()]);
return $this;
}