public async Task StoreConsent(ConsentArtefactRepresentation consentArtefact)
        {
            var notification = consentArtefact.Notification;

            if (notification.Status == ConsentStatus.GRANTED)
            {
                var consent = new Consent(notification.ConsentDetail.ConsentId,
                                          notification.ConsentDetail,
                                          notification.Signature,
                                          notification.Status,
                                          notification.ConsentId);
                await consentRepository.AddAsync(consent);
            }
            else
            {
                await consentRepository.UpdateAsync(notification.ConsentId, notification.Status);

                if (notification.Status == ConsentStatus.REVOKED)
                {
                    var consent = await consentRepository.GetFor(notification.ConsentId);

                    var cmSuffix        = consent.ConsentArtefact.ConsentManager.Id;
                    var gatewayResponse = new GatewayRevokedConsentRepresentation(
                        Guid.NewGuid(),
                        DateTime.Now.ToUniversalTime(),
                        new ConsentUpdateResponse(ConsentUpdateStatus.OK.ToString(),
                                                  notification.ConsentId),
                        null,
                        new Resp(consentArtefact.RequestId));
                    await gatewayClient.SendDataToGateway(PATH_CONSENT_ON_NOTIFY, gatewayResponse, cmSuffix);
                }
            }
        }
Example #2
0
 public void SendDataToGateway(object pATH_CONSENT_ON_NOTIFY, GatewayRevokedConsentRepresentation gatewayRevokedConsentRepresentation, string id)
 {
     throw new NotImplementedException();
 }