Problem/Motivation

Cybersource changed the way they work with microform, they are doing the change gradually on test enviroments first and when your account changes the microform will not work anymore the way it is on the module now.

https://support.visaacceptance.com/knowledgebase/Knowledgearticle/?code=...

On April 2025 they will change production environment to this new request.

Proposed resolution

As required in the documentation we need to change the way we load the microform JS file to load it from URL that wll be sent from JWT token, in my experiences it works but not if i fully follow the docs because including the crossorigin and integrity attributes will trigger CORS error.
So we can go with a partial solution, but as far as i can see drupal do not let us to have a dynamic library changing it's path based on an logic so we must change it with a hook_library_info_alter but inside this hook i do not have the file path from JWT, so i propose to cache it's value on src/PluginForm/FlexForm.php to use it on the hook.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thiagomoraesp created an issue. See original summary.

thiagomoraesp’s picture

Issue tags: -JavaScript +JavaScript
StatusFileSize
new3.4 KB

Here is a patch for it, i know that it is not the best approach but solves the problem for now.

thiagomoraesp’s picture

Issue summary: View changes
Issue tags: -JavaScript +JavaScript
thiagomoraesp’s picture

Title: Microform v2 js needs to be changed based on JWT token » Microform v2 js path needs to be changed based on JWT token
damondt’s picture

In practice, currently, the token contains https://flex.cybersource.com/microform/bundle/v2.4.0/flex-microform.min.js which is the same, latest version that the hardcoded https://flex.cybersource.com/microform/bundle/v2/flex-microform.min.js version returns (based on the commenting in that file). But hearing you, would be cool to do the right way.
Just read the part about it being deprecated. I wonder if this should be done in Flex::generateKey() where the actual token used is received and returned to FlexForm along with the current variable returned (wrapped in an array or object) and then added to #attached?

jsacksick’s picture

Assigned: Unassigned » jsacksick

I think the approach isn't correct here, will work on this.
I think we should add the JS SDK dynamically via Javascript.

jsacksick’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Active » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • jsacksick committed 44204470 on 8.x-1.x
    feat: #3494814 Microform v2 js path needs to be changed based on JWT...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.