@@ 495,7 495,7 @@ class JmpPay < Roda
body[:currency] = params["currency"]
body[:order_at] = Time.now.strftime("%Y-%m-%d %H:%m:%S")
body[:order_id] = sale_result.transaction.id
- body[:name] = "Customer"
+ body[:name] = "#{params['given-name']} #{params['family-name']}"
body[:city] = postal_lookup["results"].values.first.first["city"]
body[:province_code] = postal_lookup["results"].values.first.first["state_code"]
req.body = body.to_json
@@ 508,7 508,7 @@ class JmpPay < Roda
end
r.get do
- view :esim_adapter, locals: { antifraud: atfd }
+ view :esim_adapter, locals: { antifraud: atfd, ip: request.ip }
end
end
@@ 117,6 117,14 @@ section data-hx-get="/esim-adapter/total" data-hx-trigger="input delay:1s,change
div Email Address
input.ts-control type="email" name="email" required=true
+ label.half
+ div Cardholder Given Name
+ input.ts-control type="text" name="given-name" required=true
+
+ label.half
+ div Cardholder Surname
+ input.ts-control type="text" name="family-name" required=true
+
.htmx-indicator
.lds-ring <div></div><div></div><div></div><div></div></div>
#total
@@ 138,7 146,7 @@ javascript:
if(window.localStorage) {
var atfd = localStorage.getItem("atfd");
if(!atfd) {
- atfd = "#{antifraud}";
+ atfd = #{{antifraud.to_json}};
localStorage.setItem("atfd", atfd);
}
document.querySelector("input[name=atfd]").value = atfd;
@@ 155,11 163,21 @@ javascript:
braintreeInstance.requestPaymentMethod({
threeDSecure: {
- amount: document.querySelector("input[name=amount]").value,
+ amount: document.querySelector("*[name=amount]").value,
requireChallenge: true,
challengeRequested: true,
collectDeviceData: true,
- email: document.querySelector("input[name=email]").value
+ email: document.querySelector("*[name=email]").value,
+ billingAddress: {
+ givenName: document.querySelector("*[name=given-name]").value,
+ surname: document.querySelector("*[name=family-name]").value,
+ postalCode: document.querySelector("*[name=postal-code]").value,
+ streetAddress: document.querySelector("*[name=street-address]").value,
+ countryCodeAlpha2: document.querySelector("*[name=country-name]").value
+ },
+ additionalInformation: {
+ ipAddress: #{{@ip.to_json}}
+ }
}
}, function(err, payload) {
if(err) {