hps / heartland-php

Heartland Payment Systems Payment Gateway PHP SDK
https://developer.heartlandpaymentsystems.com/SecureSubmit/
GNU General Public License v2.0
25 stars 23 forks source link

pass gratuity in HpsCreditService #24

Closed bony-corcrm closed 7 years ago

bony-corcrm commented 7 years ago

Hello,

Thanks for this great work. I am trying to pass gratuity by using HpsCreditService capture function. But it looking like not working. can you please add and example of tip on process and tip on settlement process.

Regards

ttnnkkrr commented 7 years ago

In a typical situation for tips 2 transactions are performed \HpsCreditService::authorize and when the sale is complete \HpsCreditService::capture the third param of \HpsCreditService::capture is for gratuity and would need to be an unsigned float with up to 2 digits to precision.

$creditService->authorize(9.00, 'usd',$token,$cardHolder);
$creditService->capture($transactionId, 11.00, 2.00);

Does this help? @bony-corcrm

bony-corcrm commented 7 years ago

Thanks for reply,

Instead of token I am using HpsCreditCard

$CreditService->authorize('50.00', 'usd',$creditCard); Then I got the

HpsAuthorization Object ( [avsResultCode] => 0 [avsResultText] => AVS Not Requested. [cvvResultCode] => M [cvvResultText] => Match. [cpcIndicator] => [authorizationCode] => 36148A [authorizedAmount] => [cardType] => Visa [description] => [invoiceNumber] => [customerId] => [descriptor] => [tokenData] => [transactionId] => 1015515167 [clientTransactionId] => [responseCode] => 00 [responseText] => APPROVAL [referenceNumber] => 634716268137 [_header:protected] => HpsTransactionHeader Object ( [gatewayResponseCode] => 0 [gatewayResponseMessage] => Success [responseDt] => 2016-12-12T01:11:30.3404285 [clientTxnId] => ) )

Then I use above txnID in the capture

$CreditService->capture('1015515167','50.00','10.00');

with Following response

HpsReportTransactionDetails Object ( [issuerTransactionId] => [issuerValidationCode] => [originalTransactionId] => 0 [maskedCardNumber] => 401200******0016 [settlementAmount] => [transactionType] => 1 [transactionUTCDate] => 2016-12-12T07:11:30.34Z [exceptions] => [memo] => [invoiceNumber] => [customerId] => [transactionStatus] => A [avsResultCode] => 0 [avsResultText] => AVS Not Requested. [cvvResultCode] => M [cvvResultText] => Match. [cpcIndicator] => [authorizationCode] => 36148A [authorizedAmount] => 50.00 [cardType] => Visa [description] => [descriptor] => [tokenData] => HpsTokenData Object ( [tokenValue] => [expMonth] => [expYear] => [cvv] => [responseCode] => [responseMessage] => ) [transactionId] => 1015516527 [clientTransactionId] => [responseCode] => 00 [responseText] => APPROVAL [referenceNumber] => 634716268137 [_header:protected] => HpsTransactionHeader Object ( [gatewayResponseCode] => 0 [gatewayResponseMessage] => Success [responseDt] => 2016-12-12T01:12:04.9649875 [clientTxnId] => ) )

But it doesn't showing me anything like gratuity in the response How to check that if gratuity is deducted or not.

ttnnkkrr commented 7 years ago

@bony-corcrm Thank you for reporting this. \HpsCreditService::capture returns \HpsReportTransactionDetails and upon review the Gratuity amount is indeed returned from our gateway but not captured in the object. We will merge this in a future release. To address this problem, I have added a branch to address this missing field. You may pick it up from the branch https://github.com/hps/heartland-php/blob/gratuity-information/src/Entities/Credit/HpsReportTransactionDetails.php#L17

I recommend grabbing the entire file;

bony-corcrm commented 7 years ago

Thanks for reply It works.