Committer: gproschaev
LJSUP-4585U branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm U branches/shop/cgi-bin/LJ/Pay/RecBill.pm U branches/shop/htdocs/invite/claim.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm =================================================================== --- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm 2009-08-03 07:11:24 UTC (rev 7529) +++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm 2009-08-03 09:09:24 UTC (rev 7530) @@ -11,8 +11,8 @@ my $self = shift; my $token = $self->{token}; - my $amt = $self->{amt}; - my $type = $self->{type}; + my $amt = $self->{amt}; + my $type = $self->{type}; my $inttxt; if ($type eq 'int') { @@ -46,16 +46,17 @@ } sub send_coupon_email { - my ($u, $token, $amt, $type) = @_; + my $self = shift; + my $u = shift; + + my $token = $self->{token}; + my $amt = $self->{amt}; + return undef unless $u && $token && defined $amt; my $email = ref $u ? $u->email_raw : $u; return undef unless $email; - my $coupon = LJ::Pay::Payment::PayItem->new_memonly( item => 'coupon' ); - $coupon->{token} = $token; - $coupon->{amt} = $amt; - $coupon->{type} = $type; - my ($subject, $body) = $coupon->make_coupon_email(); + my ($subject, $body) = $self->make_coupon_email(); LJ::send_mail({ 'to' => $email, Modified: branches/shop/cgi-bin/LJ/Pay/RecBill.pm =================================================================== --- branches/shop/cgi-bin/LJ/Pay/RecBill.pm 2009-08-03 07:11:24 UTC (rev 7529) +++ branches/shop/cgi-bin/LJ/Pay/RecBill.pm 2009-08-03 09:09:24 UTC (rev 7530) @@ -36,6 +36,7 @@ use LJ::Pay::RecBill::Card; use LJ::Pay::RecBill::PendTime; use LJ::Pay::RecBill::Log; + use LJ::Pay::Payment::PayItem; use Data::Dumper; # will remove after initial launch @@ -1645,7 +1646,7 @@ my $exptime = $now; # find base price for this item at the current bill interval - my $item_obj = LJ::Pay::Payment::Payitem->new_onlymem( + my $item_obj = LJ::Pay::Payment::PayItem->new_memonly( item => $item, ); $price = $item_obj->get_item_base_price($bill_interval, $size); @@ -1785,7 +1786,7 @@ # find the base price for this item and the given # interval (recurring) - my $item = LJ::Pay::Payment::Payitem->new_onlymem( + my $item = LJ::Pay::Payment::PayItem->new_memonly( item => $it->{name}, ); my $base_price = $item->get_item_base_price @@ -2101,7 +2102,7 @@ my $size = $items{$item}->{size}; - my $item_obj = LJ::Pay::Payment::Payitem->new_onlymem( + my $item_obj = LJ::Pay::Payment::PayItem->new_memonly( item => $item, ); $full_price += $item_obj->get_item_base_price @@ -2129,7 +2130,7 @@ foreach my $it ($self->get_items) { next unless $it->get_recflag eq 'on'; - my $item_obj = LJ::Pay::Payment::Payitem->new_onlymem( + my $item_obj = LJ::Pay::Payment::PayItem->new_memonly( item => $it->{name}, ); $full_price += $item_obj->get_item_base_price Modified: branches/shop/htdocs/invite/claim.bml =================================================================== --- branches/shop/htdocs/invite/claim.bml 2009-08-03 07:11:24 UTC (rev 7529) +++ branches/shop/htdocs/invite/claim.bml 2009-08-03 09:09:24 UTC (rev 7530) @@ -104,8 +104,15 @@ unless $tokenid && $token; # send the coupon to the user in an email - LJ::Pay::send_coupon_email($u, $token, $amt, "int"); + my $coupon = LJ::Pay::Payment::PayItem->new_memonly( + item => 'coupon', + token => $token, + amt => $amt, + ); + $coupon->{type} = "int"; + $self->send_coupon_email($u); + # log to statushistory LJ::statushistory_add($u->{'userid'}, $remote->{'userid'}, "invitecp", "generated " . $damt->($amt) . " intangible coupon ($token) for " .