[dw-free] payment system needs to obey payment sysban types
[commit: http://hg.dwscoalition.org/dw-free/rev/bea7fb029067]
http://bugs.dwscoalition.org/show_bug.cgi?id=1156
Make payment pages support the various pay_* sysbans.
Patch by
denise.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1156
Make payment pages support the various pay_* sysbans.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/DW/Shop.pm
- htdocs/shop.bml
- htdocs/shop.bml.text
- htdocs/shop/account.bml
- htdocs/shop/cart.bml
- htdocs/shop/checkout.bml
- htdocs/shop/confirm.bml
- htdocs/shop/creditcard.bml
- htdocs/shop/receipt.bml
-------------------------------------------------------------------------------- diff -r 41c3e657d956 -r bea7fb029067 cgi-bin/DW/Shop.pm --- a/cgi-bin/DW/Shop.pm Sun Jul 26 21:24:27 2009 +0000 +++ b/cgi-bin/DW/Shop.pm Sun Jul 26 23:45:48 2009 +0000 @@ -137,6 +137,25 @@ sub anonymous { } +# returns a text error string if the remote is not allowed to use the +# shop/payment system, undef means they're allowed +sub remote_sysban_check { + + # do sysban checks: + if ( LJ::sysban_check( 'pay_uniq', LJ::UniqCookie->current_uniq ) ) { + return BML::ml( '/shop.bml.paymentblock', { blocktype => "computer", email => $LJ::ACCOUNTS_EMAIL } ); + } elsif ( my $remote = LJ::get_remote() ) { + if ( LJ::sysban_check( 'pay_user', $remote->user ) ) { + return BML::ml( '/shop.bml.paymentblock', { blocktype => "account", email => $LJ::ACCOUNTS_EMAIL } ); + } elsif ( LJ::sysban_check( 'pay_email', $remote->email_raw ) ) { + return BML::ml( '/shop.bml.paymentblock', { blocktype => "email address", email => $LJ::ACCOUNTS_EMAIL } ); + } + } + + # looks good + return undef; +} + ################################################################################ ## LJ::User methods ################################################################################ diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop.bml --- a/htdocs/shop.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop.bml Sun Jul 26 23:45:48 2009 +0000 @@ -31,6 +31,9 @@ body<= $title = BML::ml( '.title', { sitename => $LJ::SITENAMESHORT } ); + my $err = DW::Shop->remote_sysban_check; + return $err if $err; + my $ret; $ret .= DW::Widget::ShopCartStatusBar->render( %GET ); diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop.bml.text --- a/htdocs/shop.bml.text Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop.bml.text Sun Jul 26 23:45:48 2009 +0000 @@ -1,6 +1,8 @@ ;; -*- coding: utf-8 -*- .intro=Welcome to the [[sitename]] shop! If you are interested in supporting [[sitename]] or are just looking for more features for your account, you have come to the right place.</p><p>To purchase something from our shop, build your order and then select your preferred method of payment. If you select PayPal/Credit Card, you'll be forwarded to PayPal, our merchant processor. If you select Check/Money Order, you will be provided instructions on where to send it after you confirm your order. + +.paymentblock=We're sorry, but your [[blocktype]] has been blocked from making payments. For more information about this block, please contact [[email]]. .sideblurb=You can learn about paid accounts <a [[aopts]]>here</a>. diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/account.bml --- a/htdocs/shop/account.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/account.bml Sun Jul 26 23:45:48 2009 +0000 @@ -40,6 +40,9 @@ body<= my $remote = LJ::get_remote(); return $ML{'.error.invalidself'} if $for eq 'self' && ( !$remote || !$remote->is_personal ); + + my $err = DW::Shop->remote_sysban_check; + return $err if $err; my $account_type = DW::Pay::get_account_type( $remote ); return $ML{'.error.invalidself.perm'} diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/cart.bml --- a/htdocs/shop/cart.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/cart.bml Sun Jul 26 23:45:48 2009 +0000 @@ -30,6 +30,9 @@ body<= $title = $ML{'.title'}; + my $err = DW::Shop->remote_sysban_check; + return $err if $err; + my $ret; if ( LJ::did_post() ) { diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/checkout.bml --- a/htdocs/shop/checkout.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/checkout.bml Sun Jul 26 23:45:48 2009 +0000 @@ -30,6 +30,9 @@ body<= LJ::need_res( 'stc/shop.css' ); LJ::set_active_resource_group( 'jquery' ); + my $err = DW::Shop->remote_sysban_check; + return $err if $err; + # get their shop/cart my $cart = DW::Shop->get->cart; return $ML{'.error.nocart'} diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/confirm.bml --- a/htdocs/shop/confirm.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/confirm.bml Sun Jul 26 23:45:48 2009 +0000 @@ -27,6 +27,9 @@ body<= unless LJ::is_enabled( 'payments' ); $title = $ML{'.title'}; + + my $err = DW::Shop->remote_sysban_check; + return $err if $err; my ( $ordernum, $token, $payerid ) = ( $GET{ordernum}, $GET{token}, $GET{PayerID} ); my ( $cart, $eng, $paymentmethod ); diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/creditcard.bml --- a/htdocs/shop/creditcard.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/creditcard.bml Sun Jul 26 23:45:48 2009 +0000 @@ -29,6 +29,9 @@ body<= # this page uses new style JS LJ::need_res( 'stc/shop.css' ); LJ::set_active_resource_group( 'jquery' ); + + my $err = DW::Shop->remote_sysban_check; + return $err if $err; # get their shop/cart my $cart = DW::Shop->get->cart; diff -r 41c3e657d956 -r bea7fb029067 htdocs/shop/receipt.bml --- a/htdocs/shop/receipt.bml Sun Jul 26 21:24:27 2009 +0000 +++ b/htdocs/shop/receipt.bml Sun Jul 26 23:45:48 2009 +0000 @@ -23,6 +23,9 @@ _c?> return BML::redirect( "$LJ::SITEROOT/" ) unless LJ::is_enabled( 'payments' ); + + my $err = DW::Shop->remote_sysban_check; + return $err if $err; my $ordernum = $GET{ordernum}; --------------------------------------------------------------------------------