private OneSpanSign.Sdk.CustomField CreateTypicalSDKCustomField() { OneSpanSign.Sdk.CustomField sdkCustomField = CustomFieldBuilder.CustomFieldWithId("1") .WithDefaultValue("Default Value") .WithTranslation(TranslationBuilder.NewTranslation("en") .WithName("Translation Name") .WithDescription("Translatioin Description") .Build()) .IsRequired(true) .Build(); return(sdkCustomField); }
override public void Execute() { string customFieldId = Guid.NewGuid().ToString().Replace("-", ""); Console.WriteLine("customer field ID = " + customFieldId); CustomField customField = eslClient.GetCustomFieldService() .CreateCustomField(CustomFieldBuilder.CustomFieldWithId(customFieldId) .WithDefaultValue("#12345") .WithTranslation(TranslationBuilder.NewTranslation("en"). WithName("Player Number"). WithDescription("The number on your team jersey")) .WithTranslation(TranslationBuilder.NewTranslation("fr"). WithName("Numéro du Joueur"). WithDescription("Le numéro dans le dos de votre chandail d'équipe")) .Build()); CustomFieldValue customFieldValue = eslClient.GetCustomFieldService() .SubmitCustomFieldValue(CustomFieldValueBuilder.CustomFieldValueWithId(customField.Id) .WithValue("99") .build()); DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Sample Insurance policy") .WithSigner(SignerBuilder.NewSignerWithEmail(email1) .WithFirstName("John") .WithLastName("Smith")) .WithDocument(DocumentBuilder.NewDocumentNamed("First Document") .FromStream(documentInputStream1, DocumentType.PDF) .WithSignature(SignatureBuilder.SignatureFor(email1) .OnPage(0) .AtPosition(100, 100) .WithField(FieldBuilder.CustomField(customFieldValue.Id) .OnPage(0) .AtPosition(400, 200)))) .Build(); PackageId packageId = eslClient.CreatePackage(superDuperPackage); eslClient.SendPackage(packageId); }
override public void Execute() { // first custom field customFieldId1 = Guid.NewGuid().ToString().Replace("-", ""); Console.WriteLine("customer field ID = " + customFieldId1); CustomField customField1 = ossClient.GetCustomFieldService() .CreateCustomField(CustomFieldBuilder.CustomFieldWithId(customFieldId1) .WithDefaultValue(DEFAULT_VALUE) .WithTranslation(TranslationBuilder.NewTranslation(ENGLISH_LANGUAGE) .WithName(ENGLISH_NAME) .WithDescription(ENGLISH_DESCRIPTION)) .WithTranslation(TranslationBuilder.NewTranslation(FRENCH_LANGUAGE) .WithName(FRENCH_NAME) .WithDescription(FRENCH_DESCRIPTION)) .Build()); CustomFieldValue customFieldValue = ossClient.GetCustomFieldService() .SubmitCustomFieldValue(CustomFieldValueBuilder.CustomFieldValueWithId(customField1.Id) .WithValue(FIELD_VALUE1) .build()); // Second custom field customFieldId2 = Guid.NewGuid().ToString().Replace("-", ""); Console.WriteLine("customer field ID = " + customFieldId1); CustomField customField2 = ossClient.GetCustomFieldService() .CreateCustomField(CustomFieldBuilder.CustomFieldWithId(customFieldId2) .WithDefaultValue("Red") .WithTranslation(TranslationBuilder.NewTranslation("en"). WithName("Jersey color"). WithDescription("The color of your team jersey")) .Build()); CustomFieldValue customFieldValue2 = ossClient.GetCustomFieldService() .SubmitCustomFieldValue(CustomFieldValueBuilder.CustomFieldValueWithId(customField2.Id) .WithValue(FIELD_VALUE2) .build()); DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName) .WithSigner(SignerBuilder.NewSignerWithEmail(email1) .WithFirstName("John") .WithLastName("Smith")) .WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME) .FromStream(fileStream1, DocumentType.PDF) .WithSignature(SignatureBuilder.SignatureFor(email1) .OnPage(0) .AtPosition(100, 100) .WithField(FieldBuilder.CustomField(customFieldValue.Id) .OnPage(0) .AtPosition(400, 200)) .WithField(FieldBuilder.CustomField(customFieldValue2.Id) .OnPage(0) .AtPosition(400, 400)))) .Build(); packageId = ossClient.CreatePackage(superDuperPackage); ossClient.SendPackage(packageId); retrievedPackage = ossClient.GetPackage(packageId); // Get the entire list of custom field from account retrievedCustomFieldList1 = ossClient.GetCustomFieldService().GetCustomFields(Direction.ASCENDING); // Get a list of custom fields on page 1 sorted in ascending order by its id retrievedCustomFieldList2 = ossClient.GetCustomFieldService().GetCustomFields(Direction.ASCENDING, new PageRequest(1)); // Get the first custom field from account retrievedCustomField = ossClient.GetCustomFieldService().GetCustomField(customFieldId1); // Delete the second custom field from account ossClient.GetCustomFieldService().DeleteCustomField(customFieldId2); // Get the entire list of user custom field from the user retrieveCustomFieldValueList1 = ossClient.GetCustomFieldService().GetCustomFieldValues(); retrieveCustomFieldValue1 = ossClient.GetCustomFieldService().GetCustomFieldValue(customFieldId1); retrieveCustomFieldValue2 = ossClient.GetCustomFieldService().GetCustomFieldValue(customFieldId2); // Delete the second custom field from the user ossClient.GetCustomFieldService().DeleteCustomFieldValue(retrieveCustomFieldValueList1[1].Id); // Get the entire list of user custom field from the user retrieveCustomFieldValueList2 = ossClient.GetCustomFieldService().GetCustomFieldValues(); }
public void withSpecifiedValues() { AccountBuilder accountBuilder = AccountBuilder.NewAccount() .WithName(ACC_NAME) .WithId(ACC_ID) .WithOwner(ACC_OWNER) .WithLogoUrl(ACC_LOGOURL) .WithData(ACC_DATA) .WithCompany(CompanyBuilder.NewCompany(ACC_CO_NAME) .WithAddress(AddressBuilder.NewAddress() .WithAddress1(ACC_CO_ADDR_ADDR1) .WithAddress2(ACC_CO_ADDR_ADDR2) .WithCity(ACC_CO_ADDR_CITY) .WithCountry(ACC_CO_ADDR_COUNTRY) .WithState(ACC_CO_ADDR_STATE) .WithZipCode(ACC_CO_ADDR_ZIP).Build()) .WithId(ACC_CO_ID) .WithData(ACC_CO_DATA) .Build()) .WithCustomField(CustomFieldBuilder.CustomFieldWithId(ACC_FIELD_ID) .WithDefaultValue(ACC_FIELD_DEF_VLE) .IsRequired(ACC_FIELD_IS_REQUIRED) .WithTranslation(TranslationBuilder.NewTranslation(ACC_FIELD_TRANSL_LANG).Build()) .Build()) .WithLicense(LicenseBuilder.NewLicense() .CreatedOn(ACC_LIC_CREATED) .WithPaidUntil(ACC_LIC_PAIDUNTIL) .WithStatus(ACC_LIC_STATUS) .WithTransaction(ACC_LIC_TRANS_CREATED, CreditCardBuilder.NewCreditCard() .WithCvv(ACC_LIC_TRANS_CC_CVV) .WithName(ACC_LIC_TRANS_CC_NAME) .WithNumber(ACC_LIC_TRANS_CC_NUM) .WithType(ACC_LIC_TRANS_CC_TYPE) .WithExpiration(ACC_LIC_TRANS_CC_EXP_MONTH, ACC_LIC_TRANS_CC_EXP_YEAR) .Build(), PriceBuilder.NewPrice() .WithAmount(ACC_LIC_TRANS_PRICE_AMOUNT) .WithCurrency(ACC_LIC_TRANS_PRICE_CURR_ID, ACC_LIC_TRANS_PRICE_CURR_NAME, ACC_LIC_TRANS_PRICE_CURR_DATA) .Build()) .WithPlan(PlanBuilder.NewPlan(ACC_LIC_PLAN_ID) .WithId(ACC_LIC_PLAN_NAME) .WithContract(ACC_LIC_PLAN_CONTRACT) .WithDescription(ACC_LIC_PLAN_DES) .WithGroup(ACC_LIC_PLAN_GRP) .WithCycle(ACC_LIC_PLAN_CYC) .WithOriginal(ACC_LIC_PLAN_ORI) .WithData(ACC_LIC_PLAN_DATA) .WithFreeCycles(ACC_LIC_PLAN_CYC_COUNT, ACC_LIC_PLAN_CYC_CYCLE) .WithQuota(ACC_LIC_PLAN_QUOTA_CYCLE, ACC_LIC_PLAN_QUOTA_LIMIT, ACC_LIC_PLAN_QUOTA_SCOPE, ACC_LIC_PLAN_QUOTA_TARGET) .WithFeatures(ACC_LIC_PLAN_FEAT) .WithPrice(PriceBuilder.NewPrice() .WithAmount(ACC_LIC_PLAN_PRICE_AMOUNT) .WithCurrency(ACC_LIC_PLAN_PRICE_CURR_ID, ACC_LIC_PLAN_PRICE_CURR_NAME, ACC_LIC_PLAN_PRICE_CURR_DATA) .Build()) .Build()) .Build()) .WithAccountProviders(new List <Provider>() { ProviderBuilder.NewProvider(ACC_PROV_DOC_NAME) .WithData(ACC_PROV_DOC_DATA) .WithId(ACC_PROV_DOC_ID) .WithProvides(ACC_PROV_DOC_NAME) .Build() }, new List <Provider>() { ProviderBuilder.NewProvider(ACC_PROV_USR_NAME) .WithData(ACC_PROV_USR_DATA) .WithId(ACC_PROV_USR_ID) .WithProvides(ACC_PROV_USR_PROVIDES) .Build() }); Account account = accountBuilder.Build(); Assert.AreEqual(ACC_NAME, account.Name); Assert.AreEqual(ACC_CO_ID, account.Company.Id); Assert.AreEqual(ACC_CO_ADDR_ADDR1, account.Company.Address.Address1); Assert.AreEqual(1, account.CustomFields.Count); Assert.AreEqual(ACC_FIELD_DEF_VLE, account.CustomFields[0].Value); Assert.AreEqual(1, account.CustomFields[0].Translations.Count); Assert.AreEqual(ACC_FIELD_TRANSL_LANG, account.CustomFields[0].Translations[0].Language); Assert.AreEqual(1, account.Licenses.Count); Assert.AreEqual(ACC_LIC_STATUS, account.Licenses[0].Status); Assert.AreEqual(1, account.Licenses[0].Transactions.Count); Assert.AreEqual(ACC_LIC_TRANS_CC_NUM, account.Licenses[0].Transactions[0].CreditCard.Number); Assert.AreEqual(ACC_LIC_TRANS_PRICE_AMOUNT, account.Licenses[0].Transactions[0].Price.Amount); Assert.AreEqual(ACC_LIC_PLAN_CONTRACT, account.Licenses[0].Plan.Contract); Assert.AreEqual(ACC_LIC_PLAN_PRICE_AMOUNT, account.Licenses[0].Plan.Price.Amount); Assert.AreEqual(1, account.Providers.Documents.Count); Assert.AreEqual(ACC_PROV_DOC_NAME, account.Providers.Documents[0].Name); Assert.AreEqual(1, account.Providers.Users.Count); Assert.AreEqual(ACC_PROV_USR_NAME, account.Providers.Users[0].Name); }