Example #1
0
        public PaymentInitializeResult Initialize(PaymentMethod currentPayment, string orderNumber, string returnUrl, string orderRef)
        {
            Log.InfoFormat("Retrieving consumer legal address for payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId);
            CustomerDetails customerDetails = CreateModel(currentPayment);

            if (customerDetails == null)
            {
                throw new Exception("Payment class must be ExtendedPayExPayment when using this payment method");
            }

            ConsumerLegalAddressResult result = _verificationManager.GetConsumerLegalAddress(customerDetails.SocialSecurityNumber, customerDetails.CountryCode);

            if (!result.Status.Success)
            {
                return new PaymentInitializeResult {
                           ErrorMessage = result.Status.Description
                }
            }
            ;

            _paymentActions.UpdateConsumerInformation(currentPayment, result);
            Log.InfoFormat("Successfully retrieved consumer legal address for payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId);

            return(_paymentInitializer.Initialize(currentPayment, orderNumber, returnUrl, orderRef));
        }