1- import type { z } from "zod" ;
2-
31import { nequiAuth } from "@/auth" ;
42import { getUrls } from "@/constants" ;
53import { Dispersions } from "@/dispersions" ;
@@ -9,9 +7,15 @@ import { GenerateQR } from "@/qr";
97import { Reports } from "@/reports" ;
108import { Subscription } from "@/subscriptions" ;
119import type { SdkResponse } from "@/types" ;
12- import { NequiOptionsSchema } from "@/types" ;
1310import { handleValidationError } from "@/utils/validation" ;
1411
12+ export interface NequiOptions {
13+ apiKey : string ;
14+ clientId : string ;
15+ clientSecret : string ;
16+ env : "development" | "production" ;
17+ }
18+
1519export class Nequi {
1620 private readonly apiKey : string ;
1721 private readonly clientId : string ;
@@ -26,21 +30,11 @@ export class Nequi {
2630 readonly dispersions : Dispersions ;
2731 readonly reports : Reports ;
2832
29- constructor ( opts : z . input < typeof NequiOptionsSchema > ) {
30- const parsed = NequiOptionsSchema . safeParse ( opts ) ;
31-
32- if ( ! parsed . success ) {
33- throw NequiError . from ( {
34- message : `[Nequi SDK]: Invalid configuration - ${ parsed . error . issues . map ( ( e ) => e . message ) . join ( ", " ) } ` ,
35- name : "missing_required_field" ,
36- status : 422 ,
37- } ) ;
38- }
39-
40- this . apiKey = parsed . data . apiKey ;
41- this . clientId = parsed . data . clientId ;
42- this . clientSecret = parsed . data . clientSecret ;
43- this . env = parsed . data . env ;
33+ constructor ( opts : NequiOptions ) {
34+ this . apiKey = opts . apiKey ;
35+ this . clientId = opts . clientId ;
36+ this . clientSecret = opts . clientSecret ;
37+ this . env = opts . env ;
4438
4539 const urls = getUrls ( this . env ) ;
4640 this . basePath = urls . BASE_PATH ;
0 commit comments