When I need to tell my accounting system when payment for an order is received - the ways dankort (danish creditcards) and VISA etc. (foreign) work are so very different so that I need to know which card type was used.

Dankort is put into my account with ~1 days delay - and with 1 transaction pr. payment - with no deductions. (I'm seperately charged for fees).
VISA etc. is delayed for ~30 days, and all transactions within a certain timeframe (which I don't know exactly) is accumulated into 1 transaction - where fees are deducted first. (I'm seperately informed of which actual transactions the payment actually consisted off).

I was hoping that this information could be stored by uc_quickpay? or perhaps Quickpay's API allows for the retrieval of this information - so that it could be saved with the order (a simple table of order_id and credit card name/type or whatever way quickpay identifies them) would be of great help.

CommentFileSizeAuthor
#5 856520.patch2.14 KBxen

Comments

xen’s picture

Well, it would be fairly straitforward to note the cardtype on the log on the payment tab of orders. However, while that makes it visible on the individual order, it would make it difficult to search as uc serializes the extra information. How do you need it?

klavs’s picture

in an easy way, so that I can match on the different types - and add an invoice to accounting based on the cardtype.

Perhaps the same way as uc_po does it - it adds an extra field (po_number) to the payment_details array - available in the order object.

xen’s picture

Well, if i store it on the payment, it would be available with something like:

$payment = _uc_quickpay_get_last_transaction($order_id);
$payment->cardtype == 'dankort';

There's really no reason to stick the payment on the order object, but I should probably implement a non-module-private function to get it. However, an order might have more than one payment associated, complicating things.

klavs’s picture

I guess you mean $payment->cardtype would be equal to f.ex. 'dankort', 'VISA electron' etc. so one could compare on that.

That would do perfectly well - my accounting script bootstraps drupal anyways - so I have the functions I need - but putting the functions that could just as well be used from "outside" apache - in an .inc file - would def. be a good way to go.

xen’s picture

StatusFileSize
new2.14 KB

See if the attached patch doesn't do it for you.

The cardtype should be in $payment->qp_cardtype.

> .inc file- would def. be a good way to go.

Well, uc_order_load would have to bootstrap Drupal anyway, so it's not likely.

klavs’s picture

Works like a charm :)

Thank you very much.

Now I just need to figure out how to add the qp_cardtype variable to the existing orders - so I can write my script, expecting this information :)

I guess I'll write a script that loops through the existing orders, and adds the new array to each.. does the quickpay API support getting this info from quickpay?

xen’s picture

Status: Active » Fixed

> Works like a charm :)

Good, it'll go into the next version then.

Carefully check when upgrading to a new version in the future. _uc_quickpay_get_last_transaction is technically a module private function, and as such there's no guarantees that it'll stick around. But until I figure out a proper API, it'll have to do.

> I guess I'll write a script that loops through the existing orders, and adds the new array to each.. does the quickpay API support getting this info from quickpay?

The status command does: http://doc.quickpay.dk/api/messagetypes.html#index8h2
As there isn't a payment_save function in UC, you'll have to serialize the data an update the table in your script.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.