Description
Pre Conditions (*)
Magento 2.4-develop with Credit card payment and vault enabled.
Description
I'm having some issues with disabled tokens.
And I figured out the repository for tokens never deletes the registries. Actually they are just disabled by setting visibility and activation flags to zero.
magento2/app/code/Magento/Vault/Model/PaymentTokenRepository.php
Lines 127 to 140 in 7c6b636
So I was wondering why not removing these registries when requested by the customer.
Is there a reason for this? Is it a good practice to keep in table old and disabled tokens?
Manual steps to reproduce (*)
- Generate customer token using "generateCustomerToken" mutation
- Login to store-front and place order with Credit card vault enabled (with Save card for future option)
- Run "customerPaymentTokens" query and retrieve public_hash
- Run deletePaymentToken mutation
- Run deletePaymentToken mutation again using same public_hash
Issue: deletePaymentToken mutation always returining true. No error message displayed.
No payment tokens are removed from vault_payment_token DB table.
6. Run "customerPaymentTokens" query again
No issue: Empty set retrieved in the response as the payment token is deleted.
5. Run deletePaymentToken mutation with invalid public_hash
No issue: Expected error is retrieved in the response
Expected result:
Could not find a token .. Error message should be displayed. Just like if invalid public_hash is given.
Actual Result:
deletePaymentToken mutation always returining true.
Additional Information
#36137 (comment)