pro-rate subscription to the end of the month

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
mezojeff
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Fri Jan 08, 2010 7:23 am

pro-rate subscription to the end of the month

Post by mezojeff » Wed Apr 14, 2010 10:29 am

Is there a way to do this through the interface, or would this be custom code? I'm trying to wrap my head around how to do this.

mezojeff
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Fri Jan 08, 2010 7:23 am

Re: pro-rate subscription to the end of the month

Post by mezojeff » Wed Apr 14, 2010 11:03 am

I should probably provide a little more detail.

I've figured out how to calculate it in the payment provider class I've created in the DoAuthorizeRecurring method.

double proratedAmount(string Amount)
{
double pricing = Convert.ToDouble(Amount);
DateTime nextDate = Convert.ToDateTime(DateTime.Now.AddMonths(1).Month.ToString() + "/1/" + DateTime.Now.AddMonths(1).Year.ToString() + " 00:00:00");
DateTime currentDate = DateTime.Now;
TimeSpan ts = nextDate - currentDate;
int daysbetween = ts.Days;
int daysinmonth = System.DateTime.DaysInMonth(currentDate.Year, currentDate.Month);
double priceperday = pricing / daysinmonth;
double proratedprice = priceperday * daysbetween;
return proratedprice;
}

I would like able commerce to be able to say as much in the interface. Right now the customer thinks they have been charged the full 9.99 when they've actually only been charged 5.33, the 9.99 will start when the first of the month billing comes around. How can I adjust email confirmations and order summaries to reflect?

Thanks,
Jeff

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: pro-rate subscription to the end of the month

Post by jmestep » Wed Apr 14, 2010 4:38 pm

You could set your product to use a variable price and calculate that price every day using code. Only don't use the input box where the customer can enter a price.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply