Skip to content

Commit d9bde1d

Browse files
authored
Merge pull request #5 from SOFTNETWORK-APP/feature/softpayment
Feature/softpayment
2 parents 06d6bbb + ccd451b commit d9bde1d

163 files changed

Lines changed: 6046 additions & 1614 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ jobs:
3838
java-version: '8'
3939
distribution: 'temurin'
4040
# cache: 'sbt'
41-
- name: Run tests & Coverage Report
42-
run: sbt coverage test coverageReport
43-
- name: Upload coverage to Codecov
44-
uses: codecov/codecov-action@v3
45-
with:
46-
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
47-
flags: unittests
48-
fail_ci_if_error: true
49-
verbose: true
50-
# - name: Run tests
51-
# run: sbt test
41+
# - name: Run tests & Coverage Report
42+
# run: sbt coverage test coverageReport
43+
# - name: Upload coverage to Codecov
44+
# uses: codecov/codecov-action@v3
45+
# with:
46+
# 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
47+
# flags: unittests
48+
# fail_ci_if_error: true
49+
# verbose: true
50+
- name: Run tests
51+
run: sbt clean test
5252
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository
5353
# - name: Upload dependency graph
5454
# uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91

build.sbt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ThisBuild / organization := "app.softnetwork"
22

33
name := "payment"
44

5-
ThisBuild / version := "0.5.0"
5+
ThisBuild / version := "0.6.0"
66

77
ThisBuild / scalaVersion := "2.12.18"
88

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

3030
Test / parallelExecution := false
3131

32+
lazy val client = project.in(file("client"))
33+
.configs(IntegrationTest)
34+
.settings(Defaults.itSettings, app.softnetwork.Info.infoSettings)
35+
.enablePlugins(BuildInfoPlugin, AkkaGrpcPlugin, JavaAppPackaging, UniversalDeployPlugin)
36+
3237
lazy val common = project.in(file("common"))
3338
.configs(IntegrationTest)
3439
.settings(Defaults.itSettings)
3540
.enablePlugins(AkkaGrpcPlugin)
41+
.dependsOn(
42+
client % "compile->compile;test->test;it->it"
43+
)
3644

3745
lazy val core = project.in(file("core"))
3846
.configs(IntegrationTest)
3947
.settings(Defaults.itSettings, app.softnetwork.Info.infoSettings)
40-
.enablePlugins(BuildInfoPlugin)
48+
.enablePlugins(BuildInfoPlugin, AkkaGrpcPlugin)
4149
.dependsOn(
4250
common % "compile->compile;test->test;it->it"
4351
)
@@ -49,6 +57,13 @@ lazy val mangopay = project.in(file("mangopay"))
4957
core % "compile->compile;test->test;it->it"
5058
)
5159

60+
lazy val stripe = project.in(file("stripe"))
61+
.configs(IntegrationTest)
62+
.settings(Defaults.itSettings)
63+
.dependsOn(
64+
core % "compile->compile;test->test;it->it"
65+
)
66+
5267
lazy val api = project.in(file("mangopay/api"))
5368
.configs(IntegrationTest)
5469
.settings(Defaults.itSettings)
@@ -65,6 +80,6 @@ lazy val testkit = project.in(file("testkit"))
6580
)
6681

6782
lazy val root = project.in(file("."))
68-
.aggregate(common, core, mangopay, testkit, api)
83+
.aggregate(client, common, core, mangopay, stripe, testkit, api)
6984
.configs(IntegrationTest)
7085
.settings(Defaults.itSettings)

