Skip to content

Bad error handling in Apple Pay processor #22

@moorena

Description

@moorena

if (!error) {
if (data.status !== 'AUTHORIZED' && data.status !== 'AUTHORIZED_PENDING_REVIEW') {
throw JSON.stringify(data);
}
result = data;
// eslint-disable-next-line no-undef
session.privacy.orderPaymentSuccessful = true;
} else {
throw JSON.stringify(data);
}

the two throws here are not the correct apple/salesforce way to handle the error.

This code should be updated to return a bad status response, something like:

                session.privacy.orderPaymentSuccessful = false;
                var status = new Status(Status.ERROR);
                status.addDetail(ApplePayHookResult.STATUS_REASON_DETAIL_KEY, ApplePayHookResult.REASON_FAILURE);
                return status;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions