1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

View credit card: send more billing data to Stripe when available

This commit is contained in:
Francisco Ferreira 2019-06-02 16:43:37 +01:00
parent 8ed210d618
commit 8e8414ab49
No known key found for this signature in database
GPG Key ID: F63C20A6773E787E

View File

@ -154,11 +154,12 @@
@if ($client) @if ($client)
{{ Former::populate($client) }} {{ Former::populate($client) }}
{{ Former::populateField('country_id', (string) $client->country_id) }}
{{ Former::populateField('first_name', $contact->first_name) }} {{ Former::populateField('first_name', $contact->first_name) }}
{{ Former::populateField('last_name', $contact->last_name) }} {{ Former::populateField('last_name', $contact->last_name) }}
{{ Former::populateField('email', $contact->email) }} {{ Former::populateField('email', $contact->email) }}
@if (!$client->country_id && $client->account->country_id) @if (!$client->country_id && $client->account->country_id)
{{ Former::populateField('country_id', $client->account->country_id) }} {{ Former::populateField('country_id', (string) $client->account->country_id) }}
{{ Former::populateField('shipping_country_id', $client->account->country_id) }} {{ Former::populateField('shipping_country_id', $client->account->country_id) }}
@endif @endif
@endif @endif
@ -170,7 +171,7 @@
{{ Former::populateField('city', 'New York') }} {{ Former::populateField('city', 'New York') }}
{{ Former::populateField('state', 'NY') }} {{ Former::populateField('state', 'NY') }}
{{ Former::populateField('postal_code', '10118') }} {{ Former::populateField('postal_code', '10118') }}
{{ Former::populateField('country_id', 840) }} {{ Former::populateField('country_id', (string) 840) }}
<script> <script>
$(function() { $(function() {
@ -253,7 +254,7 @@
<div class="col-md-6"> <div class="col-md-6">
{!! Former::select('country_id') {!! Former::select('country_id')
->placeholder(trans('texts.country_id')) ->placeholder(trans('texts.country_id'))
->fromQuery($countries, 'name', 'id') ->fromQuery($countries, 'name', ['value' => 'id', 'data-iso_3166_2' => 'iso_3166_2'])
->addGroupClass('country-select') ->addGroupClass('country-select')
->label('') !!} ->label('') !!}
</div> </div>
@ -453,13 +454,17 @@
var options = { var options = {
name: document.getElementById('first_name').value + ' ' + document.getElementById('last_name').value name: document.getElementById('first_name').value + ' ' + document.getElementById('last_name').value,
@if (!empty($accountGateway->show_address))
address_line1: $('#address1').val(),
address_line2: $('#address2').val(),
address_city: $('#city').val(),
address_state: $('#state').val(),
address_zip: $('#postal_code').val(),
address_country: $("#country_id option:selected").attr('data-iso_3166_2')
@endif
}; };
if (document.getElementById('postal_code')) {
options.address_zip = document.getElementById('postal_code').value;
}
stripe.createToken(cardNumber, options).then(function(result) { stripe.createToken(cardNumber, options).then(function(result) {
if (result.error) { if (result.error) {
// Inform the user if there was an error. // Inform the user if there was an error.