Пример #1
0
        public OneSpanSign.API.CustomField ToAPICustomField()
        {
            if (sdkCustomField == null)
            {
                return(apiCustomField);
            }

            OneSpanSign.API.CustomField result = new OneSpanSign.API.CustomField();

            result.Id       = sdkCustomField.Id;
            result.Value    = sdkCustomField.Value;
            result.Name     = "";
            result.Required = sdkCustomField.Required;

            foreach (Translation translation in sdkCustomField.Translations)
            {
                result.AddTranslation(translation.toAPITranslation());
            }

            return(result);
        }
Пример #2
0
        private OneSpanSign.API.Account CreateTypicalAPIAccount()
        {
            OneSpanSign.API.Account account = new OneSpanSign.API.Account();

            account.Name    = ACC_NAME;
            account.Id      = ACC_ID;
            account.Owner   = ACC_OWNER;
            account.LogoUrl = ACC_LOGOURL;
            account.Data    = ACC_DATA;
            account.Created = ACC_CREATED;
            account.Updated = ACC_UPDATED;

            OneSpanSign.API.Company company = new OneSpanSign.API.Company();
            company.Id   = ACC_CO_ID;
            company.Name = ACC_CO_NAME;
            company.Data = ACC_CO_DATA;
            OneSpanSign.API.Address address = new OneSpanSign.API.Address();
            address.Address1 = ACC_CO_ADDR_ADDR1;
            address.Address2 = ACC_CO_ADDR_ADDR2;
            address.City     = ACC_CO_ADDR_CITY;
            address.Country  = ACC_CO_ADDR_COUNTRY;
            address.State    = ACC_CO_ADDR_STATE;
            address.Zipcode  = ACC_CO_ADDR_ZIP;
            company.Address  = address;
            account.Company  = company;

            OneSpanSign.API.CustomField customField = new OneSpanSign.API.CustomField();
            customField.Id       = ACC_FIELD_ID;
            customField.Required = ACC_FIELD_IS_REQUIRED;
            customField.Value    = ACC_FIELD_DEF_VLE;
            OneSpanSign.API.Translation translation = new OneSpanSign.API.Translation();
            translation.Language = ACC_FIELD_TRANSL_LANG;
            customField.AddTranslation(translation);
            account.AddCustomField(customField);

            OneSpanSign.API.License license = new OneSpanSign.API.License();
            license.Created   = ACC_LIC_CREATED;
            license.Status    = ACC_LIC_STATUS;
            license.PaidUntil = ACC_LIC_PAIDUNTIL;
            OneSpanSign.API.Transaction transaction = new OneSpanSign.API.Transaction();
            transaction.Created = ACC_LIC_TRANS_CREATED;
            OneSpanSign.API.CreditCard creditCard = new OneSpanSign.API.CreditCard();
            creditCard.Cvv    = ACC_LIC_TRANS_CC_CVV;
            creditCard.Type   = ACC_LIC_TRANS_CC_TYPE;
            creditCard.Name   = ACC_LIC_TRANS_CC_NAME;
            creditCard.Number = ACC_LIC_TRANS_CC_NUM;
            OneSpanSign.API.CcExpiration ccExpiration = new OneSpanSign.API.CcExpiration();
            ccExpiration.Month     = ACC_LIC_TRANS_CC_EXP_MONTH;
            ccExpiration.Year      = ACC_LIC_TRANS_CC_EXP_YEAR;
            creditCard.Expiration  = ccExpiration;
            transaction.CreditCard = creditCard;
            OneSpanSign.API.Price price = new OneSpanSign.API.Price();
            price.Amount = ACC_LIC_TRANS_PRICE_AMOUNT;
            OneSpanSign.API.Currency currency = new OneSpanSign.API.Currency();
            currency.Data     = ACC_LIC_TRANS_PRICE_CURR_DATA;
            currency.Name     = ACC_LIC_TRANS_PRICE_CURR_NAME;
            currency.Id       = ACC_LIC_TRANS_PRICE_CURR_ID;
            price.Currency    = currency;
            transaction.Price = price;
            license.AddTransaction(transaction);
            OneSpanSign.API.Plan plan = new OneSpanSign.API.Plan();
            plan.Contract    = ACC_LIC_PLAN_CONTRACT;
            plan.Group       = ACC_LIC_PLAN_GRP;
            plan.Original    = ACC_LIC_PLAN_ORI;
            plan.Description = ACC_LIC_PLAN_DES;
            plan.Data        = ACC_LIC_PLAN_DATA;
            plan.Cycle       = ACC_LIC_PLAN_CYC;
            plan.Id          = ACC_LIC_PLAN_ID;
            plan.Features    = ACC_LIC_PLAN_FEAT;
            plan.Name        = ACC_LIC_PLAN_NAME;
            OneSpanSign.API.CycleCount cycleCount = new OneSpanSign.API.CycleCount();
            cycleCount.Cycle = ACC_LIC_PLAN_CYC_CYCLE;
            cycleCount.Count = ACC_LIC_PLAN_CYC_COUNT;
            plan.FreeCycles  = cycleCount;
            OneSpanSign.API.Quota quota = new OneSpanSign.API.Quota();
            quota.Target = ACC_LIC_PLAN_QUOTA_TARGET;
            quota.Limit  = ACC_LIC_PLAN_QUOTA_LIMIT;
            quota.Cycle  = ACC_LIC_PLAN_QUOTA_CYCLE;
            quota.Scope  = ACC_LIC_PLAN_QUOTA_SCOPE;
            plan.AddQuota(quota);
            OneSpanSign.API.Price price1 = new OneSpanSign.API.Price();
            price1.Amount = ACC_LIC_PLAN_PRICE_AMOUNT;
            OneSpanSign.API.Currency currency1 = new OneSpanSign.API.Currency();
            currency1.Id    = ACC_LIC_PLAN_PRICE_CURR_ID;
            currency1.Name  = ACC_LIC_PLAN_PRICE_CURR_NAME;
            currency1.Data  = ACC_LIC_PLAN_PRICE_CURR_DATA;
            price1.Currency = currency1;
            plan.Price      = price1;
            license.Plan    = plan;
            account.AddLicense(license);

            OneSpanSign.API.AccountProviders accountProviders = new OneSpanSign.API.AccountProviders();
            OneSpanSign.API.Provider         provider         = new OneSpanSign.API.Provider();
            provider.Id       = ACC_PROV_DOC_ID;
            provider.Name     = ACC_PROV_DOC_NAME;
            provider.Data     = ACC_PROV_DOC_DATA;
            provider.Provides = ACC_PROV_DOC_PROVIDES;
            accountProviders.AddDocument(provider);
            OneSpanSign.API.Provider provider1 = new OneSpanSign.API.Provider();
            provider1.Id       = ACC_PROV_USR_ID;
            provider1.Name     = ACC_PROV_USR_NAME;
            provider1.Data     = ACC_PROV_USR_DATA;
            provider1.Provides = ACC_PROV_USR_PROVIDES;
            accountProviders.AddUser(provider1);
            account.Providers = accountProviders;

            return(account);
        }