mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:07:32 -05:00 
			
		
		
		
	Checkout: Optin/optout for saving card
This commit is contained in:
		
							parent
							
								
									d0894cec37
								
							
						
					
					
						commit
						c6b24d1c75
					
				@ -66,11 +66,6 @@ class AuthorizeAuthorizeCard {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    handle() {
 | 
			
		||||
        //this.handleFormValidation();
 | 
			
		||||
 | 
			
		||||
        // At this point as an small API you can request this.form.valid to check if input elements are valid.
 | 
			
		||||
        // Note: this.form.valid will not handle empty fields.
 | 
			
		||||
 | 
			
		||||
        this.cardButton.addEventListener("click", () => {
 | 
			
		||||
            this.cardButton.disabled = !this.cardButton.disabled;
 | 
			
		||||
             this.handleAuthorization();
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ window.CKOConfig = {
 | 
			
		||||
 | 
			
		||||
        document.querySelector(
 | 
			
		||||
            'input[name="store_card"]'
 | 
			
		||||
        ).value = document.getElementById('store-card-checkbox').checked ? 1 : 0;
 | 
			
		||||
        ).value = document.querySelector('input[name=token-billing-checkbox]:checked').value;
 | 
			
		||||
        
 | 
			
		||||
        document.getElementById('server-response').submit();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@ -84,12 +84,31 @@
 | 
			
		||||
                            </button>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    @else
 | 
			
		||||
                        <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
 | 
			
		||||
                            <dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
 | 
			
		||||
                        <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" id="store-card-checkbox" class="form-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">
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user