Skip to content

Conversation

peterwilsoncc
Copy link
Collaborator

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

Detects a possible ITN request replay when updating a subscription token. If the new and old token match, the token isn't cancelled as this will result in storing a token that is no longer valid.

Replays can either triggered manually or due to network issues.

Closes https://linear.app/a8c/issue/PAYFAST-33/double-itn-request-might-cancel-valid-token

Steps to test the changes in this Pull Request:

I was unable to reproduce the issue described in the bug, this is some defensive coding.

  1. Create a simple subscription product
  2. Order the product
  3. In the database, look for the meta data item _payfast_subscription_token stored against the new subscription.
  4. Take note of the value in the meta data item.
  5. As the purchaser, visit My Account > My subscription/s
  6. Click the link to the new subscription (this won't be required if you only have one subscription)
  7. Click Change Payment
  8. Proceed through the payfast flow until you return to the store
  9. In the database, refresh the table to ensure the _payfast_subscription_token meta data has updated
  10. Visit the Payfast sandbox tokenization screen, https://sandbox.payfast.co.za/tokenization
  11. Ensure the initial token is listed as cancelled.
  12. Visit the Payfast sandbox ITN screen, https://sandbox.payfast.co.za/itn
  13. Reply the most recent transaction (select the three dots and click Re-send ITN)
  14. Reutnr to the tokenization screen
  15. Ensure the new token has not been cancelled.

Changelog entry

Fix - Prevent ITN replays cancelling valid subscription tokens.

@peterwilsoncc peterwilsoncc self-assigned this Aug 13, 2025
@peterwilsoncc peterwilsoncc requested a review from dkotter August 13, 2025 05:58
@jeffpaul jeffpaul added this to the Future Release milestone Sep 8, 2025
@jeffpaul jeffpaul requested review from qasumitbagthariya and removed request for ankitguptaindia October 6, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants