line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Plugin::Interchange6::Routes::Checkout; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
5
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
163
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Dancer2::Plugin::Interchange6::Routes::Checkout - Checkout routes for Interchange6 Shop Machine |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This route isn't active by default and B<not recommended>. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 FUNCTIONS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 checkout_route |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Returns the checkout route based on the passed routes configuration. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub checkout_route { |
23
|
1
|
|
|
1
|
1
|
1
|
my $plugin = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return sub { |
26
|
2
|
|
|
2
|
|
342
|
my $app = shift; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# add stuff useful for cart display |
29
|
2
|
|
|
|
|
72
|
my $cart = $plugin->shop_cart; |
30
|
2
|
|
|
|
|
36
|
my $values = { |
31
|
|
|
|
|
|
|
cart_subtotal => $cart->subtotal, |
32
|
|
|
|
|
|
|
cart_total => $cart->total, |
33
|
|
|
|
|
|
|
cart => $cart->products, |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# call before_checkout_display route so template tokens |
37
|
|
|
|
|
|
|
# can be injected |
38
|
2
|
|
|
|
|
13412
|
$app->execute_hook( 'plugin.interchange6.before_checkout_display', |
39
|
|
|
|
|
|
|
$values ); |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
1630
|
$app->template( $plugin->checkout_template, $values ); |
42
|
1
|
|
|
|
|
5
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |