Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spec #26

Merged
merged 6 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ src/main/java/com/gr4vy/api/model/AuditLog.java
src/main/java/com/gr4vy/api/model/AuditLogResource.java
src/main/java/com/gr4vy/api/model/AuditLogUser.java
src/main/java/com/gr4vy/api/model/AuditLogs.java
src/main/java/com/gr4vy/api/model/BINLookupRequest.java
src/main/java/com/gr4vy/api/model/BINLookupRequestContext.java
src/main/java/com/gr4vy/api/model/BillingDetails.java
src/main/java/com/gr4vy/api/model/BillingDetailsRequest.java
src/main/java/com/gr4vy/api/model/BillingDetailsUpdateRequest.java
Expand All @@ -67,9 +69,7 @@ src/main/java/com/gr4vy/api/model/CardSchemeDefinitions.java
src/main/java/com/gr4vy/api/model/CartItem.java
src/main/java/com/gr4vy/api/model/CheckoutSession.java
src/main/java/com/gr4vy/api/model/CheckoutSessionCreateRequest.java
src/main/java/com/gr4vy/api/model/CheckoutSessionFieldsPaymentMethod.java
src/main/java/com/gr4vy/api/model/CheckoutSessionRequest.java
src/main/java/com/gr4vy/api/model/CheckoutSessionSecureFieldsUpdate.java
src/main/java/com/gr4vy/api/model/CheckoutSessionUpdateRequest.java
src/main/java/com/gr4vy/api/model/Connection.java
src/main/java/com/gr4vy/api/model/ConnectionDefinition.java
Expand All @@ -78,6 +78,8 @@ src/main/java/com/gr4vy/api/model/ConnectionOptions.java
src/main/java/com/gr4vy/api/model/ConnectionOptionsAdyenCard.java
src/main/java/com/gr4vy/api/model/ConnectionOptionsCybersourceAntiFraud.java
src/main/java/com/gr4vy/api/model/ConnectionOptionsForterAntiFraud.java
src/main/java/com/gr4vy/api/model/ConnectionOptionsPaypalPaypal.java
src/main/java/com/gr4vy/api/model/ConnectionOptionsPaypalPaypalAdditionalData.java
src/main/java/com/gr4vy/api/model/Connections.java
src/main/java/com/gr4vy/api/model/Cryptogram.java
src/main/java/com/gr4vy/api/model/DigitalWallet.java
Expand Down Expand Up @@ -204,6 +206,7 @@ src/main/java/com/gr4vy/api/model/ThreeDSecureResultRequestEventContext.java
src/main/java/com/gr4vy/api/model/ThreeDSecureSuccessEvent.java
src/main/java/com/gr4vy/api/model/ThreeDSecureSuccessEventContext.java
src/main/java/com/gr4vy/api/model/ThreeDSecureSummary.java
src/main/java/com/gr4vy/api/model/ThreeDSecureV2.java
src/main/java/com/gr4vy/api/model/TokenizedRequest.java
src/main/java/com/gr4vy/api/model/Transaction.java
src/main/java/com/gr4vy/api/model/TransactionCaptureRequest.java
Expand Down Expand Up @@ -263,6 +266,8 @@ src/test/java/com/gr4vy/api/model/AuditLogResourceTest.java
src/test/java/com/gr4vy/api/model/AuditLogTest.java
src/test/java/com/gr4vy/api/model/AuditLogUserTest.java
src/test/java/com/gr4vy/api/model/AuditLogsTest.java
src/test/java/com/gr4vy/api/model/BINLookupRequestContextTest.java
src/test/java/com/gr4vy/api/model/BINLookupRequestTest.java
src/test/java/com/gr4vy/api/model/BillingDetailsRequestTest.java
src/test/java/com/gr4vy/api/model/BillingDetailsTest.java
src/test/java/com/gr4vy/api/model/BillingDetailsUpdateRequestTest.java
Expand All @@ -278,16 +283,16 @@ src/test/java/com/gr4vy/api/model/CardSchemeDefinitionTest.java
src/test/java/com/gr4vy/api/model/CardSchemeDefinitionsTest.java
src/test/java/com/gr4vy/api/model/CartItemTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionCreateRequestTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionFieldsPaymentMethodTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionRequestTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionSecureFieldsUpdateTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionTest.java
src/test/java/com/gr4vy/api/model/CheckoutSessionUpdateRequestTest.java
src/test/java/com/gr4vy/api/model/ConnectionDefinitionTest.java
src/test/java/com/gr4vy/api/model/ConnectionDefinitionsTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsAdyenCardTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsCybersourceAntiFraudTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsForterAntiFraudTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsPaypalPaypalAdditionalDataTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsPaypalPaypalTest.java
src/test/java/com/gr4vy/api/model/ConnectionOptionsTest.java
src/test/java/com/gr4vy/api/model/ConnectionTest.java
src/test/java/com/gr4vy/api/model/ConnectionsTest.java
Expand Down Expand Up @@ -416,6 +421,7 @@ src/test/java/com/gr4vy/api/model/ThreeDSecureResultRequestEventTest.java
src/test/java/com/gr4vy/api/model/ThreeDSecureSuccessEventContextTest.java
src/test/java/com/gr4vy/api/model/ThreeDSecureSuccessEventTest.java
src/test/java/com/gr4vy/api/model/ThreeDSecureSummaryTest.java
src/test/java/com/gr4vy/api/model/ThreeDSecureV2Test.java
src/test/java/com/gr4vy/api/model/TokenizedRequestTest.java
src/test/java/com/gr4vy/api/model/TransactionCaptureRequestTest.java
src/test/java/com/gr4vy/api/model/TransactionCardRequestTest.java
Expand Down
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add the `gr4vy-java` dependency to your pom.xml:
<dependency>
<groupId>com.github.gr4vy</groupId>
<artifactId>gr4vy-java</artifactId>
<version>0.13.0</version>
<version>0.16.0</version>
</dependency>
```

Expand All @@ -34,20 +34,17 @@ in a secure location but in this code sample we simply read the file from disk.
Import Gr4vy:
```java
import com.gr4vy.sdk.*;
import com.gr4vy.api.ApiException;
import com.gr4vy.api.model.*;
import com.gr4vy.api.openapi.BuyersApi;
```

Call the API:
```java
Gr4vyClient gr4vyClient = new Gr4vyClient("[YOUR_GR4VY_ID]", "private_key.pem");
BuyersApi apiInstance = new BuyersApi(gr4vyClient.getClient());

