Git Product home page Git Product logo

subscribepro-magento2-ext's Introduction

Subscribe Pro Magento 2 Integration Extension

Latest Stable Version Total Downloads Latest Unstable Version License

This is the official Magento 2 extension for Subscribe Pro.

To learn more about Subscribe Pro you can visit us at https://www.subscribepro.com/.

Getting Started

Please visit our documentation website and start with our step by step integration guide for Magento 2: https://docs.subscribepro.com/display/spd/Install+Subscribe+Pro+for+Magento+2

Installation via Composer

You can install our Subscribe Pro Magento 2 extension via Composer. Please run these commands at the root of your Magento install:

composer require subscribepro/subscribepro-magento2-ext
php bin/magento module:enable Swarming_SubscribePro
php bin/magento setup:upgrade

Coding Standards

Subscribe Pro team follows the standards described in https://devdocs.magento.com

Subscribe Pro's internal coding standards

  • Use fully-qualified class names in PHPDoc, e.g.,
    /**
     * @param \Magento\Framework\App\RequestInterface $request
     * @return bool
     */
    
    This is expected to make the code more clear when skimming through, leaves less ambiguity when dealing with classes that are named similarly but belong to different namespaces, in IDE there is no need to ctrl+click twice to actually see the class if an alias is used. This also eradicates the situations when an unnecessary use operator is included only for the sake of writing a phpdoc/comment.
  • No space after type cast, e.g.,
    (int)$variable
    
    None of the existing PHP standards stipulates this at the moment of writing, so "no space" was elected.

To confirm project is compliant with standards PHP_CodeSniffer (phpcs)

Run PHP_CodeSniffer:

vendor/bin/phpcs -s \
  --standard=Magento2 app/code/Swarming/SubscribePro \
  --extensions=phtml \
  --error-severity=10 \
  --ignore-annotations \
  --exclude=Magento2.Annotation.MethodAnnotationStructure \
  app/code/Swarming/SubscribePro

To automatically fix certain issues with PHP Code Beautifier and Fixer:

bin/phpcbf --standard=Magento2 \
  --extensions=phtml \
  --error-severity=10 \
  --ignore-annotations \
  --exclude=Magento2.Annotation.MethodAnnotationStructure \
  app/code/Swarming/SubscribePro

Run phpstan

bin/analyse app/code/Swarming/SubscribePro --level=1 -c app/code/Swarming/SubscribePro/phpstan.neon

Run PHP Coding Standards Fixer (php-cs-fixer)

php-cs-fixer fix src/app/code/Swarming/SubscribePro

subscribepro-magento2-ext's People

Contributors

czettnersandor avatar eugene-shab avatar garthbrantley avatar graysonblanchard avatar h3raldo avatar imkingdavid avatar john-sparwasser avatar pmclain avatar rarespintearebound avatar san1tar1um avatar vkalchenko avatar ytorbyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

subscribepro-magento2-ext's Issues

window.subscribeProPaymentConfigs shows incorrect store_id

When creating an order for a new or existing customer in the admin in multi-store website, subscribe pro appears to get the wrong store_id.

Selecting store_id for example which is 18 when checking out, but the window.subscribeProPaymentConfigs has store 34

Shipping Address not working with apple pay (ShipperHQ)

When loading the shipping methods the data being sent to the module has the wrong values:
Data sent

{
    "shippingContact": {
        "administrativeArea": "IL",
        "country": "United States",
        "countryCode": "US",
        "familyName": "",
        "givenName": "",
        "locality": "Chichago",
        "postalCode": "60007",
        "subAdministrativeArea": "",
        "subLocality": ""
    }
}

but on the module in \Swarming\SubscribePro\Model\ApplePay\Shipping::getDirectoryRegionByName the administrativeArea is needed to be used as the state/region name (Illinois in this case) instead of the provided id or code. Thus sending an empty region to shipperhq and returning invalid rates for the requested address

My Product Subscriptions page does not work when Magento is installed in a subdirectory

I am able to reproduce this issue using a Magento installation in a subdirectory on an Apache server.

Steps to reproduce:

  1. Install Magento 2.1.4 into a subdirectory (I recommend using Apache). Install and configure SP extension 1.0.14.
  2. Create a subscription to a subscription product.
  3. Navigate to My Product Subscriptions in the My Account section. The page should load just fine this time.
  4. Navigate away from this page and then back to it. The loading spinner will keep spinning. If you check the Dev Tools console, you will see an error:
Failed to load resource: https://{DOMAIN}/rest/V1/swarming_subscribepro/me/subscriptions?_={TOKEN} the server responded with a status of 404 (Not Found)

Note in the above error message that the /rest/V1... path begins at the domain root rather than the subdirectory into which Magento was installed.

In my testing, even after clearing the cache I receive the same error message.

Admin reorder on a guest order does not work

The issue

I know most people don't use the subscribe pro payment method for guest orders. But if you do you'll get an error when trying to use the reorder functionality in the admin:

Transaction has been declined. Please try again later.

Which is masking:

Cannot create payment profile.

vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/AbstractProfileCreatorCommand.php

The solution

The payment form has the hidden field payment[is_active_payment_token_enabler] hard coded to 'true'. This should be false for guest orders.

Class 'array' Does Not Exist when attempting to access SOAP endpoints after SP extension is installed

I am able to reproduce this in multiple M2 environments with the SP extension installed.

Steps to reproduce:

  1. Install M2 and the SP extension.
  2. Navigate to https://{DOMAIN}/soap/default/?wsdl&services=catalogProductRepositoryV1
  3. If error reporting is not disabled you will see:
    Internal Error. Details are available in Magento log file. Report ID: webapi-58f678b12b20b
    (Otherwise you will find that in a file in var/report).
  4. When you look in the var/log/exception.log file you will find the following:
[2017-04-18 20:36:01] main.CRITICAL: exception 'LogicException' with message 'Class "array" does not exist. Please note that namespace must be specified.' in /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php:156
Stack trace:
#0 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(229): Magento\Framework\Reflection\TypeProcessor->register('array')
#1 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(198): Magento\Framework\Reflection\TypeProcessor->_processMethod(Object(Zend\Code\Reflection\MethodReflection), 'SwarmingSubscri...')
#2 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(162): Magento\Framework\Reflection\TypeProcessor->_processComplexType('\\Swarming\\Subsc...')
#3 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(229): Magento\Framework\Reflection\TypeProcessor->register('\\Swarming\\Subsc...')
#4 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(198): Magento\Framework\Reflection\TypeProcessor->_processMethod(Object(Zend\Code\Reflection\MethodReflection), 'SwarmingSubscri...')
#5 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(162): Magento\Framework\Reflection\TypeProcessor->_processComplexType('\\Swarming\\Subsc...')
#6 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(183): Magento\Framework\Reflection\TypeProcessor->register('\\Swarming\\Subsc...')
#7 /var/www/html/web/magento2test/vendor/magento/framework/Reflection/TypeProcessor.php(162): Magento\Framework\Reflection\TypeProcessor->_processComplexType('\\Swarming\\Subsc...')
#8 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/Config/ClassReflector.php(103): Magento\Framework\Reflection\TypeProcessor->register('\\Swarming\\Subsc...')
#9 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/Config/ClassReflector.php(72): Magento\Webapi\Model\Config\ClassReflector->extractMethodData(Object(Zend\Code\Reflection\MethodReflection))
#10 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/ServiceMetadata.php(120): Magento\Webapi\Model\Config\ClassReflector->reflectClassMethods('Swarming\\Subscr...', Array)
#11 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/ServiceMetadata.php(148): Magento\Webapi\Model\ServiceMetadata->initServicesMetadata()
#12 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/ServiceMetadata.php(165): Magento\Webapi\Model\ServiceMetadata->getServicesConfig()
#13 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/Soap/Wsdl/Generator.php(366): Magento\Webapi\Model\ServiceMetadata->getServiceMetadata('catalogProductR...')
#14 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/AbstractSchemaGenerator.php(169): Magento\Webapi\Model\Soap\Wsdl\Generator->getServiceMetadata('catalogProductR...')
#15 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/Soap/Wsdl/Generator.php(374): Magento\Webapi\Model\AbstractSchemaGenerator->getAllowedServicesMetadata(Array)
#16 /var/www/html/web/magento2test/vendor/magento/module-webapi/Model/AbstractSchemaGenerator.php(104): Magento\Webapi\Model\Soap\Wsdl\Generator->getAllowedServicesMetadata(Array)
#17 /var/www/html/web/magento2test/vendor/magento/module-webapi/Controller/Soap.php(132): Magento\Webapi\Model\AbstractSchemaGenerator->generate(Array, 'https', 'davidking.io', 'https://davidki...')
#18 /var/www/html/web/magento2test/var/generation/Magento/Webapi/Controller/Soap/Interceptor.php(24): Magento\Webapi\Controller\Soap->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /var/www/html/web/magento2test/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Soap\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#20 /var/www/html/web/magento2test/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#21 /var/www/html/web/magento2test/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#22 {main}

Next exception 'Exception' with message 'Report ID: webapi-58f678b12b20b; Message: Class "array" does not exist. Please note that namespace must be specified.' in /var/www/html/web/magento2test/vendor/magento/framework/Webapi/ErrorProcessor.php:195
Stack trace:
#0 /var/www/html/web/magento2test/vendor/magento/framework/Webapi/ErrorProcessor.php(139): Magento\Framework\Webapi\ErrorProcessor->_critical(Object(LogicException))
#1 /var/www/html/web/magento2test/var/generation/Magento/Framework/Webapi/ErrorProcessor/Proxy.php(95): Magento\Framework\Webapi\ErrorProcessor->maskException(Object(LogicException))
#2 /var/www/html/web/magento2test/vendor/magento/module-webapi/Controller/Soap.php(181): Magento\Framework\Webapi\ErrorProcessor\Proxy->maskException(Object(LogicException))
#3 /var/www/html/web/magento2test/vendor/magento/module-webapi/Controller/Soap.php(148): Magento\Webapi\Controller\Soap->_prepareErrorResponse(Object(LogicException))
#4 /var/www/html/web/magento2test/var/generation/Magento/Webapi/Controller/Soap/Interceptor.php(24): Magento\Webapi\Controller\Soap->dispatch(Object(Magento\Framework\App\Request\Http))
#5 /var/www/html/web/magento2test/vendor/magento/framework/App/Http.php(135): Magento\Webapi\Controller\Soap\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#6 /var/www/html/web/magento2test/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#7 /var/www/html/web/magento2test/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#8 {main} [] []

This error stops occurring if I disable the Swarming_SubscribePro module and re-attempt to load the https://{DOMAIN}/soap/default/?wsdl&services=catalogProductRepositoryV1 URL.

QuoteItem interval option value is set to null when customer tries to make a reorder

When the existing order has items with subscriptions and customer tries to make a reorder in My Account - interval option value on the QuoteItem is set to null. I believe the issue happens in this method:
\Swarming\SubscribePro\Model\Quote\SubscriptionOption\Updater::update when param $itemAddedBySubscribePro is set to true.

Magento version: 2.4.5-p1
SubscribePro module version: 1.5.16

Tiered pricing does not show discount on PDP

When a product has a tiered price for a specific customer group, the Subscription Discount does not display on the PDP.

With a product with a $100 base price and a $90 tiered price applying to logged in users, observe the following behavior:

When logged out the $100 base price is displayed and the subscription option shows a 20% discount:
tiered-pricing-pdp-logged-out

When logged in the $90 tiered price kicks in but both the subscription and one-time options show $90 with no discount:
tiered-pricing-pdp-logged-in

Customer address validation while updating shipping address is not working

Magento version: 2.4
Extension Version: 1.3.7

Steps to reproduce.

  1. Login as customer. On customer account page, follow "Product Subscriptions" tab.
  2. On any active subscriptions, click "More details"
  3. Right below "Delivery Address" click option to change shipping address.
  4. After updating, click "Continue" and nothing happens.

isValidNewAddress method is always returning false on subscription/shipping-info.js file.

Price caching in M2 Extension

"Noticed a potential issue with the Magento 2 module. When a product has a special price set in the Magento catalog, and that special price is removed, the special price will still appear in the PLP and PDP until the Subscribe Pro Product Data cache is individually refreshed. The price set in Subscribe Pro will not appear until after the cache is refreshed individually by selecting the "Subscribe Pro Product Data" item in the admin panel and choosing to refresh via the drop down."

Tiered pricing and subscription discounts in M2 Extension

