eWAYPayment / eway-rapid-php

Eway Rapid PHP library
https://www.eway.com.au
MIT License
14 stars 24 forks source link

Update customer with Direct method #1

Closed marekfri closed 8 years ago

marekfri commented 8 years ago

Hi developers, There is a method createCustomer() in the \Eway\Rapid\Client class, but I'm missing one similar - updateCustomer(), which would use UPDATE_TOKEN_CUSTOMER payment method.

How can I possibly update customer information without recording a payment? createTransaction() method doesn't allow me to do this as the payment method is overridden there for the direct access to one of PROCESS_PAYMENT / AUTHORISE.

At the moment I must implement this method elsewhere, which is not a good way as I cannot use other methods which are private in the Client class.

Thanks for the response.

incarnate commented 8 years ago

Hi Marek,

Thanks for posting about the lack of update customer in the eWAY PHP SDK - we did manage to miss that function in the initial release.

We've just pushed version 1.1.1 live which includes the update token customer function, you should be able to update your project by running composer update if you installed the SDK with composer.

We'll update our documentation soon, in the meantime the updateCustomer function can be used like this:

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$customer = [
    'TokenCustomerID' => 917758625852,
    'Title' => 'Ms.',
    'FirstName' => 'Jane',
    'LastName' => 'Smith',
    'Country' => 'au',
    'CardDetails' => [
        'Name' => 'Jane Smith',
        'Number' => '4444333322221111',
        'ExpiryMonth' => '12',
        'ExpiryYear' => '25',
        'CVN' => '123',
    ]
];

$response = $client->updateCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer);