From ce5afdc28718bd9e355813719b0d8bdc388b3827 Mon Sep 17 00:00:00 2001 From: ? Date: Sun, 6 Dec 2020 01:19:48 +0700 Subject: [PATCH] signature unlockAndValidteTrxId transfer bank > 2x --- src/Ovoid.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/Ovoid.php b/src/Ovoid.php index 307a2f7..1c31bc8 100644 --- a/src/Ovoid.php +++ b/src/Ovoid.php @@ -282,6 +282,41 @@ private function generateTrxId($amount, $actionMark) return $ch->post(OVOID::BASE_ENDPOINT . 'v1.0/api/auth/customer/genTrxId', $data, $this->_aditionalHeader())->getResponse(); } + /** + * Signature unlockAndValidateTrxId + * + * @param \Stelin\Response\GenTrxIdResponse + * @param int $amount + * @return string + */ + private function signatureUnlockAndValidateTrxId($trxId, $amount) + { + return sha1( + $trxId . '||' . $amount . '||' . Meta::DEVICE_ID + ); + } + + /** + * unlockAndValidateTrxId + * + * @param int $amount + * @param \Stelin\Response\GenTrxIdResponse + * @param string $securityCode + * @return array + */ + protected function unlockAndValidateTrxId($trxId, $amount, $securityCode) + { + $ch = new Curl; + + $data = [ + 'trxId' => $trxId, + 'signature' => $this->signatureUnlockAndValidateTrxId($trxId, $amount), + 'securityCode' => $securityCode + ]; + + return $ch->post(OVOID::BASE_ENDPOINT, 'v1.0/api/auth/customer/unlockAndValidateTrxId', $data, $this->_aditionalHeader()->getResponse()); + } + /** * logout from OVO *