Example #1
0
<?php

//error_reporting(0);
include 'config.php';
include 'lib/UnitPayModel.php';
include 'lib/UnitPay.php';
class UnitPayEvent
{
    public function check($params)
    {
        $unitPayModel = UnitPayModel::getInstance();
        if ($unitPayModel->getAccountByName($params['account'])) {
            return true;
        }
        return 'Character not found';
    }
    public function pay($params)
    {
        $unitPayModel = UnitPayModel::getInstance();
        $countItems = floor($params['sum'] / Config::ITEM_PRICE);
        $unitPayModel->donateForAccount($params['account'], $countItems);
    }
}
$payment = new UnitPay(new UnitPayEvent());
echo $payment->getResult();
Example #2
0
        $orderSum = $params['orderSum'];
        $date = $params['date'];
        $paymentType = $params['paymentType'];
        $orderCurrency = $params['orderCurrency'];
        // $errorMessage = $params['errorMessage'];
        $unitPay = new ParseObject("UnitPay");
        $unitPay->set('sum', $sum);
        $unitPay->set('profit', $profit);
        $unitPay->set('unitpayId', $unitpayId);
        $unitPay->set('account', $account);
        $unitPay->set('paymentType', $paymentType);
        $unitPay->set('orderSum', $orderSum);
        $unitPay->set('date', $date);
        $unitPay->set('paymentType', $paymentType);
        $unitPay->set('orderCurrency', $orderCurrency);
        // $unitPay->set('errorMessage', $errorMessage);
        try {
            $unitPay->save();
            // $parseId = $unitPay->getObjectId();
            return $this->getResponseSuccess('PAY is successful');
        } catch (ParseException $ex) {
            return $this->getResponseError('pay error');
        }
    }
}
$unitPay = new UnitPay();
echo $unitPay->getResult($_GET);
// CHECK
// account date operator orderCurrency orderSum paymentType phone profit projectId sign sum unitpayId
// PAY
// account date operator orderCurrency orderSum paymentType phone profit projectId sign sum unitpayId