Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8d8fbe2
add SoftPayment accounts, migrate PaymentProvider architecture to SPI…
fupelaqu Nov 22, 2023
236096f
update payment guardian to extend account guardian
fupelaqu Nov 22, 2023
00c5f3a
add account and oauth endpoints
fupelaqu Nov 22, 2023
7db4800
add ClientSession, update manager according to authenticated client
fupelaqu Nov 28, 2023
37ba733
add JwtClaims materials
fupelaqu Nov 30, 2023
41b0b4e
upgrade to typed session materials
fupelaqu Dec 3, 2023
d3c4b92
remove ClientSessionConfig
fupelaqu Dec 4, 2023
cce22ae
add typed session materials
fupelaqu Dec 4, 2023
41d4427
register providers payment account
fupelaqu Dec 4, 2023
822d12c
upgrade dependencies, retrieve clientId from bearer token or session
fupelaqu Dec 5, 2023
a4b997e
update grpc client and server, clean mangopay resources
fupelaqu Dec 6, 2023
fbd638d
fix mangopay api with scheduler
fupelaqu Dec 6, 2023
6b1e534
init client module
fupelaqu Dec 6, 2023
7de2871
add module client
fupelaqu Dec 6, 2023
aa052ea
update main client
fupelaqu Dec 6, 2023
01d7c30
to fix account status while creating account for provider(s)
fupelaqu Dec 6, 2023
7595884
update access token stuff
fupelaqu Dec 7, 2023
0d41e7d
disable upload coverage to Codecov
fupelaqu Dec 7, 2023
59f5926
clean and run tests only for PR
fupelaqu Dec 7, 2023
d591f76
update ClientServer
fupelaqu Dec 7, 2023
7cf526a
update payment client requests
fupelaqu Dec 7, 2023
1469e82
add optional clientId field for transactions
fupelaqu Dec 7, 2023
11aa750
keep client details when registering an existing provider
fupelaqu Dec 7, 2023
65fda94
add signup api
fupelaqu Dec 8, 2023
64ce0a0
add activation api
fupelaqu Dec 8, 2023
7ff8f4c
add client packaging
fupelaqu Dec 9, 2023
b5a5cef
update payment dao and server
fupelaqu Dec 9, 2023
67e005f
add clients command
fupelaqu Dec 11, 2023
d5d7826
rename PaymentClientTestKit
fupelaqu Dec 11, 2023
f156839
rename PaymentUser to NaturalUser, PaymentUserType to NaturalUserType
fupelaqu Dec 11, 2023
ec3de78
rename soft payment messages and entities
fupelaqu Dec 12, 2023
0e2b3fc
rename softpay client and provider resources
fupelaqu Dec 12, 2023
9f3a777
rename softpay account and client registration messages
fupelaqu Dec 12, 2023
838a3ef
update softpay cli
fupelaqu Dec 12, 2023
29e4c60
update mandate creation command, add clientId field to several paymen…
fupelaqu Mar 15, 2024
f6ce9f1
to fix fmt
fupelaqu Mar 16, 2024
ccd451b
add client publication
fupelaqu Mar 16, 2024
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
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ jobs:
java-version: '8'
distribution: 'temurin'
# cache: 'sbt'
- name: Run tests & Coverage Report
run: sbt coverage test coverageReport
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: common/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,teskit/target/scala-2.12/coverage-report/cobertura.xml
flags: unittests
fail_ci_if_error: true
verbose: true
# - name: Run tests
# run: sbt test
# - name: Run tests & Coverage Report
# run: sbt coverage test coverageReport
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: common/target/scala-2.12/coverage-report/cobertura.xml,core/target/scala-2.12/coverage-report/cobertura.xml,teskit/target/scala-2.12/coverage-report/cobertura.xml
# flags: unittests
# fail_ci_if_error: true
# verbose: true
- name: Run tests
run: sbt clean test
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository
# - name: Upload dependency graph
# uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91
Expand Down
21 changes: 18 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ThisBuild / organization := "app.softnetwork"

name := "payment"

ThisBuild / version := "0.5.0"
ThisBuild / version := "0.6.0"

ThisBuild / scalaVersion := "2.12.18"

Expand All @@ -29,15 +29,23 @@ ThisBuild / libraryDependencies ++= Seq(

Test / parallelExecution := false

lazy val client = project.in(file("client"))
.configs(IntegrationTest)
.settings(Defaults.itSettings, app.softnetwork.Info.infoSettings)
.enablePlugins(BuildInfoPlugin, AkkaGrpcPlugin, JavaAppPackaging, UniversalDeployPlugin)

lazy val common = project.in(file("common"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.enablePlugins(AkkaGrpcPlugin)
.dependsOn(
client % "compile->compile;test->test;it->it"
)

lazy val core = project.in(file("core"))
.configs(IntegrationTest)
.settings(Defaults.itSettings, app.softnetwork.Info.infoSettings)
.enablePlugins(BuildInfoPlugin)
.enablePlugins(BuildInfoPlugin, AkkaGrpcPlugin)
.dependsOn(
common % "compile->compile;test->test;it->it"
)
Expand All @@ -49,6 +57,13 @@ lazy val mangopay = project.in(file("mangopay"))
core % "compile->compile;test->test;it->it"
)

lazy val stripe = project.in(file("stripe"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
.dependsOn(
core % "compile->compile;test->test;it->it"
)

lazy val api = project.in(file("mangopay/api"))
.configs(IntegrationTest)
.settings(Defaults.itSettings)
Expand All @@ -65,6 +80,6 @@ lazy val testkit = project.in(file("testkit"))
)

lazy val root = project.in(file("."))
.aggregate(common, core, mangopay, testkit, api)
.aggregate(client, common, core, mangopay, stripe, testkit, api)
.configs(IntegrationTest)
.settings(Defaults.itSettings)
32 changes: 32 additions & 0 deletions client/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import com.typesafe.sbt.packager.SettingsHelper.makeDeploymentSettings

organization := "app.softnetwork.payment"

name := "softpay"

maintainer := "stephane.manciot@gmail.com"

akkaGrpcGeneratedSources := Seq(AkkaGrpc.Client)

val jacksonExclusions = Seq(
ExclusionRule(organization = "com.fasterxml.jackson.core"),
ExclusionRule(organization = "com.fasterxml.jackson.databind"),
ExclusionRule(organization = "com.fasterxml.jackson.jaxrs"),
ExclusionRule(organization = "com.fasterxml.jackson.module"),
ExclusionRule(organization = "com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
)

libraryDependencies ++= Seq(
"app.softnetwork.account" %% "account-common" % Versions.account,
"app.softnetwork.account" %% "account-common" % Versions.account % "protobuf",
"app.softnetwork.api" %% "generic-server-api" % Versions.genericPersistence,
"app.softnetwork.protobuf" %% "scalapb-extensions" % "0.1.7",
"commons-validator" % "commons-validator" % "1.6",
"com.github.scopt" %% "scopt" % Versions.scopt,
"org.scalatra.scalate" %% "scalate-core" % Versions.scalate exclude ("org.scala-lang.modules", "scala-xml_2.12") exclude ("org.scala-lang.modules", "scala-parser-combinators_2.12"),
"com.hubspot.jinjava" % "jinjava" % Versions.jinja excludeAll (jacksonExclusions *) exclude ("com.google.guava", "guava") exclude ("org.apache.commons", "commons-lang3")
)

Compile / mainClass := Some("app.softnetwork.payment.cli.Main")

makeDeploymentSettings(Universal, packageBin in Universal, "zip")
80 changes: 80 additions & 0 deletions client/src/main/protobuf/api/client.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
syntax = "proto3";

import "scalapb/scalapb.proto";
import "google/protobuf/wrappers.proto";

package app.softnetwork.payment.api;

option (scalapb.options) = {
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
preserve_unknown_fields: false
};

service ClientServiceApi {
rpc SignUpClient (SignUpClientRequest) returns (SignUpClientResponse) {}
rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {}
rpc GenerateClientTokens (GenerateClientTokensRequest) returns (ClientTokensResponse) {}
rpc RefreshClientTokens (RefreshClientTokensRequest) returns (ClientTokensResponse) {}
}

enum ProviderType {
MOCK = 0;
MANGOPAY = 1;
// STRIPE = 2;
}

message SignUpClientRequest {
string principal = 1;
string credentials = 2;
string provider_id = 3;
string provider_api_key = 4;
ProviderType provider_type = 5;
}

message ClientCreated {
string client_id = 1;
string client_secret = 2;
}

message SignUpClientResponse {
oneof signup {
ClientCreated client = 1;
string error = 2;
}
}

message ActivateClientRequest {
string token = 1;
}

message ActivateClientResponse {
oneof activation {
bool activated = 1;
string error = 2;
}
}

message Tokens {
string access_token = 1;
string token_type = 2;
int64 expires_in = 3;
string refresh_token = 4;
google.protobuf.Int64Value refresh_token_expires_in = 5;
}

message ClientTokensResponse {
oneof clientTokens {
Tokens tokens = 1;
string error = 2;
}
}

message GenerateClientTokensRequest {
string client_id = 1;
string client_secret = 2;
google.protobuf.StringValue scope = 3;
}

message RefreshClientTokensRequest {
string refresh_token = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ message PayInWithCardPreAuthorizedRequest {
string preAuthorizationId = 1;
string creditedAccount = 2;
google.protobuf.Int32Value debitedAmount = 3;
string clientId = 4;
}

enum TransactionStatus{
Expand All @@ -59,6 +60,7 @@ message TransactionResponse {
message CancelPreAuthorizationRequest {
string orderUuid = 1;
string cardPreAuthorizedTransactionId = 2;
string clientId = 3;
}

message CancelPreAuthorizationResponse {
Expand All @@ -72,6 +74,7 @@ message RefundRequest {
string currency = 4;
string reasonMessage = 5;
bool initializedByClient = 6;
string clientId = 7;
}

message PayOutRequest {
Expand All @@ -81,6 +84,7 @@ message PayOutRequest {
int32 feesAmount = 4;
string currency = 5;
google.protobuf.StringValue externalReference = 6;
string clientId = 7;
}

message TransferRequest {
Expand All @@ -92,6 +96,7 @@ message TransferRequest {
string currency = 6;
bool payOutRequired = 7;
google.protobuf.StringValue externalReference = 8;
string clientId = 9;
}

message TransferResponse {
Expand All @@ -108,10 +113,12 @@ message DirectDebitRequest {
string currency = 4;
string statementDescriptor = 5;
google.protobuf.StringValue externalReference = 6;
string clientId = 7;
}

message LoadDirectDebitTransactionRequest {
string directDebitTransactionId = 1;
string clientId = 2;
}

message RegisterRecurringPaymentRequest {
Expand Down Expand Up @@ -142,6 +149,9 @@ message RegisterRecurringPaymentRequest {
google.protobuf.BoolValue fixedNextAmount = 9;
google.protobuf.Int32Value nextDebitedAmount = 10;
google.protobuf.Int32Value nextFeesAmount = 11;
google.protobuf.StringValue statementDescriptor = 12;
google.protobuf.StringValue externalReference = 13;
string clientId = 14;
}

message RegisterRecurringPaymentResponse {
Expand All @@ -150,6 +160,7 @@ message RegisterRecurringPaymentResponse {

message CancelMandateRequest {
string externalUuid = 1;
string clientId = 2;
}

message CancelMandateResponse {
Expand All @@ -158,6 +169,7 @@ message CancelMandateResponse {

message LoadBankAccountOwnerRequest {
string externalUuid = 1;
string clientId = 2;
}

message LoadBankAccountOwnerResponse {
Expand All @@ -173,6 +185,7 @@ enum LegalUserType {

message LoadLegalUserRequest {
string externalUuid = 1;
string clientId = 2;
}

message LoadLegalUserResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option (scalapb.options) = {
import: "app.softnetwork.persistence.model._"
import: "app.softnetwork.serialization._"
import: "app.softnetwork.payment.model._"
import: "app.softnetwork.payment.serialization._"
preserve_unknown_fields: false
};

Expand All @@ -22,4 +21,5 @@ message Address {
required string city = 2;
required string postalCode = 3;
required string country = 4 [default = "FR"];
optional string state = 5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ option (scalapb.options) = {
import: "app.softnetwork.persistence.model._"
import: "app.softnetwork.serialization._"
import: "app.softnetwork.payment.model._"
import: "app.softnetwork.payment.serialization._"
preserve_unknown_fields: false
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ option (scalapb.options) = {
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
import: "app.softnetwork.serialization._"
import: "app.softnetwork.payment.model._"
import: "app.softnetwork.payment.serialization._"
preserve_unknown_fields: false
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ option (scalapb.options) = {
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
import: "app.softnetwork.serialization._"
import: "app.softnetwork.payment.model._"
import: "app.softnetwork.payment.serialization._"
preserve_unknown_fields: false
};

Expand Down Expand Up @@ -57,14 +56,14 @@ message BankAccount {
optional MandateScheme mandateScheme = 14 [default = MANDATE_SEPA];
}

message PaymentUser {
enum PaymentUserType {
message NaturalUser {
enum NaturalUserType {
PAYER = 0;
COLLECTOR = 1;
}
option (scalapb.message).extends = "ProtobufDomainObject";
option (scalapb.message).extends = "PaymentUserDecorator";
option (scalapb.message).companion_extends = "PaymentUserCompanion";
option (scalapb.message).extends = "NaturalUserDecorator";
option (scalapb.message).companion_extends = "NaturalUserCompanion";
required string firstName = 1;
required string lastName = 2;
required string email = 3;
Expand All @@ -75,7 +74,7 @@ message PaymentUser {
optional string walletId = 8;
required string externalUuid = 9;
optional string profile = 10;
optional PaymentUserType paymentUserType = 11;
optional NaturalUserType naturalUserType = 11;
// optional string secondaryWalletId = 12;
}

Expand All @@ -90,7 +89,7 @@ message LegalUser {
required LegalUserType legalUserType = 1;
required string legalName = 2;
required string siret = 3;
required PaymentUser legalRepresentative = 4;
required NaturalUser legalRepresentative = 4;
required Address legalRepresentativeAddress = 5;
required Address headQuartersAddress = 6;
optional UboDeclaration uboDeclaration = 7;
Expand All @@ -114,7 +113,7 @@ message PaymentAccount {
required google.protobuf.Timestamp createdDate = 2 [(scalapb.field).type = "java.time.Instant"];
required google.protobuf.Timestamp lastUpdated = 3 [(scalapb.field).type = "java.time.Instant"];
oneof user {
PaymentUser naturalUser = 4;
NaturalUser naturalUser = 4;
LegalUser legalUser = 5;
}
repeated Card cards = 6;
Expand All @@ -123,6 +122,7 @@ message PaymentAccount {
required PaymentAccountStatus paymentAccountStatus = 9 [default = DOCUMENTS_KO];
repeated Transaction transactions = 10;
repeated RecurringPayment recurryingPayments = 11;
optional string clientId = 12;
}

message MandateResult{
Expand Down Expand Up @@ -191,4 +191,6 @@ message RecurringPayment {
optional int32 cumulatedFeesAmount = 20;
optional bool migration = 21;
optional string cardId = 22;
optional string statementDescriptor = 23;
optional string externalReference = 24;
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ message Transaction {
optional string returnUrl = 30;
optional string payPalBuyerAccountEmail = 31;
optional string idempotencyKey = 32;
optional string clientId = 33;
}

message BrowserInfo {
Expand Down
Loading