Skip to content

Commit

Permalink
Fixed #67, #65 Histori Transaksi
Browse files Browse the repository at this point in the history
  • Loading branch information
lintangtimur committed Oct 29, 2021
1 parent d58b862 commit cf8197a
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/Ovoid.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ class OVOID
* @var string
*/
private $authToken;
private $deviceId;

private $headers = [
'OS' => 'Android',
'OS-Version'=> '9.0',
'client-id' => 'ovo_android',
'device-id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device-id' => '',
// 'host' => 'agw.ovo.id',
// 'App-Version' => Meta::APP_VERSION,
'App-Version' => Meta::APP_VERSION,
'User-Agent' => 'okhttp/4.9.0',
// 'Connection'=> 'close',
// "Accept-Encoding" => "gzip, deflate"
Expand All @@ -50,12 +49,16 @@ private function getDeviceId()
* OVOID
*
* @param string $authToken
* @param string $deviceId
*/
public function __construct($authToken = null, $deviceId)
{
$this->authToken = $authToken;
$this->deviceId = $deviceId;
$this->_setDeviceId($deviceId);
}

private function _setDeviceId($deviceId)
{
$this->headers['device-id'] = $deviceId;
}

/**
Expand All @@ -70,7 +73,7 @@ public function OTP($noTelp)

$data = [
'channel_code'=> 'ovo_android',
'device_id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device_id' => $this->headers['device-id'],
'msisdn' => $noTelp,
'otp' => [
'locale' => 'ID',
Expand All @@ -95,7 +98,7 @@ public function OTPValidation($noTelp, $otpRefId, $otp)

$data = [
'channel_code'=> 'ovo_android',
'device_id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device_id' => $this->headers['device-id'],
'msisdn' => $noTelp,
'otp' => [
'otp' => $otp,
Expand All @@ -119,11 +122,12 @@ public function getPublicKeys()
'OS' => 'Android',
'OS-Version' => '9.0',
'client-id' => 'ovo_android',
'device-id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device-id' => $this->headers['device-id'],
'host' => 'agw.ovo.id',
'User-Agent' => 'okhttp/4.9.0',
'Connection' => 'close',
];

return $ch->get(OVOID::OVO_API_AWS . 'v3/user/public_keys', null, $this->headers)->getResponse();
}

Expand All @@ -142,7 +146,7 @@ public function accountLogin($noTelp, $otpRefId, $otpToken, $securityCode)

$data = [
'channel_code'=> 'ovo_android',
'device_id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device_id' => $this->headers['device-id'],
'credentials' => [
'otp_token'=> $otpToken,
'password' => [
Expand Down Expand Up @@ -171,11 +175,11 @@ private function _encryptPassword($noTelp, $otpRefId, $securityCode)

// $publicKey = str_replace("\n","",$publicKey);

// dd($publicKey);
$deviceId = '87586011-0127-3469-aa2a-6016a68d45f6';
$deviceId = $this->headers['device-id'];
$currentTimeInMillies = '1629220160';
$payload = "LOGIN|{$securityCode}|{$currentTimeInMillies}|{$deviceId}|{$noTelp}|{$deviceId}|{$otpRefId}";
\openssl_public_encrypt($payload, $encrypted, $publicKey);

\openssl_public_encrypt($payload, $encrypted, $publicKey, 2);

return \base64_encode($encrypted);
}
Expand All @@ -196,7 +200,7 @@ public function login2FA($mobile_phone)
'OS' => 'Android',
'OS-Version' => '7.1.1',
'client-id' => 'ovo_android',
'device-id' => '87586011-0127-3469-aa2a-6016a68d45f6',
'device-id' => $this->headers['device-id'],
'app-id' => Meta::APP_ID,
'App-Version' => Meta::APP_VERSION
];
Expand Down

0 comments on commit cf8197a

Please sign in to comment.