Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Generate API User Password
- $length2 = 16;
- $randomKey = substr(str_shuffle(str_repeat($x='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^*()/\[]', ceil($length/strlen($x)) )),1,$length2);
- // $password = $client->oneWayEncrypt(['plainText'=>$randomKey, 'crytoKey'=>'tranglo123']);
- // $password = json_decode(json_encode($password), true);
- // $password = $password['oneWayEncryptResult'];
- // correct method to call (2017-02-02)
- $password = $client->sEncryptData(['plainText'=>$randomKey, 'crytoKey'=> Yii::$app->params['soapclient.crytokey']] );
- $password = $password->sEncryptDataResult;
- //END: Generate API User Password
- //Generate API Security Key
- $length3 = 16;
- $randomKey2 = substr(str_shuffle(str_repeat($x='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^*()/\[]', ceil($length/strlen($x)) )),1,$length3);
- // $secure_ans = $client->oneWayEncrypt(['plainText'=>$randomKey2, 'crytoKey'=>'tranglo123']);
- // $secure_ans = json_decode(json_encode($secure_ans), true);
- // $secure_ans = $secure_ans['oneWayEncryptResult'];
- $secure_ans = $client->sEncryptData(['plainText'=>$randomKey2, 'crytoKey'=> Yii::$app->params['soapclient.crytokey']] );
- $secure_ans = $secure_ans->sEncryptDataResult;
- //END: Generate API Security Key
- $password2 = $client->sEncryptData(['plainText'=>$randomKey, 'crytoKey'=>Yii::$app->params['soapclient.crytokey2']]);
- $password2 = json_decode(json_encode($password2), true);
- $password2 = $password2['sEncryptDataResult'];
- $systemuser = Yii::$app->db2->createCommand()->update(
- 'systemusers',
- [
- 'Username' => $apiUserId,
- 'Password' => $password2
- ],
- [
- 'rspid' => $partner_staging->RspId,
- 'category' => 1
- ]
- );
- $systemuser->execute();
- $SecurityKey = Yii::$app->db2->createCommand()->update(
- 'SecurityKey',
- [
- 'HashKey' => $randomKey
- ],
- [
- 'RSPID' => $partner_staging->RspId
- ]
- );
- $SecurityKey->execute();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement