Esempio n. 1
0
        private void makePayment()
        {
            try
            {
                var response = paymentEndPoint.authorise(buildPaymentRequest());
                payment.transactionId = response.pspReference;
                CreatePaymentNotice.createSave(payment, response);
                paymentStatus.success = (response.resultCode != "Refused");
                paymentStatus.message = (paymentStatus.success) ? "PAYMENT_SUCCESSFUL" : "PAYMENT_FAILED";
            }

            catch (Exception exp)
            {
                paymentStatus.success = false;
                paymentStatus.message = exp.Message;
                log.Error(exp);
            }
        }
Esempio n. 2
0
        public string paymentResult(AdyenResult adyenResult)
        {
            try
            {
                //here we map the fields
                var paymentNotice = new PaymentNotice
                {
                    success       = true,
                    paymentRef    = adyenResult.merchantReference,
                    type          = (adyenResult.authResult == "A") ? "AUTHORISATION" : "REFUSED",
                    transactionId = adyenResult.pspReference
                };


                //then we create thepayment notice
                CreatePaymentNotice.save(paymentNotice);

                //then we result a payment status
                result.PaymentStatus = new PaymentStatus
                {
                    paymentRef = adyenResult.merchantReference,
                    success    = (adyenResult.authResult == "A"),
                };



                if (result.PaymentStatus.success)
                {
                    //pay.paymentRef, pay.amount, pay.currency, pay.shopperEmail, pay.accountHolderName
                    var paramPayment = new Payment {
                        paymentRef = adyenResult.merchantReference
                    };
                    result.Payment = orm.execObject <Result>(paramPayment, "api.user_payment_get").Payment;

                    result.Payment.sendReceiptEmail();
                }
            }
            catch (Exception exp)
            {
                errorResult(exp);
            }
            return(formattedResult(result));
        }
Esempio n. 3
0
        public string index(FormCollection formCollection)
        {
            string retString;

            if (formCollection["eventCode"] == "NOTIFICATIONTEST")
            {
                return("[accepted]");
            }
            try
            {
                var paymentNotice = createPaymentNotice(formCollection);
                CreatePaymentNotice.save(paymentNotice);
                retString = "[accepted]";
            }
            catch (Exception exp)
            {
                retString = "[Failed]";
                log.Error(exp);
            }
            return(retString);
        }