Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/mrt deploy #33

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion adyen/components/helpers/baseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const onSubmit = async (state, component, props) => {
if (!state.isValid) {
throw new Error('invalid state')
}
// await props.submitBilling()
const adyenPaymentService = new AdyenPaymentsService(props?.token)
const paymentsResponse = await adyenPaymentService.submitPayment(
state.data,
Expand Down
3 changes: 2 additions & 1 deletion overrides/app/pages/checkout/partials/payment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const Payment = () => {
</Box>

<Stack spacing={6}>
<AdyenCheckout beforeSubmit={[onBillingSubmit]} />
<AdyenCheckout beforeSubmit={[onBillingSubmit]} onError={showError} />

<Divider borderColor="gray.100" />

Expand Down Expand Up @@ -182,6 +182,7 @@ const Payment = () => {
<ShippingAddressSelection
form={billingAddressForm}
selectedAddress={selectedBillingAddress}
hideSubmitButton
/>
)}
</Stack>
Expand Down
82 changes: 41 additions & 41 deletions overrides/app/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import PaymentsDetailsController from '../../adyen/controllers/payments-details'
import PaymentsController from '../../adyen/controllers/payments'
import {
authenticate,
validateHmac,
errorHandler,
handleWebhook
handleWebhook,
validateHmac
} from '../../adyen/controllers/webhook'

const options = {
Expand All @@ -45,45 +45,45 @@ const {handler} = runtime.createHandler(options, (app) => {
app.use(bodyParser.json())

// Set HTTP security headers
// app.use(
// helmet({
// contentSecurityPolicy: {
// useDefaults: true,
// directives: {
// 'img-src': [
// "'self'",
// '*.commercecloud.salesforce.com',
// 'data:',
// '*.adyen.com',
// '*.paypal.com',
// 'https://www.paypalobjects.com/js-sdk-logos/2.2.7/paypal-blue.svg'
// ],
// 'script-src': [
// "'self'",
// "'unsafe-eval'",
// 'storage.googleapis.com',
// '*.paypal.com',
// 'https://x.klarnacdn.net/kp/lib/v1/api.js',
// 'https://static-eu.payments-amazon.com/checkout.js',
// 'https://sandbox.src.mastercard.com/sdk/srcsdk.mastercard.js',
// 'https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visa-sdk.js?v2',
// 'https://pay.google.com/gp/p/js/pay.js'
// ],
// 'connect-src': [
// "'self'",
// 'api.cquotient.com',
// '*.adyen.com',
// 'https://www.sandbox.paypal.com/xoplatform/logger/api/logger?disableSetCookie=true'
// ],
// 'frame-src': ["'self'", '*.adyen.com', '*.paypal.com'],
//
// // Do not upgrade insecure requests for local development
// 'upgrade-insecure-requests': isRemote() ? [] : null
// }
// },
// hsts: isRemote()
// })
// )
app.use(
helmet({
contentSecurityPolicy: {
useDefaults: true,
directives: {
'img-src': [
"'self'",
'*.commercecloud.salesforce.com',
'data:',
'*.adyen.com',
'*.paypal.com',
'https://www.paypalobjects.com/js-sdk-logos/2.2.7/paypal-blue.svg'
],
'script-src': [
"'self'",
"'unsafe-eval'",
'storage.googleapis.com',
'*.paypal.com',
'https://x.klarnacdn.net/kp/lib/v1/api.js',
'https://static-eu.payments-amazon.com/checkout.js',
'https://sandbox.src.mastercard.com/sdk/srcsdk.mastercard.js',
'https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/src-i-adapter/visa-sdk.js?v2',
'https://pay.google.com/gp/p/js/pay.js'
],
'connect-src': [
"'self'",
'api.cquotient.com',
'*.adyen.com',
'https://www.sandbox.paypal.com/xoplatform/logger/api/logger?disableSetCookie=true'
],
'frame-src': ["'self'", '*.adyen.com', '*.paypal.com'],

// Do not upgrade insecure requests for local development
'upgrade-insecure-requests': isRemote() ? [] : null
}
},
hsts: isRemote()
})
)

// Handle the redirect from SLAS as to avoid error
app.get('/callback?*', (req, res) => {
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* eslint-disable @typescript-eslint/no-var-requires */
var config = require('@salesforce/pwa-kit-dev/configs/webpack/config')
var configNames = require('@salesforce/pwa-kit-dev/configs/webpack/config-names')
const {isRemote} = require('@salesforce/pwa-kit-runtime/utils/ssr-server')

module.exports = config.map((configItem) => {
if (configItem.name === configNames.CLIENT || configItem.name === configNames.SERVER) {
return {
...configItem,
devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false,
devtool: isRemote() ? false : 'source-map',
module: {
...configItem.module,
rules: [
Expand Down