Last active
September 20, 2023 07:14
-
-
Save hendrasyp/7ae9322828689d9176a43c88b86dfd87 to your computer and use it in GitHub Desktop.
BPJSLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BPJSFingerSEPFindOne_Response SEPFINGER_FindOne(string memberNo, DateOnly serviceDate, BPJSSetupEntity bpjsSetup) | |
{ | |
string DateVal = serviceDate.ToString(BaseConfiguration.DateOnly).ToString(); | |
StringBuilder jsonString = new StringBuilder(); | |
BPJSResponse bpjsResponse = new BPJSResponse(); | |
BPJSFingerSEPFindOne_Response resultBpjs = new BPJSFingerSEPFindOne_Response(); | |
LogRequest dbLog = new LogRequest(); | |
dbLog.DeviceInfo = "Background Process"; | |
dbLog.PartnerKey = Int32.Parse(partnerKey); | |
dbLog.ReferenceNo = $"{memberNo} :: {DateVal}" ; | |
dbLog.RequestTime = BaseConfiguration.ServerDateTime_DT; | |
dbLog.EpisodeNo = ""; | |
dbLog.RequestType = "RequestResponse"; | |
dbLog.UserId = userId; | |
dbLog.WsCode = AFYAServiceEnum.VClaim.GetString(); | |
try | |
{ | |
string uriRequest = $"{bpjsSetup.BPJSSetupObject.BPJSSvc}{bpjsSetup.BPJSHeaderParameter.ServiceURI}{memberNo}/TglPelayanan/{DateVal}"; | |
dbLog.ServicesName = $"{AFYAServiceEnum.VCLAIM_FINGER_SEP_FINDONE.GetEnumDescription()} {uriRequest}"; | |
dbLog.RequestData = $"{memberNo} :: {DateVal}"; | |
jsonString.Append(BPJSBridge.HttpGETJSonString( | |
$"{uriRequest}", | |
bpjsSetup.BPJSSetupObject.BPJSConsId, | |
bpjsSetup.BPJSHeaderParameter.TimeStamps, | |
bpjsSetup.BPJSHeaderParameter.SignatureKey, | |
bpjsSetup.BPJSHeaderParameter.UserVClaimKey | |
)); | |
bpjsResponse = JsonConvert.DeserializeObject<BPJSResponse>(jsonString.ToString()); | |
dbLog.ResponseData = jsonString.ToString(); | |
dbLog.ResponseTime = BaseConfiguration.ServerDateTime_DT; | |
if (bpjsResponse == null) // NotConnection | |
{ | |
dbLog.ResponseDecrypt = "Response tidak dapat di dekrip karena respon BPJS null."; | |
resultBpjs.Code = BpjsHttpStatusCodes.ErrorCode.ToString(); | |
resultBpjs.Message = BaseConfiguration.BpjsErrorMessage; | |
GlobalService.APILogService.KLogger(dbLog); | |
return resultBpjs; | |
} | |
else { | |
if (bpjsResponse.metaData.code == "200" && bpjsSetup.IsEncrypted == true) | |
{ | |
string key = bpjsSetup.BPJSHeaderParameter.ConsumerID + bpjsSetup.BPJSHeaderParameter.ConsumerSecret + bpjsSetup.BPJSHeaderParameter.TimeStamps; | |
object objResponse = BPJSBridge.DecryptResult(key, bpjsResponse.response); | |
resultBpjs.response = JsonConvert.DeserializeObject<HOM.Models.Responses.BPJS.FingerSEP.Response>(objResponse.ToString()); | |
dbLog.ResponseDecrypt = objResponse.ToString(); | |
} | |
Exception bpjsErr = new Exception(bpjsResponse.metaData.message); | |
resultBpjs.Code = bpjsResponse.metaData.code; | |
resultBpjs.Message = "[BPJS] " + bpjsResponse.metaData.message; | |
GlobalService.APILogService.KLogger(dbLog); | |
return resultBpjs; | |
} | |
} | |
catch (Exception e) | |
{ | |
resultBpjs.ErrorCode = BpjsHttpStatusCodes.ErrorCode.ToString(); | |
resultBpjs.ErrorMessage = GenerateBridgingException(AFYAServiceEnum.VCLAIM_CariNomorSuratKontrol.GetString(), e); | |
_textLogger.Error(resultBpjs.ErrorMessage); | |
dbLog.ResponseData = resultBpjs.Message; | |
GlobalService.APILogService.KLogger(dbLog); | |
return resultBpjs; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment