fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-01-04 02:30 am

[dw-nonfree] generate 'warning' email when check/money order order is checked out

[commit: http://hg.dwscoalition.org/dw-nonfree/rev/1d40ccd5736e]

http://bugs.dwscoalition.org/show_bug.cgi?id=3357

Send an email to site administrators, when someone makes a money order.

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/en_DW.dat
  • cgi-bin/DW/Hooks/MailboxAlert.pm
--------------------------------------------------------------------------------
diff -r 293289331a83 -r 1d40ccd5736e bin/upgrading/en_DW.dat
--- a/bin/upgrading/en_DW.dat	Thu Dec 30 12:23:07 2010 +0800
+++ b/bin/upgrading/en_DW.dat	Tue Jan 04 10:29:43 2011 +0800
@@ -22,6 +22,10 @@ invitecodes.userclass.premium_paid=Premi
 
 langname.en_DW=English
 
+shop.admin.checkmoneyorder.body=[[user]] just sent a check/money order. Receipt is at: [[receipturl]]
+
+shop.admin.checkmoneyorder.subject=New Check/Money Order Pending
+
 shop.anniversarypromoblurb=Dreamwidth is currently offering an Anniversary Promotion -- we're giving you 10% more points on all of your orders!
 
 shop.annivpromo.points=This order will earn you <strong>[[points]] Dreamwidth [[?points|Point|Points]]</strong> to spend on your next order as part of our Anniversary Promotion.
diff -r 293289331a83 -r 1d40ccd5736e cgi-bin/DW/Hooks/MailboxAlert.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Hooks/MailboxAlert.pm	Tue Jan 04 10:29:43 2011 +0800
@@ -0,0 +1,36 @@
+# Alert site administrators when someone makes a money order
+#
+# Authors:
+#     Afuna <coder.dw@afunamatata.com>
+#
+# Copyright (c) 2011 by Dreamwidth Studios, LLC.
+#
+# This program is NOT free software or open-source; you can use it as an
+# example of how to implement your own site-specific extensions to the
+# Dreamwidth Studios open-source code, but you cannot use it on your site
+# or redistribute it, with or without modifications.
+#
+
+package DW::Hooks::MailboxAlert;
+
+use strict;
+use LJ::Hooks;
+
+LJ::Hooks::register_hook( 'check_money_order_pending', sub {
+    my ( $cart, $u ) = @_;
+
+    LJ::send_mail( {
+        to => $LJ::ACCOUNTS_EMAIL,
+        from => $LJ::BOGUS_EMAIL,
+        fromname => $LJ::SITENAME,
+        subject => LJ::Lang::ml( 'shop.admin.checkmoneyorder.subject', { sitename => $LJ::SITENAME } ),
+        body => LJ::Lang::ml( 'shop.admin.checkmoneyorder.body', {
+            user => LJ::isu( $u ) ? $u->display_name : $cart->email,
+            receipturl => "$LJ::SITEROOT/shop/receipt?ordernum=" . $cart->ordernum,
+        } ),
+    } );
+
+} );
+
+
+1;
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org