Exemple #1
0
        public virtual RequestBuilder BuildRequest(string root)
        {
            var builder = new RequestBuilder(root);

            builder.AddElement("billing-day-of-month", BillingDayOfMonth);
            builder.AddElement("descriptor", Descriptor);
            builder.AddElement("first-billing-date", FirstBillingDate);
            builder.AddElement("payment-method-token", PaymentMethodToken);
            builder.AddElement("payment-method-nonce", PaymentMethodNonce);
            if (HasTrialPeriod.HasValue)
            {
                builder.AddElement("trial-period", HasTrialPeriod.Value);

                if (HasTrialPeriod.Value)
                {
                    if (TrialDuration != 0)
                    {
                        builder.AddElement("trial-duration", TrialDuration.ToString());
                    }
                    if (TrialDurationUnit != null)
                    {
                        builder.AddElement("trial-duration-unit", TrialDurationUnit.GetDescription());
                    }
                }
            }
            builder.AddElement("merchant-account-id", MerchantAccountId);
            if (NumberOfBillingCycles.HasValue)
            {
                builder.AddElement("number-of-billing-cycles", NumberOfBillingCycles.Value);
            }
            if (NeverExpires.HasValue)
            {
                builder.AddElement("never-expires", NeverExpires.Value);
            }
            builder.AddElement("id", Id);
            builder.AddElement("plan-id", PlanId);
            if (Price.HasValue)
            {
                builder.AddElement("price", Price.Value);
            }

            builder.AddElement("add-ons", AddOns);
            builder.AddElement("discounts", Discounts);
            builder.AddElement("options", Options);

            return(builder);
        }
        public virtual RequestBuilder BuildRequest(string root)
        {
            var builder = new RequestBuilder(root);

            builder.AddElement("billing-day-of-month", BillingDayOfMonth);
            builder.AddElement("billing-frequency", BillingFrequency);
            builder.AddElement("currency-iso-code", CurrencyIsoCode);
            builder.AddElement("description", Description);
            builder.AddElement("id", Id);
            builder.AddElement("name", Name);
            builder.AddElement("number-of-billing-cycles", NumberOfBillingCycles);
            builder.AddElement("price", Price);
            builder.AddElement("trial-period", TrialPeriod);
            builder.AddElement("trial-duration", TrialDuration);
            if (TrialDurationUnit != null)
            {
                builder.AddElement("trial-duration-unit", TrialDurationUnit.GetDescription());
            }
            builder.AddElement("add-ons", AddOns);
            builder.AddElement("discounts", Discounts);
            return(builder);
        }