[go: up one dir, main page]

0% found this document useful (0 votes)
11 views10 pages

LINK JavaScript Controller FAQ Final

The document provides FAQs regarding the integration of LINK technology partners with Demandware's SiteGenesis, specifically addressing the need to support both pipeline-based and JavaScript Controller-based versions. It outlines the recommendations for partners, the level of effort required for integration, and certification policies for LINK cartridges. Additionally, it discusses the support timeline for pipelines and incentives for early adopters of the new architecture.

Uploaded by

k7govindarajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views10 pages

LINK JavaScript Controller FAQ Final

The document provides FAQs regarding the integration of LINK technology partners with Demandware's SiteGenesis, specifically addressing the need to support both pipeline-based and JavaScript Controller-based versions. It outlines the recommendations for partners, the level of effort required for integration, and certification policies for LINK cartridges. Additionally, it discusses the support timeline for pipelines and incentives for early adopters of the new architecture.

Uploaded by

k7govindarajan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

 

 
JavaScript  Controllers  –  LINK  Technology  Partner  FAQ  and  
Integration  Techniques  
 

I.  Frequently  Asked  Questions  


1. Do  all  LINK  technology  partners  need  to  update  their  integrations  in  order  to  support  both  the  
pipeline-­‐based  SiteGenesis  as  well  as  the  JavaScript  Controller-­‐based  version  of  SiteGenesis?  
 
No,  this  is  not  a  requirement  at  the  current  time.    However,  Demandware  highly  recommends  that  all  
LINK  technology  partners  go  through  this  process  as  soon  as  possible  in  order  to  best  meet  the  needs  of  
all  Demandware  customers.    Supporting  both  versions  of  SiteGenesis  will  likely  be  a  requirement  for  
technology  partners  in  the  future.    Demandware  will  indicate  which  integrations  are  certified  with  the  
pipeline-­‐based  version  of  SiteGenesis  and  the  JavaScript  Controller-­‐based  version  of  SiteGenesis  in  the  
LINK  Marketplace.  

2. What  is  the  level  of  effort  required  to  support  both  versions  of  SiteGenesis?  
 
Demandware  has  tested  implementing  several  existing  LINK  integrations  with  the  JavaScript  Controller  
version  of  SiteGenesis  and  has  found  that  the  estimated  level  of  effort  is  between  8  and  80  hours  
depending  on  the  size  and  type  of  the  integration.  

3. Do  LINK  technology  partners  need  to  re-­‐write  their  LINK  cartridge  using  JavaScript  Controllers  
instead  of  Demandware  pipelines?  
 
No,  this  is  not  a  requirement.    However,  Demandware  highly  recommends  that  partners  perform  this  
task  because  the  Demandware  developer  community  prefers  working  with  JavaScript  Controllers  
instead  of  pipelines.    

4. How  long  will  Demandware  continue  supporting  pipelines  on  the  Demandware  platform?  
 
There  is  no  immediate  need  to  migrate  existing  customer  projects  from  pipelines  to  controllers  and  
Demandware  will  not  force  anyone  to  do  so.  Pipelines  will  still  be  supported  as  long  as  our  customers  
need  them.  Demandware  is  optimistic  of  the  value  of  the  new  development  model  and  hopes  customers  
will  see  the  developer  satisfaction,  efficiency,  and  innovation  benefits  of  the  new  model  and  seek  to  
migrate  when  the  time  fits  their  business.  

   
 
 

 
5. What  is  Demandware’s  policy  for  certifying  LINK  cartridges?  

Existing  LINK  technology  partners  with  agreements  signed  before  February  1,  2016:  

Demandware  will  continue  to  certify  a  LINK  cartridge  that  uses  pipelines  or  JavaScript  Controllers  in  the  
integration  cartridge  in  2016.    Demandware  will  allow  the  LINK  technology  partner  to  choose  to  certify  
with  either  the  pipeline  based  or  JavaScript  Controller-­‐based  version  of  SiteGenesis.    The  technology  
partner  may  also  choose  to  certify  with  both  versions  of  SiteGenesis.  

