public IPaymentResponse Charge(PaymentRequest request) { //var callbackUrl = PaymentHelper.GetCallbackUrl(this, nameof(Notify), Context); request.Additional.TryGetValue("email", out var email); var req = new Smart2PayRequest { Payment = new Smart2PayPaymentBasic { MerchantTransactionId = request.Id.ToString(), Amount = (long)request.TotalAmount, Currency = request.Currency, Description = request.Description, ReturnUrl = Setting.ReturnUrl, Customer = new Smart2PayPaymentBasic.CustomerInfo { Email = (string)email } } }; var resp = new Smart2PayApi(Setting).CreatePayment(req); return(new RedirectResponse(resp.Payment.RedirectUrl, request.Id) { paymemtMethodReferenceId = resp.Payment.Id.ToString() }); }
public PaymentStatusResponse checkStatus(PaymentRequest request) { var result = new PaymentStatusResponse { HasResult = true }; try { var paymentId = request.ReferenceId; var statusResponse = new Smart2PayApi(Setting).CheckStatus(long.Parse(paymentId)); result.Status = ConvertStatus(statusResponse.Payment.Status.Info); } catch (AggregateException ex) { Kooboo.Data.Log.Instance.Exception.WriteException(ex.InnerException); } return(result); }