Skip to content

Commit f5190dd

Browse files
committed
comment resolved
1 parent 7a8c0ad commit f5190dd

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

scripts/add_connector.sh

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ for file in "${default_impl_files[@]}"; do
8080
BEGIN { in_macro = 0 }
8181
8282
{
83-
# Detect the beginning of a macro block like: default_imp_for_connector_authentication! {
8483
if ($0 ~ /^default_imp_for_.*!\s*[\({]$/) {
8584
in_macro = 1
8685
inserted = 0
@@ -95,13 +94,10 @@ for file in "${default_impl_files[@]}"; do
9594
next
9695
}
9796
98-
# If currently parsing a macro block
9997
if (in_macro) {
100-
# Detect the closing line of the macro block
10198
if ((macro_close == "}" && $0 ~ /^[[:space:]]*}[[:space:]]*$/) ||
10299
(macro_close == ");" && $0 ~ /^[[:space:]]*\);[[:space:]]*$/)) {
103100
104-
# Analyze all collected lines inside macro to see if prev/new connectors are already present
105101
for (i = 1; i <= macro_lines_count; i++) {
106102
line = macro_lines[i]
107103
clean = line
@@ -111,17 +107,13 @@ for file in "${default_impl_files[@]}"; do
111107
if (clean == "connectors::" new ",") found_new = 1
112108
}
113109
114-
# Print the macro header first
115110
print macro_header
116111
117-
# If neither previous nor new connector is found in the list,
118-
# insert the new connector at the top by default
119112
if (!found_prev && !found_new) {
120113
print " connectors::" new ","
121114
inserted = 1
122115
}
123116
124-
# Now, go line by line through macro content and print each line
125117
for (i = 1; i <= macro_lines_count; i++) {
126118
line = macro_lines[i]
127119
clean = line
@@ -130,8 +122,6 @@ for file in "${default_impl_files[@]}"; do
130122
131123
print " " clean
132124
133-
# If we haven't inserted the new connector yet, and we just printed the previous connector,
134-
# insert the new connector right after it
135125
if (!inserted && clean == "connectors::" prev ",") {
136126
if (!found_new) {
137127
print " connectors::" new ","
@@ -140,18 +130,15 @@ for file in "${default_impl_files[@]}"; do
140130
}
141131
}
142132
143-
# Print the closing bracket/parenthesis of the macro
144133
print $0
145134
in_macro = 0
146135
next
147136
}
148137
149-
# Collect the current line as part of macro body
150138
macro_lines[++macro_lines_count] = $0
151139
next
152140
}
153141
154-
# For all lines outside macro blocks, print as is
155142
print $0
156143
}' "$file" > "$tmpfile" && mv "$tmpfile" "$file"
157144
done
@@ -187,15 +174,13 @@ sed -i'' -e "s/^default_imp_for_new_connector_integration_payouts!(/default_imp_
187174
sed -i'' -e "s/^default_imp_for_new_connector_integration_frm!(/default_imp_for_new_connector_integration_frm!(\n connector::${payment_gateway_camelcase},/" crates/router/src/core/payments/connector_integration_v2_impls.rs
188175
sed -i'' -e "s/^default_imp_for_new_connector_integration_connector_authentication!(/default_imp_for_new_connector_integration_connector_authentication!(\n connector::${payment_gateway_camelcase},/" crates/router/src/core/payments/connector_integration_v2_impls.rs
189176

190-
191-
192-
# Remove temporary files created in above step
193-
rm $conn.rs-e $src/types/api.rs-e $src/configs/settings.rs-e config/development.toml-e config/docker_compose.toml-e config/config.example.toml-e loadtest/config/development.toml-e crates/api_models/src/connector_enums.rs-e crates/euclid/src/enums.rs-e crates/api_models/src/routing.rs-e $src/core/payments/flows.rs-e crates/common_enums/src/connector_enums.rs-e $src/types/transformers.rs-e $src/core/admin.rs-e crates/hyperswitch_connectors/src/default_implementations.rs-e crates/hyperswitch_connectors/src/default_implementations_v2.rs-e crates/hyperswitch_interfaces/src/configs.rs-e $src/connector.rs-e config/deployments/integration_test.toml-e config/deployments/production.toml-e config/deployments/sandbox.toml-e temp crates/connector_configs/src/connector.rs-e crates/router/tests/connectors/main.rs-e crates/router/src/core/payments/connector_integration_v2_impls.rs-e
194-
195177
sed -i'' -e "/pub ${previous_connector}: ConnectorParams,/a\\
196178
pub ${payment_gateway}: ConnectorParams,
197179
" crates/hyperswitch_domain_models/src/configs.rs
198-
rm crates/hyperswitch_domain_models/src/configs.rs-e
180+
181+
182+
# Remove temporary files created in above step
183+
rm $conn.rs-e $src/types/api.rs-e $src/configs/settings.rs-e config/development.toml-e config/docker_compose.toml-e config/config.example.toml-e loadtest/config/development.toml-e crates/api_models/src/connector_enums.rs-e crates/euclid/src/enums.rs-e crates/api_models/src/routing.rs-e $src/core/payments/flows.rs-e crates/common_enums/src/connector_enums.rs-e $src/types/transformers.rs-e $src/core/admin.rs-e crates/hyperswitch_connectors/src/default_implementations.rs-e crates/hyperswitch_connectors/src/default_implementations_v2.rs-e crates/hyperswitch_interfaces/src/configs.rs-e $src/connector.rs-e config/deployments/integration_test.toml-e config/deployments/production.toml-e config/deployments/sandbox.toml-e temp crates/connector_configs/src/connector.rs-e crates/router/tests/connectors/main.rs-e crates/router/src/core/payments/connector_integration_v2_impls.rs-e crates/hyperswitch_domain_models/src/configs.rs-e
199184

200185
cd $conn/
201186

@@ -220,7 +205,7 @@ echo "\n\n[${payment_gateway}]\napi_key=\"API Key\"" >> ${tests}/sample_auth.tom
220205
# Remove temporary files created in above step
221206
rm ${tests}/main.rs-e ${test_utils}/connector_auth.rs-e
222207
cargo +nightly fmt --all
223-
cargo run
208+
cargo check --features v1
224209
echo "${GREEN}Successfully created connector. Running the tests of $payment_gateway.rs"
225210

226211
# Runs tests for the new connector

0 commit comments

Comments
 (0)