<commit_before>@extends('layouts.main')

@section('title')
  Payment
@endsection

@section('breadcrumb')

    <ol class="breadcrumb">
        <li><a href="/shop">Shop</a></li>
        <li><a href="/cart">Cart</a></li>
        <li><a href="/checkout">Checkout</a></li>
        <li class="active">Pay</li>
    </ol>

@endsection

@section('content')

    <h1>Pay</h1>

    <h2>Order Details</h2>

    @include('orders._summary')

    <form action="" id="pay-now-form" class="row">
        <div class="col-sm-12 col-md-4 col-lg-3">
            <button type="submit" class="btn btn-success btn-lg btn-block">Pay now</button>
        </div>
    </form>
@stop

@section('scripts')
    <script>
        (function() {
            const stripe = Stripe('{{ config('services.stripe.publishable') }}');
            const sessionId = '{{ $session_id }}';

            document.querySelector('#pay-now-form').addEventListener('submit', e => {
                e && e.preventDefault();

                stripe.redirectToCheckout({ sessionId }).then(function (result) {
                    if (result.error && result.error.message) {
                        alert(result.error.message);
                    }
                });
            });
        })();
    </script>
@stop
<commit_msg>Use ES5 function syntax in script<commit_after>@extends('layouts.main')

@section('title')
  Payment
@endsection

@section('breadcrumb')

    <ol class="breadcrumb">
        <li><a href="/shop">Shop</a></li>
        <li><a href="/cart">Cart</a></li>
        <li><a href="/checkout">Checkout</a></li>
        <li class="active">Pay</li>
    </ol>

@endsection

@section('content')

    <h1>Pay</h1>

    <h2>Order Details</h2>

    @include('orders._summary')

    <form action="" id="pay-now-form" class="row">
        <div class="col-sm-12 col-md-4 col-lg-3">
            <button type="submit" class="btn btn-success btn-lg btn-block">Pay now</button>
        </div>
    </form>
@stop

@section('scripts')
    <script>
        (function() {
            const stripe = Stripe('{{ config('services.stripe.publishable') }}');
            const sessionId = '{{ $session_id }}';

            document.querySelector('#pay-now-form').addEventListener('submit', function(e) {
                e && e.preventDefault();

                stripe.redirectToCheckout({ sessionId }).then(function (result) {
                    if (result.error && result.error.message) {
                        alert(result.error.message);
                    }
                });
            });
        })();
    </script>
@stop

{'fraction_non_alphanumeric': 0.18781528909584788, 'fraction_numerical': 0.006596818005432673, 'mean_word_length': 2.124848484848485, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5547021', 'n_tokens_mistral': 813, 'n_tokens_neox': 786, 'n_words': 133}