Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#40 payment #49

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.hanghae.commerce.payment.adapter

import org.springframework.stereotype.Component

@Component
class ConsolePaymentGateway : PaymentGateway {

Check failure on line 7 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L7 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:7:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
override fun execute(totalPrice: Int, cardNumber: String?) {

Check failure on line 8 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L8 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:8:26: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 8 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L8 <standard:function-signature>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:8:43: error: Parameter should start on a newline (standard:function-signature)

Check failure on line 8 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L8 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:8:62: error: Newline expected before closing parenthesis (standard:function-signature)
println("결제 μ™„λ£Œ");

Check failure on line 9 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L9 <standard:no-semi>

Unnecessary semicolon
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:9:25: error: Unnecessary semicolon (standard:no-semi)
}

Check failure on line 11 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt#L11 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/ConsolePaymentGateway.kt:11:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.hanghae.commerce.payment.adapter

import com.hanghae.commerce.order.domain.Order
import com.hanghae.commerce.order.domain.OrderRepository
import com.hanghae.commerce.payment.application.port.PaymentPort
import com.hanghae.commerce.payment.domain.Payment
import com.hanghae.commerce.payment.domain.PaymentRepository
import org.springframework.stereotype.Component

@Component
class PaymentAdapter(

Check failure on line 11 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L11 <standard:indent>

Unexpected indentation (1) (should be 0)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:11:1: error: Unexpected indentation (1) (should be 0) (standard:indent)
private val paymentGateway: PaymentGateway,
private val paymentRepository: PaymentRepository,
private val orderRepository: OrderRepository,
) : PaymentPort {

Check failure on line 15 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L15 <standard:indent>

Unexpected indentation (1) (should be 0)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:15:1: error: Unexpected indentation (1) (should be 0) (standard:indent)

Check failure on line 16 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L16 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:16:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
override fun getOrder(orderId: String): Order? {

Check failure on line 17 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L17 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:17:1: error: Unexpected indentation (5) (should be 4) (standard:indent)
return orderRepository.findById(orderId)

Check failure on line 18 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L18 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:18:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
}

Check failure on line 19 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L19 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:19:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

override fun pay(totalPrice: Int, cardNumber: String?) {

Check failure on line 21 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L21 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:21:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

Check failure on line 21 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L21 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:21:23: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 21 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L21 <standard:function-signature>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:21:40: error: Parameter should start on a newline (standard:function-signature)

Check failure on line 21 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L21 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:21:59: error: Newline expected before closing parenthesis (standard:function-signature)
paymentGateway.execute(totalPrice, cardNumber);

Check failure on line 22 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L22 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:22:1: error: Unexpected indentation (9) (should be 8) (standard:indent)

Check failure on line 22 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L22 <standard:no-semi>

Unnecessary semicolon
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:22:56: error: Unnecessary semicolon (standard:no-semi)
}

Check failure on line 23 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L23 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:23:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

override fun save(payment: Payment?) {

Check failure on line 25 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L25 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:25:1: error: Unexpected indentation (5) (should be 4) (standard:indent)
payment?.let { paymentRepository.save(it) };

Check failure on line 26 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L26 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:26:1: error: Unexpected indentation (9) (should be 8) (standard:indent)

Check failure on line 26 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L26 <standard:no-semi>

Unnecessary semicolon
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:26:53: error: Unnecessary semicolon (standard:no-semi)
}

Check failure on line 27 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L27 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:27:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

Check failure on line 28 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L28 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:28:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}

Check failure on line 29 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt#L29 <standard:indent>

Unexpected indentation (1) (should be 0)
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentAdapter.kt:29:1: error: Unexpected indentation (1) (should be 0) (standard:indent)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.hanghae.commerce.payment.adapter

interface PaymentGateway {
fun execute(totalPrice: Int, cardNumber: String?)

Check failure on line 4 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt#L4 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt:4:17: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 4 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt#L4 <standard:function-signature>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt:4:34: error: Parameter should start on a newline (standard:function-signature)

Check failure on line 4 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt#L4 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/adapter/PaymentGateway.kt:4:53: error: Newline expected before closing parenthesis (standard:function-signature)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.hanghae.commerce.payment.application.port

import com.hanghae.commerce.order.domain.Order
import com.hanghae.commerce.payment.domain.Payment

interface PaymentPort {

Check failure on line 7 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt#L7 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt:7:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
fun getOrder(orderId: String): Order?

fun pay(totalPrice: Int, cardNumber: String?)

Check failure on line 10 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt#L10 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt:10:13: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 10 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt#L10 <standard:function-signature>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt:10:30: error: Parameter should start on a newline (standard:function-signature)

Check failure on line 10 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt#L10 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt:10:49: error: Newline expected before closing parenthesis (standard:function-signature)

fun save(payment: Payment?)

Check failure on line 13 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt#L13 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/port/PaymentPort.kt:13:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.hanghae.commerce.payment.application.service

import com.hanghae.commerce.order.domain.Order
import com.hanghae.commerce.payment.application.port.PaymentPort
import com.hanghae.commerce.payment.domain.Payment
import com.hanghae.commerce.payment.presentation.dto.PaymentRequest
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/payments")
class PaymentService(
private val paymentPort: PaymentPort,
) {

Check failure on line 20 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L20 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:20:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
@PostMapping
@Transactional
fun payment(@RequestBody request: PaymentRequest): ResponseEntity<Void?>? {

Check failure on line 23 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L23 <standard:parameter-list-wrapping>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:23:17: error: Parameter should start on a newline (standard:parameter-list-wrapping)

Check failure on line 23 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L23 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:23:17: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 23 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L23 <standard:parameter-list-wrapping>

Missing newline before ")"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:23:53: error: Missing newline before ")" (standard:parameter-list-wrapping)

Check failure on line 23 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L23 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:23:53: error: Newline expected before closing parenthesis (standard:function-signature)
val order: Order? = paymentPort.getOrder(request.orderId)

if (order != null) {
println("order >>>>" + order.id)
}

val payment = Payment.from(order, request.cardNumber)
paymentPort.pay(payment.getPrice(), payment.cardNumber)
paymentPort.save(payment)

return ResponseEntity.status(HttpStatus.OK).build<Void>()
}

Check failure on line 36 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt#L36 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/application/service/PaymentService.kt:36:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.hanghae.commerce.payment.domain

import com.hanghae.commerce.common.IdentifierConstants
import com.hanghae.commerce.order.domain.Order

class Payment(
val id: String = IdentifierConstants.NOT_YET_PERSISTED_ID,
val order: Order,
val cardNumber: String,
) {

Check failure on line 11 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt#L11 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt:11:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
companion object {
fun from(order: Order?, cardNumber: String): Payment {

Check failure on line 13 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt#L13 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt:13:18: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 13 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt#L13 <standard:function-signature>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt:13:33: error: Parameter should start on a newline (standard:function-signature)

Check failure on line 13 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt#L13 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt:13:51: error: Newline expected before closing parenthesis (standard:function-signature)
return Payment(
order = order!!,
cardNumber = cardNumber,
)
}
}

fun getPrice(): Int {
return order.paymentAmount
}

Check failure on line 24 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt#L24 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/Payment.kt:24:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hanghae.commerce.payment.domain

import org.springframework.stereotype.Repository

@Repository
interface PaymentRepository {

Check failure on line 7 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt#L7 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt:7:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
fun save(payment: Payment): String

Check failure on line 9 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt#L9 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/domain/PaymentRepository.kt:9:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.hanghae.commerce.payment.presentation.dto

import jakarta.validation.constraints.NotBlank

data class PaymentRequest(
@field: NotBlank(message = "μ£Όλ¬Έ IDλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")

Check failure on line 6 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt#L6 <standard:colon-spacing>

Unexpected spacing after ":"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt:6:11: error: Unexpected spacing after ":" (standard:colon-spacing)
val orderId: String,
@field: NotBlank(message = "μΉ΄λ“œ λ²ˆν˜ΈλŠ” ν•„μˆ˜μž…λ‹ˆλ‹€.")

Check failure on line 8 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt#L8 <standard:colon-spacing>

Unexpected spacing after ":"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt:8:11: error: Unexpected spacing after ":" (standard:colon-spacing)
val cardNumber: String

Check failure on line 9 in commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt#L9 <standard:trailing-comma-on-declaration-site>

Missing trailing comma before ")"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/payment/presentation/dto/PaymentRequest.kt:9:27: error: Missing trailing comma before ")" (standard:trailing-comma-on-declaration-site)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.hanghae.commerce.payment.application.service

import com.fasterxml.jackson.databind.ObjectMapper
import com.hanghae.commerce.order.domain.Order
import com.hanghae.commerce.order.domain.OrderItem
import com.hanghae.commerce.order.domain.OrderRepository
import com.hanghae.commerce.order.domain.OrderStatus
import com.hanghae.commerce.payment.presentation.dto.PaymentRequest
import com.hanghae.commerce.testconfiguration.IntegrationTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.ResultActions
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
import org.springframework.test.web.servlet.result.MockMvcResultHandlers
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@IntegrationTest
@DisplayName("결제 API ν…ŒμŠ€νŠΈ")
class PaymentServiceTest(
@Autowired var orderRepository: OrderRepository,
) {

Check failure on line 25 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L25 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:25:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
@Autowired
lateinit var objectMapper: ObjectMapper

@Autowired
lateinit var mvc: MockMvc

@Test

Check failure on line 32 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L32 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:32:1: error: Unexpected indentation (5) (should be 4) (standard:indent)
fun `결제 μš”μ²­μ„ ν•œλ‹€`() {

Check failure on line 33 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L33 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:33:1: error: Unexpected indentation (5) (should be 4) (standard:indent)
// given

Check failure on line 34 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L34 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:34:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
val savedOrder = `μ£Όλ¬Έ 생성`()

Check failure on line 35 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L35 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:35:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
val request = `μ£Όλ¬Έ 결제 μš”μ²­ 생성`(savedOrder)

Check failure on line 36 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L36 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:36:1: error: Unexpected indentation (9) (should be 8) (standard:indent)

// when

Check failure on line 38 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L38 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:38:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
val result: ResultActions = mvc.perform(

Check failure on line 39 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L39 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:39:1: error: Unexpected indentation (9) (should be 8) (standard:indent)

Check failure on line 39 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L39 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:39:38: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
post("/payments")

Check failure on line 40 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L40 <standard:indent>

Unexpected indentation (13) (should be 12)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:40:1: error: Unexpected indentation (13) (should be 12) (standard:indent)
.content(objectMapper.writeValueAsString(request))

Check failure on line 41 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L41 <standard:indent>

Unexpected indentation (17) (should be 16)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:41:1: error: Unexpected indentation (17) (should be 16) (standard:indent)
.contentType(MediaType.APPLICATION_JSON)

Check failure on line 42 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L42 <standard:indent>

Unexpected indentation (17) (should be 16)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:42:1: error: Unexpected indentation (17) (should be 16) (standard:indent)
.accept(MediaType.APPLICATION_JSON),

Check failure on line 43 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L43 <standard:indent>

Unexpected indentation (17) (should be 16)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:43:1: error: Unexpected indentation (17) (should be 16) (standard:indent)
).andDo(MockMvcResultHandlers.print())

Check failure on line 44 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L44 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:44:1: error: Unexpected indentation (9) (should be 8) (standard:indent)

// then

Check failure on line 46 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L46 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:46:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
result.andExpect(status().isOk())

Check failure on line 47 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L47 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:47:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
}

Check failure on line 48 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L48 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:48:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

fun `μ£Όλ¬Έ 생성`(): Order {
val order = Order(

Check failure on line 51 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L51 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:51:21: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
orderAmount = 1,
discountAmount = 0,
paymentAmount = 4500,
deliveryFee = 0,
status = OrderStatus.PAYMENT_WAIT,
orderItemList = listOf(

Check failure on line 57 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L57 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:57:29: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
OrderItem(
id = "1",
itemId = "1",
// orderId = "2",
name = "μ•„μ΄μŠ€ν‹°",
price = 3000,
quantity = 1,
),
OrderItem(
id = "2",
itemId = "3",
// orderId = "2",
name = "아메리카노",
price = 1500,
quantity = 1,
),
),
)
return orderRepository.save(order)
}

fun `μ£Όλ¬Έ 결제 μš”μ²­ 생성`(order: Order): PaymentRequest? {

Check failure on line 79 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L79 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:79:1: error: Unexpected indentation (5) (should be 4) (standard:indent)
val cardNumber = "1234-1234-1234-1234"

Check failure on line 80 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L80 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:80:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
return PaymentRequest(order.id, cardNumber)

Check failure on line 81 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L81 <standard:indent>

Unexpected indentation (9) (should be 8)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:81:1: error: Unexpected indentation (9) (should be 8) (standard:indent)
}

Check failure on line 82 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L82 <standard:indent>

Unexpected indentation (5) (should be 4)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:82:1: error: Unexpected indentation (5) (should be 4) (standard:indent)

Check failure on line 83 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L83 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:83:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}

Check failure on line 84 in commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt#L84 <standard:indent>

Unexpected indentation (1) (should be 0)
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/payment/application/service/PaymentServiceTest.kt:84:1: error: Unexpected indentation (1) (should be 0) (standard:indent)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.hanghae.commerce.data.domain.payment

import org.springframework.data.jpa.repository.JpaRepository

interface JpaPaymentRepository : JpaRepository<PaymentEntity, Long> {

Check failure on line 5 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/JpaPaymentRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/JpaPaymentRepository.kt#L5 <standard:no-empty-class-body>

Unnecessary block ("{}")
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/JpaPaymentRepository.kt:5:69: error: Unnecessary block ("{}") (standard:no-empty-class-body)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.hanghae.commerce.data.domain.payment

import com.hanghae.commerce.data.common.PrimaryKeyEntity
import com.hanghae.commerce.data.domain.order.OrderEntity
import jakarta.persistence.Entity
import jakarta.persistence.OneToOne
import jakarta.persistence.Table


Check failure on line 9 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L9 <standard:no-consecutive-blank-lines>

Needless blank line(s)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:9:1: error: Needless blank line(s) (standard:no-consecutive-blank-lines)
@Entity
@Table(name = "payments")
class PaymentEntity(
@Transient
private val id: String,

Check failure on line 15 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L15 <standard:no-blank-line-in-list>

Unexpected blank line(s) in value parameter list
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:15:1: error: Unexpected blank line(s) in value parameter list (standard:no-blank-line-in-list)
@OneToOne
var order: OrderEntity,

Check failure on line 18 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L18 <standard:no-blank-line-in-list>

Unexpected blank line(s) in value parameter list
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:18:1: error: Unexpected blank line(s) in value parameter list (standard:no-blank-line-in-list)
var cardNumber: String,

Check failure on line 20 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L20 <standard:no-blank-line-in-list>

Unexpected blank line(s) in value parameter list
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:20:1: error: Unexpected blank line(s) in value parameter list (standard:no-blank-line-in-list)
) : PrimaryKeyEntity(id) {

Check failure on line 22 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L22 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:22:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
// companion object {
// fun from(payment: Payment): PaymentEntity {
// return PaymentEntity(
// id = UUID.randomUUID().toString(),
// order = payment.order.toEntity(),
// cardNumber = payment.cardNumber,
// )
// }
// }

Check failure on line 32 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt#L32 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntity.kt:32:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.hanghae.commerce.data.domain.payment

import com.hanghae.commerce.payment.domain.Payment
import com.hanghae.commerce.payment.domain.PaymentRepository
import org.springframework.stereotype.Repository
import org.springframework.transaction.annotation.Transactional

@Repository
class PaymentEntityRepository(
private val jpaPaymentRepository: JpaPaymentRepository,
) : PaymentRepository {

Check failure on line 12 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt#L12 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt:12:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
@Transactional
override fun save(payment: Payment): String {
return jpaPaymentRepository.save(
payment.toEntity(),
).id!!
}

Check failure on line 19 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt#L19 <standard:no-blank-line-before-rbrace>

Unexpected blank line(s) before "}"
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentEntityRepository.kt:19:1: error: Unexpected blank line(s) before "}" (standard:no-blank-line-before-rbrace)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.hanghae.commerce.data.domain.payment

import com.hanghae.commerce.data.domain.order.toDomain
import com.hanghae.commerce.data.domain.order.toEntity
import com.hanghae.commerce.order.domain.OrderItem
import com.hanghae.commerce.payment.domain.Payment

fun Payment.toEntity(): PaymentEntity {

Check failure on line 8 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L8 <standard:indent>

Unexpected indentation (4) (should be 0)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:8:1: error: Unexpected indentation (4) (should be 0) (standard:indent)
return PaymentEntity(

Check failure on line 9 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L9 <standard:indent>

Unexpected indentation (8) (should be 4)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:9:1: error: Unexpected indentation (8) (should be 4) (standard:indent)
id = this.id,

Check failure on line 10 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L10 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:10:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
order = this.order.toEntity(),

Check failure on line 11 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L11 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:11:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
cardNumber = this.cardNumber,

Check failure on line 12 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L12 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:12:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
)

Check failure on line 13 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L13 <standard:indent>

Unexpected indentation (8) (should be 4)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:13:1: error: Unexpected indentation (8) (should be 4) (standard:indent)
}

Check failure on line 14 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L14 <standard:indent>

Unexpected indentation (4) (should be 0)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:14:1: error: Unexpected indentation (4) (should be 0) (standard:indent)

fun PaymentEntity.toDomain(orderItemList: List<OrderItem>): Payment {

Check failure on line 16 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L16 <standard:indent>

Unexpected indentation (4) (should be 0)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:16:1: error: Unexpected indentation (4) (should be 0) (standard:indent)
return Payment(

Check failure on line 17 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L17 <standard:indent>

Unexpected indentation (8) (should be 4)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:17:1: error: Unexpected indentation (8) (should be 4) (standard:indent)
id = this.id,

Check failure on line 18 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L18 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:18:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
order = this.order.toDomain(orderItemList),

Check failure on line 19 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L19 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:19:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
cardNumber = this.cardNumber,

Check failure on line 20 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L20 <standard:indent>

Unexpected indentation (12) (should be 8)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:20:1: error: Unexpected indentation (12) (should be 8) (standard:indent)
)

Check failure on line 21 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L21 <standard:indent>

Unexpected indentation (8) (should be 4)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:21:1: error: Unexpected indentation (8) (should be 4) (standard:indent)
}

Check failure on line 22 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt#L22 <standard:indent>

Unexpected indentation (4) (should be 0)
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/payment/PaymentMapper.kt:22:1: error: Unexpected indentation (4) (should be 0) (standard:indent)
Loading