123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Payment\Model;
- use Magento\Framework\DataObject;
- use Magento\Quote\Api\Data\CartInterface;
- /**
- * Payment interface
- * @api
- * @since 100.0.2
- */
- interface MethodInterface
- {
- /**
- * Different payment actions.
- */
- const ACTION_ORDER = 'order';
- const ACTION_AUTHORIZE = 'authorize';
- const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture';
- /**
- * Different payment method checks.
- */
- const CHECK_USE_FOR_COUNTRY = 'country';
- const CHECK_USE_FOR_CURRENCY = 'currency';
- const CHECK_USE_CHECKOUT = 'checkout';
- const CHECK_USE_INTERNAL = 'internal';
- const CHECK_ORDER_TOTAL_MIN_MAX = 'total';
- const CHECK_ZERO_TOTAL = 'zero_total';
- const GROUP_OFFLINE = 'offline';
- /**
- * Retrieve payment method code
- *
- * @return string
- *
- */
- public function getCode();
- /**
- * Retrieve block type for method form generation
- *
- * @return string
- *
- * @deprecated 100.0.2
- */
- public function getFormBlockType();
- /**
- * Retrieve payment method title
- *
- * @return string
- *
- */
- public function getTitle();
- /**
- * Store id setter
- * @param int $storeId
- * @return void
- */
- public function setStore($storeId);
- /**
- * Store id getter
- * @return int
- */
- public function getStore();
- /**
- * Check order availability
- *
- * @return bool
- *
- */
- public function canOrder();
- /**
- * Check authorize availability
- *
- * @return bool
- *
- */
- public function canAuthorize();
- /**
- * Check capture availability
- *
- * @return bool
- *
- */
- public function canCapture();
- /**
- * Check partial capture availability
- *
- * @return bool
- *
- */
- public function canCapturePartial();
- /**
- * Check whether capture can be performed once and no further capture possible
- *
- * @return bool
- *
- */
- public function canCaptureOnce();
- /**
- * Check refund availability
- *
- * @return bool
- *
- */
- public function canRefund();
- /**
- * Check partial refund availability for invoice
- *
- * @return bool
- *
- */
- public function canRefundPartialPerInvoice();
- /**
- * Check void availability
- * @return bool
- *
- */
- public function canVoid();
- /**
- * Using internal pages for input payment data
- * Can be used in admin
- *
- * @return bool
- */
- public function canUseInternal();
- /**
- * Can be used in regular checkout
- *
- * @return bool
- */
- public function canUseCheckout();
- /**
- * Can be edit order (renew order)
- *
- * @return bool
- *
- */
- public function canEdit();
- /**
- * Check fetch transaction info availability
- *
- * @return bool
- *
- */
- public function canFetchTransactionInfo();
- /**
- * Fetch transaction info
- *
- * @param InfoInterface $payment
- * @param string $transactionId
- * @return array
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- *
- */
- public function fetchTransactionInfo(InfoInterface $payment, $transactionId);
- /**
- * Retrieve payment system relation flag
- *
- * @return bool
- *
- */
- public function isGateway();
- /**
- * Retrieve payment method online/offline flag
- *
- * @return bool
- *
- */
- public function isOffline();
- /**
- * Flag if we need to run payment initialize while order place
- *
- * @return bool
- *
- */
- public function isInitializeNeeded();
- /**
- * To check billing country is allowed for the payment method
- *
- * @param string $country
- * @return bool
- */
- public function canUseForCountry($country);
- /**
- * Check method for processing with base currency
- *
- * @param string $currencyCode
- * @return bool
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function canUseForCurrency($currencyCode);
- /**
- * Retrieve block type for display method information
- *
- * @return string
- *
- * @deprecated 100.0.2
- */
- public function getInfoBlockType();
- /**
- * Retrieve payment information model object
- *
- * @return InfoInterface
- * @throws \Magento\Framework\Exception\LocalizedException
- *
- * @deprecated 100.0.2
- */
- public function getInfoInstance();
- /**
- * Retrieve payment information model object
- *
- * @param InfoInterface $info
- * @return void
- *
- * @deprecated 100.0.2
- */
- public function setInfoInstance(InfoInterface $info);
- /**
- * Validate payment method information object
- *
- * @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
- *
- */
- public function validate();
- /**
- * Order payment abstract method
- *
- * @param InfoInterface $payment
- * @param float $amount
- * @return $this
- *
- */
- public function order(\Magento\Payment\Model\InfoInterface $payment, $amount);
- /**
- * Authorize payment abstract method
- *
- * @param InfoInterface $payment
- * @param float $amount
- * @return $this
- *
- */
- public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount);
- /**
- * Capture payment abstract method
- *
- * @param InfoInterface $payment
- * @param float $amount
- * @return $this
- *
- */
- public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount);
- /**
- * Refund specified amount for payment
- *
- * @param InfoInterface $payment
- * @param float $amount
- * @return $this
- *
- */
- public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount);
- /**
- * Cancel payment abstract method
- *
- * @param InfoInterface $payment
- * @return $this
- *
- */
- public function cancel(\Magento\Payment\Model\InfoInterface $payment);
- /**
- * Void payment abstract method
- *
- * @param InfoInterface $payment
- * @return $this
- *
- */
- public function void(\Magento\Payment\Model\InfoInterface $payment);
- /**
- * Whether this method can accept or deny payment
- * @return bool
- *
- */
- public function canReviewPayment();
- /**
- * Attempt to accept a payment that us under review
- *
- * @param InfoInterface $payment
- * @return false
- * @throws \Magento\Framework\Exception\LocalizedException
- *
- */
- public function acceptPayment(InfoInterface $payment);
- /**
- * Attempt to deny a payment that us under review
- *
- * @param InfoInterface $payment
- * @return false
- * @throws \Magento\Framework\Exception\LocalizedException
- *
- */
- public function denyPayment(InfoInterface $payment);
- /**
- * Retrieve information from payment configuration
- *
- * @param string $field
- * @param int|string|null|\Magento\Store\Model\Store $storeId
- *
- * @return mixed
- */
- public function getConfigData($field, $storeId = null);
- /**
- * Assign data to info model instance
- *
- * @param DataObject $data
- * @return $this
- *
- */
- public function assignData(DataObject $data);
- /**
- * Check whether payment method can be used
- *
- * @param CartInterface|null $quote
- * @return bool
- *
- */
- public function isAvailable(CartInterface $quote = null);
- /**
- * Is active
- *
- * @param int|null $storeId
- * @return bool
- *
- */
- public function isActive($storeId = null);
- /**
- * Method that will be executed instead of authorize or capture
- * if flag isInitializeNeeded set to true
- *
- * @param string $paymentAction
- * @param object $stateObject
- *
- * @return $this
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- *
- */
- public function initialize($paymentAction, $stateObject);
- /**
- * Get config payment action url
- * Used to universalize payment actions when processing payment place
- *
- * @return string
- *
- */
- public function getConfigPaymentAction();
- }
|