-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path_klarna_credit.html.erb
34 lines (31 loc) · 1.3 KB
/
_klarna_credit.html.erb
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
<% param_prefix = "payment_source[#{payment_method.id}]" %>
<div class="klarna_credit_box" data-order-id="<%= @order.number %>" data-payment-method-id="<%= payment_method.id %>" data-preferred-payment-method="<%= payment_method.options[:payment_method] %>">
<div class="header">
<div class="logo">
<img src="https://cdn.klarna.com/1.0/shared/image/generic/logo/en_us/basic/white.png?width=80" width="80px">
</div>
</div>
<%= hidden_field_tag "#{param_prefix}[authorization_token]", "", {id: "klarna_authorization_token"} %>
<div class="klarna_error general_error flash error"><%= Spree.t('klarna.general_error') %></div>
<div class="klarna_error denied_error flash error"><%= Spree.t('klarna.denied_error') %></div>
<div id="klarna_container"></div>
</div>
<script type="text/javascript" id="klarna-credit-lib-x">
/* <![CDATA[ */
KlarnaGateway.loadSdk(this, document, function() {
jQuery(".klarna_credit_box").klarnaAuthorize({
onSubmit:function(settings) {
// Update the order when a coupon was applied in this step
if ($('#coupon_status').length > 0) {
Spree.ajax({
method: "POST",
url: settings.sessionUrl,
data: {klarna_payment_method_id: settings.paymentId},
async: false
})
}
}
});
});
/* ]]> */
</script>