public static function getMyPayment($idUser) { $allowCash = Efiwebsetting::getData('App_Allow_Cash') == 'yes'; $allowDokuWallet = Efiwebsetting::getData('App_Allow_Doku_Wallet') == 'yes'; $allowCreditCard = Efiwebsetting::getData('App_Allow_Credit_Card') == 'yes'; $user = new UserModel(); $user->getByID($idUser); if (Generic::IsNullOrEmptyString($user->id_user)) { Generic::errorMsg(Keys::$ERR_NOT_FOUND_USER); } $results['allow_cash'] = $allowCash; $results['allow_doku_wallet'] = $allowDokuWallet; $results['allow_credit_card'] = $allowCreditCard; if (Generic::IsNullOrEmptyString($user->payment_type)) { $user->payment_type = Keys::$PAYMENT_TYPE_CASH; $user->save(); } $results['user'] = Util::extractModel($user, Helper::$columnReturnLogin); $results['payment_type'] = $user->payment_type; $results['has_doku_wallet'] = !Generic::IsNullOrEmptyString($user->payment_id); $results['has_credit_card'] = !Generic::IsNullOrEmptyString($user->payment_token); $results['doku_wallet']['balance'] = Keys::$EMPTY; $results['doku_wallet']['doku_id'] = Keys::$EMPTY; $results['credit_card']['payment_token'] = Keys::$EMPTY; // $results['credit_card']['payment_id'] = Keys::$EMPTY; $results['credit_card']['payment_bank'] = Keys::$EMPTY; $results['credit_card']['payment_mcn'] = Keys::$EMPTY; if ($allowDokuWallet) { $doku = new PaymentDoku(); $results['doku_wallet']['status_init'] = $doku->STATUS_INIT; $results['doku_wallet']['doku_error'] = $doku->DOKU_ERROR; if ($doku->DOKU_ERROR) { $results['has_doku_wallet'] = false; } $results['doku_wallet']['balance'] = $doku->checkBalance($user->payment_id); $results['doku_wallet']['doku_id'] = $user->payment_id; } if ($allowCreditCard) { $results['credit_card']['payment_token'] = Generic::IsNullOrEmptyString($user->payment_token) ? "" : $user->payment_token; // $results['credit_card']['payment_id'] = (Generic::IsNullOrEmptyString($user->payment_id)) ? "" : $user->payment_id; $results['credit_card']['payment_bank'] = Generic::IsNullOrEmptyString($user->payment_bank) ? "" : $user->payment_bank; $results['credit_card']['payment_mcn'] = Generic::IsNullOrEmptyString($user->payment_mcn) ? "" : $user->payment_mcn; $results['credit_card']['payment_bank_pic'] = Generic::insertImageUrl(Keys::$EMPTY); } return $results; }
public function getUserDWBalance() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } if (Generic::IsNullOrEmptyString($_GET['id_user'])) { $results['balance'] = doubleval(0); Generic::finish($results); } $idUser = addslashes($_GET['id_user']); $user = new UserModel(); $user->getByID($idUser); $results["pic"] = Generic::insertImageUrl($user->pic); $allowDokuWallet = Efiwebsetting::getData('App_Allow_Doku_Wallet') == 'yes'; if (Generic::IsNullOrEmptyString($user->payment_id) || $user->payment_id == 0) { $results['balance'] = doubleval(0); } else { if ($allowDokuWallet) { $doku = new PaymentDoku(); $results['balance'] = $doku->checkBalance($user->payment_id); } else { $results['balance'] = doubleval(0); } } Generic::finish($results); }