コード例 #1
0
        private CreditCard CreateTypicalSDKCreditCard()
        {
            CreditCard creditCard = new CreditCard();

            creditCard.Cvv    = CC_CVV;
            creditCard.Type   = CC_TYPE;
            creditCard.Name   = CC_NAME;
            creditCard.Number = CC_NUM;
            CcExpiration ccExpiration = new CcExpiration();

            ccExpiration.Month    = CC_EXP_MONTH;
            ccExpiration.Year     = CC_EXP_YEAR;
            creditCard.Expiration = ccExpiration;

            return(creditCard);
        }
コード例 #2
0
        private Account CreateTypicalSDKAccount()
        {
            Account account = new 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;

            Company company = new Company();

            company.Id   = ACC_CO_ID;
            company.Name = ACC_CO_NAME;
            company.Data = ACC_CO_DATA;
            Address address = new 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;

            CustomField customField = new CustomField();

            customField.Id       = ACC_FIELD_ID;
            customField.Required = ACC_FIELD_IS_REQUIRED;
            customField.Value    = ACC_FIELD_DEF_VLE;
            Translation translation = new Translation();

            translation.Language = ACC_FIELD_TRANSL_LANG;
            customField.AddTranslations(new List <Translation> {
                translation
            });
            account.AddCustomField(customField);

            License license = new License();

            license.Created   = ACC_LIC_CREATED;
            license.Status    = ACC_LIC_STATUS;
            license.PaidUntil = ACC_LIC_PAIDUNTIL;
            Transaction transaction = new Transaction();

            transaction.Created = ACC_LIC_TRANS_CREATED;
            CreditCard creditCard = new 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;
            CcExpiration ccExpiration = new CcExpiration();

            ccExpiration.Month     = ACC_LIC_TRANS_CC_EXP_MONTH;
            ccExpiration.Year      = ACC_LIC_TRANS_CC_EXP_YEAR;
            creditCard.Expiration  = ccExpiration;
            transaction.CreditCard = creditCard;
            Price price = new Price();

            price.Amount = ACC_LIC_TRANS_PRICE_AMOUNT;
            Currency currency = new 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);
            Plan plan = new 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;
            CycleCount cycleCount = new CycleCount();

            cycleCount.Cycle = ACC_LIC_PLAN_CYC_CYCLE;
            cycleCount.Count = ACC_LIC_PLAN_CYC_COUNT;
            plan.FreeCycles  = cycleCount;
            Quota quota = new 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);
            Price price1 = new Price();

            price1.Amount = ACC_LIC_PLAN_PRICE_AMOUNT;
            Currency currency1 = new 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);

            AccountProviders accountProviders = new AccountProviders();
            Provider         provider         = new 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);
            Provider provider1 = new 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);
        }
コード例 #3
0
        private License CreateTypicalSDKLicense()
        {
            License license = new License();

            license.Created   = LIC_CREATED;
            license.Status    = LIC_STATUS;
            license.PaidUntil = LIC_PAIDUNTIL;
            Transaction transaction = new Transaction();

            transaction.Created = LIC_TRANS_CREATED;
            CreditCard creditCard = new CreditCard();

            creditCard.Cvv    = LIC_TRANS_CC_CVV;
            creditCard.Type   = LIC_TRANS_CC_TYPE;
            creditCard.Name   = LIC_TRANS_CC_NAME;
            creditCard.Number = LIC_TRANS_CC_NUM;
            CcExpiration ccExpiration = new CcExpiration();

            ccExpiration.Month     = LIC_TRANS_CC_EXP_MONTH;
            ccExpiration.Year      = LIC_TRANS_CC_EXP_YEAR;
            creditCard.Expiration  = ccExpiration;
            transaction.CreditCard = creditCard;
            Price price = new Price();

            price.Amount = LIC_TRANS_PRICE_AMOUNT;
            Currency currency = new Currency();

            currency.Data     = LIC_TRANS_PRICE_CURR_DATA;
            currency.Name     = LIC_TRANS_PRICE_CURR_NAME;
            currency.Id       = LIC_TRANS_PRICE_CURR_ID;
            price.Currency    = currency;
            transaction.Price = price;
            license.AddTransaction(transaction);
            Plan plan = new Plan();

            plan.Contract    = LIC_PLAN_CONTRACT;
            plan.Group       = LIC_PLAN_GRP;
            plan.Original    = LIC_PLAN_ORI;
            plan.Description = LIC_PLAN_DES;
            plan.Data        = LIC_PLAN_DATA;
            plan.Cycle       = LIC_PLAN_CYC;
            plan.Id          = LIC_PLAN_ID;
            plan.Features    = LIC_PLAN_FEAT;
            plan.Name        = LIC_PLAN_NAME;
            CycleCount cycleCount = new CycleCount();

            cycleCount.Cycle = LIC_PLAN_CYC_CYCLE;
            cycleCount.Count = LIC_PLAN_CYC_COUNT;
            plan.FreeCycles  = cycleCount;
            Quota quota = new Quota();

            quota.Target = LIC_PLAN_QUOTA_TARGET;
            quota.Limit  = LIC_PLAN_QUOTA_LIMIT;
            quota.Cycle  = LIC_PLAN_QUOTA_CYCLE;
            quota.Scope  = LIC_PLAN_QUOTA_SCOPE;
            plan.AddQuota(quota);
            Price price1 = new Price();

            price1.Amount = LIC_PLAN_PRICE_AMOUNT;
            Currency currency1 = new Currency();

            currency1.Id    = LIC_PLAN_PRICE_CURR_ID;
            currency1.Name  = LIC_PLAN_PRICE_CURR_NAME;
            currency1.Data  = LIC_PLAN_PRICE_CURR_DATA;
            price1.Currency = currency1;
            plan.Price      = price1;
            license.Plan    = plan;


            return(license);
        }