[Handel] credit card processing questions

Christopher H. Laco claco at chrislaco.com
Wed Dec 7 16:31:01 CET 2005

charlie Bowman wrote:
> I'm going through my first site using Handel and
> Catalyst and I've got a few questions.  Please bear
> with me through this process.

I still get silly every time someone actually uses my code. :-)

> 1. What field is the credit card info stored?

Good question. I guess I forgot to put those fields in the pod. :-)
The following temporary fields are declared for Handel::Order:

	ccn cctype ccm ccy ccvn ccname

Temporary is the key word here. They act like fields, but they are never
stored in the database [by design]. The values in these fields live only
as long as the order instance they are used within.

Typically, one would load an order, set the credit card info, then call
the $checkout->process() to do order processing. Once that processing is
over and $order is out of scope, those fields are lost.

If you would like something more permanent, you can subclass
Handel::Order and create your own:


> 2. How do I unencrypt this number for later refunds or
> charges.

Don't. :-) If you are dealing with refunds, this needs to be offline in
a business system IMHO, or in permanent records; not in an online ecom
site. If you really need to, subclass Handel::Order, make a custom field
and a sub that does the encryption/decryption.

> 3. Where do I add in my actuall credit card
> processing.  Do I just add it to the Checkout/payment
> function?

You would need to write a new plugin for the phases
CHECKOUT_PHASE_AUTHORIZE, if someone else hasn't already.


This would roughly be:

  package MyPackage::FaxOrder;
  use Handel::Constants qw(:checkout);
  use base 'Handel::Checkout::Plugin';
  use Business::OnlinePayment::SomePaymentProcessor

  sub register {
    my ($self, $ctx) = @_;

    $ctx->add_handler(CHECKOUT_PHASE_AUTHORIZE, \&process_credit_card);

  sub process_credit_card {
    my ($self, $ctx) = @_;

    ...online payment code here...


See the Business::OnlinePayment::* modules on CPAN for starters...

> 4. I can't seem to get the updated field in the orders
> table to update.  Any ideas?

Manually, or after you place an order in the generic scaffold created
for Catalyst?

The updated field doesn't set itself everytime something is updated.
It's a manual field like all the others.

If you're using MySQL, I think the AssignOrderNumber plugin makes some
silly assumptions, like:

    $ctx->order->updated(scalar localtime);

I may just remove that from that plugin, because it doesn't have
anyhting to do with assigning an order number. :-)

> Even though I'm spending alot of time learning these
> two tools.  I've already saved myself several days of
> work!  Thanks in advance for the help.
> Charlie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20051207/b9cd4ce8/smime.bin

More information about the Handel mailing list