[Handel] credit card processing questions
    Christopher H. Laco 
    claco at chrislaco.com
       
    Thu Dec  8 06:11:06 CET 2005
    
    
  
Christopher H. Laco wrote:
>>Now I'm beginnin to understand your idea of a plugable
>>system....and I like it!  I do have one question.  Do
>>I have to make the plugin/sub function 
>>CHECKOUT_PHASE_AUTHORIZE or is that an arbitrary name
>>that you chose.  I have the same question about the
> 
> 
> 
> I just reread that. The register sub is required...the handler it calls
> can be anything. CHECKOUT_PHASE_AUTHORIZE just talls the checkout
> process what phase it should call your handler sub.
> 
>   sub register {
>     my ($self, $ctx) = @_;
> 
>     $ctx->add_handler(CHECKOUT_PHASE_AUTHORIZE, \&anyoldcrap);
>   };
> 
>    sub anyoldcrap {};
> 
> -=Chris
For the brave, I've added the start of custom phase constant code to
trunk @ http://handelframework.com/svn/CPAN/Handel/trunk
In short, it's:
use Handel::Checkout;
Handel::Checkout->add_phase('CHECKOUT_PHASE_CUSTOMPHASENAME', 37, 1);
# add_phase($name, $value [, $import])
print &CHECKOUT_PHASE_CUSTOMPHASENAME;
print Handel::Constants::CHECKOUT_PHASE_CUSTOMPHASENAME;
# plugin code
use constant CHECKOUT_PHASE_CUSTOMPHASENAME => 37;
sub register {
	$ctx->add_handler(CHECKOUT_PHASE_CUSTOMPHASENAME, &myhandler);
};
There are of course, a few caveats. Since all of this happens well after
import() and Exporter magic, you're on your own in terms of whether the
constant/subname is actually available. You can always use the long version:
add_handler(
  Handel::Constants::CHECKOUT_PHASE_CUSTOMPHASENAME, &myhandler
);
-=CHris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20051208/f53c5625/signature.pgp
    
    
More information about the Handel
mailing list