Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDD Software Licenses Uses Payment Date to generate license instead of Payment Completion Date #9709

Open
sharmashivanand opened this issue Feb 3, 2024 · 1 comment
Labels
type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on.

Comments

@sharmashivanand
Copy link

sharmashivanand commented Feb 3, 2024

Bug Report

Apparently EDD Software Licenses uses Payment Date instead of Payment Completion Date to generate license keys.

includes/classes/class-edd-software-licensing.php
...
$license->create( $args['download_id'], $args['payment_id'], $price_id, $args['cart_index'], $options );

And...

includes/classes/class-sl-license.php
...
// Get the purchase date so we can set the correct license expiration date.
    $payment_meta  = $payment->get_meta();
    $purchase_date = null;
    if ( ! empty( $payment_meta['date'] ) ) {
        $purchase_date = strtotime( $payment_meta['date'], current_time( 'timestamp' ) );
    }
...
$expiration_date = strtotime( $license_length, $purchase_date );

Expected behaviour

It's expected that the license key use payment completion date so that they don't get expired unexpectedly.

Actual behaviour

If a customer completes an ancient order, the license key is generated for a back-date which is expired.

Steps to reproduce the behaviour

  1. Create an order older than 1 year ago
  2. Complete this order.
  3. The license keys are expired.
    etc, etc

Information (if a specific version is affected):

PHP Version: 8*

EDD Version (or branch): 3*

WordPress Version: 6*

Any other relevant information:

@sharmashivanand sharmashivanand added type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on. labels Feb 3, 2024
@sharmashivanand
Copy link
Author

Apparently filter 'edd_sl_license_creation_options' can be engaged to correct this but still it would be better to have sane defaults.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug workflow-needs-replication workflow-pending-triage Items that need to be triaged and reviewed before they are worked on.
Projects
None yet
Development

No branches or pull requests

1 participant