Upload_Individual.js.bak 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. function uploadIndividual()
  2. {
  3. var registrarCode = Project.Variables.code.Value("codeRegister");
  4. var issuerCode = Project.Variables.code.Value("issuerCode");
  5. var clientCode = Project.Variables.code.Value("accountclientCodeUpload");
  6. var nameIndividual = Project.Variables.name.Value("investoreIndividualName1");
  7. var ktpIndividual = Project.Variables.npwp.Value("ktpInvestor1");
  8. var passportNumber = Project.Variables.code.Value("passportNumberUpload");
  9. var bod = Project.Variables.createUser.Value("bodUpload");
  10. var url = "C:\Users\vendor_qafusi2\Documents\TestComplete 14 Projects\EBAE Website\Automation Testing File\File upload\Upload Investor Individual\\";
  11. var template =
  12. '<Message>\n'+
  13. '<Record name="data">\n'+
  14. '<Field name="action">CREATION</Field>\n'+
  15. '<Field name="investorType">INDIVIDUAL</Field>\n'+
  16. '<Field name="investorClientType">DIRECT</Field>\n'+
  17. '<Field name="accountLocalCode">'+registrarCode+'</Field>\n'+
  18. '<Field name="accountClientCode">'+clientCode+'</Field>\n'+
  19. '<Field name="accountIssuerCode">'+issuerCode+'</Field>\n'+
  20. '<Field name="accountTaxCode">101001</Field>\n'+
  21. '<Field name="investorFirstName"><![CDATA['+nameIndividual+']]></Field>\n'+
  22. '<Field name="investorMiddleName"></Field>\n'+
  23. '<Field name="investorLastName"></Field>\n'+
  24. '<Field name="investorNationality">CN</Field>\n'+
  25. '<Field name="investorKTPNumber">'+ktpIndividual+'</Field>\n'+
  26. '<Field name="investorKTPRegistrationDate"></Field>\n'+
  27. '<Field name="investorKTPExpiredDate">20251010</Field>\n'+
  28. '<Field name="investorNPWPNumber"></Field>\n'+
  29. '<Field name="investorNPWPRegistrationDate"></Field>\n'+
  30. '<Field name="investorPassportNumber">'+passportNumber+'</Field>\n'+
  31. '<Field name="investorPassportExpiredDate">21200312</Field>\n'+
  32. '<Field name="investorKitasSKDNumber"></Field>\n'+
  33. '<Field name="investorKitasSKDExpiredDate"></Field>\n'+
  34. '<Field name="investorBirthPlace">JAKARTA</Field>\n'+
  35. '<Field name="investorBirthDate">'+bod+'</Field>\n'+
  36. '<Field name="investorAddress1">JALAN AUTOMATION</Field>\n'+
  37. '<Field name="investorAddress2"></Field>\n'+
  38. '<Field name="investorAddress3"></Field>\n'+
  39. '<Field name="investorCity">999</Field>\n'+
  40. '<Field name="investorProvince">1000</Field>\n'+
  41. '<Field name="investorPostalCode"></Field>\n'+
  42. '<Field name="investorCountry">CN</Field>\n'+
  43. '<Field name="investorHomePhone"></Field>\n'+
  44. '<Field name="investorMobilePhone"></Field>\n'+
  45. '<Field name="investorEmail"></Field>\n'+
  46. '<Field name="investorFax"></Field>\n'+
  47. '<Field name="investorOtherAddress1"></Field>\n'+
  48. '<Field name="investorOtherAddress2"></Field>\n'+
  49. '<Field name="investorOtherAddress3"></Field>\n'+
  50. '<Field name="investorOtherCity"></Field>\n'+
  51. '<Field name="investorOtherProvince"></Field>\n'+
  52. '<Field name="investorOtherPostalCode"></Field>\n'+
  53. '<Field name="investorOtherCountry"></Field>\n'+
  54. '<Field name="investorOtherHomePhone"></Field>\n'+
  55. '<Field name="investorOtherMobilePhone"></Field>\n'+
  56. '<Field name="investorOtherEmail"></Field>\n'+
  57. '<Field name="investorOtherFax"></Field>\n'+
  58. '<Field name="investorSex">1</Field>\n'+
  59. '<Field name="investorMaritalStatus">1</Field>\n'+
  60. '<Field name="investorSpouseName"></Field>\n'+
  61. '<Field name="investorMothersMaidenName">AUTOMATION</Field>\n'+
  62. '<Field name="investorHeirName"></Field>\n'+
  63. '<Field name="investorHeirRelation"></Field>\n'+
  64. '<Field name="investorEducationalBackground">3</Field>\n'+
  65. '<Field name="investorOccupation">4</Field>\n'+
  66. '<Field name="investorOccupationText"></Field>\n'+
  67. '<Field name="investorNatureofBusiness"></Field>\n'+
  68. '<Field name="investorIncomePerAnnum">2</Field>\n'+
  69. '<Field name="investorFundSource">2</Field>\n'+
  70. '<Field name="investorFundSourceText"></Field>\n'+
  71. '<Field name="accountDescription"></Field>\n'+
  72. '<Field name="investorBankAccountName1"></Field>\n'+
  73. '<Field name="investorBankAccountNumber1"></Field>\n'+
  74. '<Field name="investorBankAccountBICCode1"></Field>\n'+
  75. '<Field name="investorBankAccountHolderName1"></Field>\n'+
  76. '<Field name="investorBankAccountCurrency1"></Field>\n'+
  77. '<Field name="investorBankAccountName2"></Field>\n'+
  78. '<Field name="investorBankAccountNumber2"></Field>\n'+
  79. '<Field name="investorBankAccountBICCode2"></Field>\n'+
  80. '<Field name="investorBankAccountHolderName2"></Field>\n'+
  81. '<Field name="investorBankAccountCurrency2"></Field>\n'+
  82. '<Field name="investorBankAccountName3"></Field>\n'+
  83. '<Field name="investorBankAccountNumber3"></Field>\n'+
  84. '<Field name="investorBankAccountBICCode3"></Field>\n'+
  85. '<Field name="investorBankAccountHolderName3"></Field>\n'+
  86. '<Field name="investorBankAccountCurrency3"></Field>\n'+
  87. '<Field name="investorInvestmentObjective">1</Field>\n'+
  88. '<Field name="DirectSid"></Field>\n'+
  89. '<Field name="AssetOwner">1</Field>\n'+
  90. '<Field name="accountCreationFlag">N</Field>\n'+
  91. '</Record>\n'+
  92. '</Message>' ;
  93. if (aqFile.Create(url + 'inv_inda.sdi') == 0)
  94. {
  95. aqFile.WriteToTextFile(url + 'inv_inda.sdi', template, aqFile.ctUTF8);
  96. Log.Message("File dibuat dan teks yang ditentukan berhasil ditulis.");
  97. var fileName = "inv_inda.sdi";
  98. Log.SaveResultsAs(fileName, 2);
  99. // Specifies the name of the archive
  100. var archivePath = url + "inv_indi";
  101. // Packes the resutls
  102. if (slPacker.Pack(fileName, url, archivePath)) {
  103. var OldPath = url + "inv_indi.Zip";
  104. var NewPath = url + "inv_inda.zip";
  105. // Renames the file
  106. aqFileSystem.RenameFile(OldPath, NewPath);
  107. Log.Message("Files compressed successfully.");
  108. }
  109. }
  110. else
  111. {
  112. aqFile.Delete(url + 'inv_inda.sdi');
  113. Log.Message("Delete successfully.");
  114. aqFile.Delete(url + 'inv_inda.zip');
  115. Log.Message("Delete successfully.");
  116. if (aqFile.Create(url + 'inv_inda.sdi') == 0)
  117. {
  118. aqFile.WriteToTextFile(url + 'inv_inda.sdi', template, aqFile.ctUTF8);
  119. Log.Message("File dibuat dan teks yang ditentukan berhasil ditulis.");
  120. var fileName = "inv_inda.sdi";
  121. Log.SaveResultsAs(fileName, 2);
  122. // Specifies the name of the archive
  123. var archivePath = url + "inv_indi";
  124. // Packes the resutls
  125. if (slPacker.Pack(fileName, url, archivePath)) {
  126. var OldPath = url + "inv_indi.Zip";
  127. var NewPath = url + "inv_inda.zip";
  128. // Renames the file
  129. aqFileSystem.RenameFile(OldPath, NewPath);
  130. Log.Message("Files compressed successfully.");
  131. }
  132. }
  133. }
  134. }