@cheqi/sdk 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,5 +3,4 @@ export declare class MatchingService {
|
|
|
3
3
|
private readonly apiClient;
|
|
4
4
|
constructor(apiClient: Pick<CheqiApiClient, "matchCustomer">);
|
|
5
5
|
matchCustomer(identificationDetails: IdentificationDetails, accessToken?: string | null): Promise<RecipientResolutionResponse>;
|
|
6
|
-
private hasValidIdentifiers;
|
|
7
6
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { CheqiApiError, CheqiSDKError, ErrorCodes } from "../errors.js";
|
|
2
|
-
import { coalesceString } from "../utils.js";
|
|
3
2
|
export class MatchingService {
|
|
4
3
|
apiClient;
|
|
5
4
|
constructor(apiClient) {
|
|
6
5
|
this.apiClient = apiClient;
|
|
7
6
|
}
|
|
8
7
|
async matchCustomer(identificationDetails, accessToken) {
|
|
9
|
-
if (!
|
|
10
|
-
throw new CheqiSDKError("Identification details
|
|
8
|
+
if (!identificationDetails) {
|
|
9
|
+
throw new CheqiSDKError("Identification details cannot be null", { errorCode: ErrorCodes.VALIDATION_ERROR, httpStatusCode: 400 });
|
|
11
10
|
}
|
|
12
11
|
try {
|
|
13
12
|
return await this.apiClient.matchCustomer(identificationDetails, accessToken);
|
|
@@ -22,11 +21,5 @@ export class MatchingService {
|
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
|
-
hasValidIdentifiers(identificationDetails) {
|
|
26
|
-
if (!identificationDetails) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return Boolean(coalesceString(identificationDetails.cardDetails?.paymentAccountNumber, identificationDetails.cardDetails?.paymentAccountReference, identificationDetails.paymentAccountDetails?.identifier, identificationDetails.recipientEmail, identificationDetails.cheqiReceiptId, identificationDetails.pairingCode));
|
|
30
|
-
}
|
|
31
24
|
}
|
|
32
25
|
//# sourceMappingURL=matching.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matching.js","sourceRoot":"","sources":["../../src/services/matching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"matching.js","sourceRoot":"","sources":["../../src/services/matching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGxE,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,SAAgD;QAAhD,cAAS,GAAT,SAAS,CAAuC;IAAG,CAAC;IAEjF,KAAK,CAAC,aAAa,CACjB,qBAA4C,EAC5C,WAA2B;QAE3B,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3B,MAAM,IAAI,aAAa,CACrB,uCAAuC,EACvC,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,cAAc,EAAE,GAAG,EAAE,CAChE,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;QAChF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,aAAa,EAAE,CAAC;gBACnC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,aAAa,CAAC,6BAA6B,MAAM,CAAE,KAAe,CAAC,OAAO,CAAC,EAAE,EAAE;gBACvF,SAAS,EAAE,UAAU,CAAC,aAAa;gBACnC,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|