Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/components/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,34 @@ export async function createSubscription({
return response;
}

export async function createAppStoreSubscription({
secretKey,
customerId,
planId,
receipt,
}) {
const response = await server.loadJson(
`${
Config.apiUrl
}${Endpoints.PROJECT.PAYMENTS.SUBSCRIPTIONS.CREATE_APP_STORE(customerId)}`,
{
method: 'POST',
headers: {
'X-CM-ProjectId': Config.projectId,
Authorization: `Bearer ${secretKey || Config.secretKey}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
planId,
receipt,
}),
}
);

return response;
}

export async function updateSubscription({
secretKey,
id,
Expand Down
8 changes: 2 additions & 6 deletions src/components/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ export async function updateDevice({
return response;
}

export async function updateDeviceUser({
secretKey,
idOrKey,
userId,
}) {
export async function updateDeviceUser({secretKey, idOrKey, userId}) {
const response = await server.loadJson(
`${Config.apiUrl}${Endpoints.PROJECT.NOTIFICATIONS.PUSH.UPDATE_DEVICE_USER(
idOrKey
Expand All @@ -175,7 +171,7 @@ export async function updateDeviceUser({
'Content-Type': 'application/json',
},
body: JSON.stringify({
userId
userId,
}),
}
);
Expand Down
2 changes: 2 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export const CONFIG = {
SUBSCRIPTIONS: {
CREATE: (customerId) =>
`/v2/payments/customers/${customerId}/subscriptions`,
CREATE_APP_STORE: (customerId) =>
`/v2/payments/customers/${customerId}/subscriptions/apple`,
UPDATE: (customerId, id) =>
`/v2/payments/customers/${customerId}/subscriptions/${id}`,
CHANGE: (customerId, id) =>
Expand Down