Skip to content

Commit

Permalink
refactor: simplify sale method input by using SecureSale type
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-herasme committed Dec 4, 2024
1 parent d108891 commit b2ba5b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/azul-api/secure/secure.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { randomUUID } from 'crypto';
import { ProcessPaymentTransaction } from '../process-payment/process-payment';
import { ProcessPaymentSchema, ProcessPaymentSchemaInput } from '../process-payment/schemas';
import { ProcessPaymentSchema } from '../process-payment/schemas';
import { Process } from '../processes';
import AzulRequester from '../request';
import { BrowserInfo, CardHolderInfo, MethodNotificationStatus, ThreeDSAuth } from './types';
import { MethodNotificationStatus, SecureSale } from './types';
import { sleep } from '../../utils';

type SecurePaymentSession = {
Expand All @@ -20,15 +20,7 @@ export class Secure {
this.requester = requester;
}

async sale(
input: ProcessPaymentSchemaInput & {
cardHolderInfo: CardHolderInfo;
browserInfo: BrowserInfo;
threeDSAuth: ThreeDSAuth;
} & {
useIframe?: boolean;
}
): Promise<
async sale(input: SecureSale): Promise<
| {
redirect: true;
id: string;
Expand Down
10 changes: 10 additions & 0 deletions src/azul-api/secure/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import type { ProcessPaymentSchemaInput } from '../process-payment/schemas';

export type SecureSale = ProcessPaymentSchemaInput & {
cardHolderInfo: CardHolderInfo;
browserInfo: BrowserInfo;
threeDSAuth: ThreeDSAuth;
} & {
useIframe?: boolean;
};

export enum ChallengeIndicator {
/**
* Sin preferencias (no tiene preferencia si se debe realizar un desafío.
Expand Down

0 comments on commit b2ba5b4

Please sign in to comment.