Skip to content

Commit

Permalink
Response status for mollie webhook and finish slack message
Browse files Browse the repository at this point in the history
  • Loading branch information
KjellBerlin committed Aug 30, 2024
1 parent 6c4f85f commit 1d41f1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.carbonara.core.payment

import com.carbonara.core.order.OrderService
import mu.KotlinLogging
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -11,12 +12,12 @@ class MolliePaymentWebhookController(
) {

// Potential dos attack endpoint, introduce rate limiting
// TODO: Add response status

@PostMapping("/mollie-payment-status", "application/x-www-form-urlencoded")
suspend fun handleMollieWebhook(requestBody: MollieWebhookRequestBody) {
@PostMapping("/mollie-payment-status", consumes = ["application/x-www-form-urlencoded"])
suspend fun handleMollieWebhook(requestBody: MollieWebhookRequestBody): ResponseEntity<Void> {
log.info("Webhook received for paymentId: {}", requestBody.id)
orderService.handleOrderPayment(requestBody.id)
return ResponseEntity.ok().build()
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ class SlackMessageService {
val response = slack.methods(slackToken).chatPostMessage { req -> req
.channel(slackChannel)
.blocks {
section {
markdownText("*New Order*")
}
/*
header {
plainText("New order")
}
*/
section {
fields {
markdownText("*Customer Name:*\n$customerName")
Expand Down

0 comments on commit 1d41f1f

Please sign in to comment.