<?php

/**
 * 腾讯 米大师 支付接入说明
 * 参考链接: https://wiki.midas.qq.com/post/index/1/70/30/0
 */

/**
 *
 * 查询游戏币余额
 *
 * @param object $sdk YSDK Object
 * @param array $params params
 * @param string $account_type "qq" or "wx"
 * @return YSDK_Ret_get_balance_m
 */
function get_balance_m($sdk, $params, $account_type) {
    $method = "get";
    $script_name = '/mpay/get_balance_m';
    return $sdk->api_pay($script_name, $account_type, $params, $method);
}

/**
 * 游戏币扣款
 * @param type $sdk
 * @param type $params
 * @param type $account_type
 * @return YSDK_Ret_pay_m
 */
function pay_m($sdk, $params, $account_type) {
    $method = "post";
    $script_name = '/mpay/pay_m';
    return $sdk->api_pay($script_name, $account_type, $params, $method);
}

/**
 * 撤销扣款
 * @param type $sdk
 * @param type $params
 * @param type $account_type
 * @return YSDK_Ret_cancel_pay_m
 */
function cancel_pay_m($sdk, $params, $account_type) {

    $method = "post";
    $script_name = '/mpay/cancel_pay_m';
    return $sdk->api_pay($script_name, $account_type, $params, $method);
}

/**
 * 赠送游戏币
 * @param type $sdk
 * @param type $params
 * @param type $account_type
 * @return YSDK_Ret_present_m
 */
function present_m($sdk, $params, $account_type) {
    $method = "post";
    $script_name = '/mpay/present_m';
    return $sdk->api_pay($script_name, $account_type, $params, $method);
}

/**
 * 服务端下单接口(后台回调发货)
 * @deprecated since version 0 就用托管游戏币接口好了
 * @param type $sdk
 * @param type $params
 * @param type $account_type
 * @return YSDK_Ret_buy_goods_m
 */
function buy_goods_m($sdk, $params, $account_type) {
    $method = "post";
    $script_name = '/mpay/buy_goods_m';
    return $sdk->api_pay($script_name, $account_type, $params, $method);
}
