mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Update client records when trial activated in Stripe
This commit is contained in:
parent
187c5b115b
commit
0e2b945c3b
@ -98,6 +98,27 @@ class NinjaPlanController extends Controller
|
||||
$stripe_response = json_decode($request->input('gateway_response'));
|
||||
$customer = $gateway_driver->findOrCreateCustomer();
|
||||
|
||||
//27-08-2022 Ensure customer is updated appropriately
|
||||
$update_client_object['name'] = $client->present()->name();
|
||||
$update_client_object['phone'] = substr($client->present()->phone(), 0, 20);
|
||||
|
||||
$update_client_object['address']['line1'] = $client->address1 ?: '';
|
||||
$update_client_object['address']['line2'] = $client->address2 ?: '';
|
||||
$update_client_object['address']['city'] = $client->city ?: '';
|
||||
$update_client_object['address']['postal_code'] = $client->postal_code ?: '';
|
||||
$update_client_object['address']['state'] = $client->state ?: '';
|
||||
$update_client_object['address']['country'] = $client->country ? $client->country->iso_3166_2 : '';
|
||||
|
||||
$update_client_object['shipping']['name'] = $client->present()->name();
|
||||
$update_client_object['shipping']['address']['line1'] = $client->shipping_address1 ?: '';
|
||||
$update_client_object['shipping']['address']['line2'] = $client->shipping_address2 ?: '';
|
||||
$update_client_object['shipping']['address']['city'] = $client->shipping_city ?: '';
|
||||
$update_client_object['shipping']['address']['postal_code'] = $client->shipping_postal_code ?: '';
|
||||
$update_client_object['shipping']['address']['state'] = $client->shipping_state ?: '';
|
||||
$update_client_object['shipping']['address']['country'] = $client->shipping_country ? $client->shipping_country->iso_3166_2 : '';
|
||||
|
||||
\Stripe\Customer::update($customer->id, $update_client_object, $gateway_driver->stripe_connect_auth);
|
||||
|
||||
$gateway_driver->attach($stripe_response->payment_method, $customer);
|
||||
$method = $gateway_driver->getStripePaymentMethod($stripe_response->payment_method);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user