Пример #1
0
        public override Task <SwiftCashoutResponse> SwiftCashout(SwiftCashoutRequest request, ServerCallContext context)
        {
            var resp = new SwiftCashoutResponse();

            resp.Result = new SwiftCashoutResponse.Types.SwiftCashoutData()
            {
                TransferId = "123123"
            };

            return(Task.FromResult(resp));
        }
Пример #2
0
        public override async Task <SwiftCashoutResponse> SwiftCashout(SwiftCashoutRequest request, ServerCallContext context)
        {
            var result = new SwiftCashoutResponse();

            var token    = context.GetBearerToken();
            var response = await _walletApiV1Client.OffchainCashoutSwiftAsync(_mapper.Map <OffchainCashoutSwiftModel>(request), token);

            if (response.Result != null)
            {
                var finalizeResponse =
                    await _walletApiV1Client.OffchainFinalizeAsync(new OffchainFinalizeModel
                {
                    TransferId         = response.Result.TransferId,
                    ClientRevokePubKey = response.Result.TransferId,
                    ClientRevokeEncryptedPrivateKey = response.Result.TransferId,
                    SignedTransferTransaction       = response.Result.TransferId
                }, token);

                if (finalizeResponse.Result != null)
                {
                    result.Body = new SwiftCashoutResponse.Types.Body
                    {
                        TransferId = finalizeResponse.Result.TransferId
                    };
                }

                if (response.Error != null)
                {
                    result.Error = response.Error.ToApiError();
                }
            }

            if (response.Error != null)
            {
                result.Error = response.Error.ToApiError();
            }

            return(result);
        }