예제 #1
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));
        }
예제 #2
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);
        }