private function formatPreApprovalData(array $paymentSettings)
    {
        $this->senderInfo['phone'] = [
            'areaCode' => $this->senderInfo['senderAreaCode'],
            'number'   => $this->senderInfo['senderPhone'],
        ];

        $this->creditCardHolder['phone'] = [
            'areaCode' => $this->creditCardHolder['creditCardHolderAreaCode'],
            'number'   => $this->creditCardHolder['creditCardHolderPhone'],
        ];

        if (!empty($this->senderInfo['senderCPF'])) {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CPF',
                'value' => $this->senderInfo['senderCPF'],
            ];

            unset($this->senderInfo['senderCPF']);
        } else {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CNPJ',
                'value' => $this->senderInfo['senderCNPJ'],
            ];

            unset($this->senderInfo['senderCNPJ']);
        }

        $this->creditCardHolder['documents'][0] = [
            'type'  => 'CPF',
            'value' => $this->creditCardHolder['creditCardHolderCPF'],
        ];

        unset($this->creditCardHolder['creditCardHolderCPF']);
        unset($this->senderInfo['senderAreaCode']);
        unset($this->senderInfo['senderPhone']);
        unset($this->creditCardHolder['creditCardHolderAreaCode']);
        unset($this->creditCardHolder['creditCardHolderPhone']);

        $data = [
            'reference'     => $this->reference,
            'plan'          => $this->plan,
            'sender'        => $this->senderInfo,
            'paymentMethod' => [
                'type'       => 'CREDITCARD',
                'creditCard' => [
                    'token'  => $paymentSettings['creditCardToken'],
                    'holder' => $this->creditCardHolder,
                ],
            ],
        ];
        $data['sender']['address'] = $this->senderAddress;
        $data['paymentMethod']['creditCard']['holder']['billingAddress'] = $this->billingAddress;

        return $data;
    }
private function formatPreApprovalData(array $paymentSettings)
    {
        $this->senderInfo['phone'] = [
            'areaCode' => $this->senderInfo['senderAreaCode'],
            'number'   => $this->senderInfo['senderPhone'],
        ];

        $this->creditCardHolder['phone'] = [
            'areaCode' => $this->creditCardHolder['creditCardHolderAreaCode'],
            'number'   => $this->creditCardHolder['creditCardHolderPhone'],
        ];

        if (!empty($this->senderInfo['senderCPF'])) {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CPF',
                'value' => $this->senderInfo['senderCPF'],
            ];

            unset($this->senderInfo['senderCPF']);
        } else {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CNPJ',
                'value' => $this->senderInfo['senderCNPJ'],
            ];

            unset($this->senderInfo['senderCNPJ']);
        }

        $this->creditCardHolder['documents'][0] = [
            'type'  => 'CPF',
            'value' => $this->creditCardHolder['creditCardHolderCPF'],
        ];

        unset($this->creditCardHolder['creditCardHolderCPF']);
        unset($this->senderInfo['senderAreaCode']);
        unset($this->senderInfo['senderPhone']);
        unset($this->creditCardHolder['creditCardHolderAreaCode']);
        unset($this->creditCardHolder['creditCardHolderPhone']);

        $data = [
            'reference'     => $this->reference,
            'plan'          => $this->plan,
            'sender'        => $this->senderInfo,
            'paymentMethod' => [
                'type'       => 'CREDITCARD',
                'creditCard' => [
                    'token'  => $paymentSettings['creditCardToken'],
                    'holder' => $this->creditCardHolder,
                ],
            ],
        ];
        $data['sender']['address'] = $this->senderAddress;
        $data['paymentMethod']['creditCard']['holder']['billingAddress'] = $this->billingAddress;

        return $data;
    }
private function formatPreApprovalData ( array $ paymentSettings ) { $ this -> senderInfo [ 'phone' ] = [ 'areaCode' => $ this -> senderInfo [ 'senderAreaCode' ] , 'number' => $ this -> senderInfo [ 'senderPhone' ] , ] ; $ this -> creditCardHolder [ 'phone' ] = [ 'areaCode' => $ this -> creditCardHolder [ 'creditCardHolderAreaCode' ] , 'number' => $ this -> creditCardHolder [ 'creditCardHolderPhone' ] , ] ; if ( ! empty ( $ this -> senderInfo [ 'senderCPF' ] ) ) { $ this -> senderInfo [ 'documents' ] [ 0 ] = [ 'type' => 'CPF' , 'value' => $ this -> senderInfo [ 'senderCPF' ] , ] ; unset ( $ this -> senderInfo [ 'senderCPF' ] ) ; } else { $ this -> senderInfo [ 'documents' ] [ 0 ] = [ 'type' => 'CNPJ' , 'value' => $ this -> senderInfo [ 'senderCNPJ' ] , ] ; unset ( $ this -> senderInfo [ 'senderCNPJ' ] ) ; } $ this -> creditCardHolder [ 'documents' ] [ 0 ] = [ 'type' => 'CPF' , 'value' => $ this -> creditCardHolder [ 'creditCardHolderCPF' ] , ] ; unset ( $ this -> creditCardHolder [ 'creditCardHolderCPF' ] ) ; unset ( $ this -> senderInfo [ 'senderAreaCode' ] ) ; unset ( $ this -> senderInfo [ 'senderPhone' ] ) ; unset ( $ this -> creditCardHolder [ 'creditCardHolderAreaCode' ] ) ; unset ( $ this -> creditCardHolder [ 'creditCardHolderPhone' ] ) ; $ data = [ 'reference' => $ this -> reference , 'plan' => $ this -> plan , 'sender' => $ this -> senderInfo , 'paymentMethod' => [ 'type' => 'CREDITCARD' , 'creditCard' => [ 'token' => $ paymentSettings [ 'creditCardToken' ] , 'holder' => $ this -> creditCardHolder , ] , ] , ] ; $ data [ 'sender' ] [ 'address' ] = $ this -> senderAddress ; $ data [ 'paymentMethod' ] [ 'creditCard' ] [ 'holder' ] [ 'billingAddress' ] = $ this -> billingAddress ; return $ data ; }
Formata os dados para enviar.

@param array $paymentSettings

@return array
Formata os dados para enviar .