OBJECT Codeunit 1072 MS - PayPal Create Demo Data
{
  OBJECT-PROPERTIES
  {
    Date=;
    Time=;
    Version List=;
  }
  PROPERTIES
  {
    OnRun=BEGIN
            InsertSandboxPayPalTemplate;
            InsertDemoPayPalAccount;
          END;

  }
  CODE
  {
    VAR
      DemoAccountPrefixTxt@1003 : TextConst 'ENU="Demo Sandbox Account - "';
      DemoAccountIDTxt@1002 : TextConst '@@@={Locked};ENU=donotreply@dynamics.com';

    LOCAL PROCEDURE InsertSandboxPayPalTemplate@1();
    VAR
      MSPayPalStandardTemplate@1000 : Record 1071;
      MSPayPalStandardMgt@1001 : Codeunit 1070;
    BEGIN
      IF MSPayPalStandardTemplate.GET THEN
        EXIT;

      MSPayPalStandardTemplate.INIT;
      MSPayPalStandardTemplate.INSERT;

      MSPayPalStandardMgt.TemplateAssignDefaultValues(MSPayPalStandardTemplate);
      MSPayPalStandardTemplate.SetTargetURL(MSPayPalStandardMgt.GetSandboxURL);
    END;

    LOCAL PROCEDURE InsertDemoPayPalAccount@2();
    VAR
      MSPayPalStandardTemplate@1002 : Record 1071;
      MSPayPalStandardAccount@1000 : Record 1070;
      MSPayPalStandardMgt@1001 : Codeunit 1070;
    BEGIN
      MSPayPalStandardAccount.SETRANGE("Always Include on Documents",TRUE);
      IF MSPayPalStandardAccount.FINDFIRST THEN
        EXIT;

      MSPayPalStandardMgt.GetTemplate(MSPayPalStandardTemplate);
      MSPayPalStandardAccount.TRANSFERFIELDS(MSPayPalStandardTemplate,FALSE);
      MSPayPalStandardAccount.Name := DemoAccountPrefixTxt + MSPayPalStandardAccount.Name;
      MSPayPalStandardAccount.Description := DemoAccountPrefixTxt + MSPayPalStandardAccount.Description;
      MSPayPalStandardAccount."Account ID" := DemoAccountIDTxt;
      MSPayPalStandardAccount.INSERT(TRUE);

      MSPayPalStandardAccount.Enabled := TRUE;
      MSPayPalStandardAccount."Always Include on Documents" := TRUE;
      MSPayPalStandardAccount.MODIFY(TRUE);
    END;

    BEGIN
    END.
  }
}

