pcp-server-nodejs-sdk
Version:
[](https://sonarcloud.io/summary/new_code?id=PAYONE-GmbH_PCP-server-nodeJS-SDK) [ {
super(config);
}
async createOrder(merchantId, commerceCaseId, checkoutId, payload) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
if (!commerceCaseId) {
throw new TypeError(COMMERCE_CASE_ID_REQUIRED_ERROR);
}
if (!checkoutId) {
throw new TypeError(CHECKOUT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/commerce-cases/${commerceCaseId}/checkouts/${checkoutId}/order`, this.getConfig().getHost());
const requestInit = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
}),
body: JSON.stringify(payload),
};
return this.makeApiCall(url.toString(), requestInit);
}
async deliverOrder(merchantId, commerceCaseId, checkoutId, payload) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
if (!commerceCaseId) {
throw new TypeError(COMMERCE_CASE_ID_REQUIRED_ERROR);
}
if (!checkoutId) {
throw new TypeError(CHECKOUT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/commerce-cases/${commerceCaseId}/checkouts/${checkoutId}/deliver`, this.getConfig().getHost());
const requestInit = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
}),
body: JSON.stringify(payload),
};
return this.makeApiCall(url.toString(), requestInit);
}
async returnOrder(merchantId, commerceCaseId, checkoutId, payload) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
if (!commerceCaseId) {
throw new TypeError(COMMERCE_CASE_ID_REQUIRED_ERROR);
}
if (!checkoutId) {
throw new TypeError(CHECKOUT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/commerce-cases/${commerceCaseId}/checkouts/${checkoutId}/return`, this.getConfig().getHost());
const requestInit = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
}),
body: JSON.stringify(payload),
};
return this.makeApiCall(url.toString(), requestInit);
}
async cancelOrder(merchantId, commerceCaseId, checkoutId, payload) {
if (!merchantId) {
throw new TypeError(MERCHANT_ID_REQUIRED_ERROR);
}
if (!commerceCaseId) {
throw new TypeError(COMMERCE_CASE_ID_REQUIRED_ERROR);
}
if (!checkoutId) {
throw new TypeError(CHECKOUT_ID_REQUIRED_ERROR);
}
const url = new URL(`/v1/${merchantId}/commerce-cases/${commerceCaseId}/checkouts/${checkoutId}/cancel`, this.getConfig().getHost());
const requestInit = {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/json',
}),
body: JSON.stringify(payload),
};
return this.makeApiCall(url.toString(), requestInit);
}
}
//# sourceMappingURL=OrderManagementCheckoutActionsApiClient.js.map