/// <summary> /// Executes processing of the authorization event info. /// </summary> public ResultCode Execute() { ResultCode result = ResultCode.None; SharedAuthorizationLogic sharedAuthorizationLogic = new SharedAuthorizationLogic(Context, CommerceOperationsFactory.AuthorizationOperations(Context)); // Marshal MasterCard Authorization request object into partner-agnostic model. Authorization authorization = new Authorization(); Context[Key.Authorization] = authorization; MasterCard masterCard = new MasterCard(Context); masterCard.MarshalAuthorization(); // Add the authorization even to the data store. result = sharedAuthorizationLogic.AddAuthorization(); // Build the response to send back to MasterCard based on the result of adding the Authorization. Context[Key.ResultCode] = result; masterCard.BuildAuthorizationResponse(); // If the authorization event was successfully committed to the data store, send user notifications. if (result == ResultCode.Created) { Context.Log.Verbose("MasterCard Authorization successfully persisted. Sending notifications asynchronously."); NotifyAuthorization notifyAuthorization = new NotifyAuthorization(Context); Context[Key.CardBrand] = CardBrand.MasterCard; Task.Run(new Action(notifyAuthorization.SendNotification)); } return(result); }