"We are noticing an issue with Magento 2.1.3 Enterprise and Subscript Pro 1.0.7.

A subscription product setup in Magento with a tier price will not reflect any subscription discount amount configured in Subscribe Pro on the PLP or PDP. The cart and mini cart will reflect discount percentages. On the PLP and PDP, only the tier price is reflected."

Voids on already released Stripe Charges

Currently, if you try to cancel a pending order 7 days after an authorization has been made, you'll receive a Transaction Declined error.

This happens because stripe will release authorizations automatically after 7 days. When performing a cancel in the admin, the SP gateway will try to void the payment via the SP api which then tries a refund request on the given charge. Stripe will throw 40x error because you can't refund a charge that's already been refunded. SP Api then returns this error back to the client which in turn triggers the Transaction Declined error message.

Possible Solutions

  • Update in the SP Api to where they will check stripe (and maybe even other gateway providers) to see if the charge has been already refunded and then return a successful response back to the Client
  • Update in the SP api to return a specific error code when trying to refund a charge that's already been refunded, and then in the Swarming\SubscribePro\Gateway\Validator::validate check for that error code and allow the transaction to be seen as valid

Workaround

Currently, to get around this, I've built the following class like this:

<?php

namespace JoinEby\Sales\Gateway\Validator;

use Magento\Payment\Gateway\Validator\ValidatorInterface;
use Magento\Payment\Gateway\Validator\AbstractValidator;
use SubscribePro\Service\Transaction\TransactionInterface;

/**
 * Stripe will release authorizations after 7 days. If you try to void a charge that's already been released, stripe will throw an error.
 * This validator decorator will check for that specific error message and allow the transaction to be valid if that's the case.
 */
class StripeCancelledResponseValidator extends AbstractValidator implements ValidatorInterface
{
    private $validator;

    /**
     * @var \Swarming\SubscribePro\Gateway\Helper\SubjectReader
     */
    protected $subjectReader;

    /**
     * @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
     * @param \Swarming\SubscribePro\Gateway\Helper\SubjectReader $subjectReader
     */
    public function __construct(
        ValidatorInterface $validator,
        \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
        \Swarming\SubscribePro\Gateway\Helper\SubjectReader $subjectReader
    ) {
        parent::__construct($resultFactory);
        $this->validator = $validator;
        $this->subjectReader = $subjectReader;
    }

    /**
     * @param array $validationSubject
     * @return \Magento\Payment\Gateway\Validator\ResultInterface
     * @throws \InvalidArgumentException
     */
    public function validate(array $validationSubject)
    {
        $transaction = $this->subjectReader->readTransaction($validationSubject);

        if ($transaction->getState() != TransactionInterface::STATE_GATEWAY_PROCESSING_FAILED) {
            return $this->validator->validate($validationSubject);
        }

        $message = $transaction->getResponseMessage();

        return $this->createResult(preg_match('/Charge .+ has already been refunded./i', $message) === 1);
    }
}

and have the following entries in my di.xml

    <!-- Decorate the SP Response Validator -->
    <type name="JoinEby\Sales\Gateway\Validator\StripeCancelledResponseValidator">
        <arguments>
            <argument name="validator" xsi:type="object">Swarming\SubscribePro\Gateway\Validator\ResponseValidator</argument>
        </arguments>
    </type>

    <!-- VoidCommand - override the validator -->
    <type name="Swarming\SubscribePro\Gateway\Command\VoidCommand">
        <arguments>
            <argument name="validator" xsi:type="object">JoinEby\Sales\Gateway\Validator\StripeCancelledResponseValidator</argument>
        </arguments>
    </type>

This 100% is a brittle hack and will break if any of the messaging changes, but it works for now...

Session contains old data

Hi.
We were able to catch an issue, when two orders were placed one by one, first contained subscription products, second one - did not. And then SP request failed for some reasons. Due to this fail, checkout session still contains data about previous order and Magento displays a message on "Order Success" page - You will receive a separate email confirmation for your product subscription(s).

What do you think about adding an additional session cleanup into the try-catch block of SubmitAllAfter observer?

Cart does not merge items on update

Hello,

We've noticed an issue with cart items merge, steps to reproduce:
1.) Add "one time purchase" product to cart
2.) Add the same product with subscription to cart
3.) In cart, remove subscription from last added product to it become "one time purchase" as well
As the result items haven't been merged, hence we have 2 different entries in quote.

Note: when adding "one time purchase" product several times to cart, merging works properly, so we assume this is not a magento bug.

Thank You

Installation error on Magento 2.4.4 version

getting the following error when trying to install the plugin on Magento 2.4.4 Enterprise version

composer2 require subscribepro/subscribepro-magento2-ext

`Using version ^1.5 for subscribepro/subscribepro-magento2-ext
./composer.json has been updated
Running composer update subscribepro/subscribepro-magento2-ext
Loading composer repositories with package information
In Laminas\DependencyPlugin\DependencyRewriterV2::onPrePoolCreate
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- subscribepro/subscribepro-magento2-ext[1.5.10, ..., 1.5.15] require subscribepro/subscribepro-php ~1.0.24 -> satisfiable by subscribepro/subscribepro-php[1.0.24].
- subscribepro/subscribepro-magento2-ext[1.5.4, ..., 1.5.9] require subscribepro/subscribepro-php ~1.0.23 -> satisfiable by subscribepro/subscribepro-php[1.0.23, 1.0.24].
- subscribepro/subscribepro-magento2-ext[1.5.2, ..., 1.5.3] require subscribepro/subscribepro-php ~1.0.19 -> satisfiable by subscribepro/subscribepro-php[1.0.19, ..., 1.0.24].
- subscribepro/subscribepro-magento2-ext[1.5.0, ..., 1.5.1] require subscribepro/subscribepro-php ~1.0.18 -> satisfiable by subscribepro/subscribepro-php[1.0.18, ..., 1.0.24].
- subscribepro/subscribepro-php[1.0.18, ..., 1.0.24] require guzzlehttp/guzzle ~6.0.1|~6.1|~6.2 -> found guzzlehttp/guzzle[6.0.1, ..., 6.5.8] but it conflicts with your root composer.json require (^7.4).
- Root composer.json requires subscribepro/subscribepro-magento2-ext ^1.5 -> satisfiable by subscribepro/subscribepro-magento2-ext[1.5.0, ..., 1.5.15].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require subscribepro/subscribepro-magento2-ext:*" to figure out if any version is installable, or "composer require subscribepro/subscribepro-magento2-ext:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
`

