Skip to content

Commit 7c8524b

Browse files
resolve merge conflicts
2 parents e772d92 + 56d12ce commit 7c8524b

File tree

102 files changed

+3440
-616
lines changed

Some content is hidden

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

102 files changed

+3440
-616
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Migration Consistency Tests
2+
3+
on:
4+
pull_request:
5+
6+
merge_group:
7+
types:
8+
- checks_requested
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
# Allow more retries for network requests in cargo (downloading crates) and
16+
# rustup (installing toolchains). This should help to reduce flaky CI failures
17+
# from transient network timeouts or other issues.
18+
CARGO_NET_RETRY: 10
19+
RUSTUP_MAX_RETRIES: 10
20+
# Use cargo's sparse index protocol
21+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
22+
23+
jobs:
24+
migration_verify:
25+
name: Verify consistency of migrations with `schema.rs` file
26+
runs-on: ubuntu-latest
27+
28+
services:
29+
postgres:
30+
image: postgres
31+
env:
32+
POSTGRES_PASSWORD: postgres
33+
options: >-
34+
--health-cmd pg_isready
35+
--health-interval 10s
36+
--health-timeout 5s
37+
--health-retries 5
38+
ports:
39+
- 5432:5432
40+
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/[email protected]
44+
45+
- name: Install Rust
46+
uses: dtolnay/rust-toolchain@master
47+
with:
48+
toolchain: stable
49+
50+
- uses: Swatinem/[email protected]
51+
52+
- name: Install diesel_cli
53+
shell: bash
54+
run: cargo install diesel_cli --no-default-features --features postgres
55+
56+
- name: Verify `diesel migration run`
57+
shell: bash
58+
env:
59+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
60+
run: diesel migration run --locked-schema
61+
62+
- name: Verify `diesel migration redo`
63+
shell: bash
64+
env:
65+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
66+
run: diesel migration redo -a --locked-schema

Cargo.lock

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/config.example.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ checkout.base_url = "https://api.sandbox.checkout.com/"
156156
coinbase.base_url = "https://api.commerce.coinbase.com"
157157
cybersource.base_url = "https://apitest.cybersource.com/"
158158
dlocal.base_url = "https://sandbox.dlocal.com/"
159+
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
159160
fiserv.base_url = "https://cert.api.fiservapps.com/"
160161
forte.base_url = "https://sandbox.forte.net/api/v3"
161162
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"

config/development.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ locker_decryption_key1 = ""
4747
locker_decryption_key2 = ""
4848
vault_encryption_key = ""
4949
vault_private_key = ""
50+
tunnel_private_key = ""
5051

