Convious Pricing API Client

A Java client library that is meant to simplify communication with the Convious pricing API.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.convious
ArtifactId

ArtifactId

pricing-api-client
Last Version

Last Version

1.0.8
Release Date

Release Date

Type

Type

jar
Description

Description

Convious Pricing API Client
A Java client library that is meant to simplify communication with the Convious pricing API.
Project URL

Project URL

https://github.com/Convious/pricing-api-client-java
Project Organization

Project Organization

Convious
Source Code Management

Source Code Management

https://github.com/Convious/pricing-api-client-java

Download pricing-api-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.convious/pricing-api-client/ -->
<dependency>
    <groupId>com.convious</groupId>
    <artifactId>pricing-api-client</artifactId>
    <version>1.0.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.convious/pricing-api-client/
implementation 'com.convious:pricing-api-client:1.0.8'
// https://jarcasting.com/artifacts/com.convious/pricing-api-client/
implementation ("com.convious:pricing-api-client:1.0.8")
'com.convious:pricing-api-client:jar:1.0.8'
<dependency org="com.convious" name="pricing-api-client" rev="1.0.8">
  <artifact name="pricing-api-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.convious', module='pricing-api-client', version='1.0.8')
)
libraryDependencies += "com.convious" % "pricing-api-client" % "1.0.8"
[com.convious/pricing-api-client "1.0.8"]

Dependencies

compile (1)

Group / Artifact Type Version
com.google.code.gson : gson jar 2.8.5

test (4)

Group / Artifact Type Version
io.undertow : undertow-core jar [2.0.23,)
org.junit.jupiter : junit-jupiter-api jar 5.5.2
org.junit.jupiter : junit-jupiter-engine jar 5.5.2
org.mockito : mockito-all jar 1.9.5

Project Modules

There are no modules declared in this project.

Convious Pricing API Java client

A Java client library that is meant to simplify communication with the Convious pricing API.

Installation

Maven

<dependency>
    <groupId>com.convious</groupId>
    <artifactId>pricing-api-client</artifactId>
    <version>1.0</version>
</dependency>

Gradle

implementation 'com.convious:pricing-api-client:1.0.0'

SBT

libraryDependencies += "com.convious" % "pricing-api-client" % "1.0.0"

Usage

Create API client using your clientId and clientSecret:

var client = PricingApiClient.create(clientId, clientSecret);

Then you can use the client to either post events that communicate changes of your inventory or to retrieve the prices for any of the products. The client has 2 flavours of methods: synchronous and asynchronous (methods end with Async suffix and instead of result return CompletableFuture)

Posting inventory events

You can either post a single event using postEvent(Async) or post them in batches using postEvents(Async) (the latter is recommended)`:

client.postEvents(
    new InventoryEvent[] {
        new ProductCreated(
            "productReference",
            "Product name",
            3,
            new ProductPricing(
                new BigDecimal("10.00"),
                new BigDecimal("20.00"),
                new BigDecimal("15.00"),
                new BigDecimal("22.00"),
            )
        ),
        new ProductPricingChanged(
            "productReference",
            new ProductPricing(
                new BigDecimal("10.50"),
                new BigDecimal("20.50"),
                new BigDecimal("15.50"),
                new BigDecimal("22.50"),
            )
        ),
        new ProductAvailabilityChanged(
            "productReference",
            LocalDate.of(2019, 10, 10),
            "10:00:00",
            3
        ),
        new ProductRemoved(
            "productReference"
        ),
    }
);

Getting prices

You can get the prices of your inventory using getPrices(Async):

var request = new PricingRequest(
    "cookie id",
    "127.0.0.1",
    LocalDate.of(2019, 10, 1),
    LocalDate.of(2019, 10, 30),
    "Europe/Amsterdam",
    new PricingRequestProduct[] {
        new PricingRequestProduct("productReference", 2),
        new PricingRequestProduct("productReference2", 1),
    },
    new String[] { "10:00:00", "10:30:00", "12:00:00" }
);
var prices = client.getPrices(request);

License

This library is licensed under MIT. Full license text is available in LICENSE.

com.convious

convious

Versions

Version
1.0.8
1.0.7
1.0.5
1.0.3
1.0.1
1.0