diff --git a/src/main/java/com/hana/hanalink/account/domain/Account.java b/src/main/java/com/hana/hanalink/account/domain/Account.java index 3b82797..3b915ea 100644 --- a/src/main/java/com/hana/hanalink/account/domain/Account.java +++ b/src/main/java/com/hana/hanalink/account/domain/Account.java @@ -38,4 +38,5 @@ public class Account extends BaseEntity { public void withDraw(Long amount) { this.balance -= amount; } + public void deposit(Long amount) { this.balance += amount; } } diff --git a/src/main/java/com/hana/hanalink/team/controller/TeamController.java b/src/main/java/com/hana/hanalink/team/controller/TeamController.java index 29f4d15..4df6342 100644 --- a/src/main/java/com/hana/hanalink/team/controller/TeamController.java +++ b/src/main/java/com/hana/hanalink/team/controller/TeamController.java @@ -1,6 +1,8 @@ package com.hana.hanalink.team.controller; +import com.google.firebase.messaging.FirebaseMessagingException; import com.hana.hanalink.common.dto.SuccessResponse; +import com.hana.hanalink.common.firebase.FirebaseFcmService; import com.hana.hanalink.common.service.ImageUploadService; import com.hana.hanalink.member.domain.MemberDetails; import com.hana.hanalink.team.dto.request.CreateTeamReq; @@ -23,6 +25,7 @@ public class TeamController { private final TeamService teamService; private final ImageUploadService imageUploadService; + private final FirebaseFcmService firebaseFcmService; @PostMapping(value = "", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) public SuccessResponse createTeam(@AuthenticationPrincipal MemberDetails member, @@ -43,8 +46,9 @@ public SuccessResponse updateBanner(@PathVariable("teamId") Long teamId, @PostMapping("/{teamId}") SuccessResponse joinTeam(@AuthenticationPrincipal MemberDetails member, @PathVariable("teamId") Long teamId, - @RequestBody JoinTeamReq req) { + @RequestBody JoinTeamReq req) throws FirebaseMessagingException { teamService.joinTeam(member.getUsername(), teamId, req); + firebaseFcmService.subscribeToTopic(member.getMemberFcmToken(),teamId.toString()); return SuccessResponse.successWithNoData(); } diff --git a/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java b/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java index 3f622d1..797e256 100644 --- a/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java +++ b/src/main/java/com/hana/hanalink/transaction/service/TransactionService.java @@ -116,6 +116,8 @@ public Long paymentDues(Long teamId, TransactionReq transactionReq) { /*내 계좌 출금*/ myAccountWithdraw(myAccount,transactionReq.amount()); + meetingAccount.getAccount().deposit(transactionReq.amount()); + accountRepository.save(meetingAccount.getAccount()); Transaction transaction = Transaction.builder() .amount(transactionReq.amount())