Skip to content

Commit

Permalink
Merge pull request #4263 from Shopify/include-api-version-in-complian…
Browse files Browse the repository at this point in the history
…ce-webhooks

Include the webhook api version in the privacy compliance webhooks
  • Loading branch information
karenxie authored Aug 16, 2024
2 parents 7ce9d5b + 6e2f1fc commit ecf9b90
Show file tree
Hide file tree
Showing 2 changed files with 14 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,22 @@ 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 {
// eslint-disable-next-line @typescript-eslint/naming-convention
const {api_version} = webhooks
return {
api_version,
...urls,
}
}
}

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

0 comments on commit ecf9b90

Please sign in to comment.