Java
Description
Only registered partners can use this feature. Unregistered partners may test on the testnet using the secret key provided in the sample code.
This function is used by partners who support the payment system. The loyalty system's testnet is ready; you can use it for development, and once development is complete, you can switch to the mainnet.
Please create a wallet to be used with this feature and provide the wallet address to the loyalty system operations team.
For the testnet, the wallet's secret key to be used is: 0xa0dcffca22f13363ab5d109f3a51ca99754cff4ce4c71dccc0c5df7f6492beee
For the mainnet, create a wallet independently and deliver only its public address to the operations team.
The system adds purchase data received from trusted partners to the blockchain, which is then verified by validators. If the data is verified, the system provides the purchaser with points equivalent to a certain percentage of the purchase amount.
Development and Operation
Follow the steps below to proceed:
Development and Testing:
First, install the user app and set the network to testnet.
Review the test code and implement the necessary features. When creating SavePurchaseCent, use the wallet's private key: 0xa0dcffca22f13363ab5d109f3a51ca99754cff4ce4c71dccc0c5df7f6492beee (for testnet).
Purchaser’s wallet address recorded in the purchase data should be the wallet address from the user app.
Note: Testnet store IDs begin with “0x0003”.
Switching to Mainnet:
Generate a new wallet and use its private key to create SavePurchaseCent. You may use a wallet generated using MetaMask.
Send the wallet address created in step 1 to the KIOS operations team.
Cautions:
Both testnet and mainnet are always active, so ensure the system can handle both networks in the future.
If the store ID of the POS or KIOSK starts with "0x0003", use testnet information for SavePurchaseCent. If the store ID starts with "0x0004", use mainnet information.
SMS functionality is available only in Korea.
SDK
샘플코드
1. Define the private keys for a wallet by network.
Please use the registered value for the test net, generate the key to be used on the main net, and pass only the address to the KIOS operation team
// Key required to store purchase data
//---------------------------------------------------------------------------------------
Map<NetWorkType, String> keysOfCollector = new HashMap<>();
keysOfCollector.put(NetWorkType.kios_testnet, "0xa0dcffca22f13363ab5d109f3a51ca99754cff4ce4c71dccc0c5df7f6492beee");
keysOfCollector.put(NetWorkType.acc_testnet, "0x8acceea5937a8e4bb07abc93a1374264dd9bd2fc384c979717936efe63367276");
//---------------------------------------------------------------------------------------
2. Define the asset address for a wallet by network.
// 포인트 자산을 소유한 주소
//---------------------------------------------------------------------------------------
Map<NetWorkType, String> addressOfAsset = new HashMap<>();
addressOfAsset.put(NetWorkType.acc_testnet, "0x85EeBb1289c0d0C17eFCbadB40AeF0a1c3b46714");
addressOfAsset.put(NetWorkType.acc_mainnet, "0xCB2e8ebBF4013164161d7F2297be25d4A9dC6b17");
addressOfAsset.put(NetWorkType.kios_testnet, "0x153f2340807370855092D04E0e0abe4f2b634240");
addressOfAsset.put(NetWorkType.kios_mainnet, "0xf077c9CfFa387E35de72b68448ceD5382CbC5D7D");
//---------------------------------------------------------------------------------------
3. To determine the type of network
The type of network is determined by the shopID.
//---------------------------------------------------------------------------------------
// Shop ID of the KIOSK
String shopId = "0x0003be96d74202df38fd21462ffcef10dfe0fcbd7caa3947689a3903e8b6b874";
// Select a network, select a network according to the Shop ID
NetWorkType network = CommonUtils.getNetWorkType(shopId);
4. Creating a Client
// Create a client that transmits purchase data
//---------------------------------------------------------------------------------------
SavePurchaseClient savePurchaseClient = new SavePurchaseClient(network, keysOfCollector.get(network), addressOfAsset.get(network));
//---------------------------------------------------------------------------------------
5. Save new purchase data
savePurchaseClient.saveNewPurchase(
purchaseId, // 구매 아이디
timestamp, // 구매 시간
waiting, // 포인트지급까지 지연시간(초) 카드결제취소대응를 위해 10일(10*86400) 으로 지정 또는 0
totalAmount, // 전체 결제 금액
cacheAmount, // 현금 결제 금액
currency, // 환률 심벌
shopId, // 상점 아이디
userAccount, // 구매자의 지갑주소 - 구매자가 입력하지 않았다면 ""
userPhone, // 구매자의 전화번호 - 구매자가 입력하지 않았다면 ""
new PurchaseDetail[]{new PurchaseDetail(
"2020051310000000", // 상품 아이디
"10000", // 상품 단가 * 수량
10 // 상품의 포인트 지급률, 단위는 %
)}
);
6. Save Cancellation Purchase Data
savePurchaseClient.saveCancelPurchase(purchaseId, timestamp, 0);
Last updated