Skip to content

Instantly share code, notes, and snippets.

@rctay
Created June 6, 2010 08:27
Show Gist options
  • Save rctay/427424 to your computer and use it in GitHub Desktop.
Save rctay/427424 to your computer and use it in GitHub Desktop.
[satchmo] useful scripts
"""
Prints a comme-delimited list of:
- id
- first product of order
- total amount
- buyer's full name
- buyer's phone number
- payment method
Sample usage:
>>> from satchmo_store.shop.models import Order
>>> [print_order_summary(o) for o in Order.objects.get(id__get=5)]
...
"""
from livesettings import config_get_group
def print_order_summary(o):
print ",".join([
str(o.id),
str(o.orderitem_set.all()[0].product),
"$%s" % o.total,
o.contact.full_name,
o.contact.primary_phone.phone,
config_get_group('PAYMENT_%s' % o.payments.latest('time_stamp').payment).LABEL.value
])
import urls
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="abc123",
reason_code="Received"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment