forked from openedx-unsupported/frontend-app-payment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-apple-merchant-file.js
26 lines (22 loc) · 1 KB
/
create-apple-merchant-file.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require('fs');
const path = require('path');
// Write our apple pay merchant thing
const fileName = 'apple-developer-merchantid-domain-association.txt';
const outputDirectory = path.resolve(__dirname, 'dist', '.well-known');
let fileContents;
if (process.env.APPLE_DEVELOPER_MERCHANT_ID_DOMAIN_ASSOCIATION) {
// Replace spaces with newlines for apple verification file because
// build config values can't have newlines in them. We use spaces
// to represent newlines instead.
fileContents = process.env.APPLE_DEVELOPER_MERCHANT_ID_DOMAIN_ASSOCIATION.replace(/ /g, '\n');
} else {
fileContents = `
No domain association file was supplied. \n\n
For more information on setting up Apple Pay, see: \n
https://developer.apple.com/documentation/apple_pay_on_the_web/configuring_your_environment
or \n
https://developer.apple.com/documentation/apple_pay_on_the_web/maintaining_your_environment
`;
}
fs.mkdirSync(outputDirectory);
fs.writeFileSync(path.resolve(outputDirectory, fileName), fileContents);