Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. /**
  2. *
  3. *   @input guestCheckoutAddedString : String
  4. *   @output Username : String Username on guest customer.
  5. *   @output Password : String Password on guest customer.
  6. *
  7. */
  8. importPackage( dw.system );
  9.  
  10. function execute( pdict : PipelineDictionary ) : Number
  11. {    
  12.       var text : String = "123";
  13.       var alphabet : String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  14.       var numbers : String = "0123456789";
  15.       var specChar : String = "$%/()[]{}=?!.,-_*|+~#";
  16.       var emailDomain :String = Site.getCurrent().getCustomPreferenceValue('aso_newcustomers_email_domain');
  17.       var guestCheckoutAddedString : String = pdict.guestCheckoutAddedString;
  18.       for (var i = 0; i < 8; i++){
  19.         text += alphabet.charAt(Math.floor(Math.random() * alphabet.length));
  20.         text += numbers.charAt(Math.floor(Math.random() * numbers.length));
  21.         text += specChar.charAt(Math.floor(Math.random() * specChar.length));
  22.       }
  23.    
  24.       pdict.Username = new String("Guest" + guestCheckoutAddedString + System.getCalendar().getTime().getTime().toString() + "@" + emailDomain);
  25.       pdict.Password = text;
  26.    
  27.       return PIPELET_NEXT;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement