mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:17:30 -05:00 
			
		
		
		
	Stripe: Optin/optout for saving card
This commit is contained in:
		
							parent
							
								
									aeeaa62d5e
								
							
						
					
					
						commit
						3a1906bd87
					
				@ -179,7 +179,7 @@ class CreditCard
 | 
			
		||||
 | 
			
		||||
        $payment_type = PaymentType::parseCardType($payment_method_object['card']['brand']);
 | 
			
		||||
 | 
			
		||||
        if ($state['save_card'] == true) {
 | 
			
		||||
        if ($state['save_card'] == true || $state['save_card'] == 'true') {
 | 
			
		||||
            $this->saveCard($state);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
                        <h3 class="text-lg leading-6 font-medium text-gray-900">
 | 
			
		||||
                            {{ ctrans('texts.add_credit_card') }}
 | 
			
		||||
                        </h3>
 | 
			
		||||
                        <p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500" translate>
 | 
			
		||||
                        <p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">
 | 
			
		||||
                            {{ ctrans('texts.authorize_for_future_use') }}
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
@ -43,18 +43,30 @@
 | 
			
		||||
                                    <div id="card-element"></div>
 | 
			
		||||
                                </dd>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                            <div class="{{ ($gateway->token_billing == 'optin' || $gateway->token_billing == 'optout') ? 'sm:grid' : 'hidden' }} bg-gray-50 px-4 py-5 sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                                <dt class="text-sm leading-5 font-medium text-gray-500">
 | 
			
		||||
                                    {{ ctrans('texts.save_as_default') }}
 | 
			
		||||
                                    {{ ctrans('texts.token_billing_checkbox') }}
 | 
			
		||||
                                </dt>
 | 
			
		||||
                                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                                    <label for="yes" class="mr-4">
 | 
			
		||||
                                        <input type="radio" class="form-radio cursor-pointer" name="proxy_is_default" {{ $client->getSetting('auto_bill') == 'on' ? 'checked': '' }} id="proxy_is_default" value="true">
 | 
			
		||||
                                        <span class="ml-1">{{ ctrans('texts.yes') }}</span>
 | 
			
		||||
                                    <label class="mr-4">
 | 
			
		||||
                                        <input 
 | 
			
		||||
                                            type="radio"
 | 
			
		||||
                                            class="form-radio cursor-pointer" 
 | 
			
		||||
                                            name="token-billing-checkbox" 
 | 
			
		||||
                                            id="proxy_is_default"
 | 
			
		||||
                                            value="true"
 | 
			
		||||
                                            {{ ($gateway->token_billing == 'always' || $gateway->token_billing == 'optout') ? 'checked' : '' }} />
 | 
			
		||||
                                        <span class="ml-1 cursor-pointer">{{ ctrans('texts.yes') }}</span>
 | 
			
		||||
                                    </label>
 | 
			
		||||
                                    <label for="no">
 | 
			
		||||
                                        <input type="radio" class="form-radio cursor-pointer" name="proxy_is_default" {{ $client->getSetting('auto_bill') == 'off' ? 'checked': '' }} id="proxy_is_default" value="false">
 | 
			
		||||
                                        <span class="ml-1">{{ ctrans('texts.no') }}</span>
 | 
			
		||||
                                    <label>
 | 
			
		||||
                                        <input 
 | 
			
		||||
                                            type="radio" 
 | 
			
		||||
                                            class="form-radio cursor-pointer" 
 | 
			
		||||
                                            name="token-billing-checkbox" 
 | 
			
		||||
                                            id="proxy_is_default" 
 | 
			
		||||
                                            value="false"
 | 
			
		||||
                                            {{ ($gateway->token_billing == 'off' || $gateway->token_billing == 'optin') ? 'checked' : '' }} />
 | 
			
		||||
                                        <span class="ml-1 cursor-pointer">{{ ctrans('texts.no') }}</span>
 | 
			
		||||
                                    </label>
 | 
			
		||||
                                </dd>
 | 
			
		||||
                            </div>
 | 
			
		||||
 | 
			
		||||
@ -65,6 +65,7 @@
 | 
			
		||||
                                               placeholder="{{ ctrans('texts.name') }}">
 | 
			
		||||
                                    </dd>
 | 
			
		||||
                                </div>
 | 
			
		||||
 | 
			
		||||
                                <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                                    <dt class="text-sm leading-5 font-medium text-gray-500">
 | 
			
		||||
                                        {{ ctrans('texts.credit_card') }}
 | 
			
		||||
@ -73,14 +74,35 @@
 | 
			
		||||
                                        <div id="card-element"></div>
 | 
			
		||||
                                    </dd>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
 | 
			
		||||
                                <div class="{{ ($gateway->company_gateway->token_billing == 'optin' || $gateway->company_gateway->token_billing == 'optout') ? 'sm:grid' : 'hidden' }} bg-gray-50 px-4 py-5 sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                                    <dt class="text-sm leading-5 font-medium text-gray-500">
 | 
			
		||||
                                        {{ ctrans('texts.token_billing_checkbox') }}
 | 
			
		||||
                                    </dt>
 | 
			
		||||
                                    <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                                        <input type="checkbox" class="form-checkbox" name="token-billing-checkbox"/>
 | 
			
		||||
                                        <label class="mr-4">
 | 
			
		||||
                                            <input 
 | 
			
		||||
                                                type="radio"
 | 
			
		||||
                                                class="form-radio cursor-pointer" 
 | 
			
		||||
                                                name="token-billing-checkbox" 
 | 
			
		||||
                                                id="proxy_is_default"
 | 
			
		||||
                                                value="true"
 | 
			
		||||
                                                {{ ($gateway->company_gateway->token_billing == 'always' || $gateway->company_gateway->token_billing == 'optout') ? 'checked' : '' }} />
 | 
			
		||||
                                            <span class="ml-1 cursor-pointer">{{ ctrans('texts.yes') }}</span>
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                        <label>
 | 
			
		||||
                                            <input 
 | 
			
		||||
                                                type="radio" 
 | 
			
		||||
                                                class="form-radio cursor-pointer" 
 | 
			
		||||
                                                name="token-billing-checkbox" 
 | 
			
		||||
                                                id="proxy_is_default" 
 | 
			
		||||
                                                value="false"
 | 
			
		||||
                                                {{ ($gateway->company_gateway->token_billing == 'off' || $gateway->company_gateway->token_billing == 'optin') ? 'checked' : '' }} />
 | 
			
		||||
                                            <span class="ml-1 cursor-pointer">{{ ctrans('texts.no') }}</span>
 | 
			
		||||
                                        </label>
 | 
			
		||||
                                    </dd>
 | 
			
		||||
                                </div>
 | 
			
		||||
 | 
			
		||||
                                <div class="bg-white px-4 py-5 flex justify-end">
 | 
			
		||||
                                    <button
 | 
			
		||||
                                        type="button"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user