diff --git a/public_html/classes/logentry.php b/public_html/classes/logentry.php index 9c31b15..68084dd 100644 --- a/public_html/classes/logentry.php +++ b/public_html/classes/logentry.php @@ -43,4 +43,5 @@ class LogEntry extends CPHPDatabaseRecordClass const DONATION_MADE = 4; const UNSUBSCRIPTION = 5; const SUBSCRIPTION_CONFIRMED = 6; + const DONATION_SKIPPED = 7; } diff --git a/public_html/modules/payment/notify_skip.php b/public_html/modules/payment/notify_skip.php new file mode 100644 index 0000000..367310a --- /dev/null +++ b/public_html/modules/payment/notify_skip.php @@ -0,0 +1,29 @@ +uPaid = true; +$sPaymentRequest->InsertIntoDatabase(); + +$sLogEntry = new LogEntry(0); +$sLogEntry->uType = LogEntry::DONATION_SKIPPED; +$sLogEntry->uIp = $_SERVER['REMOTE_ADDR']; +$sLogEntry->uData = json_encode(array("payment_request" => $sPaymentRequest->sId)); +$sLogEntry->uCampaignId = $sPaymentRequest->sCampaign->sId; +$sLogEntry->uDate = time(); +$sLogEntry->uSessionId = session_id(); +$sLogEntry->InsertIntoDatabase(); + +$sPageTitle = "Thanks for letting us know."; +$sPageContents = NewTemplater::Render("payment/skipped", $locale->strings, array()); diff --git a/public_html/rewrite.php b/public_html/rewrite.php index 3918e26..eda9f7f 100644 --- a/public_html/rewrite.php +++ b/public_html/rewrite.php @@ -63,6 +63,11 @@ $router->routes = array( 'authenticator' => "authenticators/payment.php", 'auth_error' => "modules/error/nosuchpayment.php" ), + "^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/skip$" => array( + 'target' => "modules/payment/notify_skip.php", + 'authenticator' => "authenticators/payment.php", + 'auth_error' => "modules/error/nosuchpayment.php" + ), "^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/paypal$" => array( 'target' => "modules/payment/paypal.php", 'authenticator' => "authenticators/payment.php", diff --git a/public_html/templates/payment/skipped.tpl b/public_html/templates/payment/skipped.tpl new file mode 100644 index 0000000..2d1cefd --- /dev/null +++ b/public_html/templates/payment/skipped.tpl @@ -0,0 +1,11 @@ +
+ By telling us when you'd prefer to skip a donation, you help us + improve our statistics. Thanks for your decision to do so. We'll + e-mail you again in a month. +
+ ++ You can close this page now. +