public void Report() { var iDealTransactionId = Request["transaction_id"]; var payment = _paymentService.Query().ByThirdPartyTransactionId(iDealTransactionId, "iDeal"); var paymentMethod = _paymentMethodService.Find(payment.PaymentMethodId); var settings = paymentMethod.LoadProcessorConfig <IDealConfig>(); var idealCheck = new IdealCheck(settings.PartnerId, settings.TestMode, iDealTransactionId); ProcessPaymentResult result = null; if (idealCheck.Error) { result = ProcessPaymentResult.Failed(idealCheck.ErrorMessage, iDealTransactionId); } else if (idealCheck.Payed) { result = ProcessPaymentResult.Success(iDealTransactionId); } if (result != null) { _paymentService.AcceptProcessResult(payment, result); } }
public ActionResult FakeFailure(int paymentId, string commerceReturnUrl) { var payment = _paymentService.Find(paymentId); _paymentService.AcceptProcessResult(payment, ProcessPaymentResult.Failed("Payment failed.", Guid.NewGuid().ToString("N"))); return(Redirect(Url.Payment().DecorateReturn(commerceReturnUrl, payment))); }
private ProcessPaymentResult ProcessResponse(Payment payment, BuckarooConfig settings) { var signature = BuckarooUtil.GetSignature(Request.Form, settings.SecretKey); if (signature != Request["brq_signature"]) { throw new InvalidOperationException("Invalid response."); } var statusCode = Request["brq_statuscode"]; var transactionType = Request["brq_transaction_type"]; var statusMessage = Request["brq_statusmessage"]; var transactionId = Request["brq_transactions"]; var methodId = Request["Brq_payment_method"]; // Failed / Validation Failure / Technical Failure if (statusCode == "490" || statusCode == "491" || statusCode == "492") { return(ProcessPaymentResult.Failed(statusCode + ": " + statusMessage)); } // Rejected by the (third party) payment provider if (statusCode == "690") { return(ProcessPaymentResult.Failed(statusCode + ": " + statusMessage)); } // Cancelled by Customer / Merchant if (statusCode == "890" || statusCode == "891") { return(ProcessPaymentResult.Cancelled()); } // 190: Success (but might later become reserved) if (statusCode != "190") { return(ProcessPaymentResult.Pending(null)); } if (methodId == "simplesepadirectdebit") { // Reserved if (transactionType == "C501") { return(ProcessPaymentResult.Pending(transactionId)); } return(ProcessPaymentResult.Pending(null)); } else if (methodId == "ideal") { return(ProcessPaymentResult.Success(transactionId)); } else if (methodId == "paypal") { return(ProcessPaymentResult.Success(transactionId)); } throw new NotSupportedException("Not support payment method: " + methodId + "."); }