# Run the hard due date updater
2 3 * * * . ~/.bashrc && $EG_BIN_DIR/update_hard_due_dates.srfsh
+# Run the credit card number clearing script
+#5 4 * * * . ~/.bashrc && $EG_BIN_DIR/clear_cc_number.srfsh
+
# Action/Trigger entries ----
# Runs all pending A/T events every half hour
$(supportscr)/purge_holds.srfsh \
$(supportscr)/purge_circulations.srfsh \
$(supportscr)/purge_pending_users.srfsh \
+ $(supportscr)/clear_cc_number.srfsh \
$(supportscr)/sitemap_generator \
$(srcdir)/extras/eg_config \
$(srcdir)/extras/openurl_map.pl \
sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/long-overdue-status-update.pl'
sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/thaw_expired_frozen_holds.srfsh'
+ sed -i 's|BINDIR|@bindir@|g' '$(DESTDIR)@bindir@/clear_cc_number.srfsh'
sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@bindir@/oils_ctl.sh'
sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@bindir@/oils_ctl.sh'
);
+sub clear_cc_number {
+ my $self = shift;
+ my $client = shift;
+ my $payment_age = shift;
+
+ # using NOW() in the AGE() calculation lets us modify payments
+ # that occurred today without having to specify negative ages.
+
+ my $sql = <<" SQL";
+ UPDATE money.credit_card_payment
+ SET cc_number = NULL
+ WHERE AGE(NOW(), payment_ts) > ?::INTERVAL;
+ SQL
+
+ my $sth = actor::user->db_Main->prepare_cached($sql);
+ $sth->execute($payment_age);
+
+ return $sth->rows;
+}
+
+__PACKAGE__->register_method(
+ api_name => 'open-ils.storage.money.clear_cc_number',
+ method => 'clear_cc_number',
+ api_level => 1,
+ signature => q/
+ Credit card payments store the last 4 digits of the card
+ number. This API call set the credit card number field
+ to NULL to remove this data after the payment has
+ reached the specified age.
+ @param payment_age The age as a string.
+ /
+);
+
+
1;
--- /dev/null
+#!BINDIR/srfsh
+request open-ils.storage open-ils.storage.money.clear_cc_number "1 year"