# Copyright (c) 2000 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: ECPaymentProcessAll.pm,v 2.3 2010/05/10 14:56:22 moeller Exp $ package Bivio::Biz::Action::ECPaymentProcessAll; use strict; use Bivio::Base 'Action.JobBase'; # C sets up a background job to # process all pending credit card payments. The job will process and commit # one payment at a time. our($VERSION) = sprintf('%d.%02d', q$Revision: 2.3 $ =~ /\d+/g); my($_PROCESSOR); Bivio::IO::Config->register({ processor => 'Bivio::Biz::Action::ECCreditCardProcessor', }); sub handle_config { my(undef, $cfg) = @_; $_PROCESSOR = b_use($cfg->{processor}); return; } sub internal_execute { # Go through list of all payments which need to be processed. # For each payment, setup user and realm, then call ECCreditCardProcessor # to handle it. my($self, $req) = @_; b_use('Model.ECPayment')->new($req)->do_iterate(sub { my($ecp) = @_; $ecp->put_on_request; $req->set_user($ecp->get('user_id')); $req->set_realm($ecp->get('realm_id')); $_PROCESSOR->execute_process($req); return 1; }, 'unauth_iterate_start', 'creation_date_time asc', { status => b_use('Type.ECPaymentStatus')->needs_processing_list, }); return 0; } 1;