Skip to content

Add Requisition Submission feature #20125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 27, 2025
Merged

Conversation

FollowTheFlo
Copy link
Contributor

@FollowTheFlo FollowTheFlo commented Mar 26, 2025

Add CMS cpnt: cart btns and requisition page

  • in Punchout-Requisition cpnt:
    Fetch Requisition data from server
    logout user
    submit hidden form programmatically

  • in PunchoutButtons cpnt:
    2 btns added on cart page
    Only displayed when user is logged and punchoutSessionId exists.
    click on btn redirect user to Requisition Page (which loads punchoutRequisition cpnt above)

Added translation

@FollowTheFlo FollowTheFlo requested a review from a team as a code owner March 26, 2025 14:21
@FollowTheFlo FollowTheFlo requested review from a team as code owners March 26, 2025 19:27
@@ -39,7 +43,9 @@ export abstract class PunchoutFacade {
* Abstract method used to get Punchout Session Requisition data
* @param sessionId is the sesssion Id given by ARIBA via url param
*/
abstract getPunchoutSessionRequisition(
sessionId: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to provide the sessionId as parameter, the facade method now gets it from the state (within punchoutStoreService ) directly.

tap((punchoutRequisition) => {
this.listenAndSubmitForm(punchoutRequisition).subscribe({
next: () => {
this.punchoutFormElement.nativeElement.submit();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the only way to submit a POST form with 'action' attribute programmatically.
As long as nativeElement is not being modified, it is safe.


protected isFormNativeElementAccessible(): Observable<boolean> {
// timer(0) wait for next Javascript event loop, this way DOM native elements becomes accessible.
return timer(0).pipe(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reliable, I tested with all network speeds, nativeElement (line 45) is always accessible a expected, no race condition observed.

@FollowTheFlo FollowTheFlo merged commit 4648697 into epic/punchout Mar 27, 2025
11 checks passed
@FollowTheFlo FollowTheFlo deleted the feature/CXSPA-8592 branch March 27, 2025 17:34
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.

2 participants