Keyple Card Calypso C++ Library - 3.2.2
Component of the Keyple C++ middleware
CommandRatification.cpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional *
5 * information regarding copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the *
8 * terms of the Eclipse Public License 2.0 which is available at *
9 * http://www.eclipse.org/legal/epl-2.0 *
10 * *
11 * SPDX-License-Identifier: EPL-2.0 *
12 ******************************************************************************/
13
14#include "keyple/card/calypso/CommandRatification.hpp"
15
16#include <memory>
17
18#include "keyple/card/calypso/CalypsoCardAdapter.hpp"
19#include "keyple/core/util/ApduUtil.hpp"
20
21namespace keyple {
22namespace card {
23namespace calypso {
24
25using keyple::core::util::ApduUtil;
26
27CommandRatification::CommandRatification(
28 const std::shared_ptr<DtoAdapters::TransactionContextDto>&
29 transactionContext,
30 const std::shared_ptr<DtoAdapters::CommandContextDto>& commandContext)
31: Command(
32 CardCommandRef::RATIFICATION,
33 std::unique_ptr<int>(new int(0)),
34 transactionContext,
35 commandContext)
36{
37 setApduRequest(
38 std::make_shared<DtoAdapters::ApduRequestAdapter>(ApduUtil::build(
39 getTransactionContext()->getCard()->getCardClass().getValue(),
40 getCommandRef().getInstructionByte(),
41 0x00,
42 0x00)));
43}
44
45void
46CommandRatification::finalizeRequest()
47{
48 /* NOP */
49}
50
51bool
52CommandRatification::isCryptoServiceRequiredToFinalizeRequest() const
53{
54 return false;
55}
56
57bool
58CommandRatification::synchronizeCryptoServiceBeforeCardProcessing()
59{
60 return true;
61}
62
63void
64CommandRatification::parseResponse(
65 std::shared_ptr<ApduResponseApi> apduResponse)
66{
67 try {
68 Command::setApduResponseAndCheckStatus(apduResponse);
69
70 } catch (const CardCommandException&) {
71 /* NOP: ratification nominal case */
72 }
73}
74
75} /* namespace calypso */
76} /* namespace card */
77} /* namespace keyple */