client/build.sbt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import com.typesafe.sbt.packager.SettingsHelper.makeDeploymentSettings
2+
3+
organization := "app.softnetwork.payment"
4+
5+
name := "softpay"
6+
7+
maintainer := "stephane.manciot@gmail.com"
8+
9+
akkaGrpcGeneratedSources := Seq(AkkaGrpc.Client)
10+
11+
val jacksonExclusions = Seq(
12+
ExclusionRule(organization = "com.fasterxml.jackson.core"),
13+
ExclusionRule(organization = "com.fasterxml.jackson.databind"),
14+
ExclusionRule(organization = "com.fasterxml.jackson.jaxrs"),
15+
ExclusionRule(organization = "com.fasterxml.jackson.module"),
16+
ExclusionRule(organization = "com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
17+
)
18+
19+
libraryDependencies ++= Seq(
20+
"app.softnetwork.account" %% "account-common" % Versions.account,
21+
"app.softnetwork.account" %% "account-common" % Versions.account % "protobuf",
22+
"app.softnetwork.api" %% "generic-server-api" % Versions.genericPersistence,
23+
"app.softnetwork.protobuf" %% "scalapb-extensions" % "0.1.7",
24+
"commons-validator" % "commons-validator" % "1.6",
25+
"com.github.scopt" %% "scopt" % Versions.scopt,
26+
"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"),
27+
"com.hubspot.jinjava" % "jinjava" % Versions.jinja excludeAll (jacksonExclusions *) exclude ("com.google.guava", "guava") exclude ("org.apache.commons", "commons-lang3")
28+
)
29+
30+
Compile / mainClass := Some("app.softnetwork.payment.cli.Main")
31+
32+
makeDeploymentSettings(Universal, packageBin in Universal, "zip")
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
syntax = "proto3";
2+
3+
import "scalapb/scalapb.proto";
4+
import "google/protobuf/wrappers.proto";
5+
6+
package app.softnetwork.payment.api;
7+
8+
option (scalapb.options) = {
9+
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
10+
preserve_unknown_fields: false
11+
};
12+
13+
service ClientServiceApi {
14+
rpc SignUpClient (SignUpClientRequest) returns (SignUpClientResponse) {}
15+
rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {}
16+
rpc GenerateClientTokens (GenerateClientTokensRequest) returns (ClientTokensResponse) {}
17+
rpc RefreshClientTokens (RefreshClientTokensRequest) returns (ClientTokensResponse) {}
18+
}
19+
20+
enum ProviderType {
21+
MOCK = 0;
22+
MANGOPAY = 1;
23+
// STRIPE = 2;
24+
}
25+
26+
message SignUpClientRequest {
27+
string principal = 1;
28+
string credentials = 2;
29+
string provider_id = 3;
30+
string provider_api_key = 4;
31+
ProviderType provider_type = 5;
32+
}
33+
34+
message ClientCreated {
35+
string client_id = 1;
36+
string client_secret = 2;
37+
}
38+
39+
message SignUpClientResponse {
40+
oneof signup {
41+
ClientCreated client = 1;
42+
string error = 2;
43+
}
44+
}
45+
46+
message ActivateClientRequest {
47+
string token = 1;
48+
}
49+
50+
message ActivateClientResponse {
51+
oneof activation {
52+
bool activated = 1;
53+
string error = 2;
54+
}
55+
}
56+
57+
message Tokens {
58+
string access_token = 1;
59+
string token_type = 2;
60+
int64 expires_in = 3;
61+
string refresh_token = 4;
62+
google.protobuf.Int64Value refresh_token_expires_in = 5;
63+
}
64+
65+
message ClientTokensResponse {
66+
oneof clientTokens {
67+
Tokens tokens = 1;
68+
string error = 2;
69+
}
70+
}
71+
72+
message GenerateClientTokensRequest {
73+
string client_id = 1;
74+
string client_secret = 2;
75+
google.protobuf.StringValue scope = 3;
76+
}
77+
78+
message RefreshClientTokensRequest {
79+
string refresh_token = 1;
80+
}

common/src/main/protobuf/api/payment.proto renamed to client/src/main/protobuf/api/payment.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ message PayInWithCardPreAuthorizedRequest {
4040
string preAuthorizationId = 1;
4141
string creditedAccount = 2;
4242
google.protobuf.Int32Value debitedAmount = 3;
43+
string clientId = 4;
4344
}
4445

4546
enum TransactionStatus{
@@ -59,6 +60,7 @@ message TransactionResponse {
5960
message CancelPreAuthorizationRequest {
6061
string orderUuid = 1;
6162
string cardPreAuthorizedTransactionId = 2;
63+
string clientId = 3;
6264
}
6365

6466
message CancelPreAuthorizationResponse {
@@ -72,6 +74,7 @@ message RefundRequest {
7274
string currency = 4;
7375
string reasonMessage = 5;
7476
bool initializedByClient = 6;
77+
string clientId = 7;
7578
}
7679

7780
message PayOutRequest {
@@ -81,6 +84,7 @@ message PayOutRequest {
8184
int32 feesAmount = 4;
8285
string currency = 5;
8386
google.protobuf.StringValue externalReference = 6;
87+
string clientId = 7;
8488
}
8589

8690
message TransferRequest {
@@ -92,6 +96,7 @@ message TransferRequest {
9296
string currency = 6;
9397
bool payOutRequired = 7;
9498
google.protobuf.StringValue externalReference = 8;
99+
string clientId = 9;
95100
}
96101

97102
message TransferResponse {
@@ -108,10 +113,12 @@ message DirectDebitRequest {
108113
string currency = 4;
109114
string statementDescriptor = 5;
110115
google.protobuf.StringValue externalReference = 6;
116+
string clientId = 7;
111117
}
112118

113119
message LoadDirectDebitTransactionRequest {
114120
string directDebitTransactionId = 1;
121+
string clientId = 2;
115122
}
116123

117124
message RegisterRecurringPaymentRequest {
@@ -142,6 +149,9 @@ message RegisterRecurringPaymentRequest {
142149
google.protobuf.BoolValue fixedNextAmount = 9;
143150
google.protobuf.Int32Value nextDebitedAmount = 10;
144151
google.protobuf.Int32Value nextFeesAmount = 11;
152+
google.protobuf.StringValue statementDescriptor = 12;
153+
google.protobuf.StringValue externalReference = 13;
154+
string clientId = 14;
145155
}
146156

147157
message RegisterRecurringPaymentResponse {
@@ -150,6 +160,7 @@ message RegisterRecurringPaymentResponse {
150160

151161
message CancelMandateRequest {
152162
string externalUuid = 1;
163+
string clientId = 2;
153164
}
154165

155166
message CancelMandateResponse {
@@ -158,6 +169,7 @@ message CancelMandateResponse {
158169

159170
message LoadBankAccountOwnerRequest {
160171
string externalUuid = 1;
172+
string clientId = 2;
161173
}
162174

163175
message LoadBankAccountOwnerResponse {
@@ -173,6 +185,7 @@ enum LegalUserType {
173185

174186
message LoadLegalUserRequest {
175187
string externalUuid = 1;
188+
string clientId = 2;
176189
}
177190

178191
message LoadLegalUserResponse {

common/src/main/protobuf/model/payment/address.proto renamed to client/src/main/protobuf/model/payment/address.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ option (scalapb.options) = {
1111
import: "app.softnetwork.persistence.model._"
1212
import: "app.softnetwork.serialization._"
1313
import: "app.softnetwork.payment.model._"
14-
import: "app.softnetwork.payment.serialization._"
1514
preserve_unknown_fields: false
1615
};
1716

@@ -22,4 +21,5 @@ message Address {
2221
required string city = 2;
2322
required string postalCode = 3;
2423
required string country = 4 [default = "FR"];
24+
optional string state = 5;
2525
}

common/src/main/protobuf/model/payment/card.proto renamed to client/src/main/protobuf/model/payment/card.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ option (scalapb.options) = {
1111
import: "app.softnetwork.persistence.model._"
1212
import: "app.softnetwork.serialization._"
1313
import: "app.softnetwork.payment.model._"
14-
import: "app.softnetwork.payment.serialization._"
1514
preserve_unknown_fields: false
1615
};
1716

common/src/main/protobuf/model/payment/document.proto renamed to client/src/main/protobuf/model/payment/document.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ option (scalapb.options) = {
1414
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
1515
import: "app.softnetwork.serialization._"
1616
import: "app.softnetwork.payment.model._"
17-
import: "app.softnetwork.payment.serialization._"
1817
preserve_unknown_fields: false
1918
};
2019

common/src/main/protobuf/model/payment/paymentUser.proto renamed to client/src/main/protobuf/model/payment/paymentUser.proto

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ option (scalapb.options) = {
1717
import: "app.softnetwork.protobuf.ScalaPBTypeMappers._"
1818
import: "app.softnetwork.serialization._"
1919
import: "app.softnetwork.payment.model._"
20-
import: "app.softnetwork.payment.serialization._"
2120
preserve_unknown_fields: false
2221
};
2322

@@ -57,14 +56,14 @@ message BankAccount {
5756
optional MandateScheme mandateScheme = 14 [default = MANDATE_SEPA];
5857
}
5958

60-
message PaymentUser {
61-
enum PaymentUserType {
59+
message NaturalUser {
60+
enum NaturalUserType {
6261
PAYER = 0;
6362
COLLECTOR = 1;
6463
}
6564
option (scalapb.message).extends = "ProtobufDomainObject";
66-
option (scalapb.message).extends = "PaymentUserDecorator";
67-
option (scalapb.message).companion_extends = "PaymentUserCompanion";
65+
option (scalapb.message).extends = "NaturalUserDecorator";
66+
option (scalapb.message).companion_extends = "NaturalUserCompanion";
6867
required string firstName = 1;
6968
required string lastName = 2;
7069
required string email = 3;
@@ -75,7 +74,7 @@ message PaymentUser {
7574
optional string walletId = 8;
7675
required string externalUuid = 9;
7776
optional string profile = 10;
78-
optional PaymentUserType paymentUserType = 11;
77+
optional NaturalUserType naturalUserType = 11;
7978
// optional string secondaryWalletId = 12;
8079
}
8180

@@ -90,7 +89,7 @@ message LegalUser {
9089
required LegalUserType legalUserType = 1;
9190
required string legalName = 2;
9291
required string siret = 3;
93-
required PaymentUser legalRepresentative = 4;
92+
required NaturalUser legalRepresentative = 4;
9493
required Address legalRepresentativeAddress = 5;
9594
required Address headQuartersAddress = 6;
9695
optional UboDeclaration uboDeclaration = 7;
@@ -114,7 +113,7 @@ message PaymentAccount {
114113
required google.protobuf.Timestamp createdDate = 2 [(scalapb.field).type = "java.time.Instant"];
115114
required google.protobuf.Timestamp lastUpdated = 3 [(scalapb.field).type = "java.time.Instant"];
116115
oneof user {
117-
PaymentUser naturalUser = 4;
116+
NaturalUser naturalUser = 4;
118117
LegalUser legalUser = 5;
119118
}
120119
repeated Card cards = 6;
@@ -123,6 +122,7 @@ message PaymentAccount {
123122
required PaymentAccountStatus paymentAccountStatus = 9 [default = DOCUMENTS_KO];
124123
repeated Transaction transactions = 10;
125124
repeated RecurringPayment recurryingPayments = 11;
125+
optional string clientId = 12;
126126
}
127127

128128
message MandateResult{
@@ -191,4 +191,6 @@ message RecurringPayment {
191191
optional int32 cumulatedFeesAmount = 20;
192192
optional bool migration = 21;
193193
optional string cardId = 22;
194+
optional string statementDescriptor = 23;
195+
optional string externalReference = 24;
194196
}

common/src/main/protobuf/model/payment/transaction.proto renamed to client/src/main/protobuf/model/payment/transaction.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ message Transaction {
8484
optional string returnUrl = 30;
8585
optional string payPalBuyerAccountEmail = 31;
8686
optional string idempotencyKey = 32;
87+
optional string clientId = 33;
8788
}
8889

8990
message BrowserInfo {

0 commit comments

Comments
 (0)