feat(order_details): Adding order_details both inside and outside of metadata, in payments request, for backward compatibility (#1344)

Co-authored-by: Narayan Bhat <48803246+Narayanbhat166@users.noreply.github.com>
This commit is contained in:
rishavkar
2023-06-14 22:12:33 +05:30
committed by GitHub
parent 92c822257e
commit 913b833117
19 changed files with 640 additions and 268 deletions

View File

@ -1,6 +1,6 @@
use std::collections::HashMap;
use api_models::payments::{self, OrderDetails};
use api_models::payments::{self, OrderDetailsWithAmount};
use base64::Engine;
use common_utils::{
date_time,
@ -179,7 +179,7 @@ pub trait PaymentsAuthorizeRequestData {
fn is_auto_capture(&self) -> Result<bool, Error>;
fn get_email(&self) -> Result<Email, Error>;
fn get_browser_info(&self) -> Result<types::BrowserInformation, Error>;
fn get_order_details(&self) -> Result<OrderDetails, Error>;
fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>;
fn get_card(&self) -> Result<api::Card, Error>;
fn get_return_url(&self) -> Result<String, Error>;
fn connector_mandate_id(&self) -> Option<String>;
@ -206,7 +206,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
.clone()
.ok_or_else(missing_field_err("browser_info"))
}
fn get_order_details(&self) -> Result<OrderDetails, Error> {
fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error> {
self.order_details
.clone()
.ok_or_else(missing_field_err("order_details"))