private async Task RejectProofRequest() { var loadingDialog = DialogService.Loading("Proccessing"); try { this.IsBusy = true; var context = await _agentProvider.GetContextAsync(); // var (message, proofRecord) = await _proofService.CreatePresentationAsync(context, ProofRequestRecord.Id, RequestedCredentials); await _proofService.RejectProofRequestAsync(context, ProofRequestRecord.Id); _eventAggregator.Publish(new ApplicationEvent() { Type = ApplicationEventType.CredentialsUpdated }); loadingDialog.Hide(); await NavigationService.NavigateBackAsync(); this.IsBusy = false; var toastConfig = new ToastConfig("Rejected successfully!"); toastConfig.BackgroundColor = Color.Green; toastConfig.Position = ToastPosition.Top; toastConfig.SetDuration(3000); DialogService.Toast(toastConfig); } catch (Exception e) { this.IsBusy = false; loadingDialog.Hide(); DialogService.Alert("Error while Reject Proof Request"); } }
/// <summary> /// Reference https://github.com/hyperledger/aries-framework-dotnet/blob/master/test/Hyperledger.Aries.Tests/Protocols/ProofTests.cs#L838 /// </summary> async Task DismissProofRequest() { var isConfirmed = await Application.Current.MainPage.DisplayAlert("Confirm", "Are you sure you want to decline this request?", "Yes", "No"); if (!isConfirmed) { return; } try { IsBusy = true; var agentContext = await agentContextProvider.GetContextAsync(); string id = proofRecord?.Id; if (id != null) { await proofService.RejectProofRequestAsync(agentContext, id); eventAggregator.Publish(new ApplicationEvent() { Type = ApplicationEventType.RefreshProofRequests }); } await NavigationService.NavigateBackAsync(); } catch (Exception xx) { await Application.Current.MainPage.DisplayAlert("Error", xx.Message, "Ok"); } finally { IsBusy = false; } }
public async Task RejectProofRequestCredentialNotFound() { var ex = await Assert.ThrowsAsync <AriesFrameworkException>(async() => await _proofService.RejectProofRequestAsync(_issuerWallet, "bad-proof-id")); Assert.True(ex.ErrorCode == ErrorCode.RecordNotFound); }