File size: 3,240 Bytes
366d6fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{% extends "base.html" %}
{% block title %}Check out - Apple{% endblock %}
{% block content %}
<div class="wrap">
  <nav class="crumbs" aria-label="Breadcrumb">
    <a href="/shop/bag">Bag</a> › <span>Checkout</span>
  </nav>
  <div class="listing-head"><h1>Check out</h1></div>
  {% if error %}<p class="form-error" role="alert" data-testid="checkout-error">{{ error }}</p>{% endif %}

  <div class="checkout">
    <form method="post" action="/shop/checkout" class="stack">
      <h2>Shipping address</h2>
      <label>Full name
        <input type="text" name="name" required autocomplete="name"
               value="{{ (form or {}).get('name', visitor.display_name or '') }}">
      </label>
      <label>Email
        <input type="email" name="email" required autocomplete="email"
               value="{{ (form or {}).get('email', visitor.email or '') }}">
      </label>
      <label>Street address
        <input type="text" name="line1" required autocomplete="address-line1"
               value="{{ (form or {}).get('line1', '') }}">
      </label>
      <label>City
        <input type="text" name="city" required autocomplete="address-level2"
               value="{{ (form or {}).get('city', '') }}">
      </label>
      <label>State
        <input type="text" name="state" required maxlength="2" autocomplete="address-level1"
               value="{{ (form or {}).get('state', '') }}">
      </label>
      <label>ZIP code
        <input type="text" name="postal" required inputmode="numeric" autocomplete="postal-code"
               value="{{ (form or {}).get('postal', '') }}">
      </label>

      <h2>Delivery</h2>
      {% for method in delivery_methods %}
      <label class="choice">
        <input type="radio" name="delivery" value="{{ method.id }}"
               {% if method.id == delivery %}checked{% endif %}>
        {{ method.label }} — {% if method.cost %}${{ '%.2f'|format(method.cost / 100) }}{% else %}FREE{% endif %}
      </label>
      {% endfor %}

      <h2>Payment</h2>
      <p class="finance">This clone uses the local sandbox payment adapter. No card
        details are collected, sent or stored.</p>
      {% for choice in payment_choices %}
      <label class="choice">
        <input type="radio" name="scenario" value="{{ choice.id }}"
               {% if loop.first %}checked{% endif %}>
        {{ choice.label }}
      </label>
      {% endfor %}

      <button class="pill" type="submit">Place Order</button>
    </form>

    <aside class="order-summary">
      <h2>Summary</h2>
      {% for line in lines %}
      <div class="summary-line">
        <span>{{ line.name }} × {{ line.quantity }}</span>
        <span>{{ line.line_total_display }}</span>
      </div>
      {% endfor %}
      <div class="summary-line"><span>Subtotal</span><span data-testid="subtotal">{{ totals.subtotal_display }}</span></div>
      <div class="summary-line"><span>Shipping</span><span>{{ totals.shipping_display }}</span></div>
      <div class="summary-line"><span>Estimated tax</span><span>{{ totals.tax_display }}</span></div>
      <div class="summary-line grand"><span>Total</span><span data-testid="total">{{ totals.total_display }}</span></div>
    </aside>
  </div>
</div>
{% endblock %}