Skip to content

Commit

Permalink
add request to error response for apple pay validate
Browse files Browse the repository at this point in the history
  • Loading branch information
elizalucas committed Mar 22, 2022
1 parent a2a042b commit d47b213
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions server-middleware/apiApplePay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,24 @@ app.post('/validate', (req, res) => {
? payfacMerchantIdentityKey
: partnershipMerchantIdentityKey, // key apple
})
const requestData = {
merchantIdentifier:
merchantType === 'PayFac' ? payfacMerchantId : partnershipMerchantId,
domainName,
displayName: DISPLAY_NAME,
}
axios
.post(
appleUrl,
{
merchantIdentifier:
merchantType === 'PayFac'
? payfacMerchantId
: partnershipMerchantId,
domainName,
displayName: DISPLAY_NAME,
},
{
httpsAgent,
}
)
.post(appleUrl, requestData, {
httpsAgent,
})
.then((a) => {
// return the json received from Apple Pay server unmodified
res.send(a.data)
})
.catch((a) => {
res.send({
message: a.message,
errorMessage: a.message,
request: requestData,
responseStatus: a.response.status,
responseData: a.response.data,
responseHeaders: a.response.headers,
Expand Down

0 comments on commit d47b213

Please sign in to comment.