From 9160ffe22e8afe191e0192fbff8f6a7b2b236f46 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 31 Mar 2015 13:41:58 -0500 Subject: [PATCH] Added processor_id functionality --- BatchPayment.pm | 9 +++++++++ BatchPayment/Batch.pm | 12 ++++++++++++ BatchPayment/Processor.pm | 8 ++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/BatchPayment.pm b/BatchPayment.pm index abc2a83..8f4eaac 100644 --- a/BatchPayment.pm +++ b/BatchPayment.pm @@ -55,6 +55,15 @@ our $VERSION = '0.02_01'; ... process items and record successful/failed payments } + # if your processor uses processor_id... + + $processor->submit(@request); + foreach (@request) { + ... record process_id for that request + } + # later... + my @reply = $processor->receive(@process_ids); + =head1 CLASS METHODS =over 4 diff --git a/BatchPayment/Batch.pm b/BatchPayment/Batch.pm index b05eb80..e5dd22f 100644 --- a/BatchPayment/Batch.pm +++ b/BatchPayment/Batch.pm @@ -37,6 +37,12 @@ If your processor uses C and C, this will be set to 0 by C and incremented every time C is called. Convenient for formats that require record numbers. +=item processor_id + +Processor-specific value to be set by the processor during submit and +passed to receive, useful for processors that require their own identifiers +for download. + =back =head1 METHODS @@ -69,6 +75,12 @@ has batch_id => ( default => '', ); +has processor_id => ( + is => 'rw', + isa => 'Str', + default => '', +); + has items => ( traits => ['Array'], is => 'rw', diff --git a/BatchPayment/Processor.pm b/BatchPayment/Processor.pm index a148c16..3cb88c6 100644 --- a/BatchPayment/Processor.pm +++ b/BatchPayment/Processor.pm @@ -97,14 +97,18 @@ Specifying only 'input' will direct 'output' to /dev/null, and vice versa. =item submit BATCH Send a batch of requests to the gateway. BATCH must be a -L. +L. No defined return value, +but processors may optionally set the 'processor_id' field +on the input batch, which should then be stored and passed +to receive. =item receive Download/otherwise acquire the available confirmed transactions from the gateway, parse them, and return a list of L objects. The items in these batches will have, at minimum, the 'approved' -field and either the 'tid' or 'amount' field set. +field and either the 'tid' or 'amount' field set. Accepts an optional +list of processor_id strings, if required by your processor. =item format_request BATCH -- 2.11.0