LINK  technology  partners  with  agreements  signed  after  February  1,  2016:  

Demandware  will  only  certify  a  LINK  cartridge  that  uses  JavaScript  Controllers;  LINK  cartridges  that  use  
pipelines  will  not  be  certified.    Demandware  will  allow  the  LINK  technology  partner  to  choose  to  certify  
with  either  the  pipeline-­‐based  or  JavaScript  Controller-­‐based  version  of  SiteGenesis.    The  LINK  
technology  partner  may  also  choose  to  certify  with  both  versions  of  SiteGenesis.  

6. Will  Demandware  incentivize  early  adopters  of  the  JavaScript  Controller  architecture?  

Demandware  will  recognize  early  adopters  of  the  JavaScript  Controller  architecture  by  featuring  them  
during  one  of  the  keynote  sessions  at  the  2016  Demandware  XChange  Conference  on  April  4-­‐6  in  
Hollywood,  Florida  and  June  14-­‐15  in  Berlin,  Germany.    The  qualifications  for  being  recognized  are:  

a. Successfully  certifying  a  LINK  cartridge  with  the  JavaScript  Controller-­‐based  version  of  
SiteGenesis  by  no  later  than  March  28,  2016  for  the  North  American  XChange  Conference  
or  by  no  later  than  June  1,  2016  for  the  European  XChange  Conference.  
b. Successfully  demonstrating  a  LINK  cartridge  that  is  integrated  with  the  JavaScript  Controller  
version  of  SiteGenesis  by  no  later  than  March  28,  2016  for  the  North  American  XChange  
Conference  or  by  no  later  than  June  1,  2016  for  the  European  XChange  Conference.  

Partners  who  meet  one  or  both  of  these  criteria  will  be  highlighted  on  the  main  stage  during  a  keynote  
session.    Demandware  will  retain  final  discretion  with  regard  to  whether  a  partner  has  met  the  
qualifying  criteria  to  be  recognized.        

7. What  are  the  steps  and  techniques  for  integrating  a  LINK  cartridge  based  on  pipelines  with  the  
JavaScript  Controller-­‐based  version  of  SiteGenesis?  
 
LINK  integrations  require  various  types  of  modifications  to  SiteGenesis  in  order  to  be  integrated  with  a  
merchant’s  site.    Demandware  has  tested  several  LINK  integrations  and  is  providing  the  following  
recommendations  (see  section  below)  for  how  to  integrate  existing  LINK  integrations  with  the  JavaScript  
Controller  version  of  SiteGenesis.  

   
 
 

II.  Integration  Techniques    


LINK  integrations  require  various  types  of  modifications  to  SiteGenesis  in  order  to  be  integrated  with  a  
merchant’s  site.    Demandware  has  tested  several  LINK  integrations  and  is  providing  the  following  
recommendations  for  how  to  integrate  existing  LINK  integrations  with  the  JavaScript  Controller  version  
of  SiteGenesis.  

A. The  LINK  integration  requires  that  you  add  a  call  node  to  a  SiteGenesis  pipeline  in  order  to  call  a  
pipeline  in  a  LINK  cartridge.    The  following  code  provides  an  example  of  how  to  call  a  pipeline  from  a  
controller  instead  of  using  a  call  node:  
 

let Pipeline = require('dw/system/Pipeline');  

let pdict = Pipeline.execute('MyPipeline-Start', {  

MyArgString: 'someStringValue',  

MyArgNumber: 12345,  

MyArgBoolean: true  

});  

let result = pdict.MyReturnValue;

The  name  of  the  end  node  where  the  pipeline  ends  is  not  available  in  the  pdict.    An  alternate  variable  in  
the  pdict  must  be  set  by  the  pipeline  in  order  to  evaluate  the  end  state  of  the  pipeline.    For  example,  the  
end  node  might  have  been  ‘OK’  or  ‘ERROR’.    This  value  would  need  to  be  stored  in  a  variable  such  as  
pipeline_result  and  evaluated  in  the  JavaScript  code  when  the  pipeline  execution  is  finished.  

If(pdict.pipeline_result  ===  ‘SUCCESS’)  

{  

  return  (success:  true);  

}    

else  

{  

  return  (success:  false);  


 
 

}  

The  pipeline  dictionary  transports  data  in  the  pipeline  flow  and  keeps  track  of  all  parameters  and  values  
processed  by  the  pipeline.    The  pipeline  dictionary  is  automatically  passed  from  one  pipeline  to  another  
pipeline  that  is  executed  via  a  call  node  or  a  jump  node.    Data  stored  in  models  and  variables  declared  in  
JavaScript  functions  are  not  automatically  passed  into  a  pipeline  that  is  called  via  the  dw.system.Pipeline  
class.    This  data  has  to  be  explicitly  passed  into  the  pipeline  as  an  argument.    This  is  shown  in  the  above  
example.    A  general  technique  for  determining  which  arguments  to  pass  into  a  pipeline  is  to  review  all  
the  nodes  in  the  pipeline  to  review  the  dictionary  input  and  output  values.    Some  dictionary  input  has  to  
be  provided  as  an  argument  to  the  Pipeline.execute  method  and  other  input  is  added  to  the  pipeline  
dictionary  as  dictionary  output  from  a  script  node  or  pipelet  node.    You  will  need  to  review  all  the  code  
in  the  pipeline  being  executed  to  determine  which  arguments  to  pass  into  the  pipeline.    Some  objects  
such  as  the  CurrentForms  and  CurrentHttpParameterMap  are  available  in  the  pdict  by  default.  

B. The  LINK  integration  requires  that  the  user  be  redirected  via  an  interaction  continue  node  to  a  third  
party  site.    An  interaction  continue  node  in  a  pipeline  allows  the  pipeline  to  be  paused  while  the  
user  submits  form  data  or  is  redirected  to  a  third  party  site.    The  pipeline  may  be  resumed  by  calling  
the  correct  continue  URL.    Interaction  continue  nodes  cannot  be  used  in  a  pipeline  that  is  executed  
via  the  dw.system.Pipeline  class.    An  alternate  technique  must  be  used  instead.  
 

The  general  technique  is  to  stop  the  pipeline  from  continuing  to  execute  via  a  stop  node  and  to  redirect  
the  user  in  the  JavaScript  function  using  the  response.redirect  method.    For  example:  

 
 
 

The  pipeline  would  be  modified  with  changes  similar  to  the  following:  

 
 
 

The  JavaScript  code  to  execute  the  pipeline  would  be  similar  to  the  following:  

let  Pipeline  =  require('dw/system/Pipeline');  

       let  pdict  =  Pipeline.execute(THIRD_PARTY-­‐Redirect',  {  

               Basket:  cart.object  

       });  

         

       if(pdict.redirectUrl)  

       {  

          response.redirect(pdict.redirectURL);  

       }  

 
 
 

A  controller  called  THIRD_PARTY  with  a  function  called  RedirectFromThirdParty  would  be  written  to  
handle  the  redirect  request  from  the  third  party.    The  RedirectFromThirdParty  function  would  call  the  
RedirectFromThirdParty  start  node  that  was  added  to  the  pipeline  using  the  dw.system.Pipeline  class  to  
continue  executing  the  pipeline  that  used  to  contain  an  interaction  continue  node.    For  example:  

function  redirectFromThirdParty(args)  {  

   

  var  cart  =  app.getModel('Cart').get();  

   

  let  Pipeline  =  require('dw/system/Pipeline');  

  let  pdict  =  Pipeline.execute('THIRD_PARTY-­‐RedirectFromThirdParty',  {  

         Basket:  cart.object,  

         PaymentInstrument:  cart.object.paymentInstrument  

  });  

   

  if(pdict.Success)  

  {  

    app.getController('COSummary').Start();  

  }  

  else  

  {  

    app.getController('COBilling').Start();  

  }  

}  

C. The  LINK  integration  contains  an  interaction  continue  node  used  to  collect  data  via  a  form:    
 
 
 

High  Level  Summary  

• Replace  the  ICN  (Interaction  Continue  Node)  in  the  controller  script  by  code  that  renders  the  
ISML  template  and  pass  an  additional  parameter  named  ‚ContinueURL‘  
 
• The  ‘ContinueURL’  parameter  specifies  which  controller  to  execute  when  the  form  has  been  
submitted  
• A  new  public  controller  function  representing  the  ‘ContinueURL’  needs  to  be  added  to  the  
controller  and  needs  to  be  exported  
• The  code  within  the  newly  added  function  needs  to  react  on  the  different  actions  just  the  same  
way  as  in  any  other  form  handling  controller    

Step-­‐by-­‐step  guide  

• Within  the  controller  which  replaces  the  pipeline  containing  the  interaction  continue  node,  the  
interaction  continue  node  should  be  replaced  by  the  below  script  code:  

app.getView({  

ContinueURL:  URLUtils.https(‘ExampleController-­‐ExampleStartNode'),  

         AdditionalParam1:  additionalParamValue1,  

         AdditionalParam2:  additionalParamValue2  

       }).render('path/to/template');  

function  exampleStartNode  ()  {  

         …  

}  

• Pass  a  parameter  named  ‘ContinueURL’  to  the  ISML  template  to  render  
 
• The  ‘AdditionalParam*’  are  just  placed  in  the  above  script  example  to  illustrate  that  you  might  
need  to  pass  additional  values  to  the  ISML  template  to  render  
 
• The  render  function  expects  the  path  to  the  ISML  template  to  render,  so  replace  
‘path/to/template’  with  the  correct  template  path  
 
• Create  a  new  controller  function  representing  the  continue  URL  and  export  that  function:  

exports.  ExampleStartNode'  =  guard.ensure(['https'],  exampleStartNode');  


 
 

• Implement  the  form  handling  code  (the  named  handler  functions  represent  the  former  
connector  names):  

app.getForm('exampleForm').handleAction({  

               exampleAction1:  function  ()  {  

                   …  

               },  

               exampleAction2:  function  ()  {  

…  

               },  

       });  

D. The  LINK  integration  requires  that  you  modify  a  SiteGenesis  pipeline  to  add  an  expression  node  to  
change  the  business  logic  in  the  SiteGenesis  pipeline.  
 

The  business  logic  formerly  written  in  pipelines  is  now  in  JavaScript  code.    This  type  of  modification  
can  be  accomplished  by  adding  if/else  statements  inside  a  JavaScript  function.  

E. The  LINK  integration  requires  that  you  add  or  modify  an  assign  node  inside  a  SiteGenesis  pipeline.      
 

This  can  be  accomplished  by  simply  assigning  a  variable  value  inside  a  JavaScript  function.    An  
example  is  provided  below:  

Var  foo  =  bar;  

In  some  cases,  the  assign  node  needs  to  be  transactional.    This  can  be  accomplished  by  wrapping  the  
variable  assignment  with  dw.system.Transaction.wrap:  

var  txn = require('dw/system/Transaction');  


 
 

txn.wrap(function() {  

var foo = bar;  

});  

F. The  LINK  integration  requires  that  you  add  a  script  node  to  a  SiteGenesis  pipeline.    Add  the  script  
that  is  required  via  a  require  statement  in  the  JavaScript  controller,  add  the  appropriate  arguments,  
and  execute  the  correct  method.    For  example:  
 

Var  myscript  =  require(‘~/scripts/myscript’);  

Myscript.execute(myArgs);  

G. The  LINK  integration  requires  that  you  add  a  pipelet  to  a  SiteGenesis  pipeline.    The  following  code  
can  be  used  instead  to  call  a  pipelet  from  a  JavaScript  controller:  
 

var  addProductToBasketResult  =  new  dw.system.Pipelet('AddProductToBasket').execute({  

       Basket                          :  cart.object,  

       ProductOptionModel  :  productOptionSelections,  

       Quantity                      :  quantity,  

       Category                      :  dw.catalog.CatalogMgr.getCategory(cgid),  

       ProductListItem        :  productListItem  

});  

if  (addProductToBasketResult.result  ===  PIPELET_ERROR)  {  

       return;  

}  

You might also like