Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## 2.0.28 2024-11-19
- iOS SDK: Adding background property to UPA
- iOS SDK: Adding ClientTxnID to Response

## 2.0.27 2024-08-21
- iOS SDK: Duplicated transaction due to Surcharge lookup result.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class C2XTransactionsViewController: UIViewController {
var isDeviceConnected: Bool = false
var terminalRefNumber: String?
var clientTransactionId: String?
var clientTxnID: String?

var transactionId: String? {
didSet {
Expand Down Expand Up @@ -486,6 +487,10 @@ extension C2XTransactionsViewController: HpsC2xDeviceDelegate, GMSTransactionDel
print(" Status response: \(responseStatus)")
}

if let clientTxnId = response.clientTxnId {
print("ClientTxnID: \(clientTxnId)")
}

print(" Response: \(response)")

if let surchargeRequested = response.surchargeRequested {
Expand All @@ -496,6 +501,7 @@ extension C2XTransactionsViewController: HpsC2xDeviceDelegate, GMSTransactionDel

self.terminalRefNumber = response.terminalRefNumber
self.clientTransactionId = response.clientTransactionId
self.clientTxnID = response.clientTxnId

if mainTransaction != .capture {
self.transactionId = responseTransactionId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extension UpaTransactionProtocol {
let builder = HpsUpaSAFTransactionBuilder(with: device)

let getSAFReport = HpsUpaGetSaf(
data: HpsUpaCommandPayload(command: "GetSAFReport", ecrId: "123", requestId: "123", data: HpsUpaGetSafData(params: HpsUpaGetSafDataReportOutput(reportOutput: "ReturnData")))
data: HpsUpaCommandPayload(command: "GetSAFReport", ecrId: "123", requestId: "123", data: HpsUpaGetSafData(params: HpsUpaGetSafDataReportOutput(reportOutput: "ReturnData", background: "true")))
)

builder.execute(request: getSAFReport) { ihpsDeviceResponse, hpsUpaSafResponse, error in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HpsUPASAFTests: XCTestCase {

let builder = HpsUpaSAFTransactionBuilder(with: device)

let sendSAF = HpsUpaGetSaf(data: HpsUpaCommandPayload(command: HpsUpaGetSafConstants.command, ecrId: "123", requestId: "123", data: HpsUpaGetSafData(params: HpsUpaGetSafDataReportOutput(reportOutput: "ReturnData"))))
let sendSAF = HpsUpaGetSaf(data: HpsUpaCommandPayload(command: HpsUpaGetSafConstants.command, ecrId: "123", requestId: "123", data: HpsUpaGetSafData(params: HpsUpaGetSafDataReportOutput(reportOutput: "ReturnData", background: "true"))))

builder.execute(request: sendSAF) { response, safResponse, error in
XCTAssertNotNil(response)
Expand Down
2 changes: 1 addition & 1 deletion Heartland-iOS-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Heartland-iOS-SDK"
s.version = "2.0.27"
s.version = "2.0.28"
s.summary = "Secure Tokenized Payments by Heartland Payment Systems."

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@property(nonatomic,strong) NSString *saleAmount;
@property(nonatomic,strong) NSString *returnCount;
@property(nonatomic,strong) NSString *returnAmount;
@property(nonatomic,strong) NSString *clientTxnId;

-(id)initWithPayload:(id <HpaResposeInterface>)response;
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ -(id)initWithPayload:(id <HpaResposeInterface>)response {
if([[batchdetails allKeys] containsObject:@"ReturnAmt"]) {
self.returnAmount = [batchdetails valueForKey:@"ReturnAmt"];
}
if([[batchdetails allKeys] containsObject:@"ClientTxnId"]) {
self.clientTxnId = [batchdetails valueForKey:@"ClientTxnId"];
}
return self;
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
@property (readonly,retain) CardSummaryRecord *CardSummaryRecord;
@property (readonly,retain) TransactionSummaryRecord *TransactionSummaryRecord;
@property (readonly,retain) NSString *CardholderName;

@property (readonly,retain) NSString *ClientTxnID;

//EOD
@property (readonly,retain) NSString *Reversal;
Expand Down
1 change: 1 addition & 0 deletions Heartland-iOS-SDK/Classes/Terminals/HpsTerminalResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
@property (nonatomic) SurchargeEligibility *surchargeRequested;
@property (nonatomic,strong) NSString *surchargeFee;
@property (nonatomic,strong) NSString *surchargeAmount;
@property (nonatomic,strong) NSString *clientTxnId;
- (void) mapResponse:(id <HpaResposeInterface>) response;
// @todo
//+(HpsTerminalResponse*)terminalResponseFromVitalSDK:(TransactionResponse*)transactionResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (void) execute:(void(^)(HpsUpaResponse*, NSError*))responseBlock{
if (self.transactionId != nil) {
request.data.data.transaction.referenceNumber = self.transactionId;
}
request.data.data.transaction.totalAmount = self.amount != nil ? [formatter stringFromNumber:[NSNumber numberWithDouble:[self.amount doubleValue]]] : nil;
request.data.data.transaction.totalAmount = self.amount != nil ? [[formatter stringFromNumber:[NSNumber numberWithDouble:[self.amount doubleValue]]] stringByReplacingOccurrencesOfString:@"," withString:@"."] : nil;

if (self.details != nil) {
request.data.data.transaction.invoiceNbr = self.details.invoiceNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ - (void) executeForUPAUSA:(void(^)(HpsUpaResponse*, NSString*, NSError*))respons
request.data.data.transaction.allowDuplicate = self.allowDuplicate;
}

request.data.data.transaction.baseAmount = baseAmount != nil ? [formatter stringFromNumber:[NSNumber numberWithDouble:[baseAmount doubleValue]]] : nil;
request.data.data.transaction.baseAmount = baseAmount != nil ? [[formatter stringFromNumber:[NSNumber numberWithDouble:[baseAmount doubleValue]]] stringByReplacingOccurrencesOfString:@"," withString:@"."] : nil;
request.data.data.transaction.tipAmount = self.gratuity != nil ? [formatter stringFromNumber:[NSNumber numberWithDouble:[self.gratuity doubleValue]]] : nil;
request.data.data.transaction.taxAmount = self.taxAmount != nil ? [formatter stringFromNumber:[NSNumber numberWithDouble:[self.taxAmount doubleValue]]] : nil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import Foundation

struct HpsUpaGetSafConstants {
public struct HpsUpaGetSafConstants {
static let command = "GetSAFReport"
}

Expand All @@ -32,8 +32,10 @@ public struct HpsUpaGetSafData: Codable {

public struct HpsUpaGetSafDataReportOutput: Codable {
public let reportOutput: String?
public let background: String?

public init(reportOutput: String?) {
public init(reportOutput: String?, background: String?) {
self.reportOutput = reportOutput
self.background = background
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ -(id)initWithJSONDoc:(JsonDoc*)response
self.partialApproval = [host getValueAsString:@"partialApproval"];
self.batchId = [host getValueAsString:@"batchId"];
self.cardBrandTransactionId = [host getValueAsString:@"cardBrandTransId"];

if ([host has:@"clientTxnId"]) {
self.clientTxnId = [host getValueAsString:@"clientTxnId"];;
}

if ([host has:@"cashbackAmount"]) {
self.cashBackAmount = [NSDecimalNumber decimalNumberWithString:[host getValueAsString:@"cashbackAmount"]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class GMSResponseHelper {

data.responseText = resp?.gatewayResponseText
data.deviceResponseCode = deviceResponseCode
data.clientTxnId = resp?.clientTxnID

return data
}
Expand Down Expand Up @@ -68,7 +69,7 @@ class GMSResponseHelper {
data.responseText = resp?.gatewayResponseText
data.issuerRspCode = resp?.emvIssuerRspCode
// data.issuerRspMsg = resp?.hostProcessingResult?.emvIssuerAuthenticationData

data.clientTxnId = resp?.clientTxnID
if let uintValue = resp?.tip {
data.tipAmount = uintToDecimal(uintValue)
}
Expand Down Expand Up @@ -184,6 +185,7 @@ class GMSResponseHelper {
data.issuerRspMsg = resp?.hostProcessingResult?.emvIssuerAuthenticationData
data.authCode = resp?.authCode
data.authCodeData = resp?.authCodeData
data.clientTxnId = resp?.clientTxnID
if let uintValue = resp?.tip {
data.tipAmount = uintToDecimal(uintValue)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ extension GMSWrapper: TransactionDelegate {

data.transactionId = response?.gatewayTransactionId
data.clientTransactionId = response?.transactionId
data.clientTxnId = response?.clientTxnID

if let uintValue = response?.approvedAmount {
data.approvedAmount = GMSResponseHelper.uintToDecimal(uintValue)
Expand Down
Binary file not shown.
Loading