Class PaymentPlan

Payment Plan is a type of order that will be a recurring order.

Inheritance
System.Object
PaymentPlan
Implements
System.Xml.Serialization.IXmlSerializable
System.ICloneable
System.Runtime.Serialization.ISerializable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Orders
Assembly: Mediachase.Commerce.dll
Version: 10.8.0
Syntax
public class PaymentPlan : OrderGroup, IXmlSerializable, IStorageObject, ICloneable, ISerializable, IPaymentPlan, IOrderGroup, IExtendedProperties, IDeepCloneable

Constructors

PaymentPlan()

Initializes a new instance of the PaymentPlan class.

Declaration
protected PaymentPlan()

PaymentPlan(IDataReader)

Internal constructor required by collection implementation.

Declaration
public PaymentPlan(IDataReader reader)
Parameters
Type Name Description
System.Data.IDataReader reader

The reader.

PaymentPlan(SerializationInfo, StreamingContext)

Initializes a new instance of the PaymentPlan class.

Declaration
protected PaymentPlan(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The info.

System.Runtime.Serialization.StreamingContext context

The context.

PaymentPlan(String, Guid)

Initializes a new instance of the PaymentPlan class.

Declaration
public PaymentPlan(string Name, Guid CustomerId)
Parameters
Type Name Description
System.String Name

The name.

System.Guid CustomerId

The customer id.

Properties

CompletedCyclesCount

Gets or sets the completed cycles count. This property will be auto increased on each new generated sale.

Declaration
public virtual int CompletedCyclesCount { get; set; }
Property Value
Type Description
System.Int32

The completed cycles count.

CycleLength

Gets or sets the length of the cycle. For example to charge customer monthly, set this value to 1 and CycleMode to Months.

Declaration
public virtual int CycleLength { get; set; }
Property Value
Type Description
System.Int32

The length of the cycle.

CycleMode

Gets or sets the cycle mode. Cycle modes available are days, weeks, months and years as well as None, Custom1 and Custom2.

Declaration
public virtual PaymentPlanCycle CycleMode { get; set; }
Property Value
Type Description
PaymentPlanCycle

The cycle mode.

EndDate

Gets or sets the stop date for the last payment.

Declaration
public virtual DateTime EndDate { get; set; }
Property Value
Type Description
System.DateTime

The stop date.

IsActive

Gets or sets a value indicating whether this Payment Plan is active.

Declaration
public virtual bool IsActive { get; set; }
Property Value
Type Description
System.Boolean

true if this plan is active; otherwise, false.

IsDue

Returns true if payment plan payment is due

Declaration
public bool IsDue { get; }
Property Value
Type Description
System.Boolean

true if this instance is due; otherwise, false.

LastTransactionDate

Gets or sets the last transaction date.

Declaration
public virtual DateTime LastTransactionDate { get; set; }
Property Value
Type Description
System.DateTime

The last transaction date.

MaxCyclesCount

Gets or sets the max cycles count. So for instance if you want to charge customer for a year each month, set CycleMode to month, CycleLength to 1 and MaxCyclesCount to 12. Leave at 0 if you never want this cycle to end.

Declaration
public virtual int MaxCyclesCount { get; set; }
Property Value
Type Description
System.Int32

The max cycles count.

NextTransactionDate

Returns the date of the next transaction.

Declaration
public DateTime NextTransactionDate { get; }
Property Value
Type Description
System.DateTime

The next transaction date. In UTC Format.

Remarks

Gets the Date for the next transaction based on the type of Payment Plan

OrderNumberMethod

Gets or sets the order number method that is used to generate the tracking PO sequence. If none set, the framework will use built in function GenerateOrderNumber:

this.OrderNumberMethod = new CreateOrderNumber(GenerateOrderNumber);

private string GenerateOrderNumber(Cart cart) { string num = new Random().Next(100, 999).ToString(); return String.Format("PO{0}{1}", cart.OrderGroupId, num); }

Declaration
public PaymentPlan.CreateOrderNumber OrderNumberMethod { get; set; }
Property Value
Type Description
PaymentPlan.CreateOrderNumber

The order number method.

StartDate

Gets or sets the start date for first payment.

Declaration
public virtual DateTime StartDate { get; set; }
Property Value
Type Description
System.DateTime

The start date.

Methods

GetObjectData(SerializationInfo, StreamingContext)

Gets the object data.

Declaration
public override void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type Name Description
System.Runtime.Serialization.SerializationInfo info

The info.

System.Runtime.Serialization.StreamingContext context

The context.

Overrides

LoadByCustomer(Guid)

Loads the Payment Plan by customer.

Declaration
public static MetaStorageCollectionBase<PaymentPlan> LoadByCustomer(Guid CustomerId)
Parameters
Type Name Description
System.Guid CustomerId

The customer id.

Returns
Type Description
MetaStorageCollectionBase<PaymentPlan>

LoadByCustomerAndOrderGroupId(Guid, Int32)

Loads the payment plan by customer and order group id.

Declaration
[Obsolete("This method is no longer used, use LoadByOrderGroupId instead. Will remain at least until April 2016.")]
public static PaymentPlan LoadByCustomerAndOrderGroupId(Guid CustomerId, int OrderGroupId)
Parameters
Type Name Description
System.Guid CustomerId

The customer id.

System.Int32 OrderGroupId

The order group id.

Returns
Type Description
PaymentPlan

LoadByOrderGroupId(Int32)

Loads the by order group identifier.

Declaration
public static PaymentPlan LoadByOrderGroupId(int OrderGroupId)
Parameters
Type Name Description
System.Int32 OrderGroupId

The order group identifier.

Returns
Type Description
PaymentPlan

PopulateFromCart(Cart)

Populates from cart.

Declaration
public virtual void PopulateFromCart(Cart cart)
Parameters
Type Name Description
Cart cart

The cart.

SaveAsPurchaseOrder()

Saves as purchase order. This method should be called when recurring payment is processed. So for instance if it is a monthly plan, call this method on monthly basis.

Declaration
public virtual PurchaseOrder SaveAsPurchaseOrder()
Returns
Type Description
PurchaseOrder

Search(OrderSearch, out Int32)

Searches for payment plan.

Declaration
public static MetaStorageCollectionBase<PaymentPlan> Search(OrderSearch search, out int totalRecords)
Parameters
Type Name Description
OrderSearch search

The search.

System.Int32 totalRecords

The total records.

Returns
Type Description
MetaStorageCollectionBase<PaymentPlan>

WriteXml(XmlWriter)

Converts an object into its XML representation.

Declaration
public override void WriteXml(XmlWriter writer)
Parameters
Type Name Description
System.Xml.XmlWriter writer

The System.Xml.XmlWriter stream to which the object is serialized

Overrides

Explicit Interface Implementations

IPaymentPlan.CompletedCyclesCount

Gets or sets the completed cycles count. This property will be auto increased on each new generated sale.

Declaration
int IPaymentPlan.CompletedCyclesCount { get; set; }
Returns
Type Description
System.Int32

The completed cycles count.

IPaymentPlan.CycleLength

Gets or sets the length of the cycle. For example to charge customer monthly, set this value to 1 and CycleMode to Months.

Declaration
int IPaymentPlan.CycleLength { get; set; }
Returns
Type Description
System.Int32

The length of the cycle.

IPaymentPlan.CycleMode

Gets or sets the cycle mode. Cycle modes available are days, weeks, months and years as well as None, Custom1 and Custom2.

Declaration
PaymentPlanCycle IPaymentPlan.CycleMode { get; set; }
Returns
Type Description
PaymentPlanCycle

The cycle mode.

IPaymentPlan.EndDate

Gets or sets the stop date for the last payment.

Declaration
DateTime? IPaymentPlan.EndDate { get; set; }
Returns
Type Description
System.Nullable<System.DateTime>

The stop date.

IPaymentPlan.IsActive

Gets or sets a value indicating whether this Payment Plan is active.

Declaration
bool IPaymentPlan.IsActive { get; set; }
Returns
Type Description
System.Boolean

true if this plan is active; otherwise, false.

IPaymentPlan.LastTransactionDate

Gets or sets the last transaction date.

Declaration
DateTime? IPaymentPlan.LastTransactionDate { get; set; }
Returns
Type Description
System.Nullable<System.DateTime>

The last transaction date.

IPaymentPlan.MaxCyclesCount

Gets or sets the max cycles count. So for instance if you want to charge customer for a year each month, set CycleMode to month, CycleLength to 1 and MaxCyclesCount to 12. Leave at 0 if you never want this cycle to end.

Declaration
int IPaymentPlan.MaxCyclesCount { get; set; }
Returns
Type Description
System.Int32

The max cycles count.

IPaymentPlan.StartDate

Gets or sets the start date for first payment.

Declaration
DateTime IPaymentPlan.StartDate { get; set; }
Returns
Type Description
System.DateTime

The start date.

IDeepCloneable.DeepClone()

Creates a limited deep clone of this object.

Declaration
object IDeepCloneable.DeepClone()
Returns
Type Description
System.Object

A deep clone of this object.

Remarks

Some reference type properties will NOT be cloned by this method - the original and the clone will share the same instance of:

Implements

System.Xml.Serialization.IXmlSerializable
System.ICloneable
System.Runtime.Serialization.ISerializable

Extension Methods