Send an email to the buyer when the order has been processed.
Patch by fu.
diffs (75 lines):
diff -r 04746652f0fd -r 96da559656f8 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Fri May 28 15:57:36 2010 -0500
+++ b/bin/upgrading/en.dat Wed Jun 02 10:10:45 2010 +0800
@@ -3164,6 +3164,25 @@ The [[sitename]] Team
shop.email.gift.self.subject=[[sitename]] Account Credited
+shop.email.processed.body<<
+Dear [[touser]],
+
+Your purchase from [[sitename]] shop has been processed. Total price was
[[price]]. Items:
+
+[[itemlist]]
+
+You can view your receipt here:
+
+ [[receipturl]]
+
+Thank you for your purchase!
+
+Regards,
+The [[sitename]] Team
+.
+
+shop.email.processed.subject=[[sitename]] Order Processed
+
shop.email.user.anon.body<<
Dear [[touser]],
diff -r 04746652f0fd -r 96da559656f8 cgi-bin/DW/Shop/Cart.pm
--- a/cgi-bin/DW/Shop/Cart.pm Fri May 28 15:57:36 2010 -0500
+++ b/cgi-bin/DW/Shop/Cart.pm Wed Jun 02 10:10:45 2010 +0800
@@ -440,6 +440,8 @@ sub state {
LJ::Hooks::run_hooks( 'shop_cart_state_change', $self, $newstate );
+ $self->_notify_buyer_paid if $newstate == $DW::Shop::STATE_PROCESSED;
+
$self->{state} = $newstate;
$self->save;
@@ -539,5 +541,33 @@ sub _touch {
$_[0]->{starttime} = time;
}
+# let the cart owner know that their purchase has just gone through.
+sub _notify_buyer_paid {
+ my $self = $_[0];
+
+ my $u = LJ::load_userid( $self->{userid} );
+
+ my @payment_methods;
+ push @payment_methods, '$' . $self->total_cash . ' USD'
+ if $self->total_cash;
+ push @payment_methods, $self->total_points . ' points'
+ if $self->total_points;
+
+ my $itemlist = join( "\n", map { " * " . $_->short_desc } @{$self->items}
);
+
+ LJ::send_mail( {
+ to => $self->email,
+ from => $LJ::ACCOUNTS_EMAIL,
+ fromname => $LJ::SITENAME,
+ subject => LJ::Lang::ml( "shop.email.processed.subject", { sitename
=> $LJ::SITENAME } ),
+ body => LJ::Lang::ml( "shop.email.processed.body", {
+ touser => LJ::isu( $u ) ? $u->display_name : $self->email,
+ price => join( ", ", @payment_methods),
+ itemlist => $itemlist,
+ receipturl => "$LJ::SITEROOT/shop/receipt?ordernum=" .
$self->ordernum,
+ sitename => $LJ::SITENAME,
+ } ),
+ } );
+}
1;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog