Skip to content

Commit

Permalink
Include the webhook api version in the privacy compliance webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
karenxie committed Jul 31, 2024
1 parent d462d73 commit 578b5d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('privacy_compliance_webhooks', () => {
// Given
const object = {
webhooks: {
api_version: '2024-07',
subscriptions: [
{
compliance_topics: ['customers/redact', 'customers/data_request'],
Expand All @@ -53,6 +54,7 @@ describe('privacy_compliance_webhooks', () => {

// Then
expect(result).toMatchObject({
api_version: '2024-07',
customers_redact_url: 'https://example.com/customers_webhooks',
customers_data_request_url: 'https://example.com/customers_webhooks',
shop_redact_url: 'https://example.com/shop_webhooks',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,21 @@ function transformToPrivacyComplianceWebhooksModule(content: object, appConfigur
appUrl = (appConfiguration as CurrentAppConfiguration)?.application_url
}

return compact({
const urls = compact({
customers_redact_url: relativeUri(getCustomersDeletionUri(webhooks), appUrl),
customers_data_request_url: relativeUri(getCustomersDataRequestUri(webhooks), appUrl),
shop_redact_url: relativeUri(getShopDeletionUri(webhooks), appUrl),
})

if (Object.keys(urls).length === 0) {
return urls
} else {
const {api_version} = webhooks
return {
api_version,
...urls,
}
}
}

function transformFromPrivacyComplianceWebhooksModule(content: object, options?: {flags?: Flag[]}) {
Expand Down

0 comments on commit 578b5d2

Please sign in to comment.