Exemple #1
0
 public string buy(Payment payment)
 {
     try
     {
         result = orm.execObject <Result>(payment, "api.user_payment_create");
     }
     catch (Exception exp)
     {
         errorResult(exp);
     }
     return(formattedResult(result));
 }
 public string buy(Payment payment)
 {
     try
     {
         result = orm.execObject<Result>(payment, "api.user_payment_create");
     }
     catch (Exception exp)
     {
         errorResult(exp);
     }
     return formattedResult(result);
 }
Exemple #3
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));
        }
        public static PaymentStatus validatePayment(Payment payment)
        {
            var vp = new PaymentStatus();

            if (payment.method == "PAYPAL" || payment.useSavedDetails)
            {

                vp.success = true; //paypal always true for now

            }
            else
            {
                vp.success = CardValidator.Validate(payment.method, payment.number);
            }
            if (vp.success == false) // all invalid mean bad card number for now.
            {
                vp.message = "INVALID_CARD_NUMBER";
            }
            return vp;
        }
        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);
        }
Exemple #6
0
 public Pay(Payment _payment, string _userToken)
 {
     payment = _payment;
     payment.userToken = _userToken;
 }
 public ProcessPayment(Payment _payment)
 {
     payment         = _payment;
     paymentStatus   = new PaymentStatus();
     paymentEndPoint = new PaymentEndPoint().paymentService;
 }
 public ProcessPayment(Payment _payment)
 {
     payment = _payment;
     paymentStatus = new PaymentStatus();
     paymentEndPoint = new PaymentEndPoint().paymentService;
 }