Difference between revisions of "Freeside:3:Documentation:Developer/FS/cust pay batch"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
 
(6 intermediate revisions by the same user not shown)
Line 22: Line 22:
 
An FS::cust_pay_batch object represents a credit card transaction ready to be batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. Typically called by the collect method of an FS::cust_main object. The following fields are currently supported:
 
An FS::cust_pay_batch object represents a credit card transaction ready to be batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. Typically called by the collect method of an FS::cust_main object. The following fields are currently supported:
  
; paybatchnum - primary key (automatically assigned); batchnum - indentifies group in batch; payby - CARD/CHEK/LECB/BILL/COMP; payinfo; exp - card expiration; amount; invnum - invoice; custnum - customer; payname - name on card; first - name; last - name; address1; address2; city; state; zip; country; status
+
; paybatchnum - primary key (automatically assigned); batchnum - indentifies group in batch; payby - CARD/CHEK/LECB/BILL/COMP; payinfo; exp - card expiration; amount; invnum - invoice; custnum - customer; payname - name on card; first - name; last - name; address1; address2; city; state; zip; country; status - 'Approved' or 'Declined'; error_message - the error returned by the gateway if any
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 38: Line 38:
 
; cust_main
 
; cust_main
 
:Returns the customer (see [[Freeside:3:Documentation:Developer/FS/cust main|FS::cust_main]]) for this batched credit card payment.
 
:Returns the customer (see [[Freeside:3:Documentation:Developer/FS/cust main|FS::cust_main]]) for this batched credit card payment.
; approve PAYBATCH
+
; expmmyy
 +
:Returns the credit card expiration date in MMYY format. If this is a CHEK payment, returns an empty string.
 +
; pay_batch
 +
:Returns the payment batch this payment belongs to ([[Freeside:3:Documentation:Developer/FS/pay batch).|FS::pay_batch).]]
 +
; approve OPTIONS
 
:Approve this payment. This will replace the existing record with the same paybatchnum, set its status to 'Approved', and generate a payment record ([[Freeside:3:Documentation:Developer/FS/cust pay|FS::cust_pay]]). This should only be called from the batch import process.
 
:Approve this payment. This will replace the existing record with the same paybatchnum, set its status to 'Approved', and generate a payment record ([[Freeside:3:Documentation:Developer/FS/cust pay|FS::cust_pay]]). This should only be called from the batch import process.
 +
 +
:OPTIONS may contain "gatewaynum", "processor", "auth", and "order_number".
 
; decline [ REASON ]
 
; decline [ REASON ]
 
:Decline this payment. This will replace the existing record with the same paybatchnum, set its status to 'Declined', and run collection events as appropriate. This should only be called from the batch import process.
 
:Decline this payment. This will replace the existing record with the same paybatchnum, set its status to 'Declined', and run collection events as appropriate. This should only be called from the batch import process.
  
 
:REASON is a string description of the decline reason, defaulting to 'Returned payment'.
 
:REASON is a string description of the decline reason, defaulting to 'Returned payment'.
 +
; request_item [ OPTIONS ]
 +
:Returns a [[Freeside:3:Documentation:Developer/Business/BatchPayment/Item|Business::BatchPayment::Item]] object for this batch payment entry. This can be submitted to a processor.
 +
 +
:OPTIONS can be a list of key/values to append to the attributes. The most useful case of this is "process_date" to set a processing date based on the date the batch is being submitted.
 +
; process_unbatch_and_delete
 +
:[[#unbatch_and_delete|"unbatch_and_delete"]] run as a queued job, accepts ''$job'' and ''$param''.
 +
; unbatch_and_delete
 +
:May only be called on a record with an empty status and an associated [[pay_batch]] with a status of 'O' (not yet in transit.) Deletes all associated records from [[Freeside:3:Documentation:Developer/cust bill pay batch|cust_bill_pay_batch]] and then deletes this record. If there is an error, returns the error, otherwise returns false.
  
 
==BUGS==
 
==BUGS==
Line 50: Line 64:
 
==SEE ALSO==
 
==SEE ALSO==
 
[[Freeside:3:Documentation:Developer/FS/cust main|FS::cust_main]], [[Freeside:3:Documentation:Developer/FS/Record|FS::Record]]
 
[[Freeside:3:Documentation:Developer/FS/cust main|FS::cust_main]], [[Freeside:3:Documentation:Developer/FS/Record|FS::Record]]
 +
 +
==POD ERRORS==
 +
Hey! '''The above document had some coding errors, which are explained below:'''
 +
 +
; Around line 239:
 +
:Unterminated L<...> sequence

Latest revision as of 06:17, 28 September 2015

NAME

FS::cust_pay_batch - Object methods for batch cards

SYNOPSIS

 use FS::cust_pay_batch;

 $record = new FS::cust_pay_batch \%hash;
 $record = new FS::cust_pay_batch { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

 #deprecated# $error = $record->retriable;

DESCRIPTION

An FS::cust_pay_batch object represents a credit card transaction ready to be batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. Typically called by the collect method of an FS::cust_main object. The following fields are currently supported:

paybatchnum - primary key (automatically assigned); batchnum - indentifies group in batch; payby - CARD/CHEK/LECB/BILL/COMP; payinfo; exp - card expiration; amount; invnum - invoice; custnum - customer; payname - name on card; first - name; last - name; address1; address2; city; state; zip; country; status - 'Approved' or 'Declined'; error_message - the error returned by the gateway if any

METHODS

new HASHREF
Creates a new record. To add the record to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database. If there is an error, returns the error, otherwise returns false.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid transaction. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
cust_main
Returns the customer (see FS::cust_main) for this batched credit card payment.
expmmyy
Returns the credit card expiration date in MMYY format. If this is a CHEK payment, returns an empty string.
pay_batch
Returns the payment batch this payment belongs to (FS::pay_batch).
approve OPTIONS
Approve this payment. This will replace the existing record with the same paybatchnum, set its status to 'Approved', and generate a payment record (FS::cust_pay). This should only be called from the batch import process.
OPTIONS may contain "gatewaynum", "processor", "auth", and "order_number".
decline [ REASON ]
Decline this payment. This will replace the existing record with the same paybatchnum, set its status to 'Declined', and run collection events as appropriate. This should only be called from the batch import process.
REASON is a string description of the decline reason, defaulting to 'Returned payment'.
request_item [ OPTIONS ]
Returns a Business::BatchPayment::Item object for this batch payment entry. This can be submitted to a processor.
OPTIONS can be a list of key/values to append to the attributes. The most useful case of this is "process_date" to set a processing date based on the date the batch is being submitted.
process_unbatch_and_delete
"unbatch_and_delete" run as a queued job, accepts $job and $param.
unbatch_and_delete
May only be called on a record with an empty status and an associated pay_batch with a status of 'O' (not yet in transit.) Deletes all associated records from cust_bill_pay_batch and then deletes this record. If there is an error, returns the error, otherwise returns false.

BUGS

There should probably be a configuration file with a list of allowed credit card types.

SEE ALSO

FS::cust_main, FS::Record

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 239:
Unterminated L<...> sequence