Skip to content

Commit

Permalink
fix: bug parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sangvictim committed Sep 7, 2022
1 parent 2ea660c commit 54652b7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/RajaOngkir.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,33 @@ protected function apiCall(string $urlPath, array $payload = [], string $method
/**
* Method "province" digunakan untuk mendapatkan daftar propinsi yang ada di Indonesia.
*/
public function getProvince(): mixed
public function getProvince(int $idProvince = null): mixed
{
return $this->apiCall('/province');
return $this->apiCall('/province', [
'id' => $idProvince
], 'GET');
}

/**
* Method "city" digunakan untuk mendapatkan daftar kota/kabupaten yang ada di Indonesia.
*/
public function getCity(): mixed
public function getCity(int $idCity = null, int $idProvince = null): mixed
{
return $this->apiCall('/city');
return $this->apiCall('/city', [
'id' => $idCity,
'province' => $idProvince,
], 'GET');
}

/**
* Method "subdistrict" digunakan untuk mendapatkan daftar kecamatan yang ada di Indonesia.
*/
public function getSubdistrict(): mixed
public function getSubdistrict(int $idCity, int $idSubdistrict = null): mixed
{
return $this->apiCall('/subdistrict');
return $this->apiCall('/subdistrict', [
'id' => $idSubdistrict,
'city' => $idCity,
], 'GET');
}

/**
Expand Down

0 comments on commit 54652b7

Please sign in to comment.