Skip to content

Commit

Permalink
Response key change integrated (#47)
Browse files Browse the repository at this point in the history
* Response key change integrated

* version change
  • Loading branch information
divyanshusinghh authored Oct 25, 2024
1 parent 1852858 commit fa7c616
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>com.fynd</groupId>
<artifactId>fynd-extension-java</artifactId>
<version>0.6.5</version>
<version>0.6.6</version>
<name>fynd-extension-java</name>
<description>Java Fynd Extension Library</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.fynd.extension.model.webhookmodel;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BroadcasterConfig {

@JsonProperty("topic")
private String topic;

@JsonProperty("queue")
private String queue;

@JsonProperty("workflow_name")
private String workflowName;

@JsonProperty("event_bridge_name")
private String eventBridgeName;

@JsonProperty("created_on")
private String createdOn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ public class SubscriberEventMapping{
private Double subscriberId;




@JsonProperty("topic")
private String topic;




@JsonProperty("created_on")
private String createdOn;


@JsonProperty("broadcaster_config")
private BroadcasterConfig BroadcasterConfig;



}
6 changes: 3 additions & 3 deletions src/main/java/com/fynd/extension/service/WebhookService.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ private boolean isEventDiff(SubscriberResponse existingEvents,
.filter(e -> event.getSlug().equals(e.getEventCategory() + "/" + e.getEventName() + "/" + e.getEventType() + "/v" + e.getVersion()))
.findFirst()
.orElse(null);
if (existingEvent != null && !event.getTopic().equals(existingEvent.getSubscriberEventMapping().getTopic())) {
if (existingEvent != null && !event.getTopic().equals(existingEvent.getSubscriberEventMapping().getBroadcasterConfig().getTopic())) {
return true; // Topics do not match
}
}
Expand Down Expand Up @@ -579,7 +579,7 @@ public void disableSalesChannelWebhook(PlatformClient platformClient, String app
Events event = new Events();
event.setSlug(eventConfig.getEventCategory() + "/" + eventConfig.getEventName() + "/" + eventConfig.getEventType() + "/v" + eventConfig.getVersion());
if(configType.equals("kafka")){
event.setTopic(eventConfig.getSubscriberEventMapping().getTopic());
event.setTopic(eventConfig.getSubscriberEventMapping().getBroadcasterConfig().getTopic());
}
events.add(event);
});
Expand Down Expand Up @@ -642,7 +642,7 @@ public void enableSalesChannelWebhook(PlatformClient platformClient, String appl
Events event = new Events();
event.setSlug(eventConfig.getEventCategory() + "/" + eventConfig.getEventName() + "/" + eventConfig.getEventType() + "/v" + eventConfig.getVersion());
if(configType.equals("kafka")){
event.setTopic(eventConfig.getSubscriberEventMapping().getTopic());
event.setTopic(eventConfig.getSubscriberEventMapping().getBroadcasterConfig().getTopic());
}
events.add(event);
});
Expand Down

0 comments on commit fa7c616

Please sign in to comment.