Tay Ray Chuan home archive

recording "dumb" payments

Wed, 19 May 2010 13:26:34 +0800 | Filed under record, dumb, payment, satchmo

Alright, so you've got your first "dumb"-paid order! You like to do face-to-face deals, so this guy meets you at the MRT and hands you payment.

Now what?

When an order is paid in full, the order status transits (via signal listeners) and begins a whole host of actions, the most important one (IMO) being the email notification to the buyer. For the usual payment processors, all this is taken care for you.

Not so for our dear "dumb" processor. AFAIK, there isn't a nice way to do this in the django admin site, so we have to write some code to do it (usually in the django shell). Here's a quick-and-dirty shot at it:

import urls # loads listeners; import your own listeners if need be
from decimal import Decimal
from payment.utils import get_processor_by_key
from satchmo_store.shop.models import Order

do_dumb=get_processor_by_key("PAYMENT_DUMB").record_payment

do_dumb(
    order=Order.objects.get(id=13),
    amount=Decimal("12.00"),
    transaction_id="123abc",
    reason_code="Received at Bishan MRT"
)

Yuck. Suggestions welcome.

blog comments powered by Disqus