Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Work with CETELEM and probably others #8

Open
yanncharlou opened this issue May 25, 2018 · 2 comments
Open

Don't Work with CETELEM and probably others #8

yanncharlou opened this issue May 25, 2018 · 2 comments

Comments

@yanncharlou
Copy link

This module don't send required informations about buyer to CETELEM. CETELEM 3X and 4X can't work.

buyer data sent by module contain only few informations. It's missing at least :
buyer.title
buyer.mobilePhone

In vendor/monext/module-payline/PaylineApi/Request/DoWebPayment.php, function prepareBuyerData(&$data) near from line 192.
Function should be adapted to be like prepareBillingAddressData for example and provide all mandatory informations about buyer.

@yanncharlou
Copy link
Author

yanncharlou commented Jun 7, 2018

Here is a replacement function wich work for me :

protected function prepareBuyerData(&$data)
    {
        $customer = $this->cart->getCustomer();
        $paymentMethod = $this->payment->getMethod();

        $data['buyer']['title'] = $this->helperData->encodeString($this->billingAddress->getPrefix());
        if(!$data['buyer']['title']){
            $data['buyer']['title'] = $this->helperData->encodeString('M');
        }

        $data['buyer']['firstName'] = $this->helperData->encodeString(substr($this->billingAddress->getFirstname(), 0, 100));
        $data['buyer']['lastName'] = $this->helperData->encodeString(substr($this->billingAddress->getLastname(), 0, 100));
        //$data['buyer']['email'] = $this->helperData->encodeString(substr($this->billingAddress->getEmail(), 0, 100));
        $email = $this->billingAddress->getEmail();
        if($this->helperData->isEmailValid($email)) {
            $data['buyer']['email'] = $this->helperData->encodeString($email);
        }
        $data['buyer']['customerId'] = $this->helperData->encodeString($email);

        $data['buyer']['mobilePhone'] = $this->helperData->getNormalizedPhoneNumber($this->billingAddress->getTelephone());
        if(!$data['buyer']['mobilePhone']){
            $data['buyer']['mobilePhone'] = $this->helperData->encodeString('0000000000');
        }

        if($customer->getId()) {
            $data['buyer']['accountCreateDate'] = $this->formatDateTime($customer->getCreatedAt(), 'd/m/y');
        }

        if($this->helperData->isWalletEnabled($paymentMethod)) {
            if($customer->getId() && $customer->getCustomAttribute('wallet_id')->getValue()) {
                $data['buyer']['walletId'] = $customer->getCustomAttribute('wallet_id')->getValue();
            } else {
                $data['buyer']['walletId'] = $this->helperData->generateRandomWalletId();
            }
        }
    }

@yanncharlou
Copy link
Author

Nobody here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant