[Handel] credit card processing questions

Christopher H. Laco claco at chrislaco.com
Thu Dec 8 01:59:47 CET 2005


> 3. Where do I add in the actual credit card
> processing?
> 
> 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

Yes, and No. :-)
THere are a predefined set of phases in
http://search.cpan.org/dist/Handel/lib/Handel/Constants.pm

Now, checkout can do process() in two different ways.
First, by default it will just run all the phases in
CHECKOUT_PHASES_DEFAULT:

http://search.cpan.org/dist/Handel/lib/Handel/Constants.pm#CHECKOUT_DEFAULT_PHASES

But, you can also set phases on the checkout instance
($checkout->phases), or set it for the process call. process(\@phases).

Now, I'm pretty sure that any setting of the phases using add_handler in
a plugin will check constraint_checkout_phase

http://search.cpan.org/~claco/Handel/lib/Handel/Constraints.pm#constraint_checkout_phase

to see if what is passed is valid.

Oddly enough, I'mn not checkougn the phase values when tey're set in
->phases or ->process. I'm not sure if that's a bug or a feature :-)

So, all things being equal, it should be possible to declare your own
phases constants, stuff them into @Handel::Constants::CHECKOUT_ALL_PHASES

The bad news is, constraint_checkout_phases checks the phases by name,
not by looping through @CHECKOUT_ALL_PHASES.

I'll fix that for 0.29. :-)

> return value.  If there is an error in the authorising
> of the credit card, how do I pass errors back to the
> main script. 
There are three returns values for plugin handler subs:

CHECKOUT_HANDLER_OK
CHECKOUT_HANDLER_DECLINE
CHECKOUT_HANDLER_ERROR


OK means things are fine..go on to the next handler.
DECLINE means the same as OK for now.
ERROR means bad things happenes, abort $checkout->process()

If you want to add error info to the mix, call $ctx->add_messae within
the plugin. For now, those just get saved off for use via
$checkout->messages



> CHECKOUT_PHASE_AUTHORIZE makes complete
> sense as a name, I'm just wondering how open ended
> your plugin system is.

I think as soon as I fix the constraint_checkout_phase in 0.29, you can
just do what you want.

> 
> 4. I can't seem to get the updated field in the orders
> table to update.  Any ideas?
> I am using the scaffolding that works so well with
> catalyst.  I'm also using MySql as my backend.  I
> thought that field was an auto update.  I set mysql up
> to do that but I guess I set it up incorrectly.  I
> guess I'll just modify some of the code to update that
> field.

I think that could be fixable. I'll look into having that field updated
everytime other fields are updated, with a toggle switch to turn it on/off.

> 
> thanks again for the tool.  This is my 5th commerce
> site and I have been dreading making the shopping cart
> for a while! Here's a little christmas wish list for
> Handel.  Maybe these are there and I just missed them.
> 
> 1. Downloadable Mysql file to set up the database.
> (perl.com has a link the sql-lite version but this
> causes errors when loading the .sql into MySql)

YEah, one of the things I wanted to do is use SQL::Abstract to make
scripts for the various DB flavours.


> 2. A Tutorial on the web that goes furthur than the
> perl.com version.  It does a good job of setting up
> handel but doesn't explain actually whats happening. 
> When i finish this project I'm going to write up a
> small tutorial using Catalyst and Handel that starts
> where the perl.com version left off...as long as I
> figure it out by then.

Yeah, I'm hoping for a second article that covers subclassing, plugins,
and the checkout system.

-=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/20051207/da5b6449/signature.pgp


More information about the Handel mailing list