I have a recurring payment mode in the system. All is well, API successful response is logged on the database.
The concern of my question is, I’m about to automate the subsequent payment action (which unfortunately, the payment gateway doesn’t support) of the system.
Via cron I’ll schedule a check on whether which accounts must be included in the subsequent process and notice.
I have here a snip of the database entry:
+---------------------+---------------------+--------------------+
| payment_date | payment_expirydate | transaction_number |
+---------------------+---------------------+--------------------+
| 2012-02-14 03:47:15 | 2012-05-14 03:47:15 | 1-67815163 |
| 2012-02-16 00:53:03 | 2012-05-16 00:53:03 | 1-69010235 |
| 2012-02-16 08:57:16 | 2012-05-16 08:57:16 | 1-69027483 |
| 2012-02-16 09:08:06 | 2012-05-16 09:08:06 | 1-69027694 |
| 2012-02-16 09:58:17 | 2012-05-16 09:58:17 | 1-69028921 |
| 2012-02-17 09:28:32 | 2012-05-17 09:28:32 | 1-69072076 |
| 2012-02-17 06:17:45 | 2012-05-17 06:17:45 | 1-69068200 |
| 2012-02-17 11:12:08 | 2012-05-17 11:12:08 | 1-69074788 |
+---------------------+---------------------+--------------------+
I am having a difficulty in creating the SQL query for this. Assuming, the date today is 2012-05-16 and the time is 07:00:00. I want to get all the accounts which is today and less than the current time. For instance, the only valid account (based on the current date and time I indicated) I need is account 1-69010235.
Also, any tips if on what interval should I set my cron to run?
This query will return all records that expire today –
If you want all accounts expiring today but less than current time –
For codeigniter’s AR implementation you should be able to use –