本文整理汇总了PHP中Generic::dokuMoneyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::dokuMoneyValue方法的具体用法?PHP Generic::dokuMoneyValue怎么用?PHP Generic::dokuMoneyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generic
的用法示例。
在下文中一共展示了Generic::dokuMoneyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: payViaCreditCard
public static function payViaCreditCard($idOrder, $idUser = "")
{
$restoInitiate = Generic::IsNullOrEmptyString($idUser);
$userInitiate = !$restoInitiate;
$order = new MasterOrderModel();
$order->getByID($idOrder);
//KALO USER INITIATE CEK APA DIA LEADER
if ($userInitiate) {
$user = new UserModel();
$user->getByID($idUser);
if (!Util::isLeader($idOrder, $idUser)) {
Generic::errorMsg(Keys::$ERR_PAYMENT_NOT_LEADER);
}
} else {
$idUser = $order->id_user;
$user = new UserModel();
$user->getByID($idUser);
}
//CEK APA PEMBAYARAN PAKE CREDIT CARD
if ($order->payment_method != Keys::$PAYMENT_TYPE_CREDIT_CARD) {
Generic::errorMsg("This Order Not Using Credit Card as Payment Method");
}
Doku_Initiate::$sharedKey = "iMdRs8Iz987Z";
Doku_Initiate::$mallId = "3199";
$invoice = new Invoice($idOrder, true);
$params = array('amount' => Generic::dokuMoneyValue($invoice->grandTotal), 'invoice' => $idOrder, 'currency' => '360');
$detailOrders = $invoice->orderDetails;
$basket = array();
foreach ($detailOrders as $detailOrder) {
$b = array();
$b['name'] = $detailOrder->name_dish;
$b['amount'] = Generic::dokuMoneyValue($detailOrder->single_price);
$b['quantity'] = $detailOrder->quantity;
$b['subtotal'] = Generic::dokuMoneyValue($detailOrder->price);
$basket[] = $b;
}
$words = Doku_Library::doCreateWords($params);
$customer = array('name' => $user->full_name, 'data_phone' => $user->phone_no, 'data_email' => $user->email, 'data_address' => $user->district . ',' . $user->city);
// $basket[] = array(
// 'name' => 'sayur',
// 'amount' => '10000.00',
// 'quantity' => '1',
// 'subtotal' => '10000.00'
// );
// $basket[] = array(
// 'name' => 'buah',
// 'amount' => '10000.00',
// 'quantity' => '1',
// 'subtotal' => '10000.00'
// );
$dataPayment = array('req_mall_id' => Doku_Initiate::$mallId, 'req_chain_merchant' => 'NA', 'req_amount' => $params['amount'], 'req_words' => $words, 'req_purchase_amount' => $params['amount'], 'req_trans_id_merchant' => $params['invoice'], 'req_request_date_time' => date('YmdHis'), 'req_currency' => '360', 'req_purchase_currency' => '360', 'req_session_id' => sha1(date('YmdHis')), 'req_name' => $customer['name'], 'req_payment_channel' => '15', 'req_email' => $customer['data_email'], 'req_basket' => $basket, 'req_address' => $customer['data_address'], 'req_token_payment' => $user->payment_token, 'req_customer_id' => $idUser);
$response = Doku_Api::doDirectPayment($dataPayment);
if ($response->res_response_code == '0000') {
$status = "SUCCESS";
$order->status_payment = Keys::$PAYMENT_STATUS_PAID;
$order->isPaid = Keys::$YES;
$order->load = 1;
$order->save();
//success
$trans = new MasterRestoTransactionModel();
$trans->id_restaurant = $order->id_restaurant;
$trans->id_request = $order->id_order;
$trans->gross_amount = $invoice->grandTotal;
$trans->type_transaction = "1";
$trans->datetime_transaction = leap_mysqldate();
$trans->approved = "1";
$trans->mr_fee = $invoice->valFeeMR;
//doubleval($order->mr_fee);//((double)($arrOrder[0]->grand_total * $resto->mr_fee)) / 100;
//TODO LATER CHANGE 3 (BANK FEE) INTO GLOBAL VAR
$trans->other_fee = 0;
//((double)($arrOrder[0]->grand_total * $resto->cc_fee)) / 100;
$trans->bank_disc = $invoice->valDiscBank;
//doubleval($order->disc_bank);//$objOrder->disc_bank;
$valNetAmount = doubleval($trans->gross_amount - $trans->mr_fee - $trans->other_fee + $trans->bank_disc);
$trans->net_amount = $valNetAmount;
$trans->save();
//reset user credit to 0
$user = new UserModel();
$user->getByID($idUser);
$user->credit = 0;
$user->save();
} else {
$status = "FAILED";
}
$results['status'] = $status;
$results['res_token_id'] = $user->payment_token;
$results['invoice_no'] = $idOrder;
$results['id_user'] = $idUser;
$results['res_response_code'] = $response->res_response_code;
$results['doku_results'] = $response;
// $results['data_payment'] = $dataPayment;
// pr($results);
if ($status == "SUCCESS") {
return array("success" => 1, $results);
} else {
return array("success" => 0, $results);
}
// Generic::finish($results);
}
示例2: initialCreditCard
public function initialCreditCard()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$res_token_id = Generic::mustCheck($_POST['res_token_id'], "No Token");
$res_pairing_code = Generic::mustCheck($_POST['res_pairing_code'], "No Pairing Code");
$invoice_no = Generic::mustCheck($_POST['invoice_no'], "No Invoice Id");
$device_id = Generic::mustCheck($_POST['device_id'], "No Device ID");
$dataWord = Generic::getOrDefault($_POST['data_word'], "No Data Word");
$dataEmail = Generic::mustCheck($_POST['res_data_email'], "No Data Email");
$dataPhone = Generic::mustCheck($_POST['res_data_mobile_phone'], "No Data Phone");
$dataName = Generic::mustCheck($_POST['res_name'], "No Data Name");
$initialAmount = Generic::getOrDefault(Efiwebsetting::getData('credit_card_initial_amount'), '0');
// $json = Generic::mustCheck($_POST['json'], "Param Required");
// $jResponse = json_decode($json, true);
//
// $res_token_id = $jResponse['res_token_id'];
// $res_pairing_code = $jResponse['res_pairing_code'];
// $invoice_no = $jResponse['invoice_no'];
$idUser = Generic::mustCheck($_POST['id_user'], Keys::$ERR_NOT_FOUND_ID_USER);
$user = new UserModel();
$user->getByID($idUser);
Doku_Initiate::$sharedKey = "iMdRs8Iz987Z";
Doku_Initiate::$mallId = "3199";
$token = $res_token_id;
$pairing_code = $res_pairing_code;
$invoice_no = $invoice_no;
$params = array('amount' => Generic::dokuMoneyValue($initialAmount), 'invoice' => $invoice_no, 'currency' => '360', 'pairing_code' => $pairing_code, 'token' => $token, 'device_id' => $device_id);
$words = Doku_Library::doCreateWords($params);
$basket[] = array('name' => 'initial payment', 'amount' => Generic::dokuMoneyValue($initialAmount), 'quantity' => '1', 'subtotal' => Generic::dokuMoneyValue($initialAmount));
$customer = array('name' => $user->full_name, 'data_phone' => $user->phone_no, 'data_email' => $user->email, 'data_address' => $user->district . ',' . $user->city);
$dataPayment = array('req_mall_id' => Doku_Initiate::$mallId, 'req_chain_merchant' => 'NA', 'req_amount' => Generic::dokuMoneyValue($initialAmount), 'req_words' => $words, 'req_purchase_amount' => Generic::dokuMoneyValue($initialAmount), 'req_trans_id_merchant' => $invoice_no, 'req_request_date_time' => date('YmdHis'), 'req_currency' => '360', 'req_purchase_currency' => '360', 'req_session_id' => sha1(date('YmdHis')), 'req_name' => $customer['name'], 'req_payment_channel' => 15, 'req_basket' => $basket, 'req_email' => $customer['data_email'], 'req_token_id' => $token, 'req_customer_id' => $idUser, 'req_mobile_phone' => $customer['data_phone'], 'req_address' => $user->district . ',' . $user->city);
$result = Doku_Api::doPayment($dataPayment);
if ($result->res_response_code == '0000') {
$status = "SUCCESS";
$result->res_bundle_token = json_decode($result->res_bundle_token, true);
Util::saveUserPaymentDetails($result, $idUser);
//success
} else {
$status = "FAILED";
//failed
}
$results['status'] = $status;
$results['res_token_id'] = $token;
$results['invoice_no'] = $invoice_no;
$results['res_pairing_code'] = $res_pairing_code;
$results['device_id'] = $device_id;
$results['id_user'] = $idUser;
$results['res_response_code'] = $result->res_response_code;
$results['app_word'] = $dataWord;
$results['server_word'] = $words;
$results['word_match'] = $dataWord == $words;
$results['doku_results'] = $result;
$results['data_payment'] = $dataPayment;
$results['my_payment'] = Util::getMyPayment($idUser);
if ($status == "SUCCESS") {
Generic::finish($results);
} else {
Generic::errorReturn("Failed Initiate", 0, $results);
}
}