Files
Emoney-Info---IOS/Emoney Info/Classes/api/JackCardApi.swift
Wira Basalamah 8f0b001501 Initial commit
2026-04-24 04:55:24 +07:00

38 lines
1.3 KiB
Swift
Executable File

//
// JackCardApi.swift
// Emoney Info
//
// Created by Wira Irawan on 27/07/24.
//
import Foundation
public class JackCardApi : UnifiedNfcApi {
var emoney : Emoney = Emoney()
var riwayatList: [RiwayatCard] = []
public override init() {}
public func getBalance(resp : Data){
self.emoney.setCardLabel("Jackcard")
self.emoney.setCardNumber(resp.hexEncodedString().subString(from: 16, to: 32))
apduRunner.exchangeApdu(apduCommand: EmoneyApduCommands.DKI_APDU01, completionHandler: {response in
if (response.sw1 == 0x90 && response.sw2 == 0x00){
self.emoney.setBalance(response.getData().hexEncodedString().hex2decimal())
self.emoney.setTampilRiwayat(false)
self.updateScreen()
self.apduRunner.sessionEx?.alertMessage = "readFinish".localizeString(string: self.langCode!)
self.apduRunner.invalidateSession()
} else {
self.apduRunner.invalidateSession(msg: "readFailed".localizeString(string: self.langCode!))
}
})
}
private func updateScreen(){
if (self.apduRunner.callback != nil){
self.apduRunner.callback?.complete(emoney: self.emoney)
}
}
}