adrianbarbos / mobilpay

Laravel 5 mobilpay wrapper around omnipay with omnipay-mobilpay driver
MIT License
19 stars 23 forks source link

Additional params #5

Closed razvan-z closed 4 years ago

razvan-z commented 5 years ago

Hi, Is there any way to send users's email, phone and address using the setAdditionalParams() method? Thanks!

danstoian07 commented 5 years ago

You can send them: ->setAdditionalParams([ 'email' => $request->email ]) But only to receive the same information from Mobilpay in their response. I think you want them to be preset, so that the client does not have to fill the Mobilpay form again with name, phone, email, address. I am also searching for this option, to make the payment simpler for the user.

adrianbarbos commented 5 years ago

Hey, sorry guys... i've been really busy with work the past month and didn't have time to review issues for this package. I will try to make an update asap to allow that step to be autocompleted with the additional params (or maybe add another method for that step). I know it works since I managed to do it in a spring boot application.

adrianbarbos commented 5 years ago

@razvan-z @danstoian07 Hey guys, sorry for the late update. The second step for the user can be autocompleted by sending the billingAddress ( optionally shipping address ). The fields used for the addresses are:

https://github.com/adrianbarbos/mobilpay/blob/master/src/DataTrait.php#L166

        $fields = [
            'type', 'firstName', 'lastName', 'fiscalNumber', 'identityNumber', 'country', 'county',
            'city', 'zipCode', 'address', 'email', 'mobilePhone', 'bank', 'iban'
        ];

Here's an exemple (will add it to the readme also):

    $address = [
        'type' => 'person',
        'firstName' => 'Test fname',
        'lastName' => 'Test lname',
        'email' => 'email@example.com',
        'mobilePhone' => '0123456789',
        'address' => 'Address',
        'country' => 'Country',
        'county' => 'county',
        'city' => 'city',
    ];

    Mobilpay::setOrderId(1)
        ->setAmount('5.00')
        ->setDetails('Testing Payment')
        ->setBillingAddress($address)
        ->setShippingAddress($address)
        ->purchase();