-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4389 from alphagov/PP-12416_card-payment-non-moto
PP-12416: Card Payment page
- Loading branch information
Showing
21 changed files
with
308 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/controllers/simplified-account/settings/card-payments/card-payments.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { response } = require('@utils/response') | ||
const formatSimplifiedAccountPathsFor = require('@utils/simplified-account/format/format-simplified-account-paths-for') | ||
const paths = require('@root/paths') | ||
|
||
const GB_COUNTRY_CODE = 'GB' | ||
|
||
function get (req, res) { | ||
const serviceExternalId = req.service.externalId | ||
const accountType = req.account.type | ||
const cardPaymentsPaths = paths.simplifiedAccount.settings.cardPayments | ||
|
||
const billing = req.service.collectBillingAddress | ||
const country = req.service.defaultBillingAddressCountry === GB_COUNTRY_CODE ? 'United Kingdom' : req.service.defaultBillingAddressCountry | ||
const raw = req.account?.rawResponse | ||
const applePay = raw?.allow_apple_pay | ||
const googlePay = raw?.allow_google_pay | ||
|
||
response(req, res, 'simplified-account/settings/card-payments/index', { | ||
collectBillingAddressEnabled: billing, | ||
collectBillingAddressLink: formatSimplifiedAccountPathsFor(cardPaymentsPaths.collectBillingAddress, serviceExternalId, accountType), | ||
defaultBillingAddressCountry: country, | ||
defaultBillingAddressCountryLink: formatSimplifiedAccountPathsFor(cardPaymentsPaths.defaultBillingAddressCountry, serviceExternalId, accountType), | ||
applePayEnabled: applePay, | ||
applePayAddressLink: formatSimplifiedAccountPathsFor(cardPaymentsPaths.applePay, serviceExternalId, accountType), | ||
googlePayEnabled: googlePay, | ||
googlePayAddressLink: formatSimplifiedAccountPathsFor(cardPaymentsPaths.googlePay, serviceExternalId, accountType) | ||
}) | ||
} | ||
|
||
module.exports = { | ||
get | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const boolToText = (input, trueText, falseText) => { | ||
return input === true ? trueText : falseText | ||
} | ||
|
||
module.exports = { | ||
boolToText, | ||
boolToOnOrOff: (input) => boolToText(input, 'On', 'Off') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
app/views/simplified-account/settings/card-payments/index.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{% extends "../settings-layout.njk" %} | ||
|
||
{% block settingsPageTitle %} | ||
Card payments | ||
{% endblock %} | ||
|
||
{% block settingsContent %} | ||
<h1 class="govuk-heading-l">Card payments</h1> | ||
<p class="govuk-body">GOV.UK Pay uses 3D Secure for all card payments. 3D Secure (3DS) adds an extra layer of | ||
authentication to user payments.</p> | ||
|
||
|
||
{{ govukSummaryList({ | ||
classes: "govuk-!-margin-bottom-9", | ||
rows: [ | ||
{ | ||
key: { | ||
text: "Collect billing address" | ||
}, | ||
value: { | ||
text: collectBillingAddressEnabled | boolToOnOrOff | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: collectBillingAddressLink, | ||
text: "Change", | ||
classes: "govuk-link--no-visited-state", | ||
visuallyHiddenText: "collect billing address" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
key: { | ||
text: "Default billing address country" | ||
}, | ||
value: { | ||
text: defaultBillingAddressCountry | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: defaultBillingAddressCountryLink, | ||
text: "Change", | ||
classes: "govuk-link--no-visited-state", | ||
visuallyHiddenText: "default billing address country" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}) }} | ||
<h3 class="govuk-heading-m">Digital wallets</h3> | ||
<p class="govuk-body">Let users pay with Apple Pay and Google Pay.</p> | ||
|
||
|
||
{{ govukSummaryList({ | ||
classes: "govuk-!-margin-bottom-9", | ||
rows: [ | ||
{ | ||
key: { | ||
text: "Apple Pay" | ||
}, | ||
value: { | ||
text: applePayEnabled | boolToOnOrOff | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: applePayAddressLink, | ||
text: "Change", | ||
classes: "govuk-link--no-visited-state", | ||
visuallyHiddenText: "Apple Pay" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
key: { | ||
text: "Google Pay" | ||
}, | ||
value: { | ||
text: googlePayEnabled | boolToOnOrOff | ||
}, | ||
actions: { | ||
items: [ | ||
{ | ||
href: googlePayAddressLink, | ||
text: "Change", | ||
classes: "govuk-link--no-visited-state", | ||
visuallyHiddenText: "Google Pay" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}) }} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.