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

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 60: Line 60:
 
; gatewaynum
 
; gatewaynum
 
:[[Freeside:3:Documentation:Developer/FS/payment gateway|FS::payment_gateway]] id.
 
:[[Freeside:3:Documentation:Developer/FS/payment gateway|FS::payment_gateway]] id.
; paynum -
+
; paynum
 +
:Payment number ([[Freeside:3:Documentation:Developer/FS/cust pay|FS::cust_pay]]) of the completed payment.
 +
; void_paynum
 +
:Payment number of the payment if it's been voided.
 +
; invnum
 +
:Invoice number ([[Freeside:3:Documentation:Developer/FS/cust bill|FS::cust_bill]]) to try to apply this payment to.
 +
; manual
 +
:Flag for whether this is a "manual" payment (i.e. initiated through self-service or the back-office web interface, rather than from an event or a payment batch). "Manual" payments will cause the customer to be sent a payment receipt rather than a statement.
 +
; discount_term
 +
:Number of months the customer tried to prepay for.
 +
 
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 80: Line 90:
  
 
:Currently only used when resolving pending payments manually.
 
:Currently only used when resolving pending payments manually.
 +
; approve OPTIONS
 +
:Sets the status of this pending payment to "done" and creates a completed payment ([[Freeside:3:Documentation:Developer/FS/cust pay|FS::cust_pay]]). This should be called when a realtime or third-party payment has been approved.
 +
 +
:OPTIONS may include any of 'processor', 'payinfo', 'discount_term', 'auth', and 'order_number' to set those fields on the completed payment, as well as 'apply' to apply payments for this customer after inserting the new payment.
 
; decline [ STATUSTEXT ]
 
; decline [ STATUSTEXT ]
 
:Sets the status of this pending payment to "done" (with statustext "declined (manual)" unless otherwise specified).
 
:Sets the status of this pending payment to "done" (with statustext "declined (manual)" unless otherwise specified).

Revision as of 13:33, 27 June 2014

NAME

FS::cust_pay_pending - Object methods for cust_pay_pending records

SYNOPSIS

 use FS::cust_pay_pending;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::cust_pay_pending object represents an pending payment. It reflects local state through the multiple stages of processing a real-time transaction with an external gateway. FS::cust_pay_pending inherits from FS::Record. The following fields are currently supported:

paypendingnum
Primary key
custnum
Customer (see FS::cust_main)
paid
Amount of this payment
_date
Specified as a UNIX timestamp; see "time" in perlfunc. Also see Time::Local and Date::Parse for conversion functions.
payby
Payment Type (See FS::payinfo_Mixin for valid payby values)
payinfo
Payment Information (See FS::payinfo_Mixin for data format)
paymask
Masked payinfo (See FS::payinfo_Mixin for how this works)
paydate
Expiration date
payunique
Unique identifer to prevent duplicate transactions.
pkgnum
Desired pkgnum when using experimental package balances.
status
Pending transaction status, one of the following:
new
Aquires basic lock on payunique
pending
Transaction is pending with the gateway
thirdparty
Customer has been sent to an off-site payment gateway to complete processing
authorized
Only used for two-stage transactions that require a separate capture step
captured
Transaction completed with payment gateway (sucessfully), not yet recorded in the database
declined
Transaction completed with payment gateway (declined), not yet recorded in the database
done
Transaction recorded in database
statustext
Additional status information.
gatewaynum
FS::payment_gateway id.
paynum
Payment number (FS::cust_pay) of the completed payment.
void_paynum
Payment number of the payment if it's been voided.
invnum
Invoice number (FS::cust_bill) to try to apply this payment to.
manual
Flag for whether this is a "manual" payment (i.e. initiated through self-service or the back-office web interface, rather than from an event or a payment batch). "Manual" payments will cause the customer to be sent a payment receipt rather than a statement.
discount_term
Number of months the customer tried to prepay for.

METHODS

new HASHREF
Creates a new pending payment. To add the pending payment 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.
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 pending payment. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
cust_main
Returns the associated FS::cust_main record if any. Otherwise returns false.
insert_cust_pay
Sets the status of this pending pament to "done" (with statustext "captured (manual)"), and inserts a payment record (see FS::cust_pay).
Currently only used when resolving pending payments manually.
approve OPTIONS
Sets the status of this pending payment to "done" and creates a completed payment (FS::cust_pay). This should be called when a realtime or third-party payment has been approved.
OPTIONS may include any of 'processor', 'payinfo', 'discount_term', 'auth', and 'order_number' to set those fields on the completed payment, as well as 'apply' to apply payments for this customer after inserting the new payment.
decline [ STATUSTEXT ]
Sets the status of this pending payment to "done" (with statustext "declined (manual)" unless otherwise specified).
Currently only used when resolving pending payments manually.

BUGS

SEE ALSO

FS::Record, schema.html from the base documentation.