New line item created when adding one-time order product to the cart multiple times.

In my testing, this behavior is only present when using a subscribable product (has subscription turned on in the backend) and adding it to the cart as a one-time order multiple times. Instead of incrementing the product's quantity, it adds a new line-item.

This does not happen when adding a product to the cart as a subscription multiple times, or when adding a non-subscribable product to the cart multiple times. In both cases the quantity is increased as expected.

Steps to reproduce:

  1. Create a product in Magento 2
  2. Enable the "Subscription Enabled" parameter.
  3. Add the product to the cart as a one-time purchase multiple times.
  4. Observe that the product is added as multiple line items rather than a single item with a >1 quantity.

See screenshot:
multiple-line-items

Subscriptions not created from customer reorder.

PRs: #245

Issue Summary

Customer attempts to reorder from their account from a subscription recurring order. The order is successful, but no new subscriptions created. The subscription id's on the new order are those from the subscriptions used to create the recurring order.

Video of issue upon request.

Discount Description/Label displays in checkout when it should not

With the new Magento 2.4.5 updates to this module that require you to create a cart rule we're noticing that the cart rule displays when it should not.

Steps to Reproduce

  • Magento 2.4.5, Subscribe Pro module 1.5.16
  • Setup the rule as specified here making sure to include a label (Subscription)
  • Setup another 10% off coupon and add a label for that (10% Off)
  • On the frontend add a non-subscription item to the cart and apply the 10% coupon

Expected Result:

  • You should only see the 10% off coupon description

Actual Result:

  • You see both the 10% off coupon description and the subscribe pro coupon description

Our Solution:

  • Remove the Label and Description from the subscribe pro cart rule
  • Make sure to set the "Priority" field very high so that Subscribe Pro gets that last word among cart rules. I set mine to 1000
  • Add the following change to reintroduce the original subscribe pro discount text in vendor/subscribepro/subscribepro-magento2-ext/Model/Quote/ItemSubscriptionDiscount.php:

Replace this:

    protected function addDiscountDescription(QuoteItem $item)
    {
        $discountDescriptions = $item->getAddress()->getDiscountDescriptionArray();
        $item->getAddress()->setDiscountDescriptionArray($discountDescriptions);
    }

With this:

    protected function addDiscountDescription(QuoteItem $item)
    {
        $discountDescriptions = $item->getAddress()->getDiscountDescriptionArray();
        // BEGIN MOD: Fix discount description on checkout
        $discountDescriptions[self::KEY_DISCOUNT_DESCRIPTION] = __('Subscription');
        // END MOD
        $item->getAddress()->setDiscountDescriptionArray($discountDescriptions);
    }

Version 1.3.7 - validCardTypes is not defined

Hi,
we're experiencing JS error on checkout after upgrading to 1.3.7. It appears after clicking Place Order button.

Uncaught ReferenceError: validCardTypes is not defined
    at UiClass.validationPaymentData (cc-form.js:119)
    at Object.proxy (jquery.js:535)
    at Object.a (iframe-v1.min.js:6)
    at O.emit (iframe-v1.min.js:6)
    at iframe-v1.min.js:6

Subscription discount doesn't apply when no discount rules present in cart

Weโ€™re working on an upgrade to Magento 2.4.5

Weโ€™ve got the latest version of your module installed (1.5.16).

While testing things out weโ€™ve noticed that the subscription discounts no longer apply. It looks like theyโ€™ve reworked the logic around discounts in vendor/magento/module-sales-rule/Model/Quote/Discount.php::collect

Now (In 2.4) the discount logic (Magento\SalesRule\Model\Validator::process) will only apply if thereโ€™s a cart rule applied to the quote.

So the SubscribePro plugin found here vendor/subscribepro/subscribepro-magento2-ext/Plugin/SalesRule/Validator.php never fires.

As a quick and dirty workaround Iโ€™ve added an empty cart rule with no discount that always applies. This allows the subscribe pro aroundProcess plugin to fire and discount the subscription items in the cart.

Itโ€™s a bit tricky to recommend a proper way to solve this issue. That plugin may need to be refactored into a proper cart rule, or maybe thereโ€™s a different plugin point that could be used. It seems like maintaining backwards compatibility with Magento 2.3 could be difficult.

"The "String" class doesn't exist and the namespace must be specified." errors after upgrading to 2.4.5-p1

PR: #173

The client is seeing the following error in their production logs:

report.CRITICAL: LogicException: The "String" class doesn't exist and the namespace must be specified. Verify and try again. in /app/hmnfdwo4bkt2g/vendor/magento/framework/Reflection/TypeProcessor.php:147

The client reached out to Adobe support and they said they are seeing this issue in the "swarming_subscribepro" module, Specifically the:

..the module Swarming_SubscribePro is using an improper parameter type String in Swarming\SubscribePro\Api\CartManagementInterface::26. ...

(Multistore) Adminhtml for non-default website/store pulls cache using frontend cache tags of default website (if cached items exists)

\Swarming\SubscribePro\Block\Adminhtml\Order\Create\Items\Grid has a variable \Swarming\SubscribePro\Platform\Manager\Product $platformProductManager,

class Swarming\SubscribePro\Platform\Storage\Product appears to be used on the backend for loading a product with params: $sku and $websiteId = null.

Since the default website would be used for websiteId of null, $platformProductData = $this->cache->load($cacheKey);, where $this->cache is \Magento\Framework\Cache\FrontendInterface $cache,

$cacheKey is the returned object:

 $websiteCode = $this->storeManager->getWebsite($websiteId)->getCode();
 return self::PRODUCT_CACHE_KEY . '_' . md5(serialize([$sku, $websiteCode]));

This issue appears to be related to the following, as well:

#15
#40

Unable to place admin order for new customer

Magento 2.3.1 multistore setup
SP 1.1.6

When trying to create an order in admin for new customer, vendor/subscribepro/subscribepro-magento2-ext/view/adminhtml/web/js/admin-order-refresh.js creates a redirect back to store selector every time you select a store.
Hence admin order can't be placed for new customer.

Issue is not happening once admin-order-refresh.js removed from order create process.

Thank You

Cannot add card for deleted and recreated customer

If a customer is deleted from Magento 2 and recreated, new cards fail to be created with an error like the following:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`vault_payment_token`, CONSTRAINT `VAULT_PAYMENT_TOKEN_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) ON DELETE CASCADE), query was: INSERT INTO `vault_payment_token` (`customer_id`, `public_hash`, `payment_method_code`, `type`, `expires_at`, `gateway_token`, `details`, `is_active`, `is_visible`) VALUES (?, ?, ?, ?, '2021-09-01 00:00:00', ?, ?, ?, ?)

Steps to reproduce:

  1. Have an existing customer with email address [email protected] that has an existing subscription and payment profile/stored card.
  2. Delete that customer in Magento
  3. Create a new customer in Magento with the same email address
  4. Attempt to create a payment profile/stored card for that customer in Magento.

Array to String error in API serialization

The Magento 2 Extension calls the endpoint rest/V1/swarming_subscribepro/me/subscriptions to return a list of subscriptions and their subscription products.

Magento throws a notice: Array to String conversion at magento/framework/Reflection/TypeCaster.php:34. It appears that when the API serialized the Subscription model (Swarming\SubscribePro\Model\Subscription) the getProductOption() method returns an array and that array is trying to be saved as a string.

If I squelch the error output from TypeCast, the result looks like this:

<option_list>
<item>Array</item>
</option_list>

From the Subscribe Pro side it looks like this:

{
                "option_id": "137",
                "option_value": 5
}

So maybe the array should be serialized similarly? I really wish I knew what it was supposed to look like then I could provide a fix for you.

Salesrule Validator argument error Magento 2.4.4

Following error occurs during add to cart request on Salesrule Validator Plugin.

ArgumentCountError: Too few arguments to function Magento\SalesRule\Model\Validator::process(), 1 passed in /var/www/html/vendor/magento/framework/Interception/Interceptor.php on line 58 and exactly 2 expected in /var/www/html/vendor/magento/module-sales-rule/Model/Validator.php:295
Stack trace:
#0 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\SalesRule\Model\Validator->process(Object(Magento\Quote\Model\Quote\Item\Interceptor))
#1 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\SalesRule\Model\Validator\Interceptor->___callParent('process', Array)
#2 /var/www/html/vendor/subscribepro/subscribepro-magento2-ext/Plugin/SalesRule/Validator.php(67): Magento\SalesRule\Model\Validator\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Quote\Model\Quote\Item\Interceptor))
#3 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Swarming\SubscribePro\Plugin\SalesRule\Validator->aroundProcess(Object(Magento\SalesRule\Model\Validator\Interceptor), Object(Closure), Object(Magento\Quote\Model\Quote\Item\Interceptor), Object(Magento\SalesRule\Model\Rule\Interceptor))
#4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\SalesRule\Model\Validator\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Quote\Model\Quote\Item\Interceptor), Object(Magento\SalesRule\Model\Rule\Interceptor))
#5 /var/www/html/generated/code/Magento/SalesRule/Model/Validator/Interceptor.php(68): Magento\SalesRule\Model\Validator\Interceptor->___callPlugins('process', Array, NULL)
#6 /var/www/html/vendor/magento/module-sales-rule/Model/Quote/Discount.php(190): Magento\SalesRule\Model\Validator\Interceptor->process(Object(Magento\Quote\Model\Quote\Item\Interceptor), Object(Magento\SalesRule\Model\Rule\Interceptor))
#7 /var/www/html/vendor/magento/module-quote/Model/Quote/TotalsCollector.php(261): Magento\SalesRule\Model\Quote\Discount->collect(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\ShippingAssignment), Object(Magento\Quote\Model\Quote\Address\Total))
#8 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals(Object(Magento\Quote\Model\Quote\Interceptor), Object(Magento\Quote\Model\Quote\Address\Interceptor))
#9 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callParent('collectAddressT...', Array)

vault_payment_token duplicate entry

Hello,

We are having next error on 3 of our 2.1.X projects when placing an order:
Exception message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'subscribe_pro-126837-3525036' for key 'UNQ_54DCE14AEAEA03B587F9EF723EB10A10', query was: INSERT INTO vault_payment_token

As the result, we have order duplicates in SubscribePro, but not in Magento.
Customers are getting charged twice.

This is happening when website is under load.

Unfortunately, we can't upgrade to the latest SP version as it requires Magento 2.2.X version.
Also, we can't determine the root cause of this issue for now, so not sure if this is Magento or SubscribePro.

Was this error noticed by your team previously?

Thanks!

Does not work for "compiled" version of Magento - Uncaught TypeError: Argument 1 passed to SubscribePro\Sdk::__construct() must be of the type array, object given

It seems the module does not actually work for "compiled" version of Magento.
Here's the error stack

2016/10/11 09:27:42 [error] 27728#27728: *188448 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to SubscribePro\Sdk::__construct() must be of the type array, object given, called in /data/www/html/intelligentsia-qa.smarterspecies.com/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93 and defined in /data/www/html/intelligentsia-qa.smarterspecies.com/htdocs/vendor/subscribepro/subscribepro-php/src/SubscribePro/Sdk.php:89
Stack trace:
#0 /data/www/html/intelligentsia-qa.smarterspecies.com/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): SubscribePro\Sdk->__construct(Object(Magento\Framework\ObjectManager\ObjectManager))
#1 /data/www/html/intelligentsia-qa.smarterspecies.com/htdocs/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('SubscribePro\Sd...', Array)
#2 /data/www/html/intelligentsia-qa.smarterspecies.com/htdocs/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magent" while reading response header from upstream, client: 52.39.241.224, server: intelligentsia-qa.smarterspecies.com, request: "GET /checkout/cart/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "intelligentsia-qa.smarterspecies.com", referrer: "https://intelligentsia-qa.smarterspecies.com/flecha-roja-costa-rica-test"

I was able to reproduce this on my local instance with compilation performed. The module works fine in "developer" mode.

Admin ReOrder Public hash Error

When using the Stored Card via Subscribe Pro on reorder, you can sometimes get the following error on Submit Order. Order saving error: Public hash should be defined

I tracked the bug down and found that the issue comes from the fact that in certain scenarios view/adminhtml/web/js/vault.js will not set the publicHash field which when the order gets submitted, the public hash error comes up.

Steps to Reproduce

  1. Create a normal order with a subscription so that you use the SP payment method at checkout
  2. Cancel that order
  3. Create a reorder for that cancelled order
  4. In reorder, remove one of the product items and select Update Items and Quantities
  5. Then make sure billing/shipping is set, select your shipping method, then select the Stored Card with SP.

At this point, the error is already visible by inspecting document.forms.edit_form.elements['payment[public_hash]']. Normally, by this point, the public hash should be set in that field; however, in this specific scenario, the public_hash is empty.

Workaround

Currently, to workaround, we are simply just toggling the payment methods to force the JS listener to set the public_hash

SP Vault Payment Method Doesn't Show for Admin Orders when Non Subscription Transactions is Disabled

Tested in version 1.0.19.

When the SP Vault Payment Method is not enabled for non-subscription transactions, admin orders containing items creating a subscription will not show the SP Vault payment method.

I have tracked this down to Helper\Quote.php:29 where $quote->getItems() returns null instead of returning the list of quote items. Because there are no quote items, the hasSubscriptions() method returns false.

When the SP Vault Payment Method is allowed on non-subscription orders, the payment method is considered available for both subscription and non subscription orders, and is_available is true in Observer\Payment\Availablility.php:53-63.

Order item subscription block missing in admin

Magento 2.3.1
SP 1.1.6

Subscription block is missing for order item when trying to create an order from admin.
M2.3.1 uses module name to define "template" for order items grid, see vendor/magento/module-sales/view/adminhtml/layout/sales_order_create_load_block_items.xml so it doesn't use SP template

SalesRule Product Conditions don't work with Commerce edition.

The preference that adds the additional product conditions to SalesRule does not work with the AdvancedSalesRule extension that comes installed with the Commerce edition of Magento. This should be refactored to use a plugin instead of a preference so it will play nice with other extensions as well.

Cannot configure SP extension per-website in 2.1.4

If SP configuration is set per website, the Client Secret does not save properly and the connection fails.

I have only been able to reproduce this on M 2.1.4.

Steps To Reproduce:

  1. Login to Magento 2.1.4 backend with SP extension installed.
  2. Navigate to Stores -> Configuration and set the Config Scope to "Main Website"
  3. Navigate to Swarming -> Subscribe Pro and expand the first two sections.
  4. Enter the SP API credentials and without saving press Test Connection.
    a. Expected Behavior: Successful Connection
    b. Actual Behavior: Successful Connection
  5. Save the configuration and then press Test Connection.
    a. Expected Behavior: Successful Connection
    b. Actual Behavior: Failed Connection

If you follow the same steps as above, except that "Account Sharing" is set to global and the "Config Scope" is set to global, everything works as expected.

VaultDetailsHandler class not compatible with Magento 2.1.3

Class Swarming\SubscribePro\Gateway\Response\VaultDetailsHandler uses \Magento\Vault\Api\Data\PaymentTokenInterfaceFactory in consctuctor, and unfortunately Magento physically added \Magento\Vault\Api\Data\PaymentTokenInterfaceFactory interface in version 2.1.3.
Thin interface doens't have a di preference so DI manager tries to create an instance of \Magento\Vault\Api\Data\PaymentTokenInterfaceFactory. This causes fatal error.

Possible solution is to change \Magento\Vault\Api\Data\PaymentTokenInterfaceFactory in consctuctor to \Magento\Vault\Model\PaymentTokenFactory

API URL Doesn't Support Non-Root Storefronts

I have an M2 store located at /shop/. The Subscribe Pro extension attempts to send API requests to itself using the root path: /rest/V1/swarming_subscribepro/me/subscriptions.

It does not appear to attempt to resolve the base url for the store.

Example file: subscribepro-magento2-ext/view/frontend/web/js/action/change-shipping-address.js:12:

return storage.post(
                '/rest/V1/swarming_subscribepro/me/subscriptions/update-shipping-address',
                JSON.stringify({subscriptionId: subscriptionId, address: address}),
                false
            )

Billing Address is not saved upon order placement

Currently, after a buyer places an offline payment order in Magento, the billing address is not being saved to the Customer in SubscribePro. Because the address is not saved, the Subscription's Billing Address will not be set. When it is time for their Subscription to renew, the automatic recurring order in SubscribePro will fail due to this error:
400 response received with message: The shipping address is missing. Set the address and try again.

The billing address from Magento should be saved on the Customer in SubscribePro and set as the Billing Address in the Payment section of their Subscription.

Success page throws exception when using another payment method

When checking out with a payment method that is not SP, the success page's block throws an exception because it tries to count subscription data that is not present on the checkout session.

Exception #0 (Exception): Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vendor/subscribepro/subscribepro-magento2-ext/Block/Checkout/Onepage/Success/Subscriptions.php on line 41

The code in question is the following

/**
 * @return int
 */
public function getCountSubscriptions()
{
    return count($this->checkoutSession->getData(SubscriptionCreator::CREATED_SUBSCRIPTION_IDS));
}

I think it should first check if the data is there, and either return false or the count (although converting the whole thing to a bool should do it.)

Error "bad request" when updating qty, frequency, ship date on native My Subscriptions page w/ Magento 2.4.4

https://robert.sp1.dev//rest/V1/swarming_subscribepro/me/subscriptions/update-next-order-date
curl 'https://robert.sp1.dev/rest/V1/swarming_subscribepro/me/subscriptions/update-next-order-date' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0' -H 'Accept: /' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: https://robert.sp1.dev' -H 'Connection: keep-alive' -H 'Referer: https://robert.sp1.dev/subscribepro/customer/subscriptions/' -H 'Cookie: AMCV_8F99160E571FC0427F000101%40AdobeOrg=-1124106680%7CMCIDTS%7C19231%7CMCMID%7C56197231418945290903654937056138844783%7CMCAAMLH-1662132547%7C7%7CMCAAMB-1662132547%7C6G1ynYcLPuiQxYZrsz_pkqfLG9yMXBpb2zX5dvJdYQJzPXImdj0y%7CMCOPTOUT-1661534947s%7CNONE%7CMCSYNCSOP%7C411-19236%7CvVersion%7C5.2.0; private_content_version=490f5c4ffe34c3d0ccd62d0ba8e2bd69; PHPSESSID=2579d3d9bc3375e6eebff182ade96047; form_key=KBfpjK3KXWFQrzzX; mage-cache-storage=%7B%7D; mage-cache-storage-section-invalidation=%7B%7D; mage-messages=; recently_viewed_product=%7B%7D; recently_viewed_product_previous=%7B%7D; recently_compared_product=%7B%7D; recently_compared_product_previous=%7B%7D; product_data_storage=%7B%7D; section_data_ids=%7B%22cart%22%3A1661529104%2C%22directory-data%22%3A1661528904%2C%22customer%22%3A1661527649%2C%22captcha%22%3A1661529104%2C%22last-ordered-items%22%3A1661529104%2C%22instant-purchase%22%3A1661529104%7D; login_redirect=https%3A%2F%2Frobert.sp1.dev%2Fcheckout%2F; X-Magento-Vary=9bf9a599123e6402b85cde67144717a08b817412; form_key=KBfpjK3KXWFQrzzX; mage-cache-sessid=true; AMCVS_8F99160E571FC0427F000101%40AdobeOrg=1' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' --data-raw '{"subscriptionId":248787,"nextOrderDate":"2022-08-31"}'
{
"message": "An error occurred while updating next order date.",
"trace": "#0 [internal function]: Swarming\SubscribePro\Service\SubscriptionManagement->updateNextOrderDate(2, 248787, '2022-08-31')\n#1 /var/www/html/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#2 /var/www/html/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))\n#3 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)\n#5 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#6 /var/www/html/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)\n#7 /var/www/html/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#8 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()\n#9 /var/www/html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()\n#10 /var/www/html/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#11 {main}"
}
#0 [internal function]: Swarming\SubscribePro\Service\SubscriptionManagement->updateNextOrderDate(2, 248787, '2022-08-31')
#1 /var/www/html/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)
#2 /var/www/html/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))
#3 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)
#5 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))
#6 /var/www/html/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->_callPlugins('dispatch', Array, Array)
#7 /var/www/html/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#8 /var/www/html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#9 /var/www/html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#10 /var/www/html/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#11 {main}
Please enter a first name. Field: firstName Value:
Exception Class
SP\Core\Exception\Customer\CustomerManagerException
Hidden Error Message
Please enter a first name. Field: firstName Value:
Stack Trace
#0 /app/vendor/subscribepro/platform-core/src/Service/Customer/CustomerManager.php(345): SP\Core\Service\Customer\CustomerManager->handleValidatorErrors(Object(Symfony\Component\Validator\ConstraintViolationList))
#1 /app/vendor/subscribepro/platform-core/src/Service/Customer/CustomerManager.php(395): SP\Core\Service\Customer\CustomerManager->createOrUpdateCustomerAddress(Object(Proxies_CG
\SP\Core\Entity\Regional\Customer\Customer), Object(SP\Core\Entity\Regional\Customer\Address))
#2 /app/src/SFC/SubscriptionsApiBundle/Helper/SubscriptionHelper.php(357): SP\Core\Service\Customer\CustomerManager->createOrUpdateCustomerAddressFromArray(Object(Proxies_CG
\SP\Core\Entity\Regional\Customer\Customer), Array)
#3 /app/src/SFC/SubscriptionsApiBundle/Helper/SubscriptionHelper.php(251): SFC\SubscriptionsApiBundle\Helper\SubscriptionHelper->mapSubscriptionAssociations(Object(SP\Core\Entity\Regional\ProductSubscription\Subscription), Array)
#4 /app/src/SFC/SubscriptionsApiBundle/Controller/Api/SubscriptionController.php(544): SFC\SubscriptionsApiBundle\Helper\SubscriptionHelper->updateSubscriptionFromApiRequest(Object(SP\Core\Entity\Regional\ProductSubscription\Subscription), Array, Array)
#5 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(135): SFC\SubscriptionsApiBundle\Controller\Api\SubscriptionController->postUpdateAction(Object(Symfony\Component\HttpFoundation\Request), '248787')
#6 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(57): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#7 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php(67): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#8 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(183): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#9 /app/web/app.php(26): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#10 {main}

Admin ordering Website ID not set correctly

SP ver. 1.0.17
We've noticed an exception thrown in admin during order create process:

[2017-07-31 08:29:30] report.CRITICAL: exception 'Magento\Framework\Exception\NoSuchEntityException' with message 'No such entity with email = xxx, websiteId = 1' in /home/dev/projects/local.rxbar.com/www/vendor/magento/module-customer/Model/CustomerRegistry.php:121
Stack trace:
#0 /xxx/www/vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php(237): Magento\Customer\Model\CustomerRegistry->retrieveByEmail('xx...', NULL)
#1 /xxx/www/var/generation/Magento/Customer/Model/ResourceModel/CustomerRepository/Interceptor.php(37): Magento\Customer\Model\ResourceModel\CustomerRepository->get('xx...', NULL)
#2 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Platform/Manager/Customer.php(66): Magento\Customer\Model\ResourceModel\CustomerRepository\Interceptor->get('xx...', NULL)
#3 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Platform/Manager/Customer.php(45): Swarming\SubscribePro\Platform\Manager\Customer->getCustomer('xx...', true, NULL)
#4 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/AbstractProfileCreatorCommand.php(69): Swarming\SubscribePro\Platform\Manager\Customer->getCustomerById(82749, true)
#5 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/PurchaseCommand.php(29): Swarming\SubscribePro\Gateway\Command\AbstractProfileCreatorCommand->createProfile(Array)
#6 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/AbstractCommand.php(99): Swarming\SubscribePro\Gateway\Command\PurchaseCommand->processTransaction(Array)
#7 /xxx/www/vendor/subscribepro/subscribepro-magento2-ext/Gateway/Command/CaptureStrategyCommand.php(49): Swarming\SubscribePro\Gateway\Command\AbstractCommand->execute(Array)
#8 /xxx/www/vendor/magento/module-payment/Model/Method/Adapter.php(530): Swarming\SubscribePro\Gateway\Command\CaptureStrategyCommand->execute(Array)
#9 /xxx/www/vendor/magento/module-payment/Model/Method/Adapter.php(446): Magento\Payment\Model\Method\Adapter->executeCommand('capture', Array)
#10 /xxx/www/var/generation/Magento/Payment/Model/Method/Adapter/Interceptor.php(362): Magento\Payment\Model\Method\Adapter->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '33.46')
#11 /xxx/www/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(82): Magento\Payment\Model\Method\Adapter\Interceptor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '33.46')
#12 /xxx/www/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice\Interceptor))
#13 /xxx/www/vendor/magento/module-sales/Model/Order/Payment.php(447): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice\Interceptor))
#14 /xxx/www/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(180): Magento\Sales\Model\Order\Payment->capture(Object(Magento\Sales\Model\Order\Invoice\Interceptor))
#15 /xxx/www/vendor/magento/module-sales/Model/Order/Invoice.php(342): Magento\Sales\Model\Order\Payment\Interceptor->capture(Object(Magento\Sales\Model\Order\Invoice\Interceptor))
#16 /xxx/www/var/generation/Magento/Sales/Model/Order/Invoice/Interceptor.php(193): Magento\Sales\Model\Order\Invoice->capture()
#17 /xxx/www/vendor/magento/module-sales/Model/Order/Payment/Operations/AbstractOperation.php(70): Magento\Sales\Model\Order\Invoice\Interceptor->capture()
#18 /xxx/www/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(30): Magento\Sales\Model\Order\Payment\Operations\AbstractOperation->invoice(Object(Magento\Sales\Model\Order\Payment\Interceptor))
#19 /xxx/www/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
#20 /xxx/www/vendor/magento/module-sales/Model/Order/Payment.php(447): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)
#21 /xxx/www/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(180): Magento\Sales\Model\Order\Payment->capture(NULL)
#22 /xxx/www/vendor/magento/module-sales/Model/Order/Payment.php(428): Magento\Sales\Model\Order\Payment\Interceptor->capture(NULL)
#23 /xxx/www/vendor/magento/module-sales/Model/Order/Payment.php(348): Magento\Sales\Model\Order\Payment->processAction('authorize_captu...', Object(Magento\Sales\Model\Order\Interceptor))
#24 /xxx/www/var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php(167): Magento\Sales\Model\Order\Payment->place()
#25 /xxx/www/vendor/magento/module-sales/Model/Order.php(871): Magento\Sales\Model\Order\Payment\Interceptor->place()
#26 /xxx/www/vendor/magento/module-sales/Model/Order.php(1060): Magento\Sales\Model\Order->_placePayment()
#27 /xxx/www/var/generation/Magento/Sales/Model/Order/Interceptor.php(479): Magento\Sales\Model\Order->place()
#28 /xxx/www/vendor/magento/module-sales/Model/Service/OrderService.php(190): Magento\Sales\Model\Order\Interceptor->place()
#29 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Sales\Model\Service\OrderService->place(Object(Magento\Sales\Model\Order\Interceptor))
#30 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Sales\Model\Service\OrderService\Interceptor->___callParent('place', Array)
#31 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\M...', 'place', Object(Magento\Sales\Model\Service\OrderService\Interceptor), Array, 'gorillaLockQuot...')
#32 /xxx/www/app/code/Gorilla/QuoteOrderMonitor/Plugin/Sales/OrderManagement.php(47): Magento\Sales\Model\Service\OrderService\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Sales\Model\Order\Interceptor))
#33 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(142): Gorilla\QuoteOrderMonitor\Plugin\Sales\OrderManagement->aroundPlace(Object(Magento\Sales\Model\Service\OrderService\Interceptor), Object(Closure), Object(Magento\Sales\Model\Order\Interceptor))
#34 /xxx/www/var/generation/Magento/Sales/Model/Service/OrderService/Interceptor.php(117): Magento\Sales\Model\Service\OrderService\Interceptor->___callPlugins('place', Array, Array)
#35 /xxx/www/vendor/magento/module-quote/Model/QuoteManagement.php(488): Magento\Sales\Model\Service\OrderService\Interceptor->place(Object(Magento\Sales\Model\Order\Interceptor))
#36 /xxx/www/vendor/magento/module-quote/Model/QuoteManagement.php(391): Magento\Quote\Model\QuoteManagement->submitQuote(Object(Gorilla\CorePatches\Model\Quote\Quote\Interceptor), Array)
#37 /xxx/www/vendor/magento/module-sales/Model/AdminOrder/Create.php(1875): Magento\Quote\Model\QuoteManagement->submit(Object(Gorilla\CorePatches\Model\Quote\Quote\Interceptor), Array)
#38 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Sales\Model\AdminOrder\Create->createOrder()
#39 /xxx/www/var/generation/Magento/Sales/Model/AdminOrder/Create/Interceptor.php(507): Magento\Sales\Model\AdminOrder\Create\Interceptor->___callPlugins('createOrder', Array, Array)
#40 /xxx/www/vendor/magento/module-sales/Controller/Adminhtml/Order/Create/Save.php(49): Magento\Sales\Model\AdminOrder\Create\Interceptor->createOrder()
#41 /xxx/www/var/generation/Magento/Sales/Controller/Adminhtml/Order/Create/Save/Interceptor.php(24): Magento\Sales\Controller\Adminhtml\Order\Create\Save->execute()
#42 /xxx/www/vendor/magento/framework/App/Action/Action.php(102): Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor->execute()
#43 /xxx/www/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#44 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#45 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor->___callParent('dispatch', Array)
#46 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Array, 'adminAuthentica...')
#47 /xxx/www/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#48 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#49 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Array, 'log')
#50 /xxx/www/vendor/magento/module-logging/App/Action/Plugin/Log.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#51 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Logging\App\Action\Plugin\Log->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#52 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Array, 'adminMassaction...')
#53 /xxx/www/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#54 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#55 /xxx/www/var/generation/Magento/Sales/Controller/Adminhtml/Order/Create/Save/Interceptor.php(39): Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#56 /xxx/www/vendor/magento/framework/App/FrontController.php(55): Magento\Sales\Controller\Adminhtml\Order\Create\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#57 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#58 /xxx/www/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#59 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#60 /xxx/www/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#61 /xxx/www/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#62 /xxx/www/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#63 /xxx/www/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#64 /xxx/www/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#65 /xxx/www/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))

Issue appears on multistore, for new customer which belongs to non-default website (e.g. website id > 1).
It looks like SP doesn't pass proper website id here \Swarming\SubscribePro\Platform\Manager\Customer::getCustomer.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.