5152
[connectors.supported]
5253
wallets = ["klarna", "braintree", "applepay"]
@@ -62,6 +63,7 @@ cards = [
6263
"coinbase",
6364
"cybersource",
6465
"dlocal",
66+
"dummyconnector",
6567
"fiserv",
6668
"forte",
6769
"globalpay",
@@ -107,6 +109,7 @@ checkout.base_url = "https://api.sandbox.checkout.com/"
107109
coinbase.base_url = "https://api.commerce.coinbase.com"
108110
cybersource.base_url = "https://apitest.cybersource.com/"
109111
dlocal.base_url = "https://sandbox.dlocal.com/"
112+
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
110113
fiserv.base_url = "https://cert.api.fiservapps.com/"
111114
forte.base_url = "https://sandbox.forte.net/api/v3"
112115
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
@@ -217,9 +220,18 @@ apple_pay = { country = "AU,CN,HK,JP,MO,MY,NZ,SG,TW,AM,AT,AZ,BY,BE,BG,HR,CY,CZ,D
217220
bucket_name = ""
218221
region = ""
219222

223+
[pm_filters.forte]
224+
credit = {currency = "USD"}
225+
debit = {currency = "USD"}
226+
220227
[tokenization]
221228
stripe = { long_lived_token = false, payment_method = "wallet" }
222229
checkout = { long_lived_token = false, payment_method = "wallet" }
223230

224231
[connector_customer]
225232
connector_list = "stripe"
233+
234+
[dummy_connector]
235+
payment_ttl = 172800
236+
payment_duration = 1000
237+
payment_tolerance = 100

config/docker_compose.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ checkout.base_url = "https://api.sandbox.checkout.com/"
8080
coinbase.base_url = "https://api.commerce.coinbase.com"
8181
cybersource.base_url = "https://apitest.cybersource.com/"
8282
dlocal.base_url = "https://sandbox.dlocal.com/"
83+
dummyconnector.base_url = "http://localhost:8080/dummy-connector"
8384
fiserv.base_url = "https://cert.api.fiservapps.com/"
8485
forte.base_url = "https://sandbox.forte.net/api/v3"
8586
globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/"
@@ -117,6 +118,7 @@ cards = [
117118
"coinbase",
118119
"cybersource",
119120
"dlocal",
121+
"dummyconnector",
120122
"fiserv",
121123
"forte",
122124
"globalpay",

crates/api_models/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[features]
8+
default = []
89
errors = [
910
"dep:actix-web",
1011
"dep:reqwest",
1112
]
1213
multiple_mca = []
14+
dummy_connector = []
1315

1416
[dependencies]
1517
actix-web = { version = "4.3.1", optional = true }

crates/api_models/src/admin.rs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub struct MerchantDetails {
228228

229229
/// The merchant's primary email address
230230
#[schema(value_type = Option<String>, max_length = 255, example = "[email protected]")]
231-
pub primary_email: Option<Secret<String, pii::Email>>,
231+
pub primary_email: Option<pii::Email>,
232232

233233
/// The merchant's secondary contact name
234234
#[schema(value_type = Option<String>, max_length= 255, example = "John Doe2")]
@@ -240,7 +240,7 @@ pub struct MerchantDetails {
240240

241241
/// The merchant's secondary email address
242242
#[schema(value_type = Option<String>, max_length = 255, example = "[email protected]")]
243-
pub secondary_email: Option<Secret<String, pii::Email>>,
243+
pub secondary_email: Option<pii::Email>,
244244

245245
/// The business website of the merchant
246246
#[schema(max_length = 255, example = "www.example.com")]
@@ -263,6 +263,40 @@ pub enum RoutingAlgorithm {
263263
Single(api_enums::RoutableConnectors),
264264
}
265265

266+
#[derive(Clone, Debug, Deserialize, Serialize)]
267+
#[serde(
268+
tag = "type",
269+
content = "data",
270+
rename_all = "snake_case",
271+
from = "StraightThroughAlgorithmSerde",
272+
into = "StraightThroughAlgorithmSerde"
273+
)]
274+
pub enum StraightThroughAlgorithm {
275+
Single(api_enums::RoutableConnectors),
276+
}
277+
278+
#[derive(Debug, Clone, Serialize, Deserialize)]
279+
#[serde(untagged)]
280+
pub enum StraightThroughAlgorithmSerde {
281+
Direct(StraightThroughAlgorithm),
282+
Nested { algorithm: StraightThroughAlgorithm },
283+
}
284+
285+
impl From<StraightThroughAlgorithmSerde> for StraightThroughAlgorithm {
286+
fn from(value: StraightThroughAlgorithmSerde) -> Self {
287+
match value {
288+
StraightThroughAlgorithmSerde::Direct(algorithm) => algorithm,
289+
StraightThroughAlgorithmSerde::Nested { algorithm } => algorithm,
290+
}
291+
}
292+
}
293+
294+
impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
295+
fn from(value: StraightThroughAlgorithm) -> Self {
296+
Self::Nested { algorithm: value }
297+
}
298+
}
299+
266300
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
267301
#[serde(deny_unknown_fields)]
268302
pub struct PrimaryBusinessDetails {

crates/api_models/src/customers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub struct CustomerRequest {
1919
pub name: Option<String>,
2020
/// The customer's email address
2121
#[schema(value_type = Option<String>,max_length = 255, example = "[email protected]")]
22-
pub email: Option<Secret<String, pii::Email>>,
22+
pub email: Option<pii::Email>,
2323
/// The customer's phone number
2424
#[schema(value_type = Option<String>,max_length = 255, example = "9999999999")]
2525
pub phone: Option<Secret<String>>,
@@ -59,7 +59,7 @@ pub struct CustomerResponse {
5959
pub name: Option<String>,
6060
/// The customer's email address
6161
#[schema(value_type = Option<String>,max_length = 255, example = "[email protected]")]
62-
pub email: Option<Secret<String, pii::Email>>,
62+
pub email: Option<pii::Email>,
6363
/// The customer's phone number
6464
#[schema(value_type = Option<String>,max_length = 255, example = "9999999999")]
6565
pub phone: Option<Secret<String>>,

crates/api_models/src/enums.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,11 +592,15 @@ pub enum Connector {
592592
Cybersource,
593593
#[default]
594594
Dummy,
595+
#[cfg(feature = "dummy_connector")]
596+
#[serde(rename = "dummyconnector")]
597+
#[strum(serialize = "dummyconnector")]
598+
DummyConnector,
595599
Opennode,
596600
Bambora,
597601
Dlocal,
598602
Fiserv,
599-
//Forte,
603+
Forte,
600604
Globalpay,
601605
Klarna,
602606
Mollie,
@@ -649,6 +653,10 @@ impl Connector {
649653
#[serde(rename_all = "snake_case")]
650654
#[strum(serialize_all = "snake_case")]
651655
pub enum RoutableConnectors {
656+
#[cfg(feature = "dummy_connector")]
657+
#[serde(rename = "dummyconnector")]
658+
#[strum(serialize = "dummyconnector")]
659+
DummyConnector,
652660
Aci,
653661
Adyen,
654662
Airwallex,
@@ -661,7 +669,7 @@ pub enum RoutableConnectors {
661669
Cybersource,
662670
Dlocal,
663671
Fiserv,
664-
//Forte,
672+
Forte,
665673
Globalpay,
666674
Klarna,
667675
Mollie,

0 commit comments

Comments
 (0)