Skip to content

Commit

Permalink
Merge pull request #1200 from BearGroup/release/5.16.0
Browse files Browse the repository at this point in the history
Release/5.16.0
  • Loading branch information
NisiPasa committed Jul 18, 2023
2 parents de386a5 + affb3f5 commit e5d32fe
Show file tree
Hide file tree
Showing 177 changed files with 4,308 additions and 511 deletions.
20 changes: 20 additions & 0 deletions Api/CheckoutSessionManagementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,70 @@
interface CheckoutSessionManagementInterface
{
/**
* Retrieve config values for button rendering
*
* @param string|null $cartId
* @return mixed
*/
public function getConfig($cartId = null);

/**
* Get shipping address associated with Amazon checkout session
*
* @param mixed $amazonSessionId
* @return mixed
*/
public function getShippingAddress($amazonSessionId);

/**
* Get billing address associated with Amazon checkout session
*
* @param mixed $amazonSessionId
* @return mixed
*/
public function getBillingAddress($amazonSessionId);

/**
* Get short description of selected payment method for Amazon checkout session
*
* @param mixed $amazonSessionId
* @return string
*/
public function getPaymentDescriptor($amazonSessionId);

/**
* Set payment/charge information on Amazon checkout session so it can be completed.
*
* On success, returns an Amazon-hosted URL to redirect the buyer to for payment processing.
*
* @param mixed $amazonSessionId
* @param mixed|null $cartId
* @return string
*/
public function updateCheckoutSession($amazonSessionId, $cartId = null);

/**
* Complete the Amazon checkout session and place the order in Magento
*
* @param mixed $amazonSessionId
* @param mixed|null $cartId
* @return mixed
*/
public function completeCheckoutSession($amazonSessionId, $cartId = null);

/**
* Login to the Magento store using Amazon account information
*
* Creates a Magento store account if one does not exist.
*
* @param mixed $buyerToken
* @return mixed
*/
public function signIn($buyerToken);

/**
* Links entries in the amazon_customer table to Magento customer records
*
* @param mixed $buyerToken
* @param string $password
* @return mixed
Expand Down
4 changes: 2 additions & 2 deletions Api/CustomerLinkRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getById($entityId);
/**
* Delete customer link.
*
* @param \Amazon\Pay\Api\Data\CustomerLinkInterface Customer link interface.
* @param \Amazon\Pay\Api\Data\CustomerLinkInterface $customerLink
* @return bool
* @throws CouldNotDeleteException
*/
Expand All @@ -72,7 +72,7 @@ public function deleteById($entityId);
/**
* Save customer link
*
* @param \Amazon\Pay\Api\Data\CustomerLinkInterface Customer link interface.
* @param \Amazon\Pay\Api\Data\CustomerLinkInterface $customerLink
* @return \Amazon\Pay\Api\Data\CustomerLinkInterface
* @throws CouldNotSaveException
*/
Expand Down
4 changes: 2 additions & 2 deletions Api/Data/AmazonNameInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/
interface AmazonNameInterface
{
const FIRST_NAME = 'first_name';
const LAST_NAME = 'last_name';
public const FIRST_NAME = 'first_name';
public const LAST_NAME = 'last_name';

/**
* Get first name
Expand Down
14 changes: 7 additions & 7 deletions Api/Data/AsyncInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
*/
interface AsyncInterface
{
const ID = 'entity_id';
const ORDER_ID = 'order_id';
const IS_PENDING = 'is_pending';
const PENDING_ACTION = 'pending_action';
const PENDING_ID = 'pending_id';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
public const ID = 'entity_id';
public const ORDER_ID = 'order_id';
public const IS_PENDING = 'is_pending';
public const PENDING_ACTION = 'pending_action';
public const PENDING_ID = 'pending_id';
public const CREATED_AT = 'created_at';
public const UPDATED_AT = 'updated_at';

/**
* Get entity id
Expand Down
6 changes: 3 additions & 3 deletions Api/Data/CustomerLinkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ interface CustomerLinkInterface
/*
* Entity ID.
*/
const ENTITY_ID = 'entity_id';
public const ENTITY_ID = 'entity_id';

/*
* Customer ID.
*/
const CUSTOMER_ID = 'customer_id';
public const CUSTOMER_ID = 'customer_id';

/*
* Amazon ID.
*/
const AMAZON_ID = 'amazon_id';
public const AMAZON_ID = 'amazon_id';

/**
* Set amazon id
Expand Down
7 changes: 7 additions & 0 deletions Block/Adminhtml/System/Config/Form/CarrierCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class CarrierCodes extends AbstractFieldArray
*/
private $amazonCarrierRenderer;

/**
* @inheritDoc
*/
protected function _prepareToRender()
{
$this->addColumn('carrier', [
Expand Down Expand Up @@ -79,6 +82,8 @@ protected function _prepareArrayRow(DataObject $row): void
}

/**
* Get block to render carrier list
*
* @return CarrierRenderer
* @throws LocalizedException
*/
Expand All @@ -95,6 +100,8 @@ private function getCarrierRenderer()
}

/**
* Get block to render carrier list for Amazon
*
* @return AmazonCarrierRenderer
* @throws LocalizedException
*/
Expand Down
4 changes: 2 additions & 2 deletions Block/Adminhtml/System/Config/Form/DeveloperLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
class DeveloperLogs extends \Magento\Config\Block\System\Config\Form\Field
{
const DOWNLOAD_PATH = 'amazon_pay/pay/downloadLog';
public const DOWNLOAD_PATH = 'amazon_pay/pay/downloadLog';

const LOGS = [
public const LOGS = [
'async' => ['name' => 'IPN Log', 'path' => \Amazon\Pay\Logger\Handler\AsyncIpn::FILENAME],
'client' => ['name' => 'Client Log', 'path' => \Amazon\Pay\Logger\Handler\Client::FILENAME],
'alexa' => ['name' => 'Alexa Log', 'path' => \Amazon\Pay\Logger\Handler\Alexa::FILENAME],
Expand Down
11 changes: 11 additions & 0 deletions Block/Adminhtml/System/Config/Form/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class Note extends \Magento\Config\Block\System\Config\Form\Field
*/
protected $amazonConfig;

/**
* Note constructor
*
* @param \Amazon\Pay\Model\AmazonConfig $amazonConfig
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Amazon\Pay\Model\AmazonConfig $amazonConfig,
\Magento\Backend\Block\Template\Context $context,
Expand All @@ -37,6 +44,8 @@ public function __construct(
}

/**
* Render scope label
*
* @param AbstractElement $element
* @return string
*/
Expand All @@ -46,6 +55,8 @@ protected function _renderScopeLabel(AbstractElement $element)
}

/**
* Render note
*
* @param AbstractElement $element
* @return string
*/
Expand Down
3 changes: 1 addition & 2 deletions Block/Adminhtml/System/Config/Form/PrivateKeySelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class PrivateKeySelector extends \Magento\Config\Block\System\Config\Form\Field
protected $_template = 'Amazon_Pay::system/config/private-key.phtml';

/**
* @param AbstractElement $element
* @return string
* @inheritDoc
*/
protected function _getElementHtml(AbstractElement $element)
{
Expand Down
13 changes: 13 additions & 0 deletions Block/Adminhtml/System/Config/Form/RestrictCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class RestrictCategories extends \Magento\Config\Block\System\Config\Form\Field
*/
private $categoryOptions;

/**
* RestrictCategories constructor
*
* @param \Magento\Catalog\Ui\Component\Product\Form\Categories\Options $categoryOptions
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Catalog\Ui\Component\Product\Form\Categories\Options $categoryOptions,
\Magento\Backend\Block\Template\Context $context,
Expand All @@ -35,6 +42,8 @@ public function __construct(
}

/**
* Retrieve data from Restricted Categories field
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return array
*/
Expand All @@ -54,6 +63,8 @@ protected function _getElementData(\Magento\Framework\Data\Form\Element\Abstract
}

/**
* Create JS data scope from config element
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
Expand All @@ -71,6 +82,8 @@ protected function _getElementDataScope(\Magento\Framework\Data\Form\Element\Abs
}

/**
* Render restricted categories element
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
Expand Down
9 changes: 9 additions & 0 deletions Block/Adminhtml/System/Config/Form/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
*/
protected $helper;

/**
* Version constructor
*
* @param \Amazon\Pay\Helper\Data $helper
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Amazon\Pay\Helper\Data $helper,
\Magento\Backend\Block\Template\Context $context,
Expand All @@ -35,6 +42,8 @@ public function __construct(
}

/**
* Render version information
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
Expand Down
36 changes: 29 additions & 7 deletions Block/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,59 @@ class Config extends \Magento\Framework\View\Element\Template
private $amazonConfig;

/**
* Config constructor.
* @var \Amazon\Pay\Model\Subscription\SubscriptionManager
*/
private $subscriptionManager;

/**
* Config constructor
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Amazon\Pay\Helper\Data $amazonHelper
* @param \Amazon\Pay\Model\AmazonConfig $amazonConfig
* @param \Amazon\Pay\Model\Subscription\SubscriptionManager $subscriptionManager
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Amazon\Pay\Helper\Data $amazonHelper,
\Amazon\Pay\Model\AmazonConfig $amazonConfig
\Amazon\Pay\Model\AmazonConfig $amazonConfig,
\Amazon\Pay\Model\Subscription\SubscriptionManager $subscriptionManager
) {
parent::__construct($context);
$this->amazonHelper = $amazonHelper;
$this->amazonConfig = $amazonConfig;
$this->subscriptionManager = $subscriptionManager;
}

/**
* Package module configuration values for button rendering
*
* @return array
*/
public function getConfig()
{
$config = [
'region' => $this->amazonConfig->getRegion(),
'code' => \Amazon\Pay\Gateway\Config\Config::CODE,
'is_method_available' => $this->amazonConfig->isPayButtonAvailableAsPaymentMethod(),
'is_pay_only' => $this->amazonHelper->isPayOnly(),
'region' => $this->amazonConfig->getRegion(),
'code' => \Amazon\Pay\Gateway\Config\Config::CODE,
'vault_code' => \Amazon\Pay\Gateway\Config\Config::VAULT_CODE,
'is_method_available' => $this->amazonConfig->isPayButtonAvailableAsPaymentMethod(),
'is_pay_only' => $this->amazonHelper->isPayOnly(),
'is_lwa_enabled' => $this->isLwaEnabled(),
'is_guest_checkout_enabled' => $this->amazonConfig->isGuestCheckoutEnabled(),
'has_restricted_products' => $this->amazonHelper->hasRestrictedProducts(),
'is_multicurrency_enabled' => $this->amazonConfig->multiCurrencyEnabled()
'is_multicurrency_enabled' => $this->amazonConfig->multiCurrencyEnabled()
];

if ($subscriptionLabel = $this->subscriptionManager->getSubscriptionLabel()) {
$config['subscription_label'] = $subscriptionLabel;
}

return $config;
}

/**
* Convert config values to JSON object
*
* @return string
*/
public function getJsonConfig()
Expand All @@ -78,6 +96,8 @@ public function getJsonConfig()
}

/**
* Return true if module is enabled
*
* @return bool
*/
public function isEnabled()
Expand All @@ -86,6 +106,8 @@ public function isEnabled()
}

/**
* Return true if Amazon Sign in is enabled
*
* @return bool
*/
public function isLwaEnabled()
Expand Down
2 changes: 1 addition & 1 deletion Block/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
}

/**
* @return string
* @inheritDoc
*/
protected function _toHtml()
{
Expand Down

0 comments on commit e5d32fe

Please sign in to comment.