try {
Buyers result = apiInstance.listBuyers(null, null, null);
Buyers result = gr4vyClient.listBuyers(null, null, null);
System.out.println(result);
} catch (ApiException e) {
} catch (Gr4vyException e) {
System.err.println("Exception when calling BuyersApi#listBuyers");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
Expand Down Expand Up @@ -100,11 +97,11 @@ needs to be created before it can be used in this way.

```java
Gr4vyClient gr4vyClient = new Gr4vyClient("[YOUR_GR4VY_ID]", "private_key.pem");
BuyersApi apiInstance = new BuyersApi(gr4vyClient.getClient());

BuyerRequest buyer = new BuyerRequest();
buyer.setDisplayName("Tester T.");
try {
Buyer result = apiInstance.newBuyer(buyer);
Buyer result = gr4vyClient.newBuyer(buyer);
System.out.println(result);
} catch (ApiException e) {

Expand Down Expand Up @@ -141,7 +138,7 @@ example, `GET /buyers?limit=100` would be:
String search = null;
Integer limit = 100;
String cursor = null;
Buyers response = api.listBuyers(search, limit, cursor);
Buyers response = client.listBuyers(search, limit, cursor);
```

To create, the API requires a request object for that resource that is conventiently
Expand All @@ -154,7 +151,7 @@ the `addBuyer` method.
```java
BuyerRequest buyer = new BuyerRequest();
buyer.setDisplayName("Tester T.");
Buyer result = apiInstance.addBuyer(buyer);
Buyer result = client.addBuyer(buyer);
```

So to update a buyer you will need to pass in the `BuyerUpdate` object to the
Expand All @@ -163,23 +160,19 @@ So to update a buyer you will need to pass in the `BuyerUpdate` object to the
```java
BuyerUpdate buyer = new BuyerUpdate();
buyer.setDisplayName("Tester T.");
Buyer result = apiInstance.updateBuyer(buyerId, buyer);
Buyer result = client.updateBuyer(buyerId, buyer);
```

## Development

### Adding new APIs
### Updating models

To add new APIs, run the following command to update the models and APIs based
on the API spec.
To update API models, run the following command:

```sh
./openapi-generator-generate.sh
```

Next, update `sdk_<object_name>.go` to bind any new APIs or remove any APIs that are no
longer available.

Run the tests to ensure the changes do not break any existing tests.

```sh
Expand Down
21 changes: 20 additions & 1 deletion openapi-generator-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,23 @@ docker run --rm \
-c /local/.openapi-generator-config.json

rm -rf src/test/java/com/gr4vy/api
rm -rf api
rm -rf api
mkdir src/main/model
cp -R src/main/java/com/gr4vy/api/model/* src/main/model/
rm -rf src/main/java/com/gr4vy/api/*
mkdir src/main/java/com/gr4vy/api/model
cp -R src/main/model/* src/main/java/com/gr4vy/api/model/
rm -rf src/main/model

var1='OffsetDateTime'
rep1='String'
sed -i '' "s/$var1/$rep1/g" src/main/java/com/gr4vy/api/model/*.java

var1='import org.threeten.bp.String;'
rep1=''
sed -i '' "s/$var1/$rep1/g" src/main/java/com/gr4vy/api/model/*.java

var1='private String previousSchemeTransactionId = "null";'
rep1='private String previousSchemeTransactionId = null;'
sed -i '' "s/$var1/$rep1/g" src/main/java/com/gr4vy/api/model/*.java

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>gr4vy</artifactId>
<packaging>jar</packaging>
<name>gr4vy</name>
<version>0.15.0</version>
<version>0.16.0</version>
<url>https://gr4vy.com</url>
<description>Gr4vy Java SDK</description>

Expand Down
62 changes: 0 additions & 62 deletions src/main/java/com/gr4vy/api/ApiCallback.java

This file was deleted.

Loading
Loading