refactor: add support for passing context generic to api calls (#2433)

This commit is contained in:
Chethan Rao
2023-10-06 13:10:13 +05:30
committed by GitHub
parent 61288d541f
commit 601c1744b6
26 changed files with 720 additions and 431 deletions

View File

@ -6,7 +6,7 @@ use router_env::{instrument, tracing, Flow};
use crate::{
compatibility::{stripe::errors, wrap},
core::{api_locking::GetLockingInput, payments},
core::{api_locking::GetLockingInput, payment_methods::Oss, payments},
routes,
services::{api, authentication as auth},
types::api::{self as api_types},
@ -50,7 +50,7 @@ pub async fn payment_intents_create(
&req,
create_payment_req,
|state, auth, req| {
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -109,7 +109,7 @@ pub async fn payment_intents_retrieve(
&req,
payload,
|state, auth, payload| {
payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -172,7 +172,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::PSync, payment_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -236,7 +236,7 @@ pub async fn payment_intents_update(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -302,7 +302,7 @@ pub async fn payment_intents_confirm(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::Authorize, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -358,7 +358,7 @@ pub async fn payment_intents_capture(
&req,
payload,
|state, auth, payload| {
payments::payments_core::<api_types::Capture, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::Capture, api_types::PaymentsResponse, _, _, _,Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -418,7 +418,7 @@ pub async fn payment_intents_cancel(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::Void, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::Void, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,

View File

@ -9,7 +9,7 @@ use crate::{
stripe::{errors, payment_intents::types as stripe_payment_types},
wrap,
},
core::{api_locking, payments},
core::{api_locking, payment_methods::Oss, payments},
routes,
services::{api, authentication as auth},
types::api as api_types,
@ -54,7 +54,14 @@ pub async fn setup_intents_create(
&req,
create_payment_req,
|state, auth, req| {
payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<
api_types::SetupMandate,
api_types::PaymentsResponse,
_,
_,
_,
Oss,
>(
state,
auth.merchant_account,
auth.key_store,
@ -113,7 +120,7 @@ pub async fn setup_intents_retrieve(
&req,
payload,
|state, auth, payload| {
payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<api_types::PSync, api_types::PaymentsResponse, _, _, _, Oss>(
state,
auth.merchant_account,
auth.key_store,
@ -178,7 +185,14 @@ pub async fn setup_intents_update(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<
api_types::SetupMandate,
api_types::PaymentsResponse,
_,
_,
_,
Oss,
>(
state,
auth.merchant_account,
auth.key_store,
@ -244,7 +258,14 @@ pub async fn setup_intents_confirm(
&req,
payload,
|state, auth, req| {
payments::payments_core::<api_types::SetupMandate, api_types::PaymentsResponse, _, _, _>(
payments::payments_core::<
api_types::SetupMandate,
api_types::PaymentsResponse,
_,
_,
_,
Oss,
>(
state,
auth.merchant_account,
auth.key_store,