/** * return class $instance */ public static function get_instance() { if (self::$instance == null) { self::$instance = new AE_PPAdaptive(); } return self::$instance; }
/** * finish project, send money when freelancer review project * @param int $project_id * @since 1.3 * @author Dakachi */ function fre_finish_escrow($project_id) { if (ae_get_option('use_escrow')) { $bid_id_accepted = get_post_meta($project_id, 'accepted', true); if (!ae_get_option('manual_transfer')) { // cho nay co the dung action // execute payment and send money to freelancer $pay_key = get_post_meta($bid_id_accepted, 'fre_paykey', true); if ($pay_key) { $ppadaptive = AE_PPAdaptive::get_instance(); $response = $ppadaptive->executePayment($pay_key); if (strtoupper($response->responseEnvelope->ack) == 'SUCCESS') { // success update order data $order = get_post_meta($bid_id_accepted, 'fre_bid_order', true); if ($order) { wp_update_post(array('ID' => $order, 'post_status' => 'finish')); $mail = Fre_Mailing::get_instance(); $mail->alert_transfer_money($project_id, $bid_id_accepted); } } } } else { $mail = Fre_Mailing::get_instance(); $mail->alert_transfer_money($project_id, $bid_id_accepted); } } }