public IndexModule(IPbApiClient pbApiClient, IEntryPoint entryPoint, IConnectToBilling billingConnector)
        {
            Get["/"] = parameters =>
            {
                var token = Context.AuthorizationHeaderToken();
                var metaData = pbApiClient.Get<ApiMetaData>(token, "getUserMetaData");

                return Response.AsJson(metaData);
            };

            Post["/action/{action}"] = parameters =>
            {
                var token = Context.AuthorizationHeaderToken();
                var packageResponse = pbApiClient.Get<Package>(token, "package/" + parameters.action);

                var package = Mapper.DynamicMap<IPackage>(packageResponse);
                var vehicle = this.Bind<Vechicle>();
                var request = new LicensePlateNumberRequest(package, new User(), new Context(), vehicle, new AggregationInformation());
                var responses = entryPoint.GetResponsesFromLace(request);

                var packageIdentifier = new PackageIdentifier(packageResponse.Id, new VersionIdentifier(1));
                var requestIdentifier = new RequestIdentifier(Guid.NewGuid(), SystemIdentifier.CreateApi());
                var userIdentifier = new UserIdentifier(((IEntity)Context.CurrentUser).Id);
                var transactionContext = new TransactionContext(Guid.NewGuid(), userIdentifier, requestIdentifier);
                var createTransaction = new CreateTransaction(packageIdentifier, transactionContext);
                billingConnector.CreateTransaction(createTransaction);

                return Response.AsJson(responses.First().Response);
            };
        }
 public TransactionContext(Guid transactionId, UserIdentifier user, RequestIdentifier request)
 {
     TransactionId = transactionId;
     User = user;
     Request = request;
     TransactionDate = SystemTime.Now();
 }
 public TransactionRequest(Guid id, RequestIdentifier request, UserIdentifier user, StateIdentifier state, DateTime date)
 {
     Id = id;
     Request = request;
     User = user;
     State = state;
     Date = date;
     ExpirationDate = DateTime.Now.AddDays(1);
 }
 public Transaction(Guid id, DateTime date, PackageIdentifier package, RequestIdentifier request, UserIdentifier user, StateIdentifier state, ContractIdentifier contract, AccountIdentifier account)
 {
     Id = id;
     Date = date;
     Package = package;
     Request = request;
     User = user;
     State = state;
     Contract = contract;
     Account = account;
 }
 public BillTransactionMessage(PackageIdentifier packageIdentifier, UserIdentifier userIdentifier,
     RequestIdentifier requestIdentifier,
     DateTime transactionDate, Guid transactionId, StateIdentifier state, ContractIdentifier contract, AccountIdentifier account)
 {
     PackageIdentifier = packageIdentifier;
     UserIdentifier = userIdentifier;
     RequestIdentifier = requestIdentifier;
     TransactionDate = transactionDate;
     TransactionId = transactionId;
     State = state;
     Contract = contract;
     Account = account;
 }
 protected bool Equals(UserIdentifier other)
 {
     return Id.Equals(other.Id);
 }
 public InvoiceTransaction(Guid id, DateTime date, PackageIdentifier package, RequestIdentifier request, UserIdentifier user, StateIdentifier state, ContractIdentifier contract, AccountIdentifier account)
     : base(id, date, package, request, user, state, contract, account)
 {
 }