Skip to content

Commit

Permalink
[K5P-55] [fix] 테스트 코드 수정 및 sms 서비스 주석 해제
Browse files Browse the repository at this point in the history
  • Loading branch information
shinbm44 committed Aug 4, 2024
1 parent 6a84a13 commit 9b0e97c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ private void processInvoice(Invoice invoice) {
updatePaymentStatus(invoice.getId(), PAYMENT_STATUS_COMPLETED);
insertPaymentRecord(invoice, consentAccount);
emailService.sendPaymentSuccessMailCode(invoice.getContract().getMember().getEmail(), invoice, consentAccount);
// smsService.sendSuccessBilling(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(), invoice.getChargeAmount().intValue());
// 단건일 경우( 계약 종료로 변경 )
smsService.sendSuccessBilling(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(), invoice.getChargeAmount().intValue());
// 단건일 경우( 계약 종료로 변경 )
if(!checkSubscription) {
updateNotSubscriptionContractStatus(contract_id, CONTRACT_STATUS_TERMINATED);
}
Expand All @@ -77,8 +77,8 @@ private void processInvoice(Invoice invoice) {
log.info("결제 실패한 invoice ID: {}", invoice.getId());
updatePaymentStatus(invoice.getId(), PAYMENT_STATUS_UNPAID);
emailService.sendPaymentFailMailCode(invoice.getContract().getMember().getEmail(), invoice, consentAccount, paymentAttemptMessage);
// smsService.sendFailBilling(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(),
// invoice.getChargeAmount().intValue(), paymentAttemptMessage);
smsService.sendFailBilling(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(),
invoice.getChargeAmount().intValue(), paymentAttemptMessage);
// 단건일 경우( 계약 종료로 변경 )
if(!checkSubscription) {
updateNotSubscriptionContractStatus(contract_id, CONTRACT_STATUS_TERMINATED);
Expand All @@ -90,7 +90,7 @@ private void processInvoice(Invoice invoice) {
log.info("납부자 결제 invoice ID: {}", invoice.getId());
emailService.sendInvoiceMail(invoice.getContract().getMember().getEmail(), invoice);
updatePaymentStatus(invoice.getId(), PAYMENT_STATUS_PENDING);
// smsService.sendInvoice(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(), invoice.getChargeAmount().intValue(),invoice.getId());
smsService.sendInvoice(member.getPhone(), member.getConsentAccount().getOwner(), member.getConsentAccount().getBank(), invoice.getChargeAmount().intValue(),invoice.getId());

// 단건일 경우( 계약 종료로 변경 )
if(!checkSubscription) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void testWrite() throws Exception {
.paymentType(paymentType)
.invoiceType(autoInvoiceType)
.isDeleted(false)
.paymentDueCycle(3)
.createdAt(LocalDateTime.now())
.updatedAt(LocalDateTime.now())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.jdbc.core.JdbcTemplate;
import site.billingwise.batch.server_batch.batch.service.EmailService;
import site.billingwise.batch.server_batch.batch.service.SmsService;
import site.billingwise.batch.server_batch.domain.contract.Contract;
import site.billingwise.batch.server_batch.domain.contract.PaymentType;
import site.billingwise.batch.server_batch.domain.invoice.Invoice;
Expand Down Expand Up @@ -65,12 +63,12 @@ public void setUp() {
}

@Test
@DisplayName("결제 실패 시 수정 시각 업데이트")
public void testUpdateFailPaymentStatus() throws Exception {
Method method = InvoiceSendingAndPaymentManageWriter.class.getDeclaredMethod("updateFailPaymentStatus", long.class);
@DisplayName("결제 실패 시 상태 업데이트")
public void testUpdatePaymentStatusOnFailure() throws Exception {
Method method = InvoiceSendingAndPaymentManageWriter.class.getDeclaredMethod("updatePaymentStatus", long.class, long.class);
method.setAccessible(true);
method.invoke(writer, 1L);
verify(jdbcTemplate).update("update invoice set updated_at = now() where invoice_id = ?", 1L);
method.invoke(writer, 1L, PAYMENT_STATUS_UNPAID);
verify(jdbcTemplate).update("update invoice set payment_status_id = ?, updated_at = now() where invoice_id = ?", PAYMENT_STATUS_UNPAID, 1L);
}

@Test
Expand Down

0 comments on commit 9b0e97c

Please sign in to comment.