Your status is Pending Review. We have sent a confirmation to your email address.
Keep your Application ID safe. You can sign in with the credentials you created while your application is being reviewed.
';return ob_get_clean();}
echo '
';foreach(['Personal','Address','Account','Identity','Security','Review'] as $i=>$s)echo '';echo '
';
echo '';return ob_get_clean();
}
private static function panel($n,$t,$p){echo '
STEP '.$n.' OF 6
'.esc_html($t).'
'.esc_html($p).'
';}
private static function panel_end(){echo '
';}
private static function input($n,$l,$req=false,$type='text'){echo '';}
private static function select($n,$l,$opts,$req=false){$v=self::val($n);echo '';}
private static function file($n,$l,$req=false){echo '';}
private static function upload_doc($field,$app_id,$type){if(empty($_FILES[$field]['name']))return new WP_Error('doc','Please upload all required documents.');$f=$_FILES[$field];if($f['error']!==UPLOAD_ERR_OK)return new WP_Error('doc','A document upload failed. Please try again.');if($f['size']>5*1024*1024)return new WP_Error('doc','Each document must be 5 MB or smaller.');$allowed=['application/pdf'=>'pdf','image/jpeg'=>'jpg','image/png'=>'png'];$check=wp_check_filetype_and_ext($f['tmp_name'],$f['name']);if(empty($check['type'])||!isset($allowed[$check['type']]))return new WP_Error('doc','Only PDF, JPG and PNG documents are allowed.');$up=wp_upload_dir();$dir=trailingslashit($up['basedir']).'bcore-private';if(!wp_mkdir_p($dir))return new WP_Error('doc','Secure upload directory could not be created.');if(!file_exists($dir.'/.htaccess'))@file_put_contents($dir.'/.htaccess',"Deny from all\n");$name=wp_generate_password(24,false,false).'.'.$allowed[$check['type']];$dest=trailingslashit($dir).$name;if(!@move_uploaded_file($f['tmp_name'],$dest))return new WP_Error('doc','Could not store the uploaded document.');global $wpdb;$wpdb->insert(BCore_DB::table('application_documents'),['application_id'=>$app_id,'document_type'=>$type,'original_name'=>sanitize_file_name($f['name']),'stored_path'=>$dest,'mime_type'=>$check['type'],'uploaded_at'=>BCore_Utils::now()]);return true;}
private static function submit(){global $wpdb;$required=['first_name','last_name','date_of_birth','nationality','email','phone','country','state_region','city','street_address','account_type','currency','employment_status','occupation','source_of_funds','annual_income','identity_type','identity_number','username','password','password_confirm'];foreach($required as $f)if(self::val($f)==='')return new WP_Error('required','Please complete all required fields.');if(empty($_POST['declaration']))return new WP_Error('declaration','Please confirm the declaration.');$email=sanitize_email(wp_unslash($_POST['email']));if(!is_email($email))return new WP_Error('email','Please enter a valid email address.');$username=sanitize_user(wp_unslash($_POST['username']),true);if(strlen($username)<4)return new WP_Error('username','Please choose a username with at least 4 characters.');if(username_exists($username))return new WP_Error('username','That username is already in use.');if(email_exists($email))return new WP_Error('email_exists','That email address already has an account. Please sign in or use another email.');$pass=(string)wp_unslash($_POST['password']);if(strlen($pass)<10)return new WP_Error('password','Password must be at least 10 characters.');if(!hash_equals($pass,(string)wp_unslash($_POST['password_confirm'])))return new WP_Error('password_match','Passwords do not match.');$type=sanitize_key(self::val('account_type'));$currency=strtoupper(self::val('currency'));if(!in_array($type,BCore_Utils::account_types(),true)||!in_array($currency,BCore_Utils::currencies(),true))return new WP_Error('account','Invalid account selection.');$uid=wp_create_user($username,$pass,$email);if(is_wp_error($uid))return $uid;$user=new WP_User($uid);$user->set_role('bank_applicant');wp_update_user(['ID'=>$uid,'first_name'=>self::val('first_name'),'last_name'=>self::val('last_name'),'display_name'=>trim(self::val('first_name').' '.self::val('last_name'))]);$ref=BCore_Utils::ref('APP');$data=['application_ref'=>$ref,'wp_user_id'=>$uid,'title'=>self::val('title'),'first_name'=>self::val('first_name'),'middle_name'=>self::val('middle_name'),'last_name'=>self::val('last_name'),'email'=>$email,'phone'=>self::val('phone'),'date_of_birth'=>self::val('date_of_birth'),'gender'=>self::val('gender'),'nationality'=>self::val('nationality'),'country'=>self::val('country'),'state_region'=>self::val('state_region'),'city'=>self::val('city'),'street_address'=>self::val('street_address'),'building_number'=>self::val('building_number'),'postal_code'=>self::val('postal_code'),'occupation'=>self::val('occupation'),'employer'=>self::val('employer'),'employment_status'=>self::val('employment_status'),'source_of_funds'=>self::val('source_of_funds'),'annual_income'=>self::val('annual_income'),'account_type'=>$type,'currency'=>$currency,'identity_type'=>self::val('identity_type'),'identity_number'=>self::val('identity_number'),'status'=>'pending','submitted_at'=>BCore_Utils::now()];$applications_table=BCore_DB::table('applications');$columns=$wpdb->get_col("SHOW COLUMNS FROM `{$applications_table}`",0);if(is_array($columns)&&$columns){$data=array_intersect_key($data,array_flip($columns));}if(!$wpdb->insert($applications_table,$data)){if(!function_exists('wp_delete_user'))require_once ABSPATH.'wp-admin/includes/user.php';wp_delete_user($uid);return new WP_Error('save','We could not save your application.');}$id=$wpdb->insert_id;foreach([['identity_document','identity'],['proof_of_address','address']] as $d){$r=self::upload_doc($d[0],$id,$d[1]);if(is_wp_error($r)){return $r;}}BCore_Audit::log('application_submitted','application',$id,['reference'=>$ref]);wp_mail($email,'Bank account application received',"We received your application.\n\nApplication ID: $ref\nStatus: Pending Review\n\nWe will email you when the status changes.");return $ref;}
public static function status_shortcode(){if(!is_user_logged_in())return '
Please sign in to view your application status.
';global $wpdb;$a=$wpdb->get_row($wpdb->prepare('SELECT * FROM '.BCore_DB::table('applications').' WHERE wp_user_id=%d ORDER BY id DESC LIMIT 1',get_current_user_id()));if(!$a)return '
No application was found for this account.
';$steps=['pending'=>'Under Review','more_info'=>'More Information Required','approved'=>'Approved','rejected'=>'Not Approved'];$label=$steps[$a->status]??ucwords(str_replace('_',' ',$a->status));return '
APPLICATION STATUS
'.esc_html($label).'
Application ID: '.esc_html($a->application_ref).'
'.($a->customer_message?'
'.nl2br(esc_html($a->customer_message)).'
':'').'
Submitted ✓VerificationUnder ReviewApprovedAccount Active