Skip to content

Commit baf5fd9

Browse files
pixincreateshashitnakArjunKarthiksrujanchikke
authored
feat(connector): add connector nmi with card, applepay and googlepay support (#771)
Signed-off-by: chikke srujan <[email protected]> Co-authored-by: ShashiKant <[email protected]> Co-authored-by: Arjun Karthik <[email protected]> Co-authored-by: chikke srujan <[email protected]>
1 parent a904d2b commit baf5fd9

File tree

20 files changed

+2022
-7
lines changed

20 files changed

+2022
-7
lines changed

Cargo.lock

Lines changed: 11 additions & 0 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
@@ -166,6 +166,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
166166
mollie.base_url = "https://api.mollie.com/v2/"
167167
multisafepay.base_url = "https://testapi.multisafepay.com/"
168168
nexinets.base_url = "https://apitest.payengine.de/v1"
169+
nmi.base_url = "https://secure.nmi.com/"
169170
nuvei.base_url = "https://ppp-test.nuvei.com/"
170171
opennode.base_url = "https://dev-api.opennode.com"
171172
payeezy.base_url = "https://api-cert.payeezy.com/"

config/development.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ cards = [
7272
"mollie",
7373
"multisafepay",
7474
"nexinets",
75+
"nmi",
7576
"nuvei",
7677
"opennode",
7778
"payeezy",
@@ -121,6 +122,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
121122
mollie.base_url = "https://api.mollie.com/v2/"
122123
multisafepay.base_url = "https://testapi.multisafepay.com/"
123124
nexinets.base_url = "https://apitest.payengine.de/v1"
125+
nmi.base_url = "https://secure.nmi.com/"
124126
nuvei.base_url = "https://ppp-test.nuvei.com/"
125127
opennode.base_url = "https://dev-api.opennode.com"
126128
payeezy.base_url = "https://api-cert.payeezy.com/"

config/docker_compose.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
9090
mollie.base_url = "https://api.mollie.com/v2/"
9191
multisafepay.base_url = "https://testapi.multisafepay.com/"
9292
nexinets.base_url = "https://apitest.payengine.de/v1"
93+
nmi.base_url = "https://secure.nmi.com/"
9394
nuvei.base_url = "https://ppp-test.nuvei.com/"
9495
opennode.base_url = "https://dev-api.opennode.com"
9596
payeezy.base_url = "https://api-cert.payeezy.com/"
@@ -129,6 +130,7 @@ cards = [
129130
"mollie",
130131
"multisafepay",
131132
"nexinets",
133+
"nmi",
132134
"nuvei",
133135
"opennode",
134136
"payeezy",

crates/api_models/src/enums.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ pub enum Connector {
609609
Mollie,
610610
Multisafepay,
611611
Nexinets,
612+
Nmi,
612613
Nuvei,
613614
// Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage
614615
Paypal,
@@ -681,6 +682,7 @@ pub enum RoutableConnectors {
681682
Mollie,
682683
Multisafepay,
683684
Nexinets,
685+
Nmi,
684686
Nuvei,
685687
Opennode,
686688
// Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage

crates/common_utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ futures = { version = "0.3.28", optional = true }
2020
hex = "0.4.3"
2121
nanoid = "0.4.0"
2222
once_cell = "1.17.1"
23+
quick-xml = { version = "0.28.2", features = ["serialize"] }
2324
rand = "0.8.5"
2425
regex = "1.7.3"
2526
ring = "0.16.20"

crates/common_utils/src/ext_traits.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
use error_stack::{IntoReport, ResultExt};
77
use masking::{ExposeInterface, Secret, Strategy};
8+
use quick_xml::de;
89
use serde::{Deserialize, Serialize};
910

1011
use crate::errors::{self, CustomResult};
@@ -392,3 +393,22 @@ impl ConfigExt for String {
392393
self.trim().is_empty()
393394
}
394395
}
396+
397+
/// Extension trait for deserializing XML strings using `quick-xml` crate
398+
pub trait XmlExt {
399+
///
400+
/// Deserialize an XML string into the specified type `<T>`.
401+
///
402+
fn parse_xml<T>(self) -> Result<T, quick_xml::de::DeError>
403+
where
404+
T: serde::de::DeserializeOwned;
405+
}
406+
407+
impl XmlExt for &str {
408+
fn parse_xml<T>(self) -> Result<T, quick_xml::de::DeError>
409+
where
410+
T: serde::de::DeserializeOwned,
411+
{
412+
de::from_str(self)
413+
}
414+
}

crates/router/src/configs/settings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ pub struct Connectors {
376376
pub mollie: ConnectorParams,
377377
pub multisafepay: ConnectorParams,
378378
pub nexinets: ConnectorParams,
379+
pub nmi: ConnectorParams,
379380
pub nuvei: ConnectorParams,
380381
pub opennode: ConnectorParams,
381382
pub payeezy: ConnectorParams,

crates/router/src/connector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ pub mod forte;
1717
pub mod globalpay;
1818
pub mod iatapay;
1919
pub mod klarna;
20+
pub mod mollie;
2021
pub mod multisafepay;
2122
pub mod nexinets;
23+
pub mod nmi;
2224
pub mod nuvei;
2325
pub mod opennode;
2426
pub mod payeezy;
@@ -33,16 +35,14 @@ pub mod worldline;
3335
pub mod worldpay;
3436
pub mod zen;
3537

36-
pub mod mollie;
37-
3838
#[cfg(feature = "dummy_connector")]
3939
pub use self::dummyconnector::DummyConnector;
4040
pub use self::{
4141
aci::Aci, adyen::Adyen, airwallex::Airwallex, authorizedotnet::Authorizedotnet,
4242
bambora::Bambora, bitpay::Bitpay, bluesnap::Bluesnap, braintree::Braintree, checkout::Checkout,
4343
coinbase::Coinbase, cybersource::Cybersource, dlocal::Dlocal, fiserv::Fiserv, forte::Forte,
4444
globalpay::Globalpay, iatapay::Iatapay, klarna::Klarna, mollie::Mollie,
45-
multisafepay::Multisafepay, nexinets::Nexinets, nuvei::Nuvei, opennode::Opennode,
45+
multisafepay::Multisafepay, nexinets::Nexinets, nmi::Nmi, nuvei::Nuvei, opennode::Opennode,
4646
payeezy::Payeezy, paypal::Paypal, payu::Payu, rapyd::Rapyd, shift4::Shift4, stripe::Stripe,
4747
trustpay::Trustpay, worldline::Worldline, worldpay::Worldpay, zen::Zen,
4848
};

0 commit comments

Comments
 (0)