Exemplo n.º 1
0
        protected void WriteChangeSubscriptionXml(XmlTextWriter xmlWriter, ChangeTimeframe timeframe)
        {
            xmlWriter.WriteStartElement("subscription"); // Start: subscription

            xmlWriter.WriteElementString("timeframe", timeframe.ToString().EnumNameToTransportCase());
            xmlWriter.WriteElementString("quantity", Quantity.AsString());
            xmlWriter.WriteStringIfValid("plan_code", _planCode);
            xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);
            xmlWriter.WriteStringIfValid("coupon_code", _couponCode);

            if (UnitAmountInCents.HasValue)
            {
                xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
            }

            if (CollectionMethod.Like("manual"))
            {
                xmlWriter.WriteElementString("collection_method", "manual");
                xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
                xmlWriter.WriteElementString("po_number", PoNumber);
            }
            else if (CollectionMethod.Like("automatic"))
            {
                xmlWriter.WriteElementString("collection_method", "automatic");
            }

            xmlWriter.WriteEndElement(); // End: subscription
        }
Exemplo n.º 2
0
 internal void WriteXml(XmlTextWriter xmlWriter, bool embedded = false)
 {
     xmlWriter.WriteStartElement("adjustment"); // Start: adjustment
     xmlWriter.WriteElementString("description", Description);
     xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.AsString());
     xmlWriter.WriteElementString("quantity", Quantity.AsString());
     xmlWriter.WriteElementString("accounting_code", AccountingCode);
     xmlWriter.WriteElementString("tax_exempt", TaxExempt.AsString());
     xmlWriter.WriteElementString("product_code", ProductCode);
     if (!embedded)
     {
         xmlWriter.WriteElementString("currency", Currency);
     }
     if (RevenueScheduleType.HasValue)
     {
         xmlWriter.WriteElementString("revenue_schedule_type", RevenueScheduleType.Value.ToString().EnumNameToTransportCase());
     }
     if (TaxCode != null)
     {
         xmlWriter.WriteElementString("tax_code", TaxCode);
     }
     if (StartDate != DateTime.MinValue)
     {
         xmlWriter.WriteElementString("start_date", StartDate.ToString("s"));
     }
     if (EndDate.HasValue)
     {
         xmlWriter.WriteElementString("end_date", EndDate.Value.ToString("s"));
     }
     if (Origin != null)
     {
         xmlWriter.WriteElementString("origin", Origin);
     }
     xmlWriter.WriteEndElement(); // End: adjustment
 }
Exemplo n.º 3
0
        internal override void WriteXml(XmlTextWriter writer)
        {
            writer.WriteStartElement("adjustment");

            writer.WriteElementString("uuid", Uuid);
            writer.WriteElementString("quantity", Quantity.AsString());
            writer.WriteElementString("prorate", Prorate.AsString());

            writer.WriteEndElement(); // adjustment
        }
Exemplo n.º 4
0
        protected void WriteSubscriptionXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("subscription"); // Start: subscription

            xmlWriter.WriteElementString("plan_code", _planCode);

            xmlWriter.WriteElementString("currency", Currency);

            xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);

            xmlWriter.WriteStringIfValid("coupon_code", _couponCode);

            if (UnitAmountInCents.HasValue)
            {
                xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
            }

            xmlWriter.WriteElementString("quantity", Quantity.AsString());

            if (TrialPeriodEndsAt.HasValue)
            {
                xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
            }

            if (StartsAt.HasValue)
            {
                xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
            }

            if (TotalBillingCycles.HasValue)
            {
                xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
            }

            if (FirstRenewalDate.HasValue)
            {
                xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
            }

            if (CollectionMethod.Like("manual"))
            {
                xmlWriter.WriteElementString("collection_method", "manual");
                xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
                xmlWriter.WriteElementString("po_number", PoNumber);
            }
            else if (CollectionMethod.Like("automatic"))
            {
                xmlWriter.WriteElementString("collection_method", "automatic");
            }

            // <account> and billing info
            Account.WriteXml(xmlWriter);

            xmlWriter.WriteEndElement(); // End: subscription
        }
Exemplo n.º 5
0
 internal override void WriteXml(XmlTextWriter xmlWriter)
 {
     xmlWriter.WriteStartElement("adjustment");
     xmlWriter.WriteElementString("description", Description);
     xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.AsString());
     xmlWriter.WriteElementString("currency", Currency);
     xmlWriter.WriteElementString("quantity", Quantity.AsString());
     xmlWriter.WriteElementString("accounting_code", AccountingCode);
     xmlWriter.WriteElementString("tax_exempt", TaxExempt.AsString());
     xmlWriter.WriteEndElement();
 }
        internal override void WriteXml(XmlTextWriter writer)
        {
            writer.WriteStartElement("subscription_add_on");

            writer.WriteElementString("add_on_code", AddOnCode);
            writer.WriteElementString("quantity", Quantity.AsString());
            writer.WriteElementString("unit_amount_in_cents", UnitAmountInCents.AsString());

            if (RevenueScheduleType.HasValue)
            {
                writer.WriteElementString("revenue_schedule_type", RevenueScheduleType.Value.ToString().EnumNameToTransportCase());
            }

            writer.WriteEndElement();
        }
Exemplo n.º 7
0
 internal void WriteXml(XmlTextWriter xmlWriter, bool embedded = false)
 {
     xmlWriter.WriteStartElement("adjustment"); // Start: adjustment
     xmlWriter.WriteElementString("description", Description);
     xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.AsString());
     xmlWriter.WriteElementString("quantity", Quantity.AsString());
     xmlWriter.WriteElementString("accounting_code", AccountingCode);
     xmlWriter.WriteElementString("tax_exempt", TaxExempt.AsString());
     if (!embedded)
     {
         xmlWriter.WriteElementString("currency", Currency);
     }
     if (RevenueScheduleType.HasValue)
     {
         xmlWriter.WriteElementString("revenue_schedule_type", RevenueScheduleType.Value.ToString().EnumNameToTransportCase());
     }
     xmlWriter.WriteEndElement(); // End: adjustment
 }
        protected void WriteSubscriptionXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("subscription"); // Start: subscription

            xmlWriter.WriteElementString("plan_code", PlanCode);

            xmlWriter.WriteElementString("currency", Currency);

            xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);

            xmlWriter.WriteStringIfValid("coupon_code", _couponCode);

            if (_couponCodes != null && _couponCodes.Length != 0)
            {
                xmlWriter.WriteStartElement("coupon_codes");
                foreach (var _coupon_code in _couponCodes)
                {
                    xmlWriter.WriteElementString("coupon_code", _coupon_code);
                }
                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteElementString("customer_notes", CustomerNotes);
            xmlWriter.WriteElementString("terms_and_conditions", TermsAndConditions);
            xmlWriter.WriteElementString("vat_reverse_charge_notes", VatReverseChargeNotes);

            if (UnitAmountInCents.HasValue)
            {
                xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
            }

            xmlWriter.WriteElementString("quantity", Quantity.AsString());

            if (TrialPeriodEndsAt.HasValue)
            {
                xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
            }

            if (BankAccountAuthorizedAt.HasValue)
            {
                xmlWriter.WriteElementString("bank_account_authorized_at", BankAccountAuthorizedAt.Value.ToString("s"));
            }

            if (StartsAt.HasValue)
            {
                xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
            }

            if (TotalBillingCycles.HasValue)
            {
                xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
            }

            if (FirstRenewalDate.HasValue)
            {
                xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
            }

            if (Bulk.HasValue)
            {
                xmlWriter.WriteElementString("bulk", Bulk.ToString().ToLower());
            }

            if (CollectionMethod.Like("manual"))
            {
                xmlWriter.WriteElementString("collection_method", "manual");
                xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
                xmlWriter.WriteElementString("po_number", PoNumber);
            }
            else if (CollectionMethod.Like("automatic"))
            {
                xmlWriter.WriteElementString("collection_method", "automatic");
            }

            // <account> and billing info
            Account.WriteXml(xmlWriter);

            xmlWriter.WriteEndElement(); // End: subscription
        }
Exemplo n.º 9
0
        internal void WriteSubscriptionXml(XmlTextWriter xmlWriter, bool embedded)
        {
            xmlWriter.WriteStartElement("subscription"); // Start: subscription

            xmlWriter.WriteElementString("plan_code", PlanCode);

            if (!embedded)
            {
                // <account> and billing info
                Account.WriteXml(xmlWriter);
                xmlWriter.WriteElementString("currency", Currency);
                xmlWriter.WriteElementString("customer_notes", CustomerNotes);
                xmlWriter.WriteElementString("terms_and_conditions", TermsAndConditions);
                xmlWriter.WriteElementString("vat_reverse_charge_notes", VatReverseChargeNotes);
                xmlWriter.WriteElementString("po_number", PoNumber);
            }

            xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);

            xmlWriter.WriteStringIfValid("coupon_code", _couponCode);

            if (_couponCodes != null && _couponCodes.Length != 0)
            {
                xmlWriter.WriteStartElement("coupon_codes");
                foreach (var _coupon_code in _couponCodes)
                {
                    xmlWriter.WriteElementString("coupon_code", _coupon_code);
                }
                xmlWriter.WriteEndElement();
            }

            if (UnitAmountInCents.HasValue)
            {
                xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
            }

            xmlWriter.WriteElementString("quantity", Quantity.AsString());

            if (TrialPeriodEndsAt.HasValue)
            {
                xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
            }

            if (BankAccountAuthorizedAt.HasValue)
            {
                xmlWriter.WriteElementString("bank_account_authorized_at", BankAccountAuthorizedAt.Value.ToString("s"));
            }

            if (StartsAt.HasValue)
            {
                xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
            }

            if (TotalBillingCycles.HasValue)
            {
                xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
            }

            if (FirstRenewalDate.HasValue)
            {
                xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
            }

            if (Bulk.HasValue)
            {
                xmlWriter.WriteElementString("bulk", Bulk.ToString().ToLower());
            }

            if (CollectionMethod.Like("manual"))
            {
                xmlWriter.WriteElementString("collection_method", "manual");

                if (NetTerms.HasValue)
                {
                    xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
                }
            }
            else if (CollectionMethod.Like("automatic"))
            {
                xmlWriter.WriteElementString("collection_method", "automatic");
            }

            if (ShippingAddressId.HasValue)
            {
                xmlWriter.WriteElementString("shipping_address_id", ShippingAddressId.Value.ToString());
            }

            if (ImportedTrial.HasValue)
            {
                xmlWriter.WriteElementString("imported_trial", ImportedTrial.Value.ToString().ToLower());
            }

            if (RevenueScheduleType.HasValue)
            {
                xmlWriter.WriteElementString("revenue_schedule_type", RevenueScheduleType.Value.ToString().EnumNameToTransportCase());
            }

            if (RemainingBillingCycles.HasValue)
            {
                xmlWriter.WriteElementString("remaining_billing_cycles", RemainingBillingCycles.Value.AsString());
            }

            if (AutoRenew.HasValue)
            {
                xmlWriter.WriteElementString("auto_renew", AutoRenew.Value.AsString());
            }

            if (RenewalBillingCycles.HasValue)
            {
                xmlWriter.WriteElementString("renewal_billing_cycles", RenewalBillingCycles.Value.AsString());
            }

            xmlWriter.WriteIfCollectionHasAny("custom_fields", CustomFields);

            if (!ShippingMethodCode.IsNullOrEmpty())
            {
                xmlWriter.WriteElementString("shipping_method_code", ShippingMethodCode);
            }

            if (ShippingAmountInCents.HasValue)
            {
                xmlWriter.WriteElementString("shipping_amount_in_cents", ShippingAmountInCents.Value.AsString());
            }

            xmlWriter.WriteEndElement(); // End: subscription
        }