public static PayPalSessionData GetPayPalSessionData(this HttpContextBase httpContext, CheckoutState state = null) { if (state == null) state = httpContext.GetCheckoutState(); if (!state.CustomProperties.ContainsKey(PayPalPlusProvider.SystemName)) state.CustomProperties.Add(PayPalPlusProvider.SystemName, new PayPalSessionData()); return state.CustomProperties[PayPalPlusProvider.SystemName] as PayPalSessionData; }
public static CheckoutState GetCheckoutState(this HttpContextBase httpContext) { Guard.ArgumentNotNull(() => httpContext); var state = httpContext.Session.SafeGetValue<CheckoutState>(CheckoutState.CheckoutStateSessionKey); if (state != null) return state; state = new CheckoutState(); httpContext.Session.SafeSet(CheckoutState.CheckoutStateSessionKey, state); return state; }