private async Task <bool> SetResult(PaymentResponseConfig responseConfig, PaymentVerificationResponse response) { var isSuccess = false; var authority = responseConfig.Authority; if (IsSuccess(response.Body.Status)) { await SetSuccessAsync(authority, response); isSuccess = true; } else { await SetFailAsync(authority); } return(isSuccess); }
public async Task <PaymentResponseResult> PaymentResponseAsync(PaymentResponseConfig responseConfig) { var zp = GetService(); var paymentVerificationRequest = await GetPaymentVerificationRequest(responseConfig); var response = await zp.PaymentVerificationAsync(paymentVerificationRequest); await zp.CloseAsync(); var isSuccess = await SetResult(responseConfig, response); var status = response.Body.Status; var result = new PaymentResponseResult() { IsSuccess = isSuccess, ResponseCode = status }; return(result); }
private async Task <PaymentVerificationRequest> GetPaymentVerificationRequest(PaymentResponseConfig responseConfig) { string authority = responseConfig.Authority; int amount = await zarinPalPaymentRepository.GetAmountByAuthorityAsync(authority); return(new PaymentVerificationRequest() { Body = new PaymentVerificationRequestBody() { Amount = amount, Authority = authority, MerchantID = merchantId } }); }