@@ -80,7 +80,6 @@ for file in "${default_impl_files[@]}"; do
80
80
BEGIN { in_macro = 0 }
81
81
82
82
{
83
- # Detect the beginning of a macro block like: default_imp_for_connector_authentication! {
84
83
if ($0 ~ /^default_imp_for_.*!\s*[\({]$/) {
85
84
in_macro = 1
86
85
inserted = 0
@@ -95,13 +94,10 @@ for file in "${default_impl_files[@]}"; do
95
94
next
96
95
}
97
96
98
- # If currently parsing a macro block
99
97
if (in_macro) {
100
- # Detect the closing line of the macro block
101
98
if ((macro_close == "}" && $0 ~ /^[[:space:]]*}[[:space:]]*$/) ||
102
99
(macro_close == ");" && $0 ~ /^[[:space:]]*\);[[:space:]]*$/)) {
103
100
104
- # Analyze all collected lines inside macro to see if prev/new connectors are already present
105
101
for (i = 1; i <= macro_lines_count; i++) {
106
102
line = macro_lines[i]
107
103
clean = line
@@ -111,17 +107,13 @@ for file in "${default_impl_files[@]}"; do
111
107
if (clean == "connectors::" new ",") found_new = 1
112
108
}
113
109
114
- # Print the macro header first
115
110
print macro_header
116
111
117
- # If neither previous nor new connector is found in the list,
118
- # insert the new connector at the top by default
119
112
if (!found_prev && !found_new) {
120
113
print " connectors::" new ","
121
114
inserted = 1
122
115
}
123
116
124
- # Now, go line by line through macro content and print each line
125
117
for (i = 1; i <= macro_lines_count; i++) {
126
118
line = macro_lines[i]
127
119
clean = line
@@ -130,8 +122,6 @@ for file in "${default_impl_files[@]}"; do
130
122
131
123
print " " clean
132
124
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
135
125
if (!inserted && clean == "connectors::" prev ",") {
136
126
if (!found_new) {
137
127
print " connectors::" new ","
@@ -140,18 +130,15 @@ for file in "${default_impl_files[@]}"; do
140
130
}
141
131
}
142
132
143
- # Print the closing bracket/parenthesis of the macro
144
133
print $0
145
134
in_macro = 0
146
135
next
147
136
}
148
137
149
- # Collect the current line as part of macro body
150
138
macro_lines[++macro_lines_count] = $0
151
139
next
152
140
}
153
141
154
- # For all lines outside macro blocks, print as is
155
142
print $0
156
143
}' " $file " > " $tmpfile " && mv " $tmpfile " " $file "
157
144
done
@@ -187,15 +174,13 @@ sed -i'' -e "s/^default_imp_for_new_connector_integration_payouts!(/default_imp_
187
174
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
188
175
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
189
176
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
-
195
177
sed -i' ' -e " /pub ${previous_connector} : ConnectorParams,/a\\
196
178
pub ${payment_gateway} : ConnectorParams,
197
179
" 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
199
184
200
185
cd $conn /
201
186
@@ -220,7 +205,7 @@ echo "\n\n[${payment_gateway}]\napi_key=\"API Key\"" >> ${tests}/sample_auth.tom
220
205
# Remove temporary files created in above step
221
206
rm ${tests} /main.rs-e ${test_utils} /connector_auth.rs-e
222
207
cargo +nightly fmt --all
223
- cargo run
208
+ cargo check --features v1
224
209
echo " ${GREEN} Successfully created connector. Running the tests of $payment_gateway .rs"
225
210
226
211
# Runs tests for the new connector
0 commit comments