-
Notifications
You must be signed in to change notification settings - Fork 18
Support fixed day of month #104
base: master
Are you sure you want to change the base?
Conversation
@mattwire I've taken an initial look, but not tested. This is a massive PR! And surely most of it should be in core? I'm a bit worried about maintainability. Do we need a whole Api entity and action just to provide a static list of days of the month?! Like it's these four lines:
Or, even just hard code it (not going to change!) / generate with JS? I may have misunderstood. Though I could add to it e.g. to replace/wrap Another thought: it annoys many clients that the first GC DD comes in 6+ days after it's set up. Allowing people to choose a date means that if that's too soon then it's a long wait. e.g. set up a DD on the 1st and choose the 1st for a membership. Now you have to wait a month to get your membership. I realise people can choose not to use this feature, but I bet it confuses people about things like membership starts. Hmmm! Sounded so simple from the title! |
Some of this PR came across from Stripe/Smartdebit which both allow specifying a specific "start_date". Technically gocardless does too but the API also supports specifying a "day of month" which seems simpler. It would be nice to have some of this framework in core but I don't see that happening any time soon.. There are some complexities in this PR which could be simplified. As you've mentioned there is an entire API4 entity just to get the list of possible days for the settings page - angularjs is not my strongest area so could not see another way, but I guess we could just hardcode directly on the js side and simplify things a bit. We still need the PHP functions to format the options that are displayed to the user when the contribution page is loaded though. On the js side I copied a couple of bits over from CRM.payment (mjwshared) library and added the trigger for ajaxcomplete - did you test the gocardless forceRecurring on contribution pages when there are multiple processors and gocardless is not default? |
I can help with angular/js. Day of month and start date two separate features. I've used fixed start date before with upgrades from another DD bureau. I agree that day of month is easier to implement and probably the more generally useful case. I did test forcerecurring with multiple processors and I'm pretty sure without setting default but if have to re check. Apart from Selenium (which I find extortionately expensive to maintain) I don't know if a way automate tests for the different form possibilities. |
How's this? const m={1:'st', 2:'nd', 3:'rd', 21:'st', 22:'nd', 23:'rd'};
const opts = [{key: '0', value: 'any day (earliest possible)'}];
for (var i=1;i<29;i++) opts.push({key: i.toString(), value: m[i] || (i + 'th')});
opts.push({key: '-1', value: 'last day of month'}); |
5d4598b
to
b399f0e
Compare
Hi @artfulrobot I updated and simplified with your suggestion. |
@mattwire thanks I'll try to check it out soon |
Thanks @mattwire and sorry it's taken me so long to review this.
|
Thanks @artfulrobot I've updated based on suggestions. Will respond to comments / check test failures :-) |
@mattwire great. If we can get tests passing I can get this into 1.10.2 |
@mattwire dunno what changed but tests passing for me now. I see:
Fine by me. Only outstanding issue is placement of the date. Do you think the bottom of FYI: I want to release 1.10.2 very soon as I have some people waiting on some of it, be good to include this. Might even make it 1.11.0 instead since this is a new feature ;-) Also, I think I'm going to shift over to lab after this release as all bug issues are now closed. |
@artfulrobot You were right. On Stripe it is where you thought the placement should be - I've just pushed an update that fixes that here too. |
This adds support for specifying a fixed day for the direct debit per #93 in the case of Monthly/Yearly direct debits.
It does not support specifying the month - that could be added in the future.