Skip to content

Commit

Permalink
chore(deps): bump main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lsampras committed Dec 12, 2023
1 parent aab2e0f commit d02ee42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion connector-template/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl
&self,
_req: &types::PaymentsCaptureRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
) -> CustomResult<RequestContent, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
}

Expand Down
29 changes: 10 additions & 19 deletions crates/router/src/connector/placetopay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod transformers;

use std::fmt::Debug;

use common_utils::request::RequestContent;
use error_stack::{IntoReport, ResultExt};
use masking::ExposeInterface;
use transformers as placetopay;
Expand Down Expand Up @@ -165,20 +166,15 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
&self,
req: &types::PaymentsAuthorizeRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_router_data = placetopay::PlacetopayRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
req.request.amount,
req,
))?;
let req_obj = placetopay::PlacetopayPaymentsRequest::try_from(&connector_router_data)?;
let placetopay_req = types::RequestBody::log_and_get_request_body(
&req_obj,
utils::Encode::<placetopay::PlacetopayPaymentsRequest>::encode_to_string_of_json,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(placetopay_req))
Ok(RequestContent::Json(Box::new(req_obj)))
}

fn build_request(
Expand All @@ -196,7 +192,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
.body(types::PaymentsAuthorizeType::get_request_body(
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
Expand Down Expand Up @@ -316,7 +312,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
&self,
_req: &types::PaymentsCaptureRouterData,
_connectors: &settings::Connectors,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
) -> CustomResult<RequestContent, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
}

Expand All @@ -333,7 +329,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
.headers(types::PaymentsCaptureType::get_headers(
self, req, connectors,
)?)
.body(types::PaymentsCaptureType::get_request_body(
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
.build(),
Expand Down Expand Up @@ -396,20 +392,15 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
&self,
req: &types::RefundsRouterData<api::Execute>,
_connectors: &settings::Connectors,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_router_data = placetopay::PlacetopayRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
req.request.refund_amount,
req,
))?;
let req_obj = placetopay::PlacetopayRefundRequest::try_from(&connector_router_data)?;
let placetopay_req = types::RequestBody::log_and_get_request_body(
&req_obj,
utils::Encode::<placetopay::PlacetopayRefundRequest>::encode_to_string_of_json,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(placetopay_req))
Ok(RequestContent::Json(Box::new(req_obj)))
}

fn build_request(
Expand All @@ -424,7 +415,7 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
.headers(types::RefundExecuteType::get_headers(
self, req, connectors,
)?)
.body(types::RefundExecuteType::get_request_body(
.set_body(types::RefundExecuteType::get_request_body(
self, req, connectors,
)?)
.build();
Expand Down Expand Up @@ -489,7 +480,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
.body(types::RefundSyncType::get_request_body(
.set_body(types::RefundSyncType::get_request_body(
self, req, connectors,
)?)
.build(),
Expand Down

0 comments on commit d02ee42

Please sign in to comment.