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

Restructure folders for logging and webhooks #1059

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ src/cartridges/app_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA5
src/cartridges/app_adyen_SFRA/cartridge/client/default/js/checkout/checkoutSFRA6.js
src/cartridges/int_adyen_SFRA/cartridge/controllers/middlewares/checkout_services/placeOrder.js
src/cartridges/int_adyen_SFRA/cartridge/scripts
src/cartridges/int_adyen_SFRA/cartridge/adyen/

# Test files
src/cartridges/int_adyen_SFRA/test
Expand Down
4 changes: 2 additions & 2 deletions jest/sfccCartridgeMocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ jest.mock('*/cartridge/scripts/adyenZeroAuth', () => {
};
}, {virtual: true});

jest.mock('*/cartridge/scripts/checkNotificationAuth', () => {
jest.mock('*/cartridge/adyen/webhooks/checkNotificationAuth', () => {
return {
check: jest.fn(() => true),
validateHmacSignature: jest.fn(() => true),
};
}, {virtual: true});

jest.mock('*/cartridge/scripts/handleNotify', () => {
jest.mock('*/cartridge/adyen/webhooks/handleNotify', () => {
return {
notify: jest.fn(() => ({ success: true }))
};
Expand Down
8 changes: 4 additions & 4 deletions jest/sfccPathSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jest.mock('*/cartridge/controllers/middlewares/adyen/paymentsDetails', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/controllers/middlewares/adyen/paymentsDetails');
}, {virtual: true});

jest.mock('*/cartridge/controllers/middlewares/adyen/notify', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/controllers/middlewares/adyen/notify');
jest.mock('*/cartridge/adyen/webhooks/notify', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/adyen/webhooks/notify');
}, {virtual: true});

jest.mock('*/cartridge/controllers/middlewares/adyen/paymentFromComponent', () => {
Expand Down Expand Up @@ -250,8 +250,8 @@ jest.mock('*/cartridge/scripts/adyenLevelTwoThreeData', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/scripts/adyenLevelTwoThreeData');
}, {virtual: true});

jest.mock('*/cartridge/scripts/adyenCustomLogs', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/scripts/adyenCustomLogs');
jest.mock('*/cartridge/adyen/logs/adyenCustomLogs', () => {
return require('../src/cartridges/int_adyen_SFRA/cartridge/adyen/logs/adyenCustomLogs');
}, {virtual: true});

jest.mock('*/cartridge/scripts/util/giftCardsHelper', () => {
Expand Down
4 changes: 2 additions & 2 deletions metadata/site_import/jobs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<step step-id="Process" type="ExecuteScriptModule" enforce-restart="false">
<description/>
<parameters>
<parameter name="ExecuteScriptModule.Module">int_adyen_SFRA/cartridge/scripts/job/notifications.js</parameter>
<parameter name="ExecuteScriptModule.Module">int_adyen_SFRA/cartridge/adyen/webhooks/job/notifications.js</parameter>
<parameter name="ExecuteScriptModule.FunctionName">processNotifications</parameter>
<parameter name="ExecuteScriptModule.Transactional">false</parameter>
<parameter name="ExecuteScriptModule.TimeoutInSeconds">3600</parameter>
Expand All @@ -21,7 +21,7 @@
<step step-id="Clean" type="ExecuteScriptModule" enforce-restart="false">
<description/>
<parameters>
<parameter name="ExecuteScriptModule.Module">int_adyen_SFRA/cartridge/scripts/job/notifications.js</parameter>
<parameter name="ExecuteScriptModule.Module">int_adyen_SFRA/cartridge/adyen/webhooks/job/notifications.js</parameter>
<parameter name="ExecuteScriptModule.FunctionName">clearNotifications</parameter>
<parameter name="ExecuteScriptModule.Transactional">false</parameter>
<parameter name="ExecuteScriptModule.TimeoutInSeconds">3600</parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const csrfProtection = require('*/cartridge/scripts/middleware/csrf');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

server.get('Start', csrfProtection.generateToken, (_req, res, next) => {
res.render('adyenSettings/settings');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* Script used to authentication notification calls from Adyen
*/
const Site = require('dw/system/Site');
const AuthenticationUtils = require('*/cartridge/scripts/libs/libAuthenticationUtils');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AuthenticationUtils = require('*/cartridge/adyen/webhooks/libs/libAuthenticationUtils');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function check(request) {
const baUser = Site.getCurrent().getCustomPreferenceValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
const CustomObjectMgr = require('dw/object/CustomObjectMgr');

//script include
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function execute(args) {
return handle(args.orderID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Order = require('dw/order/Order');
//script includes
const constants = require('*/cartridge/adyenConstants/constants');
const adyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function execute(args) {
const result = handle(args.CustomObj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
const Calendar = require('dw/util/Calendar');
const StringUtils = require('dw/util/StringUtils');
const CustomObjectMgr = require('dw/object/CustomObjectMgr');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function execute(args) {
return notifyHttpParameterMap(args.CurrentHttpParameterMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Transaction = require('dw/system/Transaction');
const CustomObjectMgr = require('dw/object/CustomObjectMgr');

//script includes
const AdyenLogs = require('../adyenCustomLogs');
const AdyenLogs = require('../../logs/adyenCustomLogs');

function execute() {
processNotifications();
Expand All @@ -38,7 +38,7 @@ function execute() {
* to be processed and handle them to place or fail order
*/
function processNotifications(/* pdict */) {
const objectsHandler = require('*/cartridge/scripts/handleCustomObject');
const objectsHandler = require('*/cartridge/adyen/webhooks/handleCustomObject');
const searchQuery = CustomObjectMgr.queryCustomObjects(
'adyenNotification',
"custom.updateStatus = 'PROCESS'",
Expand Down Expand Up @@ -107,7 +107,7 @@ function processNotifications(/* pdict */) {
* cleanNotifications
*/
function clearNotifications(/* pdict */) {
const deleteCustomObjects = require('*/cartridge/scripts/deleteCustomObjects');
const deleteCustomObjects = require('*/cartridge/adyen/webhooks/deleteCustomObjects');
const searchQuery = CustomObjectMgr.queryCustomObjects(
'adyenNotification',
"custom.processedStatus = 'SUCCESS'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Encoding = require('dw/crypto/Encoding');
const Mac = require('dw/crypto/Mac');
const Bytes = require('dw/util/Bytes');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Transaction = require('dw/system/Transaction');
const checkAuth = require('*/cartridge/scripts/checkNotificationAuth');
const handleNotify = require('*/cartridge/scripts/handleNotify');
const checkAuth = require('*/cartridge/adyen/webhooks/checkNotificationAuth');
const handleNotify = require('*/cartridge/adyen/webhooks/handleNotify');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ afterEach(() => {

describe('Notify', () => {
it('should render error when status is falsy', () => {
const checkAuth = require('*/cartridge/scripts/checkNotificationAuth');
const checkAuth = require('*/cartridge/adyen/webhooks/checkNotificationAuth');
checkAuth.check.mockImplementation(() => false);
notify(req, res, jest.fn());
expect(res.render).toHaveBeenCalledWith('/adyen/error');
});
it('should render notify when notification result is successful', () => {
const handleNotify = require('*/cartridge/scripts/handleNotify');
const handleNotify = require('*/cartridge/adyen/webhooks/handleNotify');
handleNotify.notify.mockImplementation(() => ({ success: true }));
notify(req, res, jest.fn());
expect(res.render).toHaveBeenCalledWith('/notify');
});
it('should render notifyError when notification result is not successful', () => {
const handleNotify = require('*/cartridge/scripts/handleNotify');
const handleNotify = require('*/cartridge/adyen/webhooks/handleNotify');
handleNotify.notify.mockImplementation(() => ({
success: false,
errorMessage: 'mocked_error_message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const collections = require('*/cartridge/scripts/util/collections');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const { clearForms } = require('*/cartridge/controllers/utils/index');

function cancelPartialPaymentOrder(req, res, next) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function getFormattedProperties(checkBalanceResponse, orderAmount) {
if (checkBalanceResponse.resultCode === 'Success') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const BasketMgr = require('dw/order/BasketMgr');
const Money = require('dw/value/Money');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const { clearForms } = require('*/cartridge/controllers/utils/index');

function fetchGiftCards(req, res, next) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const adyenTerminalApi = require('*/cartridge/scripts/adyenTerminalApi');
const paymentMethodDescriptions = require('*/cartridge/adyenConstants/paymentMethodDescriptions');
const constants = require('*/cartridge/adyenConstants/constants');
const getPaymentMethods = require('*/cartridge/scripts/adyenGetPaymentMethods');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function getCountryCode(currentBasket, locale) {
const countryCode = Locale.getLocale(locale.id).country;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const showConfirmation = require('*/cartridge/controllers/middlewares/adyen/showConfirmation');
const paymentFromComponent = require('*/cartridge/controllers/middlewares/adyen/paymentFromComponent');
const notify = require('*/cartridge/controllers/middlewares/adyen/notify');
const notify = require('*/cartridge/adyen/webhooks/notify');
const showConfirmationPaymentFromComponent = require('*/cartridge/controllers/middlewares/adyen/showConfirmationPaymentFromComponent');
const paymentsDetails = require('*/cartridge/controllers/middlewares/adyen/paymentsDetails');
const redirect3ds1Response = require('*/cartridge/controllers/middlewares/adyen/redirect3ds1Response');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Resource = require('dw/web/Resource');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const constants = require('*/cartridge/adyenConstants/constants');

function responseContainsErrors(response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function addMinutes(minutes) {
const date = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const COHelpers = require('*/cartridge/scripts/checkout/checkoutHelpers');
const constants = require('*/cartridge/adyenConstants/constants');
const collections = require('*/cartridge/scripts/util/collections');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const GiftCardsHelper = require('*/cartridge/scripts/util/giftCardsHelper');

const expressMethods = ['applepay', 'amazonpay'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const OrderMgr = require('dw/order/OrderMgr');
const Transaction = require('dw/system/Transaction');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function getSignature(paymentsDetailsResponse, orderToken) {
const order = OrderMgr.getOrder(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const URLUtils = require('dw/web/URLUtils');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

/*
* Redirects to list of added cards on success. Otherwise redirects to add payment with error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const URLUtils = require('dw/web/URLUtils');
const Transaction = require('dw/system/Transaction');
const BasketMgr = require('dw/order/BasketMgr');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');

function setBillingAndShippingAddress(currentBasket) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const BasketMgr = require('dw/order/BasketMgr');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const constants = require('*/cartridge/adyenConstants/constants');
const payment = require('*/cartridge/controllers/middlewares/adyen/showConfirmation/payment');
const { clearForms } = require('*/cartridge/controllers/utils/index');
const handleAuthorised = require('*/cartridge/controllers/middlewares/adyen/showConfirmation/authorise');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');

function getPaymentDetailsPayload(querystring) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const OrderMgr = require('dw/order/OrderMgr');
const URLUtils = require('dw/web/URLUtils');
const handlePayment = require('*/cartridge/controllers/middlewares/adyen/showConfirmationPaymentFromComponent/payment');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

/*
* Show confirmation for payments completed from component directly e.g. paypal, QRcode, ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const { clearForms } = require('*/cartridge/controllers/utils/index');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function handlePaymentError(order, adyenPaymentInstrument, { res, next }) {
clearForms.clearAdyenData(adyenPaymentInstrument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const URLUtils = require('dw/web/URLUtils');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const { updateSavedCards } = require('*/cartridge/scripts/updateSavedCards');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function shouldRestoreBasket(cachedOrderNumber) {
// restore cart if order number was cached
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RiskDataHelper = require('*/cartridge/scripts/util/riskDataHelper');
const AdyenGetOpenInvoiceData = require('*/cartridge/scripts/adyenGetOpenInvoiceData');
const adyenLevelTwoThreeData = require('*/cartridge/scripts/adyenLevelTwoThreeData');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function createPaymentRequest(args) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function deleteRecurringPayment(args) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const blockedPayments = require('*/cartridge/scripts/config/blockedPaymentMethods.json');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function getMethods(basket, customer, countryCode) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Transaction = require('dw/system/Transaction');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function donate(donationReference, donationAmount, orderToken) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Order = require('dw/order/Order');
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const AdyenConfigs = require('*/cartridge/scripts/util/adyenConfigs');
const constants = require('*/cartridge/adyenConstants/constants');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');

function getTerminals() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const URLUtils = require('dw/web/URLUtils');
/* Script Modules */
const AdyenHelper = require('*/cartridge/scripts/util/adyenHelper');
const adyenCheckout = require('*/cartridge/scripts/adyenCheckout');
const AdyenLogs = require('*/cartridge/scripts/adyenCustomLogs');
const AdyenLogs = require('*/cartridge/adyen/logs/adyenCustomLogs');
const constants = require('*/cartridge/adyenConstants/constants');

function zeroAuthPayment(customer, paymentInstrument) {
Expand Down
Loading
Loading