Email integration with PEC and MAILGUN services using api call.

This commit is contained in:
piyuskag
2024-10-30 17:39:42 +05:30
parent ccfedad967
commit 51e4b7a08c
19 changed files with 394 additions and 112 deletions

View File

@@ -0,0 +1,24 @@
package net.gepafin.tendermanagement.service.feignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = "mailgunClient", url = "${mailGun_base_url}")
public interface MailgunFeignClient {
@PostMapping("/v3/{domain}/messages")
ResponseEntity<Void> sendEmail(
@PathVariable("domain") String domain,
@RequestParam("from") String from,
@RequestParam("to") List<String> to,
@RequestParam("subject") String subject,
@RequestParam("html") String htmlBody,
@RequestHeader("Authorization") String authorizationHeader);
}

View File

@@ -0,0 +1,17 @@
package net.gepafin.tendermanagement.service.feignClient;
import feign.Headers;
import net.gepafin.tendermanagement.model.request.PecEmailRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
@FeignClient(name = "pecClient", url = "${api.pecUrl}")
public interface PecFeignClient {
@PostMapping("/send")
ResponseEntity<Void> sendEmail(@RequestHeader("Authorization") String token,
@RequestBody PecEmailRequest emailRequest);
}