Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for passing
additionalDatathrough the Dynamic Checkout widget to APM redirect URLs. This enables use cases like preselecting an issuing bank for iDEAL on Adyen. Also extracts and reuses the additional data query-building logic fromprocessout.ts, and fixesencodeURI→encodeURIComponentfor proper URL encoding.Changes
Config (
payment-config.ts)additionalData?: Record<string, string>toDynamicCheckoutPublicConfigTypeDynamicCheckoutPaymentConfigclass (defaults to{})additionalDataingetConfig()return andsetInitialConfig()Core (
processout.ts)buildAdditionalDataQuery()— converts an object into?additional_data[key]=value&...query stringappendAdditionalDataToUrl()— appends additional data to an existing URL, handling?vs&separatorencodeURI→encodeURIComponentfor proper encoding of special characters in keys and valuesgetConfigurableInvoiceActionURLandgetCustomerTokenActionURLAPM payment methods
apm.ts: AppendadditionalDatatoapm.redirect_urlbefore callinghandleAction(non-save-for-future flow only)saved-apm.ts: AppendadditionalDatatoapm_customer_token.redirect_urlbefore callinghandleActionExample
additionalDatausage toexamples/dynamic-checkout/index.htmlImpact
encodeURIComponentfix affects all callers ofbuildAdditionalDataQuery(invoice action URLs and customer token action URLs) — values with special characters (&,=,#) are now properly encodedTesting Plan
additionalData— verify APM redirect URLs are unchangedadditionalData: { issuer_id: "1234" }— verify the redirect URL includesadditional_data[issuer_id]=1234{ key: "a&b=c" }) — verify proper encodingdata.customer_action.valueURL is not modifiedredirect_url— verify additional data is appendedAdditional Context
additionalDatais only appended to pre-known redirect URLs (apm.redirect_url,apm_customer_token.redirect_url), not to URLs returned from API responses (data.customer_action.value)buildAdditionalDataQueryfunction was extracted from inline duplicated code ingetConfigurableInvoiceActionURLandgetCustomerTokenActionURL