17 \Magento\Paypal\Model\Billing\Agreement\MethodInterface
144 \
Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory,
146 \
Magento\Paypal\Model\ProFactory $proFactory,
148 \
Magento\Paypal\Model\CartFactory $cartFactory,
154 $this->_urlBuilder = $urlBuilder;
155 $this->_cartFactory = $cartFactory;
169 $proInstance = array_shift(
$data);
170 if ($proInstance && $proInstance instanceof \
Magento\Paypal\Model\
Pro) {
171 $this->_pro = $proInstance;
173 $this->_pro = $proFactory->create();
175 $this->_pro->setMethod($this->_code);
189 $store = $this->_storeManager->getStore()->getId();
203 $api = $this->_pro->getApi()->setReturnUrl(
208 $this->_pro->getApi()->getBillingAgreementType()
211 $api->callSetCustomerBillingAgreement();
212 $agreement->setRedirectUrl($this->_pro->getConfig()->getStartBillingAgreementUrl($api->getToken()));
224 $api = $this->_pro->getApi()->setToken(
$agreement->getToken());
225 $api->callGetBillingAgreementCustomerDetails();
227 'token' => $api->getData(
'token'),
228 'email' => $api->getData(
'email'),
229 'payer_id' => $api->getData(
'payer_id'),
230 'payer_status' => $api->getData(
'payer_status'),
233 return $responseData;
244 $api = $this->_pro->getApi()->setToken(
$agreement->getToken());
245 $api->callCreateBillingAgreement();
246 $agreement->setBillingAgreementId($api->getData(
'billing_agreement_id'));
260 $api = $this->_pro->getApi()->setReferenceId(
262 )->setBillingAgreementStatus(
266 $api->callUpdateBillingAgreement();
269 if (!(\
Magento\Paypal\Model\Billing\Agreement::STATUS_CANCELED == $targetStatus &&
270 $api->getIsBillingAgreementAlreadyCancelled())
351 return parent::canReviewPayment() && $this->_pro->canReviewPayment($this->
getInfoInstance());
387 return $this->_pro->fetchTransactionInfo(
$payment, $transactionId);
407 $cart = $this->_cartFactory->create([
'salesModel' =>
$order]);
409 $proConfig = $this->_pro->getConfig();
410 $api = $this->_pro->getApi()->setReferenceId(
413 $proConfig->getValue(
'paymentAction')
417 $payment->getOrder()->getBaseCurrencyCode()
419 $this->_urlBuilder->getUrl(
'paypal/ipn/')
422 )->setIsLineItemsEnabled(
423 $proConfig->getValue(
'lineItemsEnabled')
429 $api->callDoReferenceTransaction();
430 $this->_pro->importPaymentInfo($api,
$payment);
431 $api->callGetTransactionDetails();
432 $this->_pro->importPaymentInfo($api,
$payment);
434 $payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0);
436 if ($api->getBillingAgreementId()) {
452 return $this->_pro->getConfig()->isMethodAvailable($this->_code);
463 return $this->_pro->getConfig()->getPaymentAction();
__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\Paypal\Model\Billing\AgreementFactory $agreementFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\ProFactory $proFactory, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
const PAYMENT_REVIEW_DENY
cancel(\Magento\Payment\Model\InfoInterface $payment)
initBillingAgreementToken(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
updateBillingAgreementStatus(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
const TRANSPORT_BILLING_AGREEMENT_ID
const PAYMENT_REVIEW_ACCEPT
void(\Magento\Payment\Model\InfoInterface $payment)
capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
placeBillingAgreement(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
getBillingAgreementTokenInfo(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement)
setData($key, $value=null)
fetchTransactionInfo(InfoInterface $payment, $transactionId)
$_canFetchTransactionInfo
const METHOD_BILLING_AGREEMENT
authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
acceptPayment(InfoInterface $payment)
denyPayment(InfoInterface $payment)
$_canRefundInvoicePartial