Skip to content
Merged
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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ThisBuild / organization := "app.softnetwork"

name := "payment"

ThisBuild / version := "0.9.1"
ThisBuild / version := "0.9.2"

ThisBuild / scalaVersion := scala212

Expand Down
8 changes: 5 additions & 3 deletions client/src/main/protobuf/model/payment/paymentUser.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ message NaturalUser {
option (scalapb.message).extends = "ProtobufDomainObject";
option (scalapb.message).extends = "NaturalUserDecorator";
option (scalapb.message).companion_extends = "NaturalUserCompanion";
required string firstName = 1;
required string lastName = 2;
required string firstName = 1 [default = ""];
required string lastName = 2 [default = ""];
required string email = 3;
required string nationality = 4 [default = "FR"];
required string birthday = 5;
required string birthday = 5 [default = ""];
required string countryOfResidence = 6 [default = "FR"];
optional string userId = 7;
optional string walletId = 8;
Expand All @@ -98,6 +98,8 @@ message NaturalUser {
optional string phone = 14;
optional Business business = 15;
optional string title = 16;
optional string name = 17;
map<string, string> additionalProperties = 18;
}

message LegalUser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ case class NaturalUserView(
address: Option[Address] = None,
phone: Option[String] = None,
business: Option[Business] = None,
title: Option[String] = None
title: Option[String] = None,
name: Option[String] = None,
additionalProperties: Map[String, String] = Map.empty
) extends User

object NaturalUserView {
Expand All @@ -42,7 +44,9 @@ object NaturalUserView {
address,
phone,
business,
title
title,
paymentUser.name,
paymentUser.additionalProperties
)
}
}
4 changes: 4 additions & 0 deletions common/src/main/protobuf/message/payment/payment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ message PaymentAccountCreatedOrUpdatedEvent {
required string externalUuid = 1;
required google.protobuf.Timestamp lastUpdated = 2 [(scalapb.field).type = "java.time.Instant"];
optional string profile = 3;
oneof user {
app.softnetwork.payment.model.NaturalUser naturalUser = 4;
app.softnetwork.payment.model.LegalUser legalUser = 5;
}
}

message CancelMandateCommandEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ trait PaymentBehavior

override protected val manifestWrapper: ManifestW = ManifestW()

private def toEventUser(
user: PaymentAccount.User
): PaymentAccountCreatedOrUpdatedEvent.User = user match {
case PaymentAccount.User.NaturalUser(value) =>
PaymentAccountCreatedOrUpdatedEvent.User.NaturalUser(value)
case PaymentAccount.User.LegalUser(value) =>
PaymentAccountCreatedOrUpdatedEvent.User.LegalUser(value)
case _ =>
PaymentAccountCreatedOrUpdatedEvent.User.Empty
}

def paymentDao: PaymentDao = PaymentDao

def softPayAccountDao: SoftPayAccountDao = SoftPayAccountDao
Expand Down Expand Up @@ -283,7 +294,10 @@ trait PaymentBehavior
PaymentAccountCreatedOrUpdatedEvent.defaultInstance
.withLastUpdated(lastUpdated)
.withExternalUuid(updatedPaymentAccount.externalUuid)
.copy(profile = updatedPaymentAccount.profile)
.copy(
profile = updatedPaymentAccount.profile,
user = toEventUser(updatedPaymentAccount.user)
)
) :+
PaymentAccountUpsertedEvent.defaultInstance
.withDocument(updatedPaymentAccount)
Expand Down Expand Up @@ -1376,7 +1390,10 @@ trait PaymentBehavior
PaymentAccountCreatedOrUpdatedEvent.defaultInstance
.withLastUpdated(lastUpdated)
.withExternalUuid(updatedPaymentAccount.externalUuid)
.copy(profile = updatedPaymentAccount.profile)
.copy(
profile = updatedPaymentAccount.profile,
user = toEventUser(updatedPaymentAccount.user)
)
)

if (
Expand Down
2 changes: 1 addition & 1 deletion stripe/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ name := "stripe-core"

libraryDependencies ++= Seq(
// stripe
"com.stripe" % "stripe-java" % "26.12.0" // TODO upgrade to v31.4.1
"com.stripe" % "stripe-java" % "26.12.0" // TODO upgrade to v27.1.2, v28.4.0, v29.5.0, v30.2.0 and then v31.4.1
)
Loading
Loading