public function createKYC($appUserId, KYC $kyc)
    {
        $url = sprintf('users/%s/kyc/', $appUserId);

        $headers = [
            'Accept' => sprintf('application/vnd.s-money.v%s+%s', $this->getApiVersion(), $this->getOutputFormat()),
            'Content-Type' => 'multipart/form-data',
        ];

        $body = [];
        $count = 0;
        foreach ($kyc->getFiles() as $file) {
            $postFile = new PostFile('file' . $count, fopen($file->getRealPath(), 'r'), $file->getFilename());
            $body['file' . $count] = $postFile;
            $count++;
        }

        try {
            $response = $this->root->getHttpClient()->post($url, $body, $headers);

            return $this->castResponseToEntity($response->json(['object' => true]), get_class($kyc));
        } catch (ClientException $e) {
            $this->addError($e->getRequest(), $e->getResponse());

            return false;
        }
    }
public function createKYC($appUserId, KYC $kyc)
    {
        $url = sprintf('users/%s/kyc/', $appUserId);

        $headers = [
            'Accept' => sprintf('application/vnd.s-money.v%s+%s', $this->getApiVersion(), $this->getOutputFormat()),
            'Content-Type' => 'multipart/form-data',
        ];

        $body = [];
        $count = 0;
        foreach ($kyc->getFiles() as $file) {
            $postFile = new PostFile('file' . $count, fopen($file->getRealPath(), 'r'), $file->getFilename());
            $body['file' . $count] = $postFile;
            $count++;
        }

        try {
            $response = $this->root->getHttpClient()->post($url, $body, $headers);

            return $this->castResponseToEntity($response->json(['object' => true]), get_class($kyc));
        } catch (ClientException $e) {
            $this->addError($e->getRequest(), $e->getResponse());

            return false;
        }
    }
public function createKYC ( $ appUserId , KYC $ kyc ) { $ url = sprintf ( 'users/%s/kyc/' , $ appUserId ) ; $ headers = [ 'Accept' => sprintf ( 'application/vnd.s-money.v%s+%s' , $ this -> getApiVersion ( ) , $ this -> getOutputFormat ( ) ) , 'Content-Type' => 'multipart/form-data' , ] ; $ body = [ ] ; $ count = 0 ; foreach ( $ kyc -> getFiles ( ) as $ file ) { $ postFile = new PostFile ( 'file' . $ count , fopen ( $ file -> getRealPath ( ) , 'r' ) , $ file -> getFilename ( ) ) ; $ body [ 'file' . $ count ] = $ postFile ; $ count ++ ; } try { $ response = $ this -> root -> getHttpClient ( ) -> post ( $ url , $ body , $ headers ) ; return $ this -> castResponseToEntity ( $ response -> json ( [ 'object' => true ] ) , get_class ( $ kyc ) ) ; } catch ( ClientException $ e ) { $ this -> addError ( $ e -> getRequest ( ) , $ e -> getResponse ( ) ) ; return false ; } }
Create new KYC demand

@param $appUserId
@param KYC $kyc
@return \Picoss\SMoney\Entity\KYC
@throws \Exception
Create new KYC demand