recurring_billing parameter
[Business-BatchPayment.git] / BatchPayment / Item.pm
index 8a203ac..c9a09b2 100644 (file)
@@ -31,7 +31,7 @@ Item TO the account identified by the Processor object's login settings."
 
 =cut
 
-enum 'Action' => qw(payment credit);
+enum 'Action' => [qw(payment credit)];
 coerce 'Action', from 'Str', via { lc $_ };
 has action => (
   is  => 'rw',
@@ -49,7 +49,7 @@ and if set on the Processor object, this is not required.
 =cut
 
 # are we okay with these names?
-enum 'PaymentType' => qw( CC ECHECK );
+enum 'PaymentType' => [qw( CC ECHECK )];
 has payment_type => ( is  => 'rw', isa => 'PaymentType' );
 
 =item amount
@@ -142,6 +142,20 @@ batch.
 
 An invoice number, for your use.
 
+=item recurring_billing
+
+A flag indicating whether this is a "recurring" transaction. Different
+processors interpret this differently, but the interface defines three kinds
+of payments:
+
+N: non-recurring; the customer is not expected to make another payment using
+the same card or bank account.
+
+F: first use; the customer has never used this card/account before but is 
+expected to use it again.
+
+S: subsequent; the customer has used the card/account in the past.
+
 =cut
 
 class_type 'DateTime';
@@ -150,6 +164,9 @@ has process_date    => ( is => 'rw', isa => 'DateTime', coerce => 1 );
 
 has invoice_number  => ( is => 'rw', isa => 'Str' );
 
+enum 'Recurring_Flag' => [ 'N', 'F', 'S' ];
+has recurring_billing => ( is => 'rw', isa => 'Recurring_Flag' );
+
 =back
 
 =head2 Bank Transfer / ACH / EFT
@@ -310,6 +327,28 @@ account again.
 The message returned by the gateway.  This may contain a value even 
 if the payment was successful (use C<approved> to determine that.)
 
+=item failure_status
+
+A normalized failure status, from the following list:
+
+=over 4
+
+=item expired
+
+=item nsf (non-sufficient funds / credit limit)
+
+=item stolen
+
+=item pickup
+
+=item blacklisted
+
+=item inactive
+
+=item decline (other card/transaction declines)
+
+=back
+
 =back
 
 =cut
@@ -325,6 +364,17 @@ has [qw(
   assigned_token
 )] => ( is => 'rw', isa => 'Str');
 
+enum FailureStatus => [ qw(
+  expired
+  nsf
+  stolen
+  pickup
+  blacklisted
+  inactive
+  decline
+) ];
+has failure_status  => ( is => 'rw', isa => 'Maybe[FailureStatus]' );
+
 has check_number => ( is => 'rw', isa => 'Int' );
 
 around 'BUILDARGS' => sub {