Skip to content

Commit

Permalink
Generated tapi (#1219)
Browse files Browse the repository at this point in the history
* refresh commits

* remove artifact

* update readme imports

* Add implicit terminal imports
  • Loading branch information
jillingk authored Jan 17, 2024
1 parent 66c7cc9 commit ce9f478
Show file tree
Hide file tree
Showing 452 changed files with 39,988 additions and 34,927 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar)

generator:=java
library:=jersey3
modelGen:=acswebhooks balancecontrol balanceplatform binlookup checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks managementwebhooks disputes transactionwebhooks
modelGen:=terminal acswebhooks balancecontrol balanceplatform binlookup checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks managementwebhooks disputes transactionwebhooks
models:=src/main/java/com/adyen/model
output:=target/out

Expand Down Expand Up @@ -53,6 +53,8 @@ managementwebhooks: spec=ManagementNotificationService-v3
# Disputes
disputes: spec=DisputeService-v30
disputes: smallServiceName=DisputesApi
# Terminal API
terminal: spec=TerminalAPI-v1

$(modelGen): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
Expand Down
52 changes: 31 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,18 @@ In order to submit In-Person requests with [Terminal API over Cloud](https://doc
// Step 1: Import the required classes
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.applicationinfo.ApplicationInfo;
import com.adyen.model.applicationinfo.CommonField;
import com.adyen.service.TerminalCloudAPI;
import com.adyen.model.nexo.*;
import com.adyen.terminal.SaleToAcquirerData;
import com.adyen.terminal.SaleToPOIRequest;
import com.adyen.terminal.TerminalAPIRequest;
import com.adyen.terminal.TerminalAPIResponse;
import com.adyen.model.terminal.*;

import java.math.BigDecimal;
import java.time.OffsetDateTime;

// Step 2: Initialize the client object
Client client = new Client("Your YOUR_API_KEY", Environment.TEST);

Expand All @@ -313,21 +321,21 @@ TerminalAPIRequest terminalAPIRequest = new TerminalAPIRequest();
SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();

MessageHeader messageHeader = new MessageHeader();
messageHeader.setMessageClass(MessageClassType.SERVICE);
messageHeader.setMessageCategory(MessageCategoryType.PAYMENT);
messageHeader.setMessageClass(MessageClass.SERVICE);
messageHeader.setMessageCategory(MessageCategory.PAYMENT);
messageHeader.setMessageType(MessageType.REQUEST);
messageHeader.setProtocolVersion("3.0");
messageHeader.setServiceID(serviceID);
messageHeader.setSaleID(saleID);
messageHeader.setPOIID(POIID);
messageHeader.setSaleID(saleID);
messageHeader.setPOIID(POIID);

saleToPOIRequest.setMessageHeader(messageHeader);

com.adyen.model.nexo.PaymentRequest paymentRequest = new com.adyen.model.nexo.PaymentRequest();
com.adyen.model.terminal.PaymentRequest paymentRequest = new com.adyen.model.terminal.PaymentRequest();
SaleData saleData = new SaleData();
TransactionIdentification transactionIdentification = new TransactionIdentification();
transactionIdentification.setTransactionID("001");
XMLGregorianCalendar timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
TransactionIDType transactionIdentification = new TransactionIDType();
transactionIdentification.setTransactionID(transactionID);
OffsetDateTime timestamp = OffsetDateTime.now();
transactionIdentification.setTimeStamp(timestamp);
saleData.setSaleTransactionID(transactionIdentification);

Expand All @@ -338,14 +346,14 @@ merchantApplication.setVersion("1");
merchantApplication.setName("Test");
applicationInfo.setMerchantApplication(merchantApplication);
saleToAcquirerData.setApplicationInfo(applicationInfo);
saleData.setSaleToAcquirerData(saleToAcquirerData);
saleData.setSaleToAcquirerData(saleToAcquirerData.toBase64());

PaymentTransaction paymentTransaction = new PaymentTransaction();
AmountsReq amountsReq = new AmountsReq();
amountsReq.setCurrency("EUR");
amountsReq.setRequestedAmount(BigDecimal.valueOf(1000));
paymentTransaction.setAmountsReq(amountsReq);

paymentRequest.setPaymentTransaction(paymentTransaction);
paymentRequest.setSaleData(saleData);

Expand All @@ -365,8 +373,8 @@ TerminalAPIRequest terminalAPIRequest = new TerminalAPIRequest();
SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();

MessageHeader messageHeader = new MessageHeader();
messageHeader.setMessageClass(MessageClassType.SERVICE);
messageHeader.setMessageCategory(MessageCategoryType.ABORT);
messageHeader.setMessageClass(MessageClass.SERVICE);
messageHeader.setMessageCategory(MessageCategory.ABORT);
messageHeader.setMessageType(MessageType.REQUEST);
messageHeader.setProtocolVersion("3.0");
messageHeader.setServiceID("Different service ID");
Expand All @@ -376,7 +384,7 @@ messageHeader.setPOIID(POIID);
AbortRequest abortRequest = new AbortRequest();
abortRequest.setAbortReason("MerchantAbort");
MessageReference messageReference = new MessageReference();
messageReference.setMessageCategory(MessageCategoryType.PAYMENT);
messageReference.setMessageCategory(MessageCategory.PAYMENT);
messageReference.setSaleID(saleID);
messageReference.setPOIID(POIID);
// Service ID of the payment you're aborting
Expand Down Expand Up @@ -409,10 +417,10 @@ messageHeader.setPOIID(POIID);

TransactionStatusRequest transactionStatusRequest = new TransactionStatusRequest();
transactionStatusRequest.setReceiptReprintFlag(true);
transactionStatusRequest.getDocumentQualifier().add(DocumentQualifierType.CASHIER_RECEIPT);
transactionStatusRequest.getDocumentQualifier().add(DocumentQualifierType.CUSTOMER_RECEIPT);
transactionStatusRequest.getDocumentQualifier().add(DocumentQualifier.CASHIERRECEIPT);
transactionStatusRequest.getDocumentQualifier().add(DocumentQualifier.CUSTOMERRECEIPT);
MessageReference messageReference = new MessageReference();
messageReference.setMessageCategory(MessageCategoryType.PAYMENT);
messageReference.setMessageCategory(MessageCategory.PAYMENT);
messageReference.setSaleID(saleID);
// serviceID of the transaction you want the status update from
messageReference.setServiceID(serviceID);
Expand All @@ -436,8 +444,9 @@ import com.adyen.Config;
import com.adyen.enums.Environment;
import com.adyen.httpclient.TerminalLocalAPIHostnameVerifier;
import com.adyen.service.TerminalLocalAPI;
import com.adyen.model.terminal.security.*;
import com.adyen.model.terminal.*;
import com.adyen.terminal.TerminalAPIResponse;
import com.adyen.terminal.security.SecurityKey;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import java.security.KeyStore;
Expand Down Expand Up @@ -481,7 +490,8 @@ If you wish to develop the Local Terminal API integration parallel to your encry
```java
// Step 1: Import the required classes
import com.adyen.service.TerminalLocalAPIUnencrypted;
import com.adyen.model.nexo.*;
import com.adyen.terminal.TerminalAPIRequest;
import com.adyen.terminal.TerminalAPIResponse;
import com.adyen.model.terminal.*;
import javax.net.ssl.SSLContext;

Expand Down
Loading

0 comments on commit ce9f478

Please sign in to comment.