Tokens with no expiration date

Created on 16 December 2024, 7 months ago

Problem/Motivation

We have seen that some tokens do not have an expiration date. We asked Wallee, and they informed us that PF Pay, Twint, PayPal, and SchemeTokens (Master/Visa) do not have an expiration date for the token. Is this a problem for our integration of the tokens/Drupal Commerce storage?

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇨🇭Switzerland cola

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @cola
  • 🇨🇭Switzerland berdir Switzerland

    According to the field definition, PaymentMethod entities do support tokens/payment methods that don't expire:

        $fields['expires'] = BaseFieldDefinition::create('timestamp')
          ->setLabel(t('Expires'))
          ->setDescription(t('The time when the payment method expires. 0 for never.'))
    ..
    

    I see that \Drupal\commerce_wallee\Services\PaymentSdk::createPaymentMethod checks if the expiration date is a valid date and only converts it then. Maybe it should use 0 as the default value and not null, but it's unlikely that commerce does a type safe check here.

    So without further checking, I'd say that should work.

  • 🇨🇭Switzerland cola

    @berdir thank you for your comment! We change it like in the patch bellow. So we try to change both the createPaymentMethod and webhookTokenVersion. If you think is working like this, we can publish it. Thank you for your quick review.

  • Status changed to Needs review 2 months ago
  • 🇨🇭Switzerland cola

    We change the patch and check also the card_exp_month and card_exp_year.

    In this field definition we see, so we means to dont set this on at this situation

    // card_exp_month and card_exp_year are not required because they might
    // not be known (tokenized non-reusable payment methods).
    $fields['card_exp_month'] = BundleFieldDefinition::create('integer')
    ->setLabel($this->t('Card expiration month'))
    ->setDescription($this->t('The credit card expiration month.'))
    ->setSetting('size', 'tiny');

    $fields['card_exp_year'] = BundleFieldDefinition::create('integer')
    ->setLabel($this->t('Card expiration year'))
    ->setDescription($this->t('The credit card expiration year.'))
    ->setSetting('size', 'small');

  • 🇨🇭Switzerland cola

    Integrate in latest 2.x DEV

  • 🇨🇭Switzerland cola
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024