function _wpsc_action_update_purchase_log_status($id, $status, $old_status, $purchase_log)
{
    if ($purchase_log->is_order_received() || $purchase_log->is_accepted_payment()) {
        wpsc_send_customer_email($purchase_log);
        wpsc_send_admin_email($purchase_log);
    }
    if (!$purchase_log->is_transaction_completed()) {
        return;
    }
    $already_processed = in_array($old_status, array(WPSC_Purchase_Log::ACCEPTED_PAYMENT, WPSC_Purchase_Log::JOB_DISPATCHED, WPSC_Purchase_Log::CLOSED_ORDER));
    if ($already_processed) {
        return;
    }
    _wpsc_process_transaction_coupon($purchase_log);
    wpsc_decrement_claimed_stock($id);
}
Ejemplo n.º 2
0
/**
 * Routine that runs when updating a purchase log's status, used to update status of coupon's used.
 *
 * @since  4.0
 *
 * @param  int               $id             Purchase Log ID.
 * @param  int               $status         Current status.
 * @param  int               $old_status     Previous status.
 * @param  WPSC_Purchase_Log $purchase_log   Purchase Log Object.
 *
 * @return void
 */
function _wpsc_update_purchase_log_coupon_status($id, $status, $old_status, $purchase_log)
{
    if (!$purchase_log->is_transaction_completed()) {
        return;
    }
    $already_processed = in_array($old_status, array(WPSC_Purchase_Log::ACCEPTED_PAYMENT, WPSC_Purchase_Log::JOB_DISPATCHED, WPSC_Purchase_Log::CLOSED_ORDER));
    if ($already_processed) {
        return;
    }
    _wpsc_process_transaction_coupon($purchase_log);
}
function _wpsc_action_update_purchase_log_status($id, $status, $old_status, $purchase_log)
{
    wpsc_send_customer_email($purchase_log);
    wpsc_send_admin_email($purchase_log);
    if (!$purchase_log->is_transaction_completed()) {
        return;
    }
    _wpsc_process_transaction_coupon($purchase_log);
    wpsc_decrement_claimed_stock($id);
}