Skip to content

[2.1.3 CE] Uses per Coupon = 1, Uses per Customer = 1, Not Honored #8310

@azeemism

Description

@azeemism

Automatically Generated Coupons do not correctly honor Uses per Coupon and Uses per Customer settings.

ISSUE 1. When Uses per Customer = 1: A "Logged in" user who has used the first coupon code generated cannot used any other subsequent coupon code generated. Breaks assumption two.

ISSUE 2. When Uses per Coupon = 1: If a "Logged in" user has already used the first coupon code generated, a "Not Logged in" and or a "Logged in" user can still reuse the first coupon code. Breaks assumption one.

Assumptions (for auto-generated coupons)

  1. Uses per coupon = 1 - Limits all users. Each coupon code generated can only be used once, and if used either by a "logged in" or "Not logged in" user uses, then that coupon code can no longer be used. However if two or more coupon codes were generated, after the first one has been used, the next coupon code can be used, but only once.

  2. Users per customer = 1 - Only limits "logged in" users. Any "logged in user can use the same generated coupon code, but they can use that code only once. So for example if 5 codes are generated, then any "logged in" use can use each code one time.

Preconditions

  1. Composer upgrade Magento 2.1.2 CE --> 2.1.3 CE
root@skynet:~# cat /proc/version
Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.39-1 (2016-12-30)
root@skynet:~# composer -V
Composer version 1.3.0 2016-12-24 00:47:03
root@skynet:~# dpkg -l | grep php7
rc  libapache2-mod-php7.0                7.0.14-1~dotdeb+8.1                  amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php7.0                               7.0.15-1~dotdeb+8.1                  all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-bcmath                        7.0.15-1~dotdeb+8.1                  amd64        Bcmath module for PHP
ii  php7.0-cli                           7.0.15-1~dotdeb+8.1                  amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                        7.0.15-1~dotdeb+8.1                  amd64        documentation, examples and common module for PHP
ii  php7.0-curl                          7.0.15-1~dotdeb+8.1                  amd64        CURL module for PHP
ii  php7.0-dev                           7.0.15-1~dotdeb+8.1                  amd64        Files for PHP7.0 module development
ii  php7.0-fpm                           7.0.15-1~dotdeb+8.1                  amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.0-gd                            7.0.15-1~dotdeb+8.1                  amd64        GD module for PHP
ii  php7.0-igbinary                      2.0.1-1~dotdeb+8.1                   amd64        igbinary serializer for PHP
ii  php7.0-imagick                       3.4.2-1~dotdeb+8.2                   amd64        Provides a wrapper to the ImageMagick library
ii  php7.0-intl                          7.0.15-1~dotdeb+8.1                  amd64        Internationalisation module for PHP
ii  php7.0-json                          7.0.15-1~dotdeb+8.1                  amd64        JSON module for PHP
ii  php7.0-mbstring                      7.0.15-1~dotdeb+8.1                  amd64        MBSTRING module for PHP
ii  php7.0-mcrypt                        7.0.15-1~dotdeb+8.1                  amd64        libmcrypt module for PHP
ii  php7.0-mysql                         7.0.15-1~dotdeb+8.1                  amd64        MySQL module for PHP
ii  php7.0-opcache                       7.0.15-1~dotdeb+8.1                  amd64        Zend OpCache module for PHP
ii  php7.0-pspell                        7.0.15-1~dotdeb+8.1                  amd64        pspell module for PHP
ii  php7.0-readline                      7.0.15-1~dotdeb+8.1                  amd64        readline module for PHP
ii  php7.0-redis                         3.1.0-1~dotdeb+8.4                   amd64        PHP extension for interfacing with Redis
ii  php7.0-soap                          7.0.15-1~dotdeb+8.1                  amd64        SOAP module for PHP
ii  php7.0-xml                           7.0.15-1~dotdeb+8.1                  amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.0-xmlrpc                        7.0.15-1~dotdeb+8.1                  amd64        XMLRPC-EPI module for PHP
ii  php7.0-xsl                           7.0.15-1~dotdeb+8.1                  all          XSL module for PHP (dummy)
ii  php7.0-zip                           7.0.15-1~dotdeb+8.1                  amd64        Zip module for PHP
root@skynet:~# dpkg -l | grep mariadb
ii  libmariadbclient18                   10.1.20+maria-1~jessie               amd64        MariaDB database client library
ii  mariadb-client                       10.1.20+maria-1~jessie               all          MariaDB database client (metapackage depending on the latest version)
ii  mariadb-client-10.1                  10.1.20+maria-1~jessie               amd64        MariaDB database client binaries
ii  mariadb-client-core-10.1             10.1.20+maria-1~jessie               amd64        MariaDB database core client binaries
ii  mariadb-common                       10.1.20+maria-1~jessie               all          MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii  mariadb-server                       10.1.20+maria-1~jessie               all          MariaDB database server (metapackage depending on the latest version)
ii  mariadb-server-10.1                  10.1.20+maria-1~jessie               amd64        MariaDB database server binaries
ii  mariadb-server-core-10.1             10.1.20+maria-1~jessie               amd64        MariaDB database core server files
root@skynet:~# dpkg -l | grep nginx
ii  libnginx-mod-http-auth-pam           1.10.2-2~dotdeb+8.2                  amd64        PAM authentication module for Nginx
ii  libnginx-mod-http-geoip              1.10.2-2~dotdeb+8.2                  amd64        GeoIP HTTP module for Nginx
ii  libnginx-mod-http-image-filter       1.10.2-2~dotdeb+8.2                  amd64        HTTP image filter module for Nginx
ii  libnginx-mod-http-lua                1.10.2-2~dotdeb+8.2                  amd64        LUA module for Nginx
ii  libnginx-mod-http-ndk                1.10.2-2~dotdeb+8.2                  amd64        Nginx Development Kit module
ii  libnginx-mod-http-perl               1.10.2-2~dotdeb+8.2                  amd64        Perl module for Nginx
ii  libnginx-mod-http-xslt-filter        1.10.2-2~dotdeb+8.2                  amd64        XSLT Transformation module for Nginx
ii  libnginx-mod-mail                    1.10.2-2~dotdeb+8.2                  amd64        Mail module for Nginx
ii  libnginx-mod-stream                  1.10.2-2~dotdeb+8.2                  amd64        Stream module for Nginx
ii  nginx-common                         1.10.2-2~dotdeb+8.2                  all          small, powerful, scalable web/proxy server - common files
ii  nginx-extras                         1.10.2-2~dotdeb+8.2                  amd64        nginx web/proxy server (extended version)
root@skynet:~# dpkg -l | grep redis
ii  php5-redis                           2.2.5-1                              amd64        PHP extension for interfacing with Redis
ii  php7.0-redis                         3.1.0-1~dotdeb+8.4                   amd64        PHP extension for interfacing with Redis
ii  redis-server                         2:3.2.6-1~dotdeb+8.1                 amd64        Persistent key-value database with network interface
ii  redis-tools                          2:3.2.6-1~dotdeb+8.1                 amd64        Persistent key-value database with network interface (client)

Steps to reproduce ISSUE 1

  1. Create a cart price rule with: several auto generated coupons; with a prefix of "SAVE5-" and a dash every "4" characters; for any cart value greater than zero; that apply a Fixed amount discount for the whole cart; with a Discount Amount of 5; with a priority of 5; for all users; set Uses per Customer = 1
  2. "Logged in" user makes a purchase with the first auto generated coupon code
  3. "Logged in" user attempts to make a purchase with any of the other subsequent coupon codes

Expected result ISSUE 1

  1. Assumption 2 stated above.

Actual result ISSUE 1

  1. ISSUE 1 stated above

Steps to reproduce ISSUE 2

  1. Create a cart price rule with: several auto generated coupons; with a prefix of "SAVE5-" and a dash every "4" characters; for any cart value greater than zero; that apply a Fixed amount discount for the whole cart; with a Discount Amount of 5; with a priority of 5; for all users; set Uses per Coupon = 1
  2. "Logged in" user makes a purchase with the first auto generated coupon code
  3. Verify that the first coupon code has been used once.
  4. "Not Logged in" makes a purchase re-using the first coupon code generated
  5. The same "Logged in" makes a purchase re-using the first coupon code generated

Expected result ISSUE 2

  1. Assumption 1 stated above.

Actual result ISSUE 2

  1. ISSUE 2 stated above

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions