Skip to content

Commit

Permalink
feat: add new remote services to enable keyple-less clients (#5)
Browse files Browse the repository at this point in the history
Introduced new service IDs for C# and Kotlin Multiplatform clients. 
Added several DTOs for analyzing, loading, and personalizing contracts. 

---------

Co-authored-by: Andrei Cristea <[email protected]>
  • Loading branch information
jeanpierrefortune and andrei-cristea authored Oct 21, 2024
1 parent 1953df0 commit 1615ef1
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 9 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/java-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code from ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
distribution: 'temurin'

- name: Write gradle.properties
run: |
mkdir -p ~/.gradle
Expand All @@ -25,12 +26,12 @@ jobs:
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --pinentry-mode loopback --passphrase "${{ secrets.OSSRH_GPG_SECRET_PASSWORD }}" --export-secret-key 568FD16F857171A0EC6D2C40742C84722FD2B235 > ~/.gradle/maven-central.gpg
gpg --list-secret-keys --keyid-format LONG
- name: Update permissions
working-directory: .
run: chmod +x ./gradlew ./.github/scripts/*.sh

- name: Check version
working-directory: .
run: ./.github/scripts/check_version.sh

- name: Build and Publish
working-directory: .
run: ./gradlew build test publish --info --stacktrace
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]

## [2.0.2] - 2024-10-15
### Added
- New service IDs in `RemoteServiceId` for C# Keyple-less clients and Kotlin Multiplatform Keyple-less clients.
- Introduced `SelectAppAndAnalyzeContractsInputDto` and `SelectAppAndAnalyzeContractsOutputDto` for analyzing contracts.
- Introduced `SelectAppAndLoadContractInputDto` and `SelectAppAndLoadContractOutputDto` for loading contracts.
- Introduced `SelectAppAndPersonalizeCardInputDto` and `SelectAppAndPersonalizeCardOutputDto` for personalizing cards.
### Changed
- Rename repository and artifact from `keyple-demo-common-lib` to `keyple-demo-ticketing-common-lib`
- Renamed repository and artifact from `keyple-demo-common-lib` to `keyple-demo-ticketing-common-lib`
- Renamed the test class `ContractStructureParserTest` to `ContractInfoStructureParserTest` to reflect the updated class
name.

## [2.0.1] - 2024-04-23
### Upgraded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@
package org.calypsonet.keyple.demo.common.constant

enum class RemoteServiceId {

// Suitable for C# Keyple-less clients
SELECT_APP_AND_READ_CONTRACTS,
SELECT_APP_AND_INCREASE_CONTRACT_COUNTER,

// Suitable for Android Keyple clients
READ_CARD_AND_ANALYZE_CONTRACTS,
READ_CARD_AND_WRITE_CONTRACT,
PERSONALIZE_CARD
PERSONALIZE_CARD,

// Suitable for Kotlin Multiplaform Keyple-less client
SELECT_APP_AND_ANALYZE_CONTRACTS,
SELECT_APP_AND_LOAD_CONTRACT,
SELECT_APP_AND_PERSONALIZE_CARD
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

data class SelectAppAndAnalyzeContractsInputDto(var pluginType: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

/**
* - validContracts: List of contracts present in the card. Each contract is tied to a counter by
* its index.
* - statusCode: 0 (if successful), 1 (server is not ready), 2 (card rejected).
* - message: Status message.
*/
data class SelectAppAndAnalyzeContractsOutputDto(
var applicationSerialNumber: String,
var validContracts: List<ContractInfo>,
var statusCode: Int,
var message: String
) {
/**
* - title: Contract name.
* - description: Contract details.
* - isValid: Indicates if the contract is currently usable.
*/
data class ContractInfo(var title: String, var description: String, var isValid: Boolean)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

import org.calypsonet.keyple.demo.common.model.type.PriorityCode

data class SelectAppAndLoadContractInputDto(
var applicationSerialNumber: String,
var contractTariff: PriorityCode,
var ticketToLoad: Int,
var pluginType: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

/**
* - statusCode: 0 (successful), 1 (server is not ready), 2 (card rejected), 3 (please present the
* same card).
* - message: error message
*/
data class SelectAppAndLoadContractOutputDto(var statusCode: Int, var message: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

class SelectAppAndPersonalizeCardInputDto(var pluginType: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* **************************************************************************************
* Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/
*
* See the NOTICE file(s) distributed with this work for additional information
* regarding copyright ownership.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
************************************************************************************** */
package org.calypsonet.keyple.demo.common.dto

/**
* - statusCode: 0 (if successful), 1 (if error).
* - message: error message
*/
data class SelectAppAndPersonalizeCardOutputDto(var statusCode: Int, var message: String)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.calypsonet.keyple.demo.common.model.type.PriorityCode
import org.calypsonet.keyple.demo.common.model.type.VersionNumber
import org.junit.jupiter.api.Test

class ContractStructureParserTest {
class ContractInfoStructureParserTest {

private val contractStructureParser = ContractStructureParser()

Expand Down

0 comments on commit 1615ef1

Please sign in to comment.