Add operation to allow newly poskod to registred through the API

This commit is contained in:
afiq.hamzah
2023-03-06 10:37:07 +08:00
parent c1d122139b
commit 99a4fe7e9e
3 changed files with 46 additions and 6 deletions
@@ -173,6 +173,17 @@ class CustomersController extends Controller
$no_pelanggan = $request->bangsa . substr($request->noic,6,2).'-'.$count;
$detail_poskod = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/poskod/' . $request->poskod)->json();
if(empty($detail_poskod)){
$detail_poskod = Http::withOptions(['verify' => config('app.api_verify')])
->post(config('api.url') . '/api/poskod', [
'poskod' => $request->poskod,
'koddaerah' => $request->koddaerah,
'kodnegeri' => $request->kodnegeri,
])->json();
}
$customer_info = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/customers/create/'. $auth_user['cawangan'],[
'kodcaw' => $auth_user['cawangan'],
'nopelanggan' => $no_pelanggan,