16 class Direct extends \Magento\Payment\Model\Method\Cc
165 \
Magento\Framework\Module\ModuleListInterface $moduleList,
166 \
Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
167 \
Magento\Paypal\Model\ProFactory $proFactory,
171 \
Magento\Paypal\Model\CartFactory $cartFactory,
180 $customAttributeFactory,
191 $this->_urlBuilder = $urlBuilder;
192 $this->_requestHttp = $requestHttp;
193 $this->_cartFactory = $cartFactory;
195 $proInstance = array_shift(
$data);
196 if ($proInstance && $proInstance instanceof \
Magento\Paypal\Model\
Pro) {
197 $this->_pro = $proInstance;
199 $this->_pro = $proFactory->create();
201 $this->_pro->setMethod($this->_code);
213 $this->setData(
'store',
$store);
215 $store = $this->_storeManager->getStore()->getId();
229 return $this->_pro->getConfig()->isCurrencyCodeSupported($currencyCode);
240 return $this->_pro->getConfig()->getPaymentAction();
250 $ccTypes = explode(
',', $this->_pro->getConfig()->getValue(
'cctypes'));
251 $country = $this->_pro->getConfig()->getMerchantCountry();
253 if ($country ==
'GB') {
254 $ccTypes = array_intersect([
'SM',
'SO',
'MC',
'DI',
'VI'], $ccTypes);
255 }
elseif ($country ==
'CA') {
256 $ccTypes = array_intersect([
'MC',
'VI'], $ccTypes);
258 return implode(
',', $ccTypes);
269 return parent::isAvailable(
$quote) && $this->_pro->getConfig()->isMethodAvailable();
287 case 'order_place_redirect_url':
288 $value = $this->getOrderPlaceRedirectUrl();
291 $value = $this->_pro->getConfig()->getValue($field);
358 $this->
void($payment);
369 return parent::canReviewPayment() && $this->_pro->canReviewPayment($this->getInfoInstance());
405 return $this->_pro->fetchTransactionInfo(
$payment, $transactionId);
418 $api = $this->_pro->getApi()->setPaymentAction(
419 $this->_pro->getConfig()->getValue(
'paymentAction')
421 $this->_requestHttp->getClientIp(
false)
425 $order->getBaseCurrencyCode()
429 $order->getCustomerEmail()
431 $this->_urlBuilder->getUrl(
'paypal/ipn/')
432 )->setCreditCardType(
434 )->setCreditCardNumber(
436 )->setCreditCardExpirationDate(
438 )->setCreditCardCvv2(
443 if (
$order->getIsVirtual()) {
444 $api->setAddress(
$order->getBillingAddress())->setSuppressShipping(
true);
446 $api->setAddress(
$order->getShippingAddress());
447 $api->setBillingAddress(
$order->getBillingAddress());
451 $cart = $this->_cartFactory->create([
'salesModel' =>
$order]);
453 $api->setPaypalCart(
$cart)->setIsLineItemsEnabled($this->_pro->getConfig()->getValue(
'lineItemsEnabled'));
456 $api->callDoDirectPayment();
460 $api->callGetTransactionDetails();
463 $payment->setIsTransactionPending(
true);
479 return sprintf(
'%02d%02d', $month, $year);
491 $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0);
492 $this->_pro->importPaymentInfo($api,
$payment);
authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
void(\Magento\Payment\Model\InfoInterface $payment)
fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId)
elseif(isset( $params[ 'redirect_parent']))
const PAYMENT_REVIEW_DENY
$_canFetchTransactionInfo
_importResultToPayment($api, $payment)
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Paypal\Model\ProFactory $proFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\App\RequestInterface $requestHttp, \Magento\Paypal\Model\CartFactory $cartFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
const PAYMENT_REVIEW_ACCEPT
cancel(\Magento\Payment\Model\InfoInterface $payment)
denyPayment(\Magento\Payment\Model\InfoInterface $payment)
acceptPayment(\Magento\Payment\Model\InfoInterface $payment)
_getFormattedCcExpirationDate($month, $year)
refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
$_canRefundInvoicePartial
_placeOrder(Payment $payment, $amount)
isAvailable(\Magento\Quote\Api\Data\CartInterface $quote=null)
canUseForCurrency($currencyCode)
getConfigData($field, $storeId=null)