Пример #1
0
/**
 * Updates an event once a payment is completed.
 *
 * @since	1.3.8
 * @param	arr		$txn_data	Transaction data from gateway.
 * @return	void
 */
function mdjm_update_event_after_payment($txn_data)
{
    $type = mdjm_get_txn_type($txn_data['txn_id']);
    if ($type == mdjm_get_deposit_label()) {
        $meta['_mdjm_event_deposit_status'] = 'Paid';
    } else {
        if ($type == mdjm_get_balance_label()) {
            $meta['_mdjm_event_deposit_status'] = 'Paid';
            $meta['_mdjm_event_balance_status'] = 'Paid';
        } else {
            if (mdjm_get_event_remaining_deposit($txn_data['event_id']) < 1) {
                $meta['_mdjm_event_deposit_status'] = 'Paid';
            }
            if (mdjm_get_event_balance($txn_data['event_id']) < 1) {
                $meta['_mdjm_event_deposit_status'] = 'Paid';
                $meta['_mdjm_event_balance_status'] = 'Paid';
            }
        }
    }
    mdjm_update_event_meta($txn_data['event_id'], $meta);
    // Update the journal
    mdjm_add_journal(array('user_id' => $txn_data['client_id'], 'event_id' => $txn_data['event_id'], 'comment_content' => sprintf(__('%s of %s received via %s', 'mobile-dj-manager'), $type, mdjm_currency_filter(mdjm_format_amount($txn_data['total'])), mdjm_get_gateway_admin_label($txn_data['gateway']))));
}
Пример #2
0
/**
 * Content tag: deposit_remaining.
 * Value of deposit remaining to be paid.
 *
 * @param	int		The event ID.
 * @param
 *
 * @return	str		The remaining amount to be paid towards the deposit.
 */
function mdjm_content_tag_deposit_remaining($event_id = '')
{
    if (empty($event_id)) {
        return;
    }
    return mdjm_currency_filter(mdjm_format_amount(mdjm_get_event_remaining_deposit($event_id)));
}