コード例 #1
1
        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);
            };
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public CreateTransactionBuilder WithPackageIdentifier(PackageIdentifier package)
 {
     this.package = package;
     return this;
 }
コード例 #5
0
 protected bool Equals(PackageIdentifier other)
 {
     return Id.Equals(other.Id) && Equals(Version, other.Version);
 }
コード例 #6
0
 public Request CreateTransaction(Guid packageId, long packageVersion, DateTime date, Guid userId,
     Guid contractId,
     string system, long contractVersion, DataProviderResponseState state, string accountNumber, double packageCostPrice, double packageRecommendedPrice, DataProviderNoRecordState billNoRecords)
 {
     DataProvider = new DataProviderIdentifier(DataProviderCommandSource.EntryPoint, DataProviderAction.Response, state, billNoRecords);
     Date = date;
     Connection = new ConnectionTypeIdentifier();
     Payload = new PayloadIdentifier();
     CommandType = CommandType.Accounting;
     State = new StateIdentifier((int) state, state.ToString());
     RequestContext = new SearchRequestIndentifier();
     Package = new PackageIdentifier(packageId, new VersionIdentifier(packageVersion), packageCostPrice, packageRecommendedPrice);
     return this;
 }
コード例 #7
0
 public CreateTransaction(PackageIdentifier packageIdentifier, TransactionContext context)
 {
     PackageIdentifier = packageIdentifier;
     Context = context;
 }
コード例 #8
0
 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)
 {
 }