forked from Shared/esg
final update on moallm client
This commit is contained in:
@@ -6,6 +6,11 @@ import {
|
||||
getSayahProviderError,
|
||||
SayahApiResponse,
|
||||
} from '../../common/helpers/sayah-response.helper';
|
||||
import {
|
||||
describeShahkarResponse,
|
||||
getShahkarProviderError,
|
||||
parseShahkarInqueryResult,
|
||||
} from '../../common/helpers/shahkar-response.helper';
|
||||
import { InquiryType } from '../../common/enums/inquiry-type.enum';
|
||||
import { ProviderName } from '../../common/enums/provider-name.enum';
|
||||
import { ProviderEnvConfig } from '../../config/configuration';
|
||||
@@ -210,14 +215,22 @@ export class HamtaProvider extends LegacyApiProvider {
|
||||
}),
|
||||
);
|
||||
|
||||
const result = this.extractSoapValue(response.data, 'ShahkarInqueryResult');
|
||||
const shahkarFields = parseShahkarInqueryResult(response.data);
|
||||
const providerError = getShahkarProviderError(shahkarFields);
|
||||
if (providerError) {
|
||||
this.nestLogger.warn(
|
||||
`SHAHKAR provider business failure | ${describeShahkarResponse(shahkarFields)}`,
|
||||
);
|
||||
throw this.formatProviderError(providerError.message, providerError.code, undefined, {
|
||||
providerTrackingCode: providerError.providerTrackingCode,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
raw: {
|
||||
nationalCode,
|
||||
mobileNo,
|
||||
result,
|
||||
soap: response.data,
|
||||
...shahkarFields,
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user