public void Cleanup(AppliedPaymentMethodCleanupContext context)
        {
            // Only finalize the process if this is an Amazon Payments order.
            if (context.PaymentMethod != AppLogic.ro_PMAmazonPayments)
            {
                return;
            }

            // Currently, Amazon only needs to clean up the checkout context if there's an error.
            //  Successful orders will trigger the checkout process to clear the context.
            if (context.Status == AppLogic.ro_OK)
            {
                return;
            }

            var checkoutContext        = PersistedCheckoutContextProvider.LoadCheckoutContext(context.Customer);
            var updatedCheckoutContext = new PersistedCheckoutContext(
                creditCard: checkoutContext.CreditCard,
                payPalExpress: checkoutContext.PayPalExpress,
                purchaseOrder: checkoutContext.PurchaseOrder,
                braintree: checkoutContext.Braintree,
                amazonPayments: null,
                termsAndConditionsAccepted: checkoutContext.TermsAndConditionsAccepted,
                over13Checked: checkoutContext.Over13Checked,
                shippingEstimateDetails: checkoutContext.ShippingEstimateDetails,
                offsiteRequiresBillingAddressId: null,
                offsiteRequiresShippingAddressId: null,
                email: checkoutContext.Email,
                selectedShippingMethodId: checkoutContext.SelectedShippingMethodId);

            PersistedCheckoutContextProvider.SaveCheckoutContext(context.Customer, updatedCheckoutContext);
            context.Customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
        }
        public void Cleanup(AppliedPaymentMethodCleanupContext context)
        {
            // Only finalize the process if this is an Amazon Payments order.
            if (context.PaymentMethod != AppLogic.ro_PMAmazonPayments)
            {
                return;
            }

            // Currently, Amazon only needs to clean up the checkout context if there's an error.
            //  Successful orders will trigger the checkout process to clear the context.
            if (context.Status == AppLogic.ro_OK)
            {
                return;
            }

            var updatedPersistedCheckoutContext = new PersistedCheckoutContextBuilder()
                                                  .From(PersistedCheckoutContextProvider.LoadCheckoutContext(context.Customer))
                                                  .WithoutAmazonPayments()
                                                  .WithoutAcceptJsCreditCard()
                                                  .WithoutAcceptJsECheck()
                                                  .WithoutOffsiteRequiredBillingAddressId()
                                                  .WithoutOffsiteRequiredShippingAddressId()
                                                  .Build();

            PersistedCheckoutContextProvider.SaveCheckoutContext(context.Customer, updatedPersistedCheckoutContext);
            context.Customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
        }
Exemplo n.º 3
0
        public void Cleanup(AppliedPaymentMethodCleanupContext context)
        {
            // Only finalize the process if this is a PayPal Express order.
            if (context.PaymentMethod != AppLogic.ro_PMPayPalExpress)
            {
                return;
            }

            // Currently, PayPal Express only needs to clean up the checkout context if there's an error.
            //  Successful orders will trigger the checkout process to clear the context.
            if (context.Status == AppLogic.ro_OK)
            {
                return;
            }

            var updatedPersistedCheckoutContext = new PersistedCheckoutContextBuilder()
                                                  .From(PersistedCheckoutContextProvider.LoadCheckoutContext(context.Customer))
                                                  .WithoutPayPalExpress()
                                                  .Build();

            PersistedCheckoutContextProvider.SaveCheckoutContext(context.Customer, updatedPersistedCheckoutContext);

            DB.ExecuteSQL(
                sql: "update Customer set RequestedPaymentMethod = null where CustomerId = @customerId",
                parameters: new System.Data.SqlClient.SqlParameter("@customerId", context.Customer.CustomerID));
        }
Exemplo n.º 4
0
 void CleanupPaymentMethod(AppliedPaymentMethodCleanupContext context)
 {
     foreach (var provider in AppliedPaymentMethodCleanupProviders)
     {
         provider.Cleanup(context);
     }
 }
        public void Cleanup(AppliedPaymentMethodCleanupContext context)
        {
            // Only finalize the process if this is a PayPal Express order.
            if (context.PaymentMethod != AppLogic.ro_PMPayPalExpress)
            {
                return;
            }

            // Currently, PayPal Express only needs to clean up the checkout context if there's an error.
            //  Successful orders will trigger the checkout process to clear the context.
            if (context.Status == AppLogic.ro_OK)
            {
                return;
            }

            var checkoutContext        = PersistedCheckoutContextProvider.LoadCheckoutContext(context.Customer);
            var updatedCheckoutContext = new PersistedCheckoutContext(
                creditCard: checkoutContext.CreditCard,
                payPalExpress: null,
                purchaseOrder: checkoutContext.PurchaseOrder,
                braintree: checkoutContext.Braintree,
                amazonPayments: checkoutContext.AmazonPayments,
                termsAndConditionsAccepted: checkoutContext.TermsAndConditionsAccepted,
                over13Checked: checkoutContext.Over13Checked,
                shippingEstimateDetails: checkoutContext.ShippingEstimateDetails,
                offsiteRequiresBillingAddressId: checkoutContext.OffsiteRequiresBillingAddressId,
                offsiteRequiresShippingAddressId: checkoutContext.OffsiteRequiresShippingAddressId,
                email: checkoutContext.Email,
                selectedShippingMethodId: checkoutContext.SelectedShippingMethodId);

            PersistedCheckoutContextProvider.SaveCheckoutContext(context.Customer, updatedCheckoutContext);

            DB.ExecuteSQL(
                sql: "update Customer set RequestedPaymentMethod = null where CustomerId = @customerId",
                parameters: new System.Data.SqlClient.SqlParameter("@customerId", context.Customer.CustomerID));
        }