== users.migratepartner ==
NOTE: currently available on staging only
==== Description ====
Update users ptnr_id (and updates ptnr_id in related records).
This is temporary solution to help fix: https://phab.dvipdev.com/T14450
Works only for currently authorized ptnr_id (via auth).
==== Input Parameters ====
<table>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
<tr><td>tracking_user</td><td>(int)</td><td>yes</td><td>tracking_user value</td></tr>
<tr><td>new_token</td><td>(string)</td><td>yes</td><td>token of new tracking_user partner</td></tr>
<tr><td>new_password</td><td>(string)</td><td>yes</td><td>password of new tracking_user partner</td></tr>
<tr><td>tracking_tags</td><td>(array)</td><td>no</td><td>list of tracking_tag(s) to be migrated (related to tracking_user from request</td></tr>
</table>
==== Return ====
<table>
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
<tr><td>result</td><td>boolarray</td><td>True or false, depends if operation went fineContains mode (string) & status (bool) </td></tr>
</table>
==== Possible error codes (specific for this api call) ====
<table>
<tr><th>Code</th><th>Description</th></tr>
<tr><td>613</td><td>New parnters auth data are wrong</td></tr>
<tr><td>865</td><td>User not found (partner + tracking_user)</td></tr>
<tr><td>606</td><td>Case not found (not recognized any of possible 3 cases)</td></tr>
</table>
==== Usage Example ====
```
<?php
//setup payment url and timeout
$payment_url = 'https://payment.dvipdev.com/api.json';
$timeout = 30;
$curl->setCredentials('some-token', 'some-pass');
$post_data = array(
'cmd' => 'users.migratepartner',
'data' => [
'tracking_user' =>1456678,
'new_token' => 'some@new-token'
'new_password' => 'new-ptnr-password'
'tracking_tags' => [1,12,141]
]
);
$response = $curl->sendPostData($payment_url, $post_data, null, $timeout);
if($response === false)
{
//handle errors
}
//decode json to get array
$response = json_decode($response, true);
var_dump($response);
```
Excepted output after running this script should be:
```
{
"result": {
"code": 700,
"status": "Action completed successfully",
"command": "users.migratepartner",
"result": {
"mode": "merge",
"status": true
},
"request": {
"cmd": "users.migratepartner",
"data": {
"tracking_user":1456678,
"new_token":"some@new-token",
"new_password":"new-ptnr-password",
"tracking_tags'": [
1,
12,
141
]
},
"token": "",
"pass": ""
},
"ts": 1527077858,
"origin_ip": false,
"errors": null
}
}
```