Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Unanswered

Payment connector - how to call method "ExecuteTask"

Posted on by 4
Hi,
 
I have a payment connector for a payment device (INamedRequestHandler) and that holds a method called "ExecuteTask".

The description for "ExecuteTask" is as follows:

_This extension request can be invoked from the POS through customizations. It is used to enable additional payment-related flows._
 
I want to create a new button on the POS and when the user pushes that button I want to call this "ExecuteTask" method so that this method can execute a certain task on my payment device.

Can someone please advice me how to approach this or perhaps share a code sample where I can see how this "ExecuteTask" method is called?
 
Any help is welcome.
 
Thx in advance!
 
 
  • LC-01111219-0 Profile Picture
    LC-01111219-0 3 on at
    Payment connector - how to call method "ExecuteTask"
    I would just like to comment and confirm that I have tried out this solution and it works really well! 
    Thank you for this response! 
  • Suggested answer
    Oksana Kovaliova Profile Picture
    Oksana Kovaliova 3,595 on at
    Payment connector - how to call method "ExecuteTask"
    Dear Mica
     
    Please, see a sample below (call it from POS).
    1) taskName is your task name you will define in Payment device class
    2) Input - any input parameters you need to do for task.
     
    import { PaymentTerminalExecuteTaskResponse, PaymentTerminalExecuteTaskRequest } from "PosApi/Consume/Peripherals";

    public async executeTask(taskName: string, input: ClientEntities.IExtensionTransaction): Promise<void> {
            var success = true;
            var taskRequest = new PaymentTerminalExecuteTaskRequest<PaymentTerminalExecuteTaskResponse>(taskName, input);
            var taskResponse = await this.context.runtime.executeAsync(taskRequest);
            var output = [];
            var errorMessage = '';
            var anyResult: any = taskResponse.data.result;
            if (anyResult.ExtensionProperties != undefined) {
                output = anyResult.ExtensionProperties;
                
                //Implement exception handling in a way how it works for you 
            }
            return Promise.resolve(); //Return any data needed for you here
        }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans