Skip to content

Commit

Permalink
chore: merging back release v0.3.0 back to main (#636) (#655)
Browse files Browse the repository at this point in the history
Co-authored-by: Sangamesh Kulkarni <[email protected]>
Co-authored-by: ItsMeShashank <[email protected]>
Co-authored-by: Abhishek <[email protected]>
Co-authored-by: Jagan <[email protected]>
Co-authored-by: SamraatBansal <[email protected]>
Co-authored-by: Sampras Lopes <[email protected]>
  • Loading branch information
7 people authored Feb 26, 2023
1 parent 7792de5 commit f3224cc
Show file tree
Hide file tree
Showing 74 changed files with 5,976 additions and 352 deletions.
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
# 0.3.0 (2023-02-25)

## Build System / Dependencies

* **docker-compose:** increase docker health check interval for hyperswitch-server (#534)

## Chores

* **release:** port release bug fixes to main branch (#612) (a8d6ce83)

## Continuous Integration

* run CI checks on merge queue events (#530) (c7b9e9c1)

## Documentation Changes

* **add_connector:** fix typo (#584) (a4f3abf3)

## New Features

* **router:**
* include eligible connectors list in list payment methods (#644) (92771b3b)
* API endpoints for managing API keys (#511) (1bdc8955)
* **connector:**
* [Airwallex] add authorize, capture, void, psync, Webhooks support (#646) (6a67dd8b)
* [Bluesnap] add authorize, capture, void, refund, psync, rsync and Webhooks support (#649) (7efdc3c5)
* add authorize, capture, void, refund, psync support for Nuvei (#645) (03a9f5a9)
* Added applepay feature (#636) (1e84c07c)
* add `track_caller` to functions that perform `change_context` (#592) (8d2e573a)
* Redis cache for MCA fetch and update (#515) (963cb528)
* **api_models:** add error structs (#532) (d107b44f)

## Bug Fixes

* **connector:** update Bluesnap in routable connectors (#654) (64cb2ffc)
* allow errors with status code 200 to pass (#601) (8a8767e9)
* don't call connector if connector transaction id doesn't exist (#525) (326d6beb)
* throw 500 error when redis goes down (#531) (aafb115a)
* **router:**
* allow setup future usage to be updated in payment update and confirm requests (#610) (#638) (6c128f82)
* feature gate openssl deps for basilisk feature (#536) (e4956820)
* **checkout:** Error Response when wrong api key is passed (#596) (55b6d88a)
* **core:** use guard for access token result (#522) (903b4521)

## Other Changes

* **router:**
* webhooks enhancement (#637) (#641) (3bc9feb0)
* api keys path params (#609) (effa7a00)

## Refactors

* **router:**
* update payments api contract to accept a list of connectors (#643) (8f1f626c)
* api-key routes refactoring (#600) (e6408276)
* appstate as trait in authentication (#588) (eaf98e66)
* **compatibility:** add additional fields to stripe payment and refund response types (#618) (2ea09e34)
* Throw 500 error on database connection error instead of panic (#527) (f1e3bf48)
* send full payment object for payment sync (#526) (6c2a1fea)
* **middleware:** change visibility to `pub` (#587) (4884a24d)

# 0.2.1 (2023-02-17)

## Fixes
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 29 additions & 2 deletions config/Development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,26 @@ locker_decryption_key1 = ""
locker_decryption_key2 = ""

[connectors.supported]
wallets = ["klarna","braintree","applepay"]
cards = ["stripe","adyen","authorizedotnet","checkout","braintree","aci","shift4","cybersource", "worldpay", "globalpay", "fiserv", "payu", "worldline", "dlocal"]
wallets = ["klarna", "braintree", "applepay"]
cards = [
"aci",
"adyen",
"airwallex",
"authorizedotnet",
"bluesnap",
"braintree",
"checkout",
"cybersource",
"dlocal",
"fiserv",
"globalpay",
"nuvei",
"payu",
"shift4",
"stripe",
"worldline",
"worldpay",
]

[refund]
max_attempts = 10
Expand Down Expand Up @@ -104,6 +122,15 @@ base_url = "https://apis.sandbox.globalpay.com/ucp/"
[connectors.worldline]
base_url = "https://eu.sandbox.api-ingenico.com/"

[connectors.bluesnap]
base_url = "https://sandbox.bluesnap.com/"

[connectors.nuvei]
base_url = "https://ppp-test.nuvei.com/"

[connectors.airwallex]
base_url = "https://api-demo.airwallex.com/"

[connectors.dlocal]
base_url = "https://sandbox.dlocal.com/"

Expand Down
11 changes: 10 additions & 1 deletion config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,19 @@ base_url = "https://try.access.worldpay.com/"
[connectors.globalpay]
base_url = "https://apis.sandbox.globalpay.com/ucp/"

# This data is used to call respective connectors for wallets and cards
[connectors.bluesnap]
base_url = "https://sandbox.bluesnap.com/"

[connectors.nuvei]
base_url = "https://ppp-test.nuvei.com/"

[connectors.airwallex]
base_url = "https://api-demo.airwallex.com/"

[connectors.dlocal]
base_url = "https://sandbox.dlocal.com/"

# This data is used to call respective connectors for wallets and cards
[connectors.supported]
wallets = ["klarna", "braintree", "applepay"]
cards = [
Expand Down
30 changes: 28 additions & 2 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,43 @@ base_url = "https://try.access.worldpay.com/"
[connectors.globalpay]
base_url = "https://apis.sandbox.globalpay.com/ucp/"

[connectors.bluesnap]
base_url = "https://sandbox.bluesnap.com/"

[connectors.nuvei]
base_url = "https://ppp-test.nuvei.com/"

[connectors.airwallex]
base_url = "https://api-demo.airwallex.com/"

[connectors.dlocal]
base_url = "https://sandbox.dlocal.com/"

[connectors.supported]
wallets = ["klarna", "braintree", "applepay"]
cards = ["stripe", "adyen", "authorizedotnet", "checkout", "braintree", "shift4", "cybersource", "worldpay", "globalpay", "fiserv", "dlocal"]
cards = [
"adyen",
"airwallex",
"authorizedotnet",
"bluesnap",
"braintree",
"checkout",
"cybersource",
"dlocal",
"fiserv",
"globalpay",
"nuvei",
"payu",
"shift4",
"stripe",
"worldline",
"worldpay",
]


[scheduler]
stream = "SCHEDULER_STREAM"

[scheduler.consumer]
disabled = false
consumer_group = "SCHEDULER_GROUP"
consumer_group = "SCHEDULER_GROUP"
8 changes: 6 additions & 2 deletions connector-template/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,14 @@ impl
fn get_url(&self, _req: &types::PaymentsAuthorizeRouterData, _connectors: &settings::Connectors,) -> CustomResult<String,errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
}

fn get_request_body(&self, req: &types::PaymentsAuthorizeRouterData) -> CustomResult<Option<String>,errors::ConnectorError> {
let req_obj = {{project-name | downcase}}::{{project-name | downcase | pascal_case}}PaymentsRequest::try_from(req)?;
let {{project-name | downcase}}_req =
utils::Encode::<{{project-name | downcase}}::{{project-name | downcase | pascal_case}}PaymentsRequest>::convert_and_encode(req).change_context(errors::ConnectorError::RequestEncodingFailed)?;
utils::Encode::<{{project-name | downcase}}::{{project-name | downcase | pascal_case}}PaymentsRequest>::encode_to_string_of_json(
&req_obj,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some({{project-name | downcase}}_req))
}

Expand Down
1 change: 1 addition & 0 deletions connector-template/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async fn should_void_authorized_payment() {
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
None,
)
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.91"
strum = { version = "0.24.1", features = ["derive"] }
time = { version = "0.3.17", features = ["serde", "serde-well-known", "std"] }
url = { version = "2.3.1", features = ["serde"] }
utoipa = { version = "3.0.1", features = ["preserve_order"] }

# First party crates
Expand Down
3 changes: 2 additions & 1 deletion crates/api_models/src/admin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use common_utils::pii;
use masking::{Secret, StrongSecret};
use serde::{Deserialize, Serialize};
use url;
use utoipa::ToSchema;

use super::payments::AddressDetails;
Expand All @@ -26,7 +27,7 @@ pub struct CreateMerchantAccount {

/// The URL to redirect after the completion of the operation
#[schema(max_length = 255, example = "https://www.example.com/success")]
pub return_url: Option<String>,
pub return_url: Option<url::Url>,

/// Webhook related details
pub webhook_details: Option<WebhookDetails>,
Expand Down
9 changes: 8 additions & 1 deletion crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use utoipa::ToSchema;
serde::Serialize,
strum::Display,
strum::EnumString,
frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
Expand Down Expand Up @@ -572,8 +573,10 @@ pub enum MandateStatus {
pub enum Connector {
Aci,
Adyen,
Airwallex,
Applepay,
Authorizedotnet,
Bluesnap,
Braintree,
Checkout,
Cybersource,
Expand All @@ -583,6 +586,7 @@ pub enum Connector {
Fiserv,
Globalpay,
Klarna,
Nuvei,
Payu,
Rapyd,
Shift4,
Expand All @@ -593,7 +597,7 @@ pub enum Connector {

impl Connector {
pub fn supports_access_token(&self) -> bool {
matches!(self, Self::Globalpay | Self::Payu)
matches!(self, Self::Airwallex | Self::Globalpay | Self::Payu)
}
}

Expand All @@ -614,14 +618,17 @@ impl Connector {
pub enum RoutableConnectors {
Aci,
Adyen,
Airwallex,
Authorizedotnet,
Bluesnap,
Braintree,
Checkout,
Cybersource,
Dlocal,
Fiserv,
Globalpay,
Klarna,
Nuvei,
Payu,
Rapyd,
Shift4,
Expand Down
8 changes: 6 additions & 2 deletions crates/api_models/src/payment_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub struct ListPaymentMethodResponse {
}
]
))]
pub payment_methods: HashSet<ListPaymentMethod>,
pub payment_methods: Vec<ListPaymentMethod>,
}

#[derive(Eq, PartialEq, Hash, Debug, serde::Deserialize, ToSchema)]
Expand Down Expand Up @@ -362,9 +362,12 @@ pub struct ListPaymentMethod {
/// Type of payment experience enabled with the connector
#[schema(value_type = Option<Vec<PaymentExperience>>, example = json!(["redirect_to_url"]))]
pub payment_experience: Option<Vec<api_enums::PaymentExperience>>,

/// Eligible connectors for this payment method
#[schema(example = json!(["stripe", "adyen"]))]
pub eligible_connectors: Option<Vec<String>>,
}

/// We need a custom serializer to only send relevant fields in ListPaymentMethodResponse
/// Currently if the payment method is Wallet or Paylater the relevant fields are `payment_method`
/// and `payment_method_issuers`. Otherwise only consider
/// `payment_method`,`payment_method_issuers`,`payment_method_types`,`payment_schemes` fields.
Expand All @@ -377,6 +380,7 @@ impl serde::Serialize for ListPaymentMethod {
let mut state = serializer.serialize_struct("ListPaymentMethod", 4)?;
state.serialize_field("payment_method", &self.payment_method)?;
state.serialize_field("payment_experience", &self.payment_experience)?;
state.serialize_field("eligible_connectors", &self.eligible_connectors)?;
match self.payment_method {
api_enums::PaymentMethodType::Wallet | api_enums::PaymentMethodType::PayLater => {
state.serialize_field("payment_method_issuers", &self.payment_method_issuers)?;
Expand Down
Loading

0 comments on commit f3224cc

Please sign in to comment.