11import { PlannedMaintenance , PscVerification , PscVerificationData , ValidationStatusResponse , ValidationStatusResponseResource } from "./types"
22
3- import { HttpResponse , IHttpClient } from "../../http" ;
3+ import { Headers , HttpResponse , IHttpClient } from "../../http" ;
44import Resource , { ApiErrorResponse , ApiResponse } from "../resource" ;
55import Mapping from "../../mapping/mapping" ;
66import { PersonWithSignificantControlResource } from "../psc/types" ;
@@ -22,10 +22,10 @@ export default class PscVerificationService {
2222 * - A `Resource<PscVerification>` object containing the created PSC verification details.
2323 * - An `ApiErrorResponse` object if an error occurs during the request.
2424 */
25- public async postPscVerification ( transactionId : string , pscVerification : PscVerificationData ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
25+ public async postPscVerification ( transactionId : string , pscVerification : PscVerificationData , headers ?: Headers ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
2626 const resourceUri = `/transactions/${ transactionId } /persons-with-significant-control-verification` ;
2727 const pscVerificationResource = Mapping . snakeCaseKeys ( pscVerification ) ;
28- const response = await this . client . httpPost ( resourceUri , pscVerificationResource ) ;
28+ const response = await this . client . httpPost ( resourceUri , pscVerificationResource , headers ) ;
2929
3030 if ( response . error ) {
3131 return this . handleErrorResponse ( response ) ;
@@ -43,9 +43,9 @@ export default class PscVerificationService {
4343 * - A `Resource<PscVerification>` object containing the PSC verification details.
4444 * - An `ApiErrorResponse` object if an error occurs during the request.
4545 */
46- public async getPscVerification ( transactionId : string , pscVerificationId : string ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
46+ public async getPscVerification ( transactionId : string , pscVerificationId : string , headers ?: Headers ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
4747 const resourceUri = `/transactions/${ transactionId } /persons-with-significant-control-verification/${ pscVerificationId } ` ;
48- const response = await this . client . httpGet ( resourceUri ) ;
48+ const response = await this . client . httpGet ( resourceUri , headers ) ;
4949
5050 if ( response . error ) {
5151 return this . handleErrorResponse ( response ) ;
@@ -64,8 +64,11 @@ export default class PscVerificationService {
6464 * - A `Resource<PscVerification>` object containing the updated PSC verification details.
6565 * - An `ApiErrorResponse` object if an error occurs during the request.
6666 */
67- public async patchPscVerification ( transactionId : string , pscVerificationId : string , pscVerificationPatch : PscVerificationData ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
68- const additionalHeaders = { "Content-Type" : "application/merge-patch+json" } ;
67+ public async patchPscVerification ( transactionId : string , pscVerificationId : string , pscVerificationPatch : PscVerificationData , headers ?: Headers ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
68+ const additionalHeaders = {
69+ ...headers ,
70+ "Content-Type" : "application/merge-patch+json"
71+ } ;
6972 const resourceUri = `/transactions/${ transactionId } /persons-with-significant-control-verification/${ pscVerificationId } ` ;
7073 const pscVerificationPatchResource = Mapping . snakeCaseKeys ( pscVerificationPatch ) ;
7174 const response = await this . client . httpPatch ( resourceUri , pscVerificationPatchResource , additionalHeaders ) ;
@@ -91,9 +94,9 @@ export default class PscVerificationService {
9194 * using the `handleErrorResponse` method. Otherwise, the response body is mapped to camelCase keys
9295 * and returned as part of the resource.
9396 */
94- public async getValidationStatus ( transactionId : string , pscVerificationId : string ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
97+ public async getValidationStatus ( transactionId : string , pscVerificationId : string , headers ?: Headers ) : Promise < Resource < PscVerification > | ApiErrorResponse > {
9598 const resourceUri = `/transactions/${ transactionId } /persons-with-significant-control-verification/${ pscVerificationId } /validation_status` ;
96- const response = await this . client . httpGet ( resourceUri ) ;
99+ const response = await this . client . httpGet ( resourceUri , headers ) ;
97100
98101 if ( response . error ) {
99102 return this . handleErrorResponse ( response ) ;
@@ -115,9 +118,9 @@ export default class PscVerificationService {
115118 * - An `ApiResponse<PlannedMaintenance>` object containing maintenance details.
116119 * - An `ApiErrorResponse` object if an error occurs during the request.
117120 */
118- public async checkPlannedMaintenance ( ) : Promise < ApiResponse < PlannedMaintenance > | ApiErrorResponse > {
121+ public async checkPlannedMaintenance ( headers ?: Headers ) : Promise < ApiResponse < PlannedMaintenance > | ApiErrorResponse > {
119122 const maintenanceUri = `/persons-with-significant-control-verification/maintenance` ;
120- const response = await this . client . httpGet ( maintenanceUri ) ;
123+ const response = await this . client . httpGet ( maintenanceUri , headers ) ;
121124
122125 if ( response . error ) {
123126 return this . handleErrorResponse ( response ) ;
0 commit comments