LLMS_Order::record_transaction( array $data = array() )
Record a transaction for the order
Parameters Parameters
- $data
-
(array) (Optional) array of additional data to store for the transaction.
Default value: array()
Return Return
(LLMS_Transaction) Instance of LLMS_Transaction for the created transaction.
Source Source
File: includes/models/model.llms.order.php
public function record_transaction( $data = array() ) {
extract(
array_merge(
array(
'amount' => 0,
'completed_date' => current_time( 'mysql' ),
'customer_id' => '',
'fee_amount' => 0,
'source_id' => '',
'source_description' => '',
'transaction_id' => '',
'status' => 'llms-txn-succeeded',
'payment_gateway' => $this->get( 'payment_gateway' ),
'payment_type' => 'single',
),
$data
)
);
$txn = new LLMS_Transaction( 'new', $this->get( 'id' ) );
$txn->set( 'api_mode', $this->get( 'gateway_api_mode' ) );
$txn->set( 'amount', $amount );
$txn->set( 'currency', $this->get( 'currency' ) );
$txn->set( 'gateway_completed_date', date_i18n( 'Y-m-d h:i:s', strtotime( $completed_date ) ) );
$txn->set( 'gateway_customer_id', $customer_id );
$txn->set( 'gateway_fee_amount', $fee_amount );
$txn->set( 'gateway_source_id', $source_id );
$txn->set( 'gateway_source_description', $source_description );
$txn->set( 'gateway_transaction_id', $transaction_id );
$txn->set( 'order_id', $this->get( 'id' ) );
$txn->set( 'payment_gateway', $payment_gateway );
$txn->set( 'payment_type', $payment_type );
$txn->set( 'status', $status );
return $txn;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |