Skip to content

Commit

Permalink
Merge pull request #10 from skumaravelayutham/plchanges
Browse files Browse the repository at this point in the history
Enhance existing event-notification-nodejs-sdk to support new topic:PRIORITY_LISTING_REVISION
  • Loading branch information
skumaravelayutham authored Jun 15, 2023
2 parents 8ac2870 + 7bf6af5 commit feaf337
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ module.exports = {
NOTIFICATION_API_ENDPOINT_SANDBOX: 'https://api.sandbox.ebay.com/commerce/notification/v1/public_key/',
SHA256: 'sha256',
TOPICS: {
MARKETPLACE_ACCOUNT_DELETION: 'MARKETPLACE_ACCOUNT_DELETION'
MARKETPLACE_ACCOUNT_DELETION: 'MARKETPLACE_ACCOUNT_DELETION',
PRIORITY_LISTING_REVISION: 'PRIORITY_LISTING_REVISION'
},
X_EBAY_SIGNATURE: 'x-ebay-signature'
};
31 changes: 31 additions & 0 deletions lib/processor/priorityListingRevisionMessageProcessor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* *
* * Copyright 2023 eBay Inc.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *
*/

'use strict';

/**
* Process the message
*
* @param {JSON} message
*/
const processInternal = (message) => {
const data = message.notification.data;
console.log(`\n==========================\PriorityListingRevision Date :` + JSON.stringify(data, null, 2))
};

module.exports = { process: processInternal };
3 changes: 3 additions & 0 deletions lib/processor/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

const topics = require('../constants').TOPICS;
const accountDeletionMessageProcessor = require('./accountDeletionMessageProcessor');
const priorityListingRevisionMessageProcessor = require('./priorityListingRevisionMessageProcessor');

/**
* Get the Processor for the given topic
Expand All @@ -30,6 +31,8 @@ const getProcessor = (topic) => {
switch (topic) {
case topics.MARKETPLACE_ACCOUNT_DELETION:
return accountDeletionMessageProcessor;
case topics.PRIORITY_LISTING_REVISION:
return priorityListingRevisionMessageProcessor;
default:
// eslint-disable-next-line no-throw-literal
throw `Message processor not registered for: ${topic}`;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "event-notification-nodejs-sdk",
"version": "1.0.2",
"version": "1.0.3",
"description": "A NodeJS SDK for processing eBay event notifications",
"main": "lib/index.js",
"repository": {
Expand Down

0 comments on commit feaf337

Please sign in to comment.