本文整理汇总了PHP中EE_Transaction::finalize方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::finalize方法的具体用法?PHP EE_Transaction::finalize怎么用?PHP EE_Transaction::finalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::finalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process_finalize_registration
/**
* _process_finalize_registration
*
* @access private
* @return void
*/
private function _process_finalize_registration()
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
// save everything
if ($this->_continue_reg && $this->_save_all_registration_information()) {
// echo '<h2 style="color:#E76700;">_process_finalize_registration<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// save TXN data to the cart
$this->_cart->get_grand_total()->save_this_and_descendants_to_txn($this->_transaction->ID());
do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->_transaction);
// if Default REG Status is set to REQUIRES APPROVAL... then payments are NOT allowed
if (EE_Registry::instance()->REQ->is_set('selected_gateway') && EE_Registry::instance()->REQ->get('selected_gateway') == 'payments_closed') {
// echo '<h2 style="color:#E76700;">payments_closed<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// set TXN Status to Open
$this->_transaction->set_status(EEM_Transaction::incomplete_status_code);
$this->_transaction->save();
$this->_transaction->finalize();
$notices = EE_Error::get_notices(FALSE);
$response = array('msg' => array('success' => isset($notices['success']) ? $notices['success'] : '', 'errors' => isset($notices['errors']) ? $notices['errors'] : ''));
$this->_thank_you_page_url = add_query_arg(array('e_reg_url_link' => $this->_transaction->primary_registration()->reg_url_link()), get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
// Default REG Status is set to PENDING PAYMENT OR APPROVED, and payments are allowed
} else {
// attempt to perform transaction via payment gateway
$response = EE_Registry::instance()->load_model('Gateways')->process_payment_start($this->_cart->get_grand_total(), $this->_transaction);
$this->_thank_you_page_url = $response['forward_url'];
}
if (isset($response['msg']['success'])) {
$response_data = array('success' => $response['msg']['success'], 'return_data' => array('redirect-to-thank-you-page' => $this->_thank_you_page_url));
$response_data = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $response_data);
// printr( $response_data, '$response_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// echo '<h4>thank_you_page_url : ' . $this->_thank_you_page_url . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
if (EE_Registry::instance()->REQ->front_ajax) {
echo json_encode($response_data);
die;
} else {
wp_safe_redirect($this->_thank_you_page_url);
exit;
}
} else {
EE_Error::add_error($response['msg']['error'], __FILE__, __FUNCTION__, __LINE__);
}
// printr( $response, '$response <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
}
$this->go_to_next_step(__FUNCTION__);
}
示例2: _process_registration_status_change
/**
* This processes requested registration status changes for all the registrations on a given transaction and (optionally) sends out notifications for the changes.
* @param EE_Transaction $transaction transaction object
* @return void
*/
protected function _process_registration_status_change($transaction)
{
//first if there is no change in status then we get out.
if (!isset($this->_req_data['txn_reg_status_change'])) {
return false;
}
//no error message, just nothing to do man.
if ($this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN') {
return;
}
//no error message, no change requested.
//made it here dude? Oh WOW. K, let's take care of changing the statuses then //note notifications will only get sent if the email notification is toggled.
$transaction->finalize(true, FALSE);
}