From eab74af831801e38e41654513402c4135158248c Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Tue, 21 Feb 2017 15:33:48 -0500 Subject: [PATCH 1/7] corrected from frameBody to additionalPanel --- SecureSubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecureSubmit.php b/SecureSubmit.php index 96424f0..cfdc42b 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -974,7 +974,7 @@ function getPanel(panelName) { additionalNext.on("click", function(event) { var continueProcessing = true; - frameBody.find('.required').each(function(i, obj) { + additionalPanel.find('.required').each(function(i, obj) { if (jQuery(this).val() == '' || jQuery(this).val() == 'Select an option below') { alert('Please complete all required fields before proceeding.'); continueProcessing = false; From c4b00b58c2a7a65108ccce2443aa21b493d65fa9 Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Tue, 21 Feb 2017 15:35:36 -0500 Subject: [PATCH 2/7] added field identifier if valid required data missing --- SecureSubmit.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SecureSubmit.php b/SecureSubmit.php index cfdc42b..66e9521 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -976,8 +976,11 @@ function getPanel(panelName) { var continueProcessing = true; additionalPanel.find('.required').each(function(i, obj) { if (jQuery(this).val() == '' || jQuery(this).val() == 'Select an option below') { + var thisEle = jQuery(this); + var elementText = thisEle.attr("placeholder"); alert('Please complete all required fields before proceeding.'); continueProcessing = false; + thisEle.focus(); return; } }); From c006eec0c55594873c289c91b94b19cc870222f8 Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Wed, 22 Feb 2017 10:48:08 -0500 Subject: [PATCH 3/7] changed placeholder for credit card from a fake card nbumber to the word credit card --- SecureSubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecureSubmit.php b/SecureSubmit.php index 66e9521..ec06806 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -801,7 +801,7 @@ function shortcode($atts) { var _card_html = "
"; _card_html += ""; _card_html += "
Card Information
"; - _card_html += "
"; + _card_html += "
"; _card_html += "
"; _card_html += "
"; _card_html += "
 
"; From 18cbf4c0af821ea0c6bd92598759ef1ef5af12d6 Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Wed, 22 Feb 2017 11:17:50 -0500 Subject: [PATCH 4/7] removed irrelivant --- SecureSubmit.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SecureSubmit.php b/SecureSubmit.php index ec06806..3ba6838 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -790,7 +790,7 @@ function shortcode($atts) { _shipping_html += ""; _shipping_html += ""; - + _shipping_html += ""; _shipping_html += "
"; _shipping_html += ""; @@ -977,7 +977,6 @@ function getPanel(panelName) { additionalPanel.find('.required').each(function(i, obj) { if (jQuery(this).val() == '' || jQuery(this).val() == 'Select an option below') { var thisEle = jQuery(this); - var elementText = thisEle.attr("placeholder"); alert('Please complete all required fields before proceeding.'); continueProcessing = false; thisEle.focus(); From fcf65377a46a6017b004a4476019b183000a1824 Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Wed, 22 Feb 2017 11:34:47 -0500 Subject: [PATCH 5/7] removed isarray which was a mistype --- SecureSubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SecureSubmit.php b/SecureSubmit.php index 3ba6838..4bfba87 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -790,7 +790,7 @@ function shortcode($atts) { _shipping_html += ""; _shipping_html += ""; - + _shipping_html += ""; _shipping_html += ""; _shipping_html += ""; From 8bb9405e8253555f1a7aa498697d97a8528c7f0b Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Fri, 24 Feb 2017 17:44:13 -0500 Subject: [PATCH 6/7] some hotfixes --- js/secure.submit.form.js | 50 ++--- lib/src/Abstractions/HpsBuilderAbstract.php | 13 +- lib/src/Abstractions/HpsConfigInterface.php | 13 ++ .../HpsGatewayServiceAbstract.php | 34 +++- .../HpsGatewayServiceInterface.php | 16 ++ lib/src/Abstractions/HpsLoggerInterface.php | 9 + .../HpsPayPlanResourceAbstract.php | 16 +- .../HpsPayPlanResourceInterface.php | 3 + .../AltPayment/HpsAltPaymentAddToBatch.php | 3 + .../Entities/AltPayment/HpsAltPaymentAuth.php | 11 +- .../AltPayment/HpsAltPaymentCapture.php | 11 +- .../AltPayment/HpsAltPaymentCreateSession.php | 11 +- .../AltPayment/HpsAltPaymentResponse.php | 17 +- .../AltPayment/HpsAltPaymentReturn.php | 3 + .../Entities/AltPayment/HpsAltPaymentSale.php | 11 +- .../AltPayment/HpsAltPaymentSessionInfo.php | 11 +- .../Entities/AltPayment/HpsAltPaymentVoid.php | 3 + lib/src/Entities/AltPayment/HpsBuyerData.php | 3 + .../HpsCardinalMPIAddOrderNumberResponse.php | 9 + .../HpsCardinalMPIAuthenticateResponse.php | 10 +- .../HpsCardinalMPIAuthorizeResponse.php | 10 +- .../HpsCardinalMPIAuthresponseResponse.php | 9 + .../HpsCardinalMPICaptureResponse.php | 9 + .../HpsCardinalMPILookupResponse.php | 10 +- .../HpsCardinalMPIPreapprovalResponse.php | 10 +- .../HpsCardinalMPIRefundResponse.php | 9 + .../AltPayment/HpsCardinalMPIResponse.php | 17 +- .../AltPayment/HpsCardinalMPIVoidResponse.php | 9 + lib/src/Entities/AltPayment/HpsLineItem.php | 3 + .../Entities/AltPayment/HpsShippingInfo.php | 3 + lib/src/Entities/Batch/HpsBatch.php | 3 + lib/src/Entities/Check/HpsCheck.php | 3 + lib/src/Entities/Check/HpsCheckHolder.php | 3 + lib/src/Entities/Check/HpsCheckResponse.php | 17 +- .../Check/HpsCheckResponseDetails.php | 3 + lib/src/Entities/Credit/HpsAccountVerify.php | 3 + lib/src/Entities/Credit/HpsAuthorization.php | 11 +- lib/src/Entities/Credit/HpsCPCData.php | 15 +- lib/src/Entities/Credit/HpsCPCEdit.php | 10 + lib/src/Entities/Credit/HpsCardHolder.php | 3 + lib/src/Entities/Credit/HpsCharge.php | 3 + .../Entities/Credit/HpsChargeExceptions.php | 3 + lib/src/Entities/Credit/HpsCreditCard.php | 7 +- .../Credit/HpsOfflineAuthorization.php | 10 + .../Entities/Credit/HpsRecurringBilling.php | 3 + lib/src/Entities/Credit/HpsRefund.php | 10 + .../Credit/HpsReportTransactionDetails.php | 23 ++- .../Credit/HpsReportTransactionSummary.php | 12 +- lib/src/Entities/Credit/HpsReversal.php | 11 +- .../Entities/Credit/HpsSecureEcommerce.php | 3 + lib/src/Entities/Credit/HpsVoid.php | 10 + lib/src/Entities/Debit/HpsDebitAddValue.php | 3 + lib/src/Entities/Debit/HpsDebitReturn.php | 3 + lib/src/Entities/Debit/HpsDebitReversal.php | 3 + lib/src/Entities/Debit/HpsDebitSale.php | 3 + lib/src/Entities/Fluent/HpsBuilderAction.php | 10 +- lib/src/Entities/Gift/HpsGiftCard.php | 9 +- lib/src/Entities/Gift/HpsGiftCardActivate.php | 11 +- lib/src/Entities/Gift/HpsGiftCardAddValue.php | 3 + lib/src/Entities/Gift/HpsGiftCardAlias.php | 11 +- lib/src/Entities/Gift/HpsGiftCardBalance.php | 3 + .../Entities/Gift/HpsGiftCardDeactivate.php | 3 + lib/src/Entities/Gift/HpsGiftCardReplace.php | 3 + lib/src/Entities/Gift/HpsGiftCardReversal.php | 3 + lib/src/Entities/Gift/HpsGiftCardReward.php | 3 + lib/src/Entities/Gift/HpsGiftCardSale.php | 11 +- lib/src/Entities/Gift/HpsGiftCardVoid.php | 3 + lib/src/Entities/HpsAddress.php | 3 + lib/src/Entities/HpsConsumer.php | 3 + lib/src/Entities/HpsDirectMarketData.php | 11 +- lib/src/Entities/HpsEncryptionData.php | 3 + lib/src/Entities/HpsTokenData.php | 9 +- lib/src/Entities/HpsTrackData.php | 3 + lib/src/Entities/HpsTransaction.php | 27 ++- lib/src/Entities/HpsTransactionDetails.php | 3 + lib/src/Entities/HpsTransactionHeader.php | 3 + lib/src/Entities/HpsTransactionStatus.php | 11 +- lib/src/Entities/PayPlan/HpsPayPlanAmount.php | 10 +- .../Entities/PayPlan/HpsPayPlanCustomer.php | 23 ++- .../PayPlan/HpsPayPlanPaymentMethod.php | 25 ++- .../Entities/PayPlan/HpsPayPlanSchedule.php | 39 +++- lib/src/Infrastructure/Enums/HpsACHType.php | 3 + .../Infrastructure/Enums/HpsAccountType.php | 3 + lib/src/Infrastructure/Enums/HpsCardBrand.php | 3 + .../Enums/HpsCentinelCheckoutType.php | 3 + lib/src/Infrastructure/Enums/HpsCheckType.php | 3 + .../Infrastructure/Enums/HpsDataEntryMode.php | 3 + .../Enums/HpsExceptionCodes.php | 3 + .../Enums/HpsGiftCardAliasAction.php | 3 + ...mChoiceTypePosResponseVer10Transaction.php | 3 + .../Enums/HpsPayPlanAccountType.php | 3 + .../Enums/HpsPayPlanCustomerStatus.php | 3 + .../Enums/HpsPayPlanPaymentMethodStatus.php | 3 + .../Enums/HpsPayPlanPaymentMethodType.php | 3 + .../Enums/HpsPayPlanScheduleDuration.php | 3 + .../Enums/HpsPayPlanScheduleFrequency.php | 3 + .../Enums/HpsPayPlanScheduleStatus.php | 3 + lib/src/Infrastructure/Enums/HpsSECCode.php | 3 + lib/src/Infrastructure/Enums/HpsTaxType.php | 3 + .../Enums/HpsTrackDataMethod.php | 3 + .../Enums/HpsTransactionType.php | 3 + .../HpsApiConnectionException.php | 10 + .../Infrastructure/HpsArgumentException.php | 10 + .../HpsAuthenticationException.php | 9 + lib/src/Infrastructure/HpsCheckException.php | 12 +- lib/src/Infrastructure/HpsConfiguration.php | 3 + lib/src/Infrastructure/HpsCreditException.php | 14 +- .../HpsCreditExceptionDetails.php | 3 + lib/src/Infrastructure/HpsEmptyLogger.php | 9 + .../Infrastructure/HpsGatewayException.php | 13 +- .../HpsGatewayExceptionDetails.php | 3 + .../HpsInvalidRequestException.php | 11 +- lib/src/Infrastructure/HpsLogger.php | 20 +- lib/src/Infrastructure/HpsProcessorError.php | 3 + .../Infrastructure/HpsProcessorException.php | 14 +- .../HpsProcessorExceptionDetails.php | 3 + .../HpsGatewayResponseValidation.php | 19 +- .../Validation/HpsInputValidation.php | 45 +++- .../HpsIssuerResponseValidation.php | 22 +- .../HpsProcessorResponseValidation.php | 27 ++- .../HpsCreditServiceAuthorizeBuilder.php | 29 ++- .../Credit/HpsCreditServiceCaptureBuilder.php | 3 +- .../Credit/HpsCreditServiceChargeBuilder.php | 28 ++- .../Credit/HpsCreditServiceGetBuilder.php | 2 +- ...psCreditServiceListTransactionsBuilder.php | 2 +- .../HpsCreditServiceOfflineAuthBuilder.php | 20 +- .../HpsCreditServiceOfflineChargeBuilder.php | 23 ++- ...HpsCreditServicePrepaidAddValueBuilder.php | 2 +- ...ditServiceUpdateTokenExpirationBuilder.php | 4 + .../Credit/HpsCreditServiceVerifyBuilder.php | 19 +- .../Fluent/Gateway/HpsFluentCheckService.php | 63 +++++- .../Fluent/Gateway/HpsFluentCreditService.php | 144 ++++++++++--- .../Fluent/Gateway/HpsFluentDebitService.php | 38 +++- .../Gateway/HpsFluentGiftCardService.php | 78 +++++-- .../AltPayment/HpsAltPaymentService.php | 152 ++++++++++++-- .../AltPayment/HpsMasterPassService.php | 8 +- .../Gateway/AltPayment/HpsPayPalService.php | 3 + .../Services/Gateway/HpsAttachmentService.php | 18 +- lib/src/Services/Gateway/HpsBatchService.php | 15 +- .../Gateway/HpsCentinelGatewayService.php | 20 +- lib/src/Services/Gateway/HpsCheckService.php | 71 ++++++- lib/src/Services/Gateway/HpsCreditService.php | 192 ++++++++++++++++-- lib/src/Services/Gateway/HpsDebitService.php | 53 ++++- .../Services/Gateway/HpsGiftCardService.php | 102 +++++++++- .../Services/Gateway/HpsPayPlanService.php | 103 ++++++++-- .../Gateway/HpsRestGatewayService.php | 52 ++++- .../Gateway/HpsSoapGatewayService.php | 130 ++++++++++-- lib/src/Services/Gateway/HpsTokenService.php | 30 ++- .../PayPlan/HpsPayPlanCustomerService.php | 33 ++- .../HpsPayPlanPaymentMethodService.php | 57 +++++- .../PayPlan/HpsPayPlanScheduleService.php | 31 ++- lib/src/Services/HpsCentinelConfig.php | 19 +- lib/src/Services/HpsServicesConfig.php | 33 ++- 153 files changed, 2322 insertions(+), 335 deletions(-) diff --git a/js/secure.submit.form.js b/js/secure.submit.form.js index 7b52d0a..a56e828 100644 --- a/js/secure.submit.form.js +++ b/js/secure.submit.form.js @@ -7,16 +7,16 @@ var url = tag.data('post-url'); var prefix = tag.data('prefix'); - $('#' . prefix . '-securesubmit-button').bind('click', handleSubmit); + $('#' + prefix + '-securesubmit-button').bind('click', handleSubmit); function handleSubmit() { hps.tokenize({ data: { public_key: pk, - number: $('#' . prefix . 'card_number').val().replace(/\D/g, ''), - cvc: $('#' . prefix . 'card_cvc').val(), - exp_month: $('#' . prefix . 'exp_month').val(), - exp_year: $('#' . prefix . 'exp_year').val() + number: $('#' + prefix + 'card_number').val().replace(/\D/g, ''), + cvc: $('#' + prefix + 'card_cvc').val(), + exp_month: $('#' + prefix + 'exp_month').val(), + exp_year: $('#' + prefix + 'exp_year').val() }, success: function(response) { secureSubmitResponseHandler(response); @@ -31,7 +31,7 @@ if(response.message) { alert(response.message); } else { - $('#' . prefix . 'securesubmit_token').val(response.token_value); + $('#' + prefix + 'securesubmit_token').val(response.token_value); chargeToken(); } } @@ -39,26 +39,26 @@ function chargeToken() { var data = { 'action': 'ssd_submit_payment', - 'securesubmit_token': $('#' . prefix . '_securesubmit_token').val(), - 'billing_firstname': $('#' . prefix . '_billing_firstname').val(), - 'billing_lastname': $('#' . prefix . '_billing_lastname').val(), - 'billing_address': $('#' . prefix . '_billing_address').val(), - 'billing_city': $('#' . prefix . '_billing_city').val(), - 'billing_state': $('#' . prefix . '_billing_state').val(), - 'billing_zip': $('#' . prefix . '_billing_zip').val(), - 'billing_email': $('#' . prefix . '_billing_email').val(), - 'shipping_firstname': $('#' . prefix . '_shipping_firstname').val(), - 'shipping_lastname': $('#' . prefix . '_shipping_lastname').val(), - 'shipping_address': $('#' . prefix . '_shipping_address').val(), - 'shipping_city': $('#' . prefix . '_shipping_city').val(), - 'shipping_state': $('#' . prefix . '_shipping_state').val(), - 'shipping_zip': $('#' . prefix . '_shipping_zip').val(), - 'same_as_billing': $('#' . prefix . '_same_as_billing').val(), - 'donation_amount': $('#' . prefix . '_donation_amount').val(), - 'product_id': $('#' . prefix . '_product_id').val() + 'securesubmit_token': $('#' + prefix + '_securesubmit_token').val(), + 'billing_firstname': $('#' + prefix + '_billing_firstname').val(), + 'billing_lastname': $('#' + prefix + '_billing_lastname').val(), + 'billing_address': $('#' + prefix + '_billing_address').val(), + 'billing_city': $('#' + prefix + '_billing_city').val(), + 'billing_state': $('#' + prefix + '_billing_state').val(), + 'billing_zip': $('#' + prefix + '_billing_zip').val(), + 'billing_email': $('#' + prefix + '_billing_email').val(), + 'shipping_firstname': $('#' + prefix + '_shipping_firstname').val(), + 'shipping_lastname': $('#' + prefix + '_shipping_lastname').val(), + 'shipping_address': $('#' + prefix + '_shipping_address').val(), + 'shipping_city': $('#' + prefix + '_shipping_city').val(), + 'shipping_state': $('#' + prefix + '_shipping_state').val(), + 'shipping_zip': $('#' + prefix + '_shipping_zip').val(), + 'same_as_billing': $('#' + prefix + '_same_as_billing').val(), + 'donation_amount': $('#' + prefix + '_donation_amount').val(), + 'product_id': $('#' + prefix + '_product_id').val() }; - $('#' . prefix . '-securesubmit-button').hide(); + $('#' + prefix + '-securesubmit-button').hide(); $.post(url, data, function(response) { if (response.indexOf("successful") >= 0) @@ -68,7 +68,7 @@ } else { - $('#' . prefix . '-donate-response').html(response); + $('#' + prefix + '-donate-response').html(response); $('#securesubmit-button').show(); } }); diff --git a/lib/src/Abstractions/HpsBuilderAbstract.php b/lib/src/Abstractions/HpsBuilderAbstract.php index 221047f..7e2c74f 100644 --- a/lib/src/Abstractions/HpsBuilderAbstract.php +++ b/lib/src/Abstractions/HpsBuilderAbstract.php @@ -1,5 +1,8 @@ executed = true; return $this; } - /** - * @return HpsBuilderAbstract + * @param $action + * + * @return \HpsBuilderAbstract */ public function addAction($action) { @@ -151,6 +155,7 @@ private function setPropertyIfExists($property, $value) } else { throw new HpsUnknownPropertyException($this, $property); } + return $this; } /** diff --git a/lib/src/Abstractions/HpsConfigInterface.php b/lib/src/Abstractions/HpsConfigInterface.php index ae5bcb1..8d7ff5d 100644 --- a/lib/src/Abstractions/HpsConfigInterface.php +++ b/lib/src/Abstractions/HpsConfigInterface.php @@ -1,11 +1,24 @@ _config = $config; } } - + /** + * @return \HpsConfigInterface|null + */ public function servicesConfig() { return $this->_config; } - + /** + * @param $value + */ public function setServicesConfig($value) { $this->_config = $value; } - + /** + * @param $url + * @param $headers + * @param null $data + * @param string $httpVerb + * @param string $keyType + * @param null $options + * + * @return mixed + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + */ protected function submitRequest($url, $headers, $data = null, $httpVerb = 'POST', $keyType = HpsServicesConfig::KEY_TYPE_SECRET, $options = null) { if ($this->_isConfigInvalid()) { @@ -113,7 +135,9 @@ protected function submitRequest($url, $headers, $data = null, $httpVerb = 'POST ); } } - + /** + * @return bool + */ protected function _isConfigInvalid() { if ($this->_config == null && ( diff --git a/lib/src/Abstractions/HpsGatewayServiceInterface.php b/lib/src/Abstractions/HpsGatewayServiceInterface.php index 8802604..aad3b3a 100644 --- a/lib/src/Abstractions/HpsGatewayServiceInterface.php +++ b/lib/src/Abstractions/HpsGatewayServiceInterface.php @@ -1,7 +1,23 @@ Transaction->$txnType; diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentCapture.php b/lib/src/Entities/AltPayment/HpsAltPaymentCapture.php index 340d7a1..ab04568 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentCapture.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentCapture.php @@ -1,10 +1,19 @@ Transaction->$txnType; diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentCreateSession.php b/lib/src/Entities/AltPayment/HpsAltPaymentCreateSession.php index ad15799..c5b1bd9 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentCreateSession.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentCreateSession.php @@ -1,10 +1,19 @@ Transaction->$txnType; diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentResponse.php b/lib/src/Entities/AltPayment/HpsAltPaymentResponse.php index a489c3a..fb26d9c 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentResponse.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentResponse.php @@ -1,9 +1,18 @@ Transaction->$txnType; @@ -20,7 +29,11 @@ public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentResp return $altPayment; } - + /** + * @param $pairs + * + * @return array + */ public static function nvpToArray($pairs) { $array = array(); diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentReturn.php b/lib/src/Entities/AltPayment/HpsAltPaymentReturn.php index 15eb41d..0ceb506 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentReturn.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentReturn.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentSessionInfo.php b/lib/src/Entities/AltPayment/HpsAltPaymentSessionInfo.php index e25aa7f..7ed8415 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentSessionInfo.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentSessionInfo.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/AltPayment/HpsAltPaymentVoid.php b/lib/src/Entities/AltPayment/HpsAltPaymentVoid.php index 93b6ab0..e111583 100644 --- a/lib/src/Entities/AltPayment/HpsAltPaymentVoid.php +++ b/lib/src/Entities/AltPayment/HpsAltPaymentVoid.php @@ -1,5 +1,8 @@ transactionId = self::readDataKey($data, 'TransactionId'); return $response; } - + /** + * @param $data + * @param $key + * + * @return null|string + */ public static function readDataKey($data, $key) { return isset($data->{$key}) ? (string)$data->{$key} : null; diff --git a/lib/src/Entities/AltPayment/HpsCardinalMPIVoidResponse.php b/lib/src/Entities/AltPayment/HpsCardinalMPIVoidResponse.php index 80ea55f..18a8d66 100644 --- a/lib/src/Entities/AltPayment/HpsCardinalMPIVoidResponse.php +++ b/lib/src/Entities/AltPayment/HpsCardinalMPIVoidResponse.php @@ -1,7 +1,16 @@ Transaction->$txnType; @@ -30,7 +39,11 @@ public static function fromDict($rsp, $txnType, $returnType = 'HpsCheckResponse' return $sale; } - + /** + * @param $checkInfo + * + * @return \HpsCheckResponseDetails + */ private static function _hydrateRspDetails($checkInfo) { $details = new HpsCheckResponseDetails(); diff --git a/lib/src/Entities/Check/HpsCheckResponseDetails.php b/lib/src/Entities/Check/HpsCheckResponseDetails.php index b32c96a..80567c5 100644 --- a/lib/src/Entities/Check/HpsCheckResponseDetails.php +++ b/lib/src/Entities/Check/HpsCheckResponseDetails.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/Credit/HpsCPCData.php b/lib/src/Entities/Credit/HpsCPCData.php index 3252375..36c83df 100644 --- a/lib/src/Entities/Credit/HpsCPCData.php +++ b/lib/src/Entities/Credit/HpsCPCData.php @@ -1,16 +1,27 @@ 17) { - throw new HpsArgumentException('Card holder PO number must be less than 17 characters'); + throw new HpsArgumentException('Card holder PO number must be less than 17 characters',HpsExceptionCodes::INVALID_CPC_DATA); } $this->cardHolderPONbr = $poNbr; } diff --git a/lib/src/Entities/Credit/HpsCPCEdit.php b/lib/src/Entities/Credit/HpsCPCEdit.php index 4e7c421..c74b02b 100644 --- a/lib/src/Entities/Credit/HpsCPCEdit.php +++ b/lib/src/Entities/Credit/HpsCPCEdit.php @@ -1,7 +1,17 @@ Transaction->$txnType; @@ -37,6 +49,10 @@ public static function fromDict($rsp, $txnType, $returnType = 'HpsReportTransact $details->responseCode = (isset($reportResponse->Data->RspCode) ? (string)$reportResponse->Data->RspCode : null); $details->responseText = (isset($reportResponse->Data->RspText) ? (string)$reportResponse->Data->RspText : null); $details->transactionStatus = (isset($reportResponse->Data->TxnStatus) ? (string)$reportResponse->Data->TxnStatus : null); + $details->gratuityAmount = (isset($reportResponse->Data->GratuityAmtInfo) ? (string)$reportResponse->Data->GratuityAmtInfo : null); + $details->settlementAmount = (isset($reportResponse->Data->SettlementAmt) ? (string)$reportResponse->Data->SettlementAmt : null); + $details->convenienceAmount = (isset($reportResponse->Data->ConvenienceAmtInfo) ? (string)$reportResponse->Data->ConvenienceAmtInfo : null); + $details->shippingAmount = (isset($reportResponse->Data->ShippingAmtInfo) ? (string)$reportResponse->Data->ShippingAmtInfo : null); if (isset($reportResponse->Data->TokenizationMsg)) { $details->tokenData = new HpsTokenData(); @@ -50,7 +66,7 @@ public static function fromDict($rsp, $txnType, $returnType = 'HpsReportTransact $details->customerId = (isset($additionalTxnFields->CustomerID) ? (string)$additionalTxnFields->CustomerID : null); } - if ((string)$reportResponse->Data->RspCode != '00') { + if ((string)$reportResponse->GatewayRspCode != '0' && (string)$reportResponse->Data->RspCode != '00') { if ($details->exceptions == null) { $details->exceptions = new HpsChargeExceptions(); } @@ -58,7 +74,8 @@ public static function fromDict($rsp, $txnType, $returnType = 'HpsReportTransact $details->exceptions->issuerException = HpsIssuerResponseValidation::getException( (string)$rsp->Header->GatewayTxnId, (string)$reportResponse->Data->RspCode, - (string)$reportResponse->Data->RspText + (string)$reportResponse->Data->RspText, + 'credit' ); } diff --git a/lib/src/Entities/Credit/HpsReportTransactionSummary.php b/lib/src/Entities/Credit/HpsReportTransactionSummary.php index 9145883..339b091 100644 --- a/lib/src/Entities/Credit/HpsReportTransactionSummary.php +++ b/lib/src/Entities/Credit/HpsReportTransactionSummary.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/Credit/HpsSecureEcommerce.php b/lib/src/Entities/Credit/HpsSecureEcommerce.php index 299e030..00fdfb4 100644 --- a/lib/src/Entities/Credit/HpsSecureEcommerce.php +++ b/lib/src/Entities/Credit/HpsSecureEcommerce.php @@ -1,5 +1,8 @@ name = $name; diff --git a/lib/src/Entities/Gift/HpsGiftCard.php b/lib/src/Entities/Gift/HpsGiftCard.php index 09b3e80..353c383 100644 --- a/lib/src/Entities/Gift/HpsGiftCard.php +++ b/lib/src/Entities/Gift/HpsGiftCard.php @@ -1,5 +1,8 @@ number = $number; diff --git a/lib/src/Entities/Gift/HpsGiftCardActivate.php b/lib/src/Entities/Gift/HpsGiftCardActivate.php index f050e4e..31d9350 100644 --- a/lib/src/Entities/Gift/HpsGiftCardActivate.php +++ b/lib/src/Entities/Gift/HpsGiftCardActivate.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/Gift/HpsGiftCardAddValue.php b/lib/src/Entities/Gift/HpsGiftCardAddValue.php index 6b86170..e3d9f77 100644 --- a/lib/src/Entities/Gift/HpsGiftCardAddValue.php +++ b/lib/src/Entities/Gift/HpsGiftCardAddValue.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/Gift/HpsGiftCardBalance.php b/lib/src/Entities/Gift/HpsGiftCardBalance.php index 345d041..789d0f2 100644 --- a/lib/src/Entities/Gift/HpsGiftCardBalance.php +++ b/lib/src/Entities/Gift/HpsGiftCardBalance.php @@ -1,5 +1,8 @@ Transaction; diff --git a/lib/src/Entities/Gift/HpsGiftCardVoid.php b/lib/src/Entities/Gift/HpsGiftCardVoid.php index 02cdb7c..1890340 100644 --- a/lib/src/Entities/Gift/HpsGiftCardVoid.php +++ b/lib/src/Entities/Gift/HpsGiftCardVoid.php @@ -1,5 +1,8 @@ invoiceNumber = $invoiceNumber; diff --git a/lib/src/Entities/HpsEncryptionData.php b/lib/src/Entities/HpsEncryptionData.php index 3992836..2d766bb 100644 --- a/lib/src/Entities/HpsEncryptionData.php +++ b/lib/src/Entities/HpsEncryptionData.php @@ -1,5 +1,8 @@ responseMessage = $responseMessage; diff --git a/lib/src/Entities/HpsTrackData.php b/lib/src/Entities/HpsTrackData.php index 2825edd..85fee46 100644 --- a/lib/src/Entities/HpsTrackData.php +++ b/lib/src/Entities/HpsTrackData.php @@ -1,5 +1,8 @@ $this->_header->gatewayResponseMessage, ); } - + /** + * @param $transactionType + * + * @return string + */ public static function transactionTypeToServiceName($transactionType) { switch ($transactionType) { @@ -88,7 +103,11 @@ public static function transactionTypeToServiceName($transactionType) return ""; } } - + /** + * @param $serviceName + * + * @return int|null + */ public static function serviceNameToTransactionType($serviceName) { switch ($serviceName) { diff --git a/lib/src/Entities/HpsTransactionDetails.php b/lib/src/Entities/HpsTransactionDetails.php index baa3d73..3a3c014 100644 --- a/lib/src/Entities/HpsTransactionDetails.php +++ b/lib/src/Entities/HpsTransactionDetails.php @@ -1,5 +1,8 @@ Transaction->$txnType; diff --git a/lib/src/Entities/PayPlan/HpsPayPlanAmount.php b/lib/src/Entities/PayPlan/HpsPayPlanAmount.php index 37810c2..b0cb39d 100644 --- a/lib/src/Entities/PayPlan/HpsPayPlanAmount.php +++ b/lib/src/Entities/PayPlan/HpsPayPlanAmount.php @@ -1,10 +1,18 @@ value = $value; diff --git a/lib/src/Entities/PayPlan/HpsPayPlanCustomer.php b/lib/src/Entities/PayPlan/HpsPayPlanCustomer.php index c2ad03a..5528055 100644 --- a/lib/src/Entities/PayPlan/HpsPayPlanCustomer.php +++ b/lib/src/Entities/PayPlan/HpsPayPlanCustomer.php @@ -1,5 +1,8 @@ paymentMethodType)); diff --git a/lib/src/Entities/PayPlan/HpsPayPlanSchedule.php b/lib/src/Entities/PayPlan/HpsPayPlanSchedule.php index 140e083..258ff4a 100644 --- a/lib/src/Entities/PayPlan/HpsPayPlanSchedule.php +++ b/lib/src/Entities/PayPlan/HpsPayPlanSchedule.php @@ -1,5 +1,8 @@ emailReceipt = 'Never'; $this->emailAdvanceNotice = 'No'; } - + /** + * @param \HpsPayPlanSchedule|null $schedule + * + * @return array + */ public static function getEditableFields( HpsPayPlanSchedule $schedule = null ) { $editableFields = array( @@ -112,7 +121,7 @@ public static function getEditableFields( HpsPayPlanSchedule $schedule = null ) 'invoiceNbr', 'description', ); - if ($schedule->scheduleStarted === 'true'){ + if ($schedule->scheduleStarted === true){ $editableFields[] = 'cancellationDate'; $editableFields[] = 'nextProcessingDate'; } @@ -125,7 +134,9 @@ public static function getEditableFields( HpsPayPlanSchedule $schedule = null ) } return $editableFields; } - + /** + * @return array + */ public static function getSearchableFields() { return array( @@ -151,7 +162,11 @@ public static function getSearchableFields() 'scheduleStatus', ); } - + /** + * @param $obj + * + * @return \HpsPayPlanSchedule + */ public static function fromStdClass($obj) { $ret = new HpsPayPlanSchedule(); @@ -190,6 +205,12 @@ public static function fromStdClass($obj) } // Needs to be implemented to get name of child class + /** + * @param null $params + * @param string $class + * + * @return array + */ public function getEditableFieldsWithValues($params = null,$class = 'HpsPayPlanSchedule'){ if ($params===null){ $params=$this; diff --git a/lib/src/Infrastructure/Enums/HpsACHType.php b/lib/src/Infrastructure/Enums/HpsACHType.php index 25cdea8..9766a64 100644 --- a/lib/src/Infrastructure/Enums/HpsACHType.php +++ b/lib/src/Infrastructure/Enums/HpsACHType.php @@ -1,5 +1,8 @@ code = $code; diff --git a/lib/src/Infrastructure/HpsCheckException.php b/lib/src/Infrastructure/HpsCheckException.php index e7dee85..de88f17 100644 --- a/lib/src/Infrastructure/HpsCheckException.php +++ b/lib/src/Infrastructure/HpsCheckException.php @@ -1,11 +1,21 @@ transactionId = $transactionId; diff --git a/lib/src/Infrastructure/HpsConfiguration.php b/lib/src/Infrastructure/HpsConfiguration.php index 5fe86a0..d2b8dc6 100644 --- a/lib/src/Infrastructure/HpsConfiguration.php +++ b/lib/src/Infrastructure/HpsConfiguration.php @@ -1,5 +1,8 @@ transactionId = $transactionId; diff --git a/lib/src/Infrastructure/HpsCreditExceptionDetails.php b/lib/src/Infrastructure/HpsCreditExceptionDetails.php index 6bafad7..cee4fa2 100644 --- a/lib/src/Infrastructure/HpsCreditExceptionDetails.php +++ b/lib/src/Infrastructure/HpsCreditExceptionDetails.php @@ -1,5 +1,8 @@ code = $code; diff --git a/lib/src/Infrastructure/HpsGatewayExceptionDetails.php b/lib/src/Infrastructure/HpsGatewayExceptionDetails.php index 4741083..e622554 100644 --- a/lib/src/Infrastructure/HpsGatewayExceptionDetails.php +++ b/lib/src/Infrastructure/HpsGatewayExceptionDetails.php @@ -1,5 +1,8 @@ param = $paramName; diff --git a/lib/src/Infrastructure/HpsLogger.php b/lib/src/Infrastructure/HpsLogger.php index 8236a7a..252937c 100644 --- a/lib/src/Infrastructure/HpsLogger.php +++ b/lib/src/Infrastructure/HpsLogger.php @@ -1,15 +1,22 @@ _logger = new HpsEmptyLogger(); } - + /** + * @return \HpsLogger|null + */ public static function getInstance() { if (null === self::$_instance) { @@ -17,12 +24,17 @@ public static function getInstance() } return self::$_instance; } - + /** + * @param \HpsLoggerInterface $logger + */ public function useLogger(HpsLoggerInterface $logger) { $this->_logger = $logger; } - + /** + * @param $message + * @param null $object + */ public function log($message, $object = null) { $this->_logger->log($message, $object); diff --git a/lib/src/Infrastructure/HpsProcessorError.php b/lib/src/Infrastructure/HpsProcessorError.php index 0cebe37..2637eba 100644 --- a/lib/src/Infrastructure/HpsProcessorError.php +++ b/lib/src/Infrastructure/HpsProcessorError.php @@ -1,5 +1,8 @@ transactionId = $transactionId; diff --git a/lib/src/Infrastructure/HpsProcessorExceptionDetails.php b/lib/src/Infrastructure/HpsProcessorExceptionDetails.php index b277b75..9bde5de 100644 --- a/lib/src/Infrastructure/HpsProcessorExceptionDetails.php +++ b/lib/src/Infrastructure/HpsProcessorExceptionDetails.php @@ -1,5 +1,8 @@ Header->GatewayRspCode; @@ -18,7 +29,13 @@ public static function checkResponse($response, $expectedType) ); } } - + /** + * @param $responseCode + * @param $responseText + * @param $response + * + * @return \HpsAuthenticationException|\HpsGatewayException|null + */ public static function getException($responseCode, $responseText, $response) { $e = null; diff --git a/lib/src/Infrastructure/Validation/HpsInputValidation.php b/lib/src/Infrastructure/Validation/HpsInputValidation.php index d71cfe6..f6cac37 100644 --- a/lib/src/Infrastructure/Validation/HpsInputValidation.php +++ b/lib/src/Infrastructure/Validation/HpsInputValidation.php @@ -1,5 +1,8 @@ 100, 'State' => 20 ); - + /** + * @param $amount + * + * @return string + * @throws \HpsInvalidRequestException + */ public static function checkAmount($amount) { if ($amount < 0 || $amount === null) { @@ -25,7 +33,12 @@ public static function checkAmount($amount) $amount = preg_replace('/[^0-9\.]/', '', $amount); return sprintf("%0.2f", round($amount, 3)); } - + /** + * @param $currency + * @param null $allowedCurrencies + * + * @throws \HpsInvalidRequestException + */ public static function checkCurrency($currency, $allowedCurrencies = null) { $currencies = self::$_defaultAllowedCurrencies; @@ -47,17 +60,29 @@ public static function checkCurrency($currency, $allowedCurrencies = null) ); } } - + /** + * @param $number + * + * @return mixed + */ public static function cleanPhoneNumber($number) { - return preg_replace('/\D+/', '', $number); + return preg_replace('/\D+/', '', trim($number)); } - + /** + * @param $zip + * + * @return mixed + */ public static function cleanZipCode($zip) { - return preg_replace('/[^0-9A-Za-z]/', '', $zip); + return preg_replace('/[^0-9A-Za-z]/', '', trim($zip)); } - + /** + * @param $date + * + * @throws \HpsInvalidRequestException + */ public static function checkDateNotFuture($date) { $current = date('Y-m-d\TH:i:s.00\Z', time()); @@ -69,7 +94,11 @@ public static function checkDateNotFuture($date) ); } } - + /** + * @param $text + * + * @return mixed + */ public static function cleanAscii($text) { return preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $text); diff --git a/lib/src/Infrastructure/Validation/HpsIssuerResponseValidation.php b/lib/src/Infrastructure/Validation/HpsIssuerResponseValidation.php index eb01b9a..5430be9 100644 --- a/lib/src/Infrastructure/Validation/HpsIssuerResponseValidation.php +++ b/lib/src/Infrastructure/Validation/HpsIssuerResponseValidation.php @@ -1,5 +1,8 @@ "The amount was partially approved.", HpsExceptionCodes::INVALID_CARD_DATA => "The card data is invalid.", ); - + /** + * @param $transactionId + * @param $responseCode + * @param $responseText + * @param string $type + * + * @throws \HpsCreditException + * @throws null + */ public static function checkResponse($transactionId, $responseCode, $responseText, $type = 'credit') { $e = HpsIssuerResponseValidation::getException( @@ -92,7 +103,14 @@ public static function checkResponse($transactionId, $responseCode, $responseTex throw $e; } } - + /** + * @param $transactionId + * @param $responseCode + * @param $responseText + * @param $type + * + * @return \HpsCreditException|null + */ public static function getException($transactionId, $responseCode, $responseText, $type) { $acceptedCodes = array('00', '0'); diff --git a/lib/src/Infrastructure/Validation/HpsProcessorResponseValidation.php b/lib/src/Infrastructure/Validation/HpsProcessorResponseValidation.php index bf419e1..d340eea 100644 --- a/lib/src/Infrastructure/Validation/HpsProcessorResponseValidation.php +++ b/lib/src/Infrastructure/Validation/HpsProcessorResponseValidation.php @@ -1,7 +1,19 @@ appendChild($xml->createElement('hps:AllowDup', ($this->allowDuplicates ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:AllowPartialAuth', ($this->allowPartialAuth ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount)); + + //update convenienceAmtInfo if passed + if ($this->convenienceAmtInfo != null && $this->convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', HpsInputValidation::checkAmount($this->convenienceAmtInfo))); + } + + //update shippingAmtInfo if passed + if ($this->shippingAmtInfo != null && $this->shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', HpsInputValidation::checkAmount($this->shippingAmtInfo))); + } if ($this->gratuity != null) { $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity)); @@ -220,12 +238,11 @@ private function setUpValidations() */ public function onlyOnePaymentMethod($actionCounts) { - return (isset($actionCounts['card']) && $actionCounts['card'] == 1 - && (!isset($actionCounts['token']) - || isset($actionCounts['token']) && $actionCounts['token'] == 0)) - || (isset($actionCounts['token']) && $actionCounts['token'] == 1 - && (!isset($actionCounts['card']) - || isset($actionCounts['card']) && $actionCounts['card'] == 0)); + $count = 0; + if (isset($actionCounts['card'])) { $count++; } + if (isset($actionCounts['token'])) { $count++; } + if (isset($actionCounts['trackData'])) { $count++; } + return 1 === $count; } /** diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceCaptureBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceCaptureBuilder.php index 8d3bbff..11b1936 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceCaptureBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceCaptureBuilder.php @@ -61,9 +61,8 @@ public function execute() if ($this->directMarketData != null && $this->directMarketData->invoiceNumber != null) { $hpsCreditAddToBatch->appendChild($this->_hydrateDirectMarketData($this->directMarketData, $xml)); } - $hpsTransaction->appendChild($hpsCreditAddToBatch); - $response = $this->doRequest($hpsTransaction); + $response = $this->service->doRequest($hpsTransaction); $this->_processChargeGatewayResponse($response, 'CreditAddToBatch'); return $this->service diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceChargeBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceChargeBuilder.php index b2c412b..a4858f3 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceChargeBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceChargeBuilder.php @@ -17,6 +17,8 @@ * @method HpsCreditServiceChargeBuilder withDirectMarketData(HpsDirectMarketData $directMarketData) * @method HpsCreditServiceChargeBuilder withAllowDuplicates(bool $allowDuplicates) * @method HpsCreditServiceChargeBuilder withGratuity(double $gratuity) + * @method HpsCreditServiceChargeBuilder withConvenienceAmtInfo(double $convenienceAmtInfo) + * @method HpsCreditServiceChargeBuilder withShippingAmtInfo(double $shippingAmtInfo) */ class HpsCreditServiceChargeBuilder extends HpsBuilderAbstract { @@ -68,6 +70,12 @@ class HpsCreditServiceChargeBuilder extends HpsBuilderAbstract protected $originalTxnReferenceData = null; protected $secureEcommerce = null; + /** @var double|null */ + protected $convenienceAmtInfo = null; + + /** @var double|null */ + protected $shippingAmtInfo = null; + /** * Instatiates a new HpsCreditServiceChargeBuilder * @@ -97,6 +105,16 @@ public function execute() $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', ($this->allowDuplicates ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:AllowPartialAuth', ($this->allowPartialAuth ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount)); + + //update convenienceAmtInfo if passed + if ($this->convenienceAmtInfo != null && $this->convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', HpsInputValidation::checkAmount($this->convenienceAmtInfo))); + } + + //update shippingAmtInfo if passed + if ($this->shippingAmtInfo != null && $this->shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', HpsInputValidation::checkAmount($this->shippingAmtInfo))); + } if ($this->gratuity != null) { $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity)); @@ -116,7 +134,8 @@ public function execute() )); if ($this->card->encryptionData != null) { $cardData->appendChild($this->service->_hydrateEncryptionData( - $this->card->encryptionData + $this->card->encryptionData, + $xml )); } } else if ($this->token != null) { @@ -127,10 +146,11 @@ public function execute() $this->readerPresent )); } else if ($this->trackData != null) { - $cardData->appendChild($this->service->_hydrateTrackData($this->trackData)); + $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml)); if ($this->trackData->encryptionData != null) { $cardData->appendChild($this->service->_hydrateEncryptionData( - $this->trackData->encryptionData + $this->trackData->encryptionData, + $xml )); } } else if ($this->paymentData != null) { @@ -175,7 +195,7 @@ public function execute() $hpsCreditSale->appendChild($hpsBlock1); $hpsTransaction->appendChild($hpsCreditSale); - return $this->service->_submitTransaction($hpsTransaction, 'CreditSale', (isset($details->clientTransactionId) ? $details->clientTransactionId : null)); + return $this->service->_submitTransaction($hpsTransaction, 'CreditSale', (isset($this->details->clientTransactionId) ? $this->details->clientTransactionId : null)); } /** diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceGetBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceGetBuilder.php index fede6a3..ca6dbbd 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceGetBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceGetBuilder.php @@ -30,7 +30,7 @@ public function execute() parent::execute(); if ($this->transactionId <= 0) { - throw new HpsArgumentException('Invalid Transaction Id'); + throw new HpsArgumentException('Invalid Transaction Id',HpsExceptionCodes::INVALID_ORIGINAL_TRANSACTION); } $xml = new DOMDocument(); diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceListTransactionsBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceListTransactionsBuilder.php index 963773a..409ea5a 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceListTransactionsBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceListTransactionsBuilder.php @@ -6,7 +6,7 @@ * * @method HpsCreditServiceListTransactionsBuilder withStartDate(string $startDate) * @method HpsCreditServiceListTransactionsBuilder withEndDate(string $endDate) - * @method HpsCreditServiceListTransactionsBuilder withFilterBy(integer|string $filterBy) + * @method HpsCreditServiceListTransactionsBuilder withFilterBy(string $filterBy) * @method HpsCreditServiceListTransactionsBuilder withClientTransactionId(string $clientTransactionId) */ class HpsCreditServiceListTransactionsBuilder extends HpsBuilderAbstract diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineAuthBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineAuthBuilder.php index da543f1..48b8f01 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineAuthBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineAuthBuilder.php @@ -22,6 +22,8 @@ * @method HpsCreditServiceOfflineAuthBuilder withGratuity(double $gratuity) * @method HpsCreditServiceOfflineAuthBuilder withAutoSubstantiation(HpsAutoSubstantiation $autoSubstantiation) * @method HpsCreditServiceOfflineAuthBuilder withOfflineAuthCode(string $offlineAuthCode) + * @method HpsCreditServiceOfflineAuthBuilder withConvenienceAmtInfo(double $convenienceAmtInfo) + * @method HpsCreditServiceOfflineAuthBuilder withShippingAmtInfo(double $shippingAmtInfo) */ class HpsCreditServiceOfflineAuthBuilder extends HpsBuilderAbstract { @@ -78,6 +80,12 @@ class HpsCreditServiceOfflineAuthBuilder extends HpsBuilderAbstract /** @var string|null */ protected $offlineAuthCode = null; + + /** @var double|null */ + protected $convenienceAmtInfo = null; + + /** @var double|null */ + protected $shippingAmtInfo = null; /** * Instatiates a new HpsCreditServiceOfflineAuthBuilder @@ -104,13 +112,23 @@ public function execute() $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', ($this->allowDuplicates ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount)); + + //update convenienceAmtInfo if passed + if ($this->convenienceAmtInfo != null && $this->convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', HpsInputValidation::checkAmount($this->convenienceAmtInfo))); + } + + //update shippingAmtInfo if passed + if ($this->shippingAmtInfo != null && $this->shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', HpsInputValidation::checkAmount($this->shippingAmtInfo))); + } if ($this->gratuity != null) { $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity)); } if ($this->cardHolder != null) { - $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder)); + $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml)); } $cardData = $xml->createElement('hps:CardData'); diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineChargeBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineChargeBuilder.php index 0e64d74..2d45299 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineChargeBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceOfflineChargeBuilder.php @@ -22,6 +22,8 @@ * @method HpsCreditServiceOfflineChargeBuilder withGratuity(double $gratuity) * @method HpsCreditServiceOfflineChargeBuilder withAutoSubstantiation(HpsAutoSubstantiation $autoSubstantiation) * @method HpsCreditServiceOfflineChargeBuilder withOfflineAuthCode(string $offlineAuthCode) + * @method HpsCreditServiceOfflineChargeBuilder withConvenienceAmtInfo(double $convenienceAmtInfo) + * @method HpsCreditServiceOfflineChargeBuilder withShippingAmtInfo(double $shippingAmtInfo) */ class HpsCreditServiceOfflineChargeBuilder extends HpsBuilderAbstract { @@ -77,7 +79,14 @@ class HpsCreditServiceOfflineChargeBuilder extends HpsBuilderAbstract protected $autoSubstantiation = null; /** @var string|null */ - protected $offlineAuthCode = null; + protected $offlineAuthCode = null; + + /** @var double|null */ + protected $convenienceAmtInfo = null; + + /** @var double|null */ + protected $shippingAmtInfo = null; + /** * Creates a offline charge transaction through the HpsCreditService */ @@ -92,13 +101,23 @@ public function execute() $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', ($this->allowDuplicates ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount)); + + //update convenienceAmtInfo if passed + if ($this->convenienceAmtInfo != null && $this->convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', HpsInputValidation::checkAmount($this->convenienceAmtInfo))); + } + + //update shippingAmtInfo if passed + if ($this->shippingAmtInfo != null && $this->shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', HpsInputValidation::checkAmount($this->shippingAmtInfo))); + } if ($this->gratuity != null) { $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity)); } if ($this->cardHolder != null) { - $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder)); + $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml)); } $cardData = $xml->createElement('hps:CardData'); diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServicePrepaidAddValueBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServicePrepaidAddValueBuilder.php index 1c0a801..2edb1bf 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServicePrepaidAddValueBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServicePrepaidAddValueBuilder.php @@ -63,7 +63,7 @@ public function execute() } else if ($this->trackData != null) { $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml)); } else if ($this->token != null) { - $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xm)); + $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml)); } $hpsBlock1->appendChild($cardData); diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceUpdateTokenExpirationBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceUpdateTokenExpirationBuilder.php index 2ff3cff..ebed1e8 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceUpdateTokenExpirationBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceUpdateTokenExpirationBuilder.php @@ -5,6 +5,10 @@ * @method HpsCreditServiceUpdateTokenExpirationBuilder withExpMonth(string $transactionId) * @method HpsCreditServiceUpdateTokenExpirationBuilder withExpYear(string $transactionId) */ + +/** + * Class HpsCreditServiceUpdateTokenExpirationBuilder + */ class HpsCreditServiceUpdateTokenExpirationBuilder extends HpsBuilderAbstract { diff --git a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceVerifyBuilder.php b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceVerifyBuilder.php index 1174249..677578e 100644 --- a/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceVerifyBuilder.php +++ b/lib/src/Services/Fluent/Gateway/Credit/HpsCreditServiceVerifyBuilder.php @@ -76,7 +76,8 @@ public function execute() )); if ($this->card->encryptionData != null) { $cardData->appendChild($this->service->_hydrateEncryptionData( - $this->card->encryptionData + $this->card->encryptionData, + $xml )); } } else if ($this->token != null) { @@ -87,10 +88,11 @@ public function execute() $this->readerPresent )); } else if ($this->trackData != null) { - $cardData->appendChild($this->service->_hydrateTrackData($this->trackData)); + $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml)); if ($this->trackData->encryptionData != null) { $cardData->appendChild($this->service->_hydrateEncryptionData( - $this->trackData->encryptionData + $this->trackData->encryptionData, + $xml )); } } @@ -125,11 +127,10 @@ private function setUpValidations() */ public function onlyOnePaymentMethod($actionCounts) { - return (isset($actionCounts['card']) && $actionCounts['card'] == 1 - && (!isset($actionCounts['token']) - || isset($actionCounts['token']) && $actionCounts['token'] == 0)) - || (isset($actionCounts['token']) && $actionCounts['token'] == 1 - && (!isset($actionCounts['card']) - || isset($actionCounts['card']) && $actionCounts['card'] == 0)); + $count = 0; + if (isset($actionCounts['card'])) { $count++; } + if (isset($actionCounts['token'])) { $count++; } + if (isset($actionCounts['trackData'])) { $count++; } + return 1 === $count; } } diff --git a/lib/src/Services/Fluent/Gateway/HpsFluentCheckService.php b/lib/src/Services/Fluent/Gateway/HpsFluentCheckService.php index 5c797d9..eb6aa3f 100644 --- a/lib/src/Services/Fluent/Gateway/HpsFluentCheckService.php +++ b/lib/src/Services/Fluent/Gateway/HpsFluentCheckService.php @@ -1,46 +1,83 @@ _config = $config; return $this; } - + /** + * @return \HpsCheckServiceOverrideBuilder + */ public function override() { return new HpsCheckServiceOverrideBuilder($this); } - + /** + * @param null $amount + * + * @return \HpsCheckServiceRecurringBuilder + */ public function recurring($amount = null) { $builder = new HpsCheckServiceRecurringBuilder($this); return $builder->withAmount($amount); } - + /** + * @return \HpsCheckServiceReturnBuilder + */ public function returnCheck() { return new HpsCheckServiceReturnBuilder($this); } - + /** + * @param null $amount + * + * @return \HpsCheckServiceSaleBuilder + */ public function sale($amount = null) { $builder = new HpsCheckServiceSaleBuilder($this); return $builder ->withAmount($amount); } - + /** + * @return \HpsCheckServiceVoidBuilder + */ public function void() { return new HpsCheckServiceVoidBuilder($this); } - + /** + * @param $action + * @param \HpsCheck $check + * @param $amount + * @param null $clientTransactionId + * @param bool $checkVerify + * @param bool $achVerify + * + * @return mixed + * @throws \HpsCheckException + * @throws \HpsInvalidRequestException + */ public function _buildTransaction($action, HpsCheck $check, $amount, $clientTransactionId = null, $checkVerify = false, $achVerify = false) { if ($amount != null) { @@ -92,7 +129,17 @@ public function _buildTransaction($action, HpsCheck $check, $amount, $clientTran return $this->_submitTransaction($hpsTransaction, 'CheckSale', $clientTransactionId); } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsAuthenticationException + * @throws \HpsCheckException + * @throws \HpsGatewayException + * @throws null + */ public function _submitTransaction($transaction, $txnType, $clientTransactionId = null) { $rsp = $this->doRequest($transaction, $clientTransactionId); diff --git a/lib/src/Services/Fluent/Gateway/HpsFluentCreditService.php b/lib/src/Services/Fluent/Gateway/HpsFluentCreditService.php index a690dbb..1f331ce 100644 --- a/lib/src/Services/Fluent/Gateway/HpsFluentCreditService.php +++ b/lib/src/Services/Fluent/Gateway/HpsFluentCreditService.php @@ -1,18 +1,34 @@ _config = $config; return $this; } - + /** + * @param null $amount + * + * @return \HpsCreditServiceAuthorizeBuilder + */ public function authorize($amount = null) { $builder = new HpsCreditServiceAuthorizeBuilder($this); @@ -20,14 +36,22 @@ public function authorize($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $transactionId + * + * @return \HpsCreditServiceCaptureBuilder + */ public function capture($transactionId = null) { $builder = new HpsCreditServiceCaptureBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceChargeBuilder + */ public function charge($amount = null) { $builder = new HpsCreditServiceChargeBuilder($this); @@ -35,38 +59,56 @@ public function charge($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $transactionId + * + * @return \HpsCreditServiceCpcEditBuilder + */ public function cpcEdit($transactionId = null) { $builder = new HpsCreditServiceCpcEditBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @return \HpsCreditServiceEditBuilder + */ public function edit() { return new HpsCreditServiceEditBuilder($this); } - + /** + * @return \HpsCreditServiceUpdateTokenExpirationBuilder + */ public function updateTokenExpiration() { $builder = new HpsCreditServiceUpdateTokenExpirationBuilder($this); //print_r($builder); return $builder; } - + /** + * @param null $transactionId + * + * @return \HpsCreditServiceGetBuilder + */ public function get($transactionId = null) { $builder = new HpsCreditServiceGetBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @return \HpsCreditServiceListTransactionsBuilder + */ public function listTransactions() { return new HpsCreditServiceListTransactionsBuilder($this); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceOfflineAuthBuilder + */ public function offlineAuth($amount = null) { $builder = new HpsCreditServiceOfflineAuthBuilder($this); @@ -74,7 +116,11 @@ public function offlineAuth($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceOfflineChargeBuilder + */ public function offlineCharge($amount = null) { $builder = new HpsCreditServiceOfflineChargeBuilder($this); @@ -82,12 +128,18 @@ public function offlineCharge($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @return \HpsCreditServicePrepaidBalanceInquiryBuilder + */ public function prepaidBalanceInquiry() { return new HpsCreditServicePrepaidBalanceInquiryBuilder($this); } - + /** + * @param null $amount + * + * @return \HpsCreditServicePrepaidAddValueBuilder + */ public function prepaidAddValue($amount = null) { $builder = new HpsCreditServicePrepaidAddValueBuilder($this); @@ -95,13 +147,21 @@ public function prepaidAddValue($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceRecurringBuilder + */ public function recurring($amount = null) { $builder = new HpsCreditServiceRecurringBuilder($this); return $builder->withAmount($amount); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceRefundBuilder + */ public function refund($amount = null) { $builder = new HpsCreditServiceRefundBuilder($this); @@ -109,7 +169,11 @@ public function refund($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsCreditServiceReverseBuilder + */ public function reverse($amount = null) { $builder = new HpsCreditServiceReverseBuilder($this); @@ -117,19 +181,32 @@ public function reverse($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @return \HpsAccountVerify + */ public function verify() { return new HpsCreditServiceVerifyBuilder($this); } - + /** + * @param null $transactionId + * + * @return \HpsCreditServiceVoidBuilder + */ public function void($transactionId = null) { $builder = new HpsCreditServiceVoidBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + * @throws null + */ private function _processChargeGatewayResponse($response, $expectedType) { $gatewayRspCode = (isset($response->Header->GatewayRspCode) ? $response->Header->GatewayRspCode : null); @@ -141,7 +218,7 @@ private function _processChargeGatewayResponse($response, $expectedType) if ($gatewayRspCode == '30') { try { - $this->reverse($transactionId, $this->_amount, $this->_currency); + $this->reverse($this->_amount)->withTransactionId($transactionId)->execute(); } catch (Exception $e) { throw new HpsGatewayException( HpsExceptionCodes::GATEWAY_TIMEOUT_REVERSAL_ERROR, @@ -153,7 +230,13 @@ private function _processChargeGatewayResponse($response, $expectedType) HpsGatewayResponseValidation::checkResponse($response, $expectedType); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsCreditException + * @throws null + */ private function _processChargeIssuerResponse($response, $expectedType) { $transactionId = (isset($response->Header->GatewayTxnId) ? $response->Header->GatewayTxnId : null); @@ -167,7 +250,7 @@ private function _processChargeIssuerResponse($response, $expectedType) // check if we need to do a reversal if ($responseCode == '91') { try { - $this->reverse($transactionId, $this->_amount, $this->_currency); + $this->reverse($this->_amount)->withTransactionId($transactionId)->execute(); } catch (HpsGatewayException $e) { // if the transaction wasn't found; throw the original timeout exception if ($e->details->gatewayResponseCode == 3) { @@ -192,7 +275,17 @@ private function _processChargeIssuerResponse($response, $expectedType) } } } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTxnId + * @param null $cardData + * + * @return array|null + * @throws \HpsCreditException + * @throws \HpsException + * @throws \HpsGatewayException + */ public function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null) { try { @@ -201,7 +294,7 @@ public function _submitTransaction($transaction, $txnType, $clientTxnId = null, if ($e->innerException != null && $e->innerException->getMessage() == 'gateway_time-out') { if (in_array($txnType, array('CreditSale', 'CreditAuth'))) { try { - $this->reverse($cardData, $this->_amount, $this->_currency); + $this->reverse($this->_amount)->withCard($cardData)->execute(); } catch (Exception $e) { throw new HpsGatewayException('0', HpsExceptionCodes::GATEWAY_TIMEOUT_REVERSAL_ERROR); } @@ -260,9 +353,6 @@ public function _submitTransaction($transaction, $txnType, $clientTxnId = null, case 'CreditOfflineAuth': $rvalue = HpsOfflineAuthorization::fromDict($response, $txnType); break; - case 'CreditOfflineAuth': - $rvalue = HpsOfflineAuthorization::fromDict($response, $txnType); - break; case 'ManageTokens': $rvalue = HpsManageTokensResponse::fromDict($response, $txnType); break; diff --git a/lib/src/Services/Fluent/Gateway/HpsFluentDebitService.php b/lib/src/Services/Fluent/Gateway/HpsFluentDebitService.php index 0d30f6a..e68ce6b 100644 --- a/lib/src/Services/Fluent/Gateway/HpsFluentDebitService.php +++ b/lib/src/Services/Fluent/Gateway/HpsFluentDebitService.php @@ -1,39 +1,67 @@ _config = $config; return $this; } - + /** + * @param null $amount + * + * @return \HpsDebitServiceAddValueBuilder + */ public function addValue($amount = null) { $builder = new HpsDebitServiceAddValueBuilder($this); return $builder ->withAmount($amount); } - + /** + * @param null $amount + * + * @return \HpsDebitServiceChargeBuilder + */ public function charge($amount = null) { $builder = new HpsDebitServiceChargeBuilder($this); return $builder ->withAmount($amount); } - + /** + * @param null $transactionId + * + * @return \HpsDebitServiceReturnBuilder + */ public function returnDebit($transactionId = null) { $builder = new HpsDebitServiceReturnBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @param null $transactionId + * + * @return \HpsDebitServiceReverseBuilder + */ public function reverse($transactionId = null) { $builder = new HpsDebitServiceReverseBuilder($this); diff --git a/lib/src/Services/Fluent/Gateway/HpsFluentGiftCardService.php b/lib/src/Services/Fluent/Gateway/HpsFluentGiftCardService.php index da18222..849eb6e 100644 --- a/lib/src/Services/Fluent/Gateway/HpsFluentGiftCardService.php +++ b/lib/src/Services/Fluent/Gateway/HpsFluentGiftCardService.php @@ -1,18 +1,34 @@ _config = $config; return $this; } - + /** + * @param null $amount + * + * @return \HpsGiftCardServiceActivateBuilder + */ public function activate($amount = null) { $builder = new HpsGiftCardServiceActivateBuilder($this); @@ -20,34 +36,50 @@ public function activate($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsGiftCardServiceAddValueBuilder + */ public function addValue($amount = null) { $builder = new HpsGiftCardServiceAddValueBuilder($this); return $builder ->withAmount($amount); } - + /** + * @return \HpsGiftCardServiceAliasBuilder + */ public function alias() { return new HpsGiftCardServiceAliasBuilder($this); } - + /** + * @return \HpsGiftCardServiceBalanceBuilder + */ public function balance() { return new HpsGiftCardServiceBalanceBuilder($this); } - + /** + * @return \HpsGiftCardServiceDeactivateBuilder + */ public function deactivate() { return new HpsGiftCardServiceDeactivateBuilder($this); } - + /** + * @return \HpsGiftCardServiceReplaceBuilder + */ public function replace() { return new HpsGiftCardServiceReplaceBuilder($this); } - + /** + * @param null $amount + * + * @return \HpsGiftCardServiceReverseBuilder + */ public function reverse($amount = null) { $builder = new HpsGiftCardServiceReverseBuilder($this); @@ -55,7 +87,11 @@ public function reverse($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsGiftCardServiceRewardBuilder + */ public function reward($amount = null) { $builder = new HpsGiftCardServiceRewardBuilder($this); @@ -63,7 +99,11 @@ public function reward($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $amount + * + * @return \HpsGiftCardServiceSaleBuilder + */ public function sale($amount = null) { $builder = new HpsGiftCardServiceSaleBuilder($this); @@ -71,14 +111,28 @@ public function sale($amount = null) ->withAmount($amount) ->withCurrency('usd'); } - + /** + * @param null $transactionId + * + * @return \HpsGiftCardServiceVoidBuilder + */ public function void($transactionId = null) { $builder = new HpsGiftCardServiceVoidBuilder($this); return $builder ->withTransactionId($transactionId); } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTxnId + * + * @return \HpsGiftCardAlias|string + * @throws \HpsAuthenticationException + * @throws \HpsCreditException + * @throws \HpsGatewayException + * @throws null + */ public function _submitTransaction($transaction, $txnType, $clientTxnId = null) { $response = $this->doRequest($transaction, $clientTxnId); diff --git a/lib/src/Services/Gateway/AltPayment/HpsAltPaymentService.php b/lib/src/Services/Gateway/AltPayment/HpsAltPaymentService.php index 0628383..c0c110b 100644 --- a/lib/src/Services/Gateway/AltPayment/HpsAltPaymentService.php +++ b/lib/src/Services/Gateway/AltPayment/HpsAltPaymentService.php @@ -1,10 +1,25 @@ appendChild($auth); return $this->_submitTransaction($transaction, 'AltPaymentAuth'); } - + /** + * @param $transactionId + * @param $amount + * + * @return null + * @throws \HpsException + * @throws \HpsInvalidRequestException + */ public function capture($transactionId, $amount) { HpsInputValidation::checkAmount($amount); @@ -52,7 +74,18 @@ public function capture($transactionId, $amount) $transaction->appendChild($capture); return $this->_submitTransaction($transaction, 'AltPaymentCapture'); } - + /** + * @param $amount + * @param $currency + * @param \HpsBuyerData|null $buyer + * @param \HpsPaymentData|null $payment + * @param \HpsShippingInfo|null $shippingAddress + * @param null $lineItems + * + * @return null + * @throws \HpsException + * @throws \HpsInvalidRequestException + */ public function createSession($amount, $currency, HpsBuyerData $buyer = null, HpsPaymentData $payment = null, HpsShippingInfo $shippingAddress = null, $lineItems = null) { HpsInputValidation::checkAmount($amount); @@ -76,7 +109,14 @@ public function createSession($amount, $currency, HpsBuyerData $buyer = null, Hp $transaction->appendChild($createSession); return $this->_submitTransaction($transaction, 'AltPaymentCreateSession'); } - + /** + * @param $transactionId + * @param bool $isPartial + * @param null $partialAmount + * + * @return null + * @throws \HpsException + */ public function refund($transactionId, $isPartial = false, $partialAmount = null) { $xml = new DOMDocument(); @@ -100,7 +140,19 @@ public function refund($transactionId, $isPartial = false, $partialAmount = null $transaction->appendChild($return); return $this->_submitTransaction($transaction, 'AltPaymentReturn'); } - + /** + * @param $sessionId + * @param $amount + * @param $currency + * @param \HpsBuyerData|null $buyer + * @param \HpsPaymentData|null $payment + * @param \HpsShippingInfo|null $shippingAddress + * @param null $lineItems + * + * @return null + * @throws \HpsException + * @throws \HpsInvalidRequestException + */ public function sale($sessionId, $amount, $currency, HpsBuyerData $buyer = null, HpsPaymentData $payment = null, HpsShippingInfo $shippingAddress = null, $lineItems = null) { HpsInputValidation::checkAmount($amount); @@ -125,7 +177,12 @@ public function sale($sessionId, $amount, $currency, HpsBuyerData $buyer = null, $transaction->appendChild($sale); return $this->_submitTransaction($transaction, 'AltPaymentSale'); } - + /** + * @param $transactionId + * + * @return null + * @throws \HpsException + */ public function void($transactionId) { $xml = new DOMDocument(); @@ -138,7 +195,12 @@ public function void($transactionId) $transaction->appendChild($void); return $this->_submitTransaction($transaction, 'AltPaymentVoid'); } - + /** + * @param $sessionId + * + * @return null + * @throws \HpsException + */ public function sessionInfo($sessionId) { $xml = new DOMDocument(); @@ -151,12 +213,19 @@ public function sessionInfo($sessionId) $transaction->appendChild($info); return $this->_submitTransaction($transaction, 'AltPaymentSessionInfo'); } - + /** + * @param $type + */ public function setTransactionType($type) { $this->_transactionType = $type; } - + /** + * @param $transactionId + * + * @return null + * @throws \HpsException + */ public function status($transactionId) { $xml = new DOMDocument(); @@ -168,7 +237,12 @@ public function status($transactionId) $transaction->appendChild($status); return $this->_submitTransaction($transaction, 'GetTransactionStatus'); } - + /** + * @param \HpsBuyerData $buyer + * @param \DOMDocument $xml + * + * @return \DOMElement + */ protected function hydrateBuyerData(HpsBuyerData $buyer, DOMDocument $xml) { $data = $xml->createElement('hps:Buyer'); @@ -189,7 +263,12 @@ protected function hydrateBuyerData(HpsBuyerData $buyer, DOMDocument $xml) } return $data; } - + /** + * @param $items + * @param \DOMDocument $xml + * + * @return \DOMElement + */ protected function hydrateLineItems($items, DOMDocument $xml) { $lineItems = $xml->createElement('hps:LineItem'); @@ -221,7 +300,13 @@ protected function hydrateLineItems($items, DOMDocument $xml) } return $lineItems; } - + /** + * @param $name + * @param $value + * @param \DOMDocument $xml + * + * @return \DOMElement + */ protected function hydrateNameValuePair($name, $value, DOMDocument $xml) { $nvp = $xml->createElement('hps:NameValuePair'); @@ -229,7 +314,12 @@ protected function hydrateNameValuePair($name, $value, DOMDocument $xml) $nvp->appendChild($xml->createElement('hps:Value', HpsInputValidation::cleanAscii($value))); return $nvp; } - + /** + * @param \HpsPaymentData $payment + * @param \DOMDocument $xml + * + * @return \DOMElement + */ protected function hydratePaymentData(HpsPaymentData $payment, DOMDocument $xml) { $data = $xml->createElement('hps:Payment'); @@ -248,7 +338,12 @@ protected function hydratePaymentData(HpsPaymentData $payment, DOMDocument $xml) } return $data; } - + /** + * @param \HpsShippingInfo $info + * @param \DOMDocument $xml + * + * @return \DOMElement + */ protected function hydrateShippingData(HpsShippingInfo $info, DOMDocument $xml) { $shipping = $xml->createElement('hps:Shipping'); @@ -263,7 +358,14 @@ protected function hydrateShippingData(HpsShippingInfo $info, DOMDocument $xml) $shipping->appendChild($address); return $shipping; } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + * @throws null + */ private function _processGatewayResponse($response, $expectedType) { $gatewayRspCode = (isset($response->Header->GatewayRspCode) ? $response->Header->GatewayRspCode : null); @@ -287,7 +389,13 @@ private function _processGatewayResponse($response, $expectedType) HpsGatewayResponseValidation::checkResponse($response, $expectedType); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsProcessorException + * @throws null + */ private function _processProcessorResponse($response, $expectedType) { $transactionId = (isset($response->Header->GatewayTxnId) ? $response->Header->GatewayTxnId : null); @@ -307,7 +415,16 @@ private function _processProcessorResponse($response, $expectedType) HpsProcessorResponseValidation::checkResponse($transactionId, $responseCode, $responseMessage, $item); } } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTxnId + * @param null $cardData + * + * @return null + * @throws \HpsException + * @throws \HpsGatewayException + */ private function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null) { try { @@ -354,6 +471,7 @@ private function _submitTransaction($transaction, $txnType, $clientTxnId = null, break; case 'GetTransactionStatus': $rvalue = HpsTransactionStatus::fromDict($response, $txnType); + break; default: break; } diff --git a/lib/src/Services/Gateway/AltPayment/HpsMasterPassService.php b/lib/src/Services/Gateway/AltPayment/HpsMasterPassService.php index 3822ef5..6a065ff 100644 --- a/lib/src/Services/Gateway/AltPayment/HpsMasterPassService.php +++ b/lib/src/Services/Gateway/AltPayment/HpsMasterPassService.php @@ -409,14 +409,14 @@ protected function getCheckoutType(HpsOrderData $orderData) ? $orderData->checkoutType : 'lightbox'; } - /** * Converts a 3-letter currency code to 3-digit ISO 4217 version * * @param string $currency currency code * - * @raises HpsArgumentException * @return string + * @throws \HpsArgumentException + * @raises HpsArgumentException */ protected function currencyStringToNumeric($currency) { @@ -530,13 +530,13 @@ protected function formatAmount($amount) return sprintf('%s', ceil(intval($amount) * 100)); // return $amount; } - /** * Processes the response from Cardinal * * @param object $response response from Cardinal * * @return null + * @throws \HpsException */ protected function processGatewayResponse($response) { @@ -550,13 +550,13 @@ protected function processGatewayResponse($response) throw new HpsException((string)$response->ErrorDesc); } - /** * Processes the response from MasterPass * * @param object $response response from Cardinal * * @return null + * @throws \HpsException */ protected function processProcessorResponse($response) { diff --git a/lib/src/Services/Gateway/AltPayment/HpsPayPalService.php b/lib/src/Services/Gateway/AltPayment/HpsPayPalService.php index 32be1b8..f7d1b95 100644 --- a/lib/src/Services/Gateway/AltPayment/HpsPayPalService.php +++ b/lib/src/Services/Gateway/AltPayment/HpsPayPalService.php @@ -1,5 +1,8 @@ createElement('hps:Transaction'); diff --git a/lib/src/Services/Gateway/HpsBatchService.php b/lib/src/Services/Gateway/HpsBatchService.php index 283f92d..6a2e1bd 100644 --- a/lib/src/Services/Gateway/HpsBatchService.php +++ b/lib/src/Services/Gateway/HpsBatchService.php @@ -1,12 +1,25 @@ submitRequest($url, $header, $data); } - + /** + * @param $curlResponse + * @param $curlInfo + * @param $curlError + * + * @return \SimpleXMLElement + * @throws \HpsException + */ public function processResponse($curlResponse, $curlInfo, $curlError) { // error_log($curlResponse); diff --git a/lib/src/Services/Gateway/HpsCheckService.php b/lib/src/Services/Gateway/HpsCheckService.php index bd12d45..dba9535 100644 --- a/lib/src/Services/Gateway/HpsCheckService.php +++ b/lib/src/Services/Gateway/HpsCheckService.php @@ -1,12 +1,19 @@ _buildTransaction('SALE', $check, $amount, $clientTransactionId); } - + /** + * @param \HpsCheck $check + * @param $amount + * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsException + * @throws \HpsInvalidRequestException + */ public function returnCheck(HpsCheck $check, $amount, $clientTransactionId = null) { + //TODO: implement replacement throw new HpsException('Check action RETURN not currently supported'); return $this->_buildTransaction('RETURN', $check, $amount, $clientTransactionId); } - + /** + * @param \HpsCheck $check + * @param $amount + * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsException + * @throws \HpsInvalidRequestException + */ public function override(HpsCheck $check, $amount, $clientTransactionId = null) { + //TODO: implement replacemen throw new HpsException('Check action OVERRIDE not currently supported'); return $this->_buildTransaction('OVERRIDE', $check, $amount, $clientTransactionId); } - /** * A Void transaction is used to cancel a previously successful sale transaction. The original sale transaction * can be identified by the GatewayTxnid of the original or by the ClientTxnId of the original if provided on the @@ -45,6 +73,10 @@ public function override(HpsCheck $check, $amount, $clientTransactionId = null) * * @param null $transactionId * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsCheckException + * @throws \HpsException */ public function void($transactionId = null, $clientTransactionId = null) { @@ -67,7 +99,16 @@ public function void($transactionId = null, $clientTransactionId = null) $hpsTransaction->appendChild($hpsCheckVoid); return $this->_submitTransaction($hpsTransaction, 'CheckVoid'); } - + /** + * @param $action + * @param \HpsCheck $check + * @param $amount + * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsCheckException + * @throws \HpsInvalidRequestException + */ private function _buildTransaction($action, HpsCheck $check, $amount, $clientTransactionId = null) { $amount = HpsInputValidation::checkAmount($amount); @@ -103,7 +144,17 @@ private function _buildTransaction($action, HpsCheck $check, $amount, $clientTra return $this->_submitTransaction($hpsTransaction, 'CheckSale', $clientTransactionId); } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTransactionId + * + * @return mixed + * @throws \HpsAuthenticationException + * @throws \HpsCheckException + * @throws \HpsGatewayException + * @throws null + */ private function _submitTransaction($transaction, $txnType, $clientTransactionId = null) { $options = array(); diff --git a/lib/src/Services/Gateway/HpsCreditService.php b/lib/src/Services/Gateway/HpsCreditService.php index fba9834..6875575 100644 --- a/lib/src/Services/Gateway/HpsCreditService.php +++ b/lib/src/Services/Gateway/HpsCreditService.php @@ -1,13 +1,38 @@ _currency = $currency; @@ -21,6 +46,16 @@ public function authorize($amount, $currency, $cardOrToken, $cardHolder = null, $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y')); $hpsBlock1->appendChild($xml->createElement('hps:AllowPartialAuth', ($allowPartialAuth ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $amount)); + //update convenienceAmtInfo if passed + if ($convenienceAmtInfo != null && $convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', $convenienceAmtInfo)); + } + + //update shippingAmtInfo if passed + if ($shippingAmtInfo != null && $shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', $shippingAmtInfo)); + } + if ($cardHolder != null) { $hpsBlock1->appendChild($this->_hydrateCardHolderData($cardHolder, $xml)); } @@ -30,7 +65,7 @@ public function authorize($amount, $currency, $cardOrToken, $cardHolder = null, if ($txnDescriptor != null && $txnDescriptor != '') { $hpsBlock1->appendChild($xml->createElement('hps:TxnDescriptor', $txnDescriptor)); } - + $cardData = $xml->createElement('hps:CardData'); if ($cardOrToken instanceof HpsCreditCard) { $cardData->appendChild($this->_hydrateManualEntry($cardOrToken, $xml)); @@ -48,7 +83,17 @@ public function authorize($amount, $currency, $cardOrToken, $cardHolder = null, return $this->_submitTransaction($hpsTransaction, 'CreditAuth', (isset($details->clientTransactionId) ? $details->clientTransactionId : null), $cardOrToken); } - + /** + * @param $transactionId + * @param null $amount + * @param null $gratuity + * @param null $clientTransactionId + * @param null $directMarketData + * + * @return array|null + * @throws \HpsArgumentException + * @throws \HpsGatewayException + */ public function capture($transactionId, $amount = null, $gratuity = null, $clientTransactionId = null, $directMarketData = null) { $xml = new DOMDocument(); @@ -78,8 +123,26 @@ public function capture($transactionId, $amount = null, $gratuity = null, $clien return $this->get($transactionId); } - - public function charge($amount, $currency, $cardOrToken, $cardHolder = null, $requestMultiUseToken = false, $details = null, $txnDescriptor = null, $allowPartialAuth = false, $cpcReq = false, $directMarketData = null) + /** + * @param $amount + * @param $currency + * @param $cardOrToken + * @param null $cardHolder + * @param bool $requestMultiUseToken + * @param null $details + * @param null $txnDescriptor + * @param bool $allowPartialAuth + * @param bool $cpcReq + * @param null $directMarketData + * @param null $convenienceAmtInfo + * @param null $shippingAmtInfo + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + * @throws \HpsInvalidRequestException + */ + public function charge($amount, $currency, $cardOrToken, $cardHolder = null, $requestMultiUseToken = false, $details = null, $txnDescriptor = null, $allowPartialAuth = false, $cpcReq = false, $directMarketData = null, $convenienceAmtInfo = null, $shippingAmtInfo = null) { HpsInputValidation::checkCurrency($currency); $this->_currency = $currency; @@ -93,6 +156,15 @@ public function charge($amount, $currency, $cardOrToken, $cardHolder = null, $re $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y')); $hpsBlock1->appendChild($xml->createElement('hps:AllowPartialAuth', ($allowPartialAuth ? 'Y' : 'N'))); $hpsBlock1->appendChild($xml->createElement('hps:Amt', $amount)); + //update convenienceAmtInfo if passed + if ($convenienceAmtInfo != null && $convenienceAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ConvenienceAmtInfo', $convenienceAmtInfo)); + } + + //update shippingAmtInfo if passed + if ($shippingAmtInfo != null && $shippingAmtInfo != '') { + $hpsBlock1->appendChild($xml->createElement('hps:ShippingAmtInfo', $shippingAmtInfo)); + } if ($cardHolder != null) { $hpsBlock1->appendChild($this->_hydrateCardHolderData($cardHolder, $xml)); } @@ -124,7 +196,19 @@ public function charge($amount, $currency, $cardOrToken, $cardHolder = null, $re return $this->_submitTransaction($hpsTransaction, 'CreditSale', (isset($details->clientTransactionId) ? $details->clientTransactionId : null), $cardOrToken); } - + /** + * @param $schedule + * @param $amount + * @param $cardOrTokenOrPMKey + * @param null $cardHolder + * @param bool $oneTime + * @param null $details + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + * @throws \HpsInvalidRequestException + */ public function recurring($schedule, $amount, $cardOrTokenOrPMKey, $cardHolder = null, $oneTime = false, $details = null) { $this->_amount = HpsInputValidation::checkAmount($amount); @@ -169,7 +253,14 @@ public function recurring($schedule, $amount, $cardOrTokenOrPMKey, $cardHolder = return $this->_submitTransaction($hpsTransaction, 'RecurringBilling', (isset($details->clientTransactionId) ? $details->clientTransactionId : null), $cardOrTokenOrPMKey); } - + /** + * @param $transactionId + * @param $cpcData + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + */ public function cpcEdit($transactionId, $cpcData) { $xml = new DOMDocument(); @@ -181,7 +272,16 @@ public function cpcEdit($transactionId, $cpcData) return $this->_submitTransaction($hpsTransaction, 'CreditCPCEdit'); } - + /** + * @param $transactionId + * @param null $amount + * @param null $gratuity + * @param null $clientTransactionId + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + */ public function edit($transactionId, $amount = null, $gratuity = null, $clientTransactionId = null) { $xml = new DOMDocument(); @@ -247,11 +347,18 @@ public function updateTokenExpiration($tokenValue, $expMonth, $expYear) { return $this->_submitTransaction($hpsTransaction, 'ManageTokens'); } - + /** + * @param $transactionId + * + * @return array|null + * @throws \HpsArgumentException + * @throws \HpsException + * @throws \HpsGatewayException + */ public function get($transactionId) { if ($transactionId <= 0) { - throw new HpsArgumentException('Invalid Transaction Id'); + throw new HpsArgumentException('Invalid Transaction Id',HpsExceptionCodes::INVALID_ORIGINAL_TRANSACTION); } $xml = new DOMDocument(); @@ -262,7 +369,16 @@ public function get($transactionId) return $this->_submitTransaction($hpsTransaction, 'ReportTxnDetail'); } - + /** + * @param $startDate + * @param $endDate + * @param null $filterBy + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + * @throws \HpsInvalidRequestException + */ public function listTransactions($startDate, $endDate, $filterBy = null) { $this->_filterBy = $filterBy; @@ -283,7 +399,18 @@ public function listTransactions($startDate, $endDate, $filterBy = null) return $this->_submitTransaction($hpsTransaction, 'ReportActivity'); } - + /** + * @param $amount + * @param $currency + * @param $cardData + * @param null $cardHolder + * @param null $details + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + * @throws \HpsInvalidRequestException + */ public function refund($amount, $currency, $cardData, $cardHolder = null, $details = null) { HpsInputValidation::checkCurrency($currency); @@ -323,7 +450,7 @@ public function refund($amount, $currency, $cardData, $cardHolder = null, $detai /** * @param HpsCreditCard|HpsTokenData|int $cardData GatewayTxnId * @param float $amount - * @param USD $currency + * @param string $currency * @param null|HpsTransactionDetails $details * @param null|float $authAmount * @return HpsReversal @@ -366,7 +493,16 @@ public function reverse($cardData, $amount, $currency, $details = null, $authAmo return $this->_submitTransaction($hpsTransaction, 'CreditReversal', (isset($details->clientTransactionId) ? $details->clientTransactionId : null)); } - + /** + * @param $cardOrToken + * @param null $cardHolder + * @param bool $requestMultiUseToken + * @param null $clientTransactionId + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + */ public function verify($cardOrToken, $cardHolder = null, $requestMultiUseToken = false, $clientTransactionId = null) { $xml = new DOMDocument(); @@ -392,7 +528,14 @@ public function verify($cardOrToken, $cardHolder = null, $requestMultiUseToken = return $this->_submitTransaction($hpsTransaction, 'CreditAccountVerify', $clientTransactionId); } - + /** + * @param $transactionId + * @param null $clientTransactionId + * + * @return array|null + * @throws \HpsException + * @throws \HpsGatewayException + */ public function void($transactionId, $clientTransactionId = null) { $xml = new DOMDocument(); @@ -403,7 +546,14 @@ public function void($transactionId, $clientTransactionId = null) return $this->_submitTransaction($hpsTransaction, 'CreditVoid', $clientTransactionId); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + * @throws null + */ private function _processChargeGatewayResponse($response, $expectedType) { $gatewayRspCode = (isset($response->Header->GatewayRspCode) ? $response->Header->GatewayRspCode : null); @@ -427,7 +577,13 @@ private function _processChargeGatewayResponse($response, $expectedType) HpsGatewayResponseValidation::checkResponse($response, $expectedType); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsCreditException + * @throws null + */ private function _processChargeIssuerResponse($response, $expectedType) { $transactionId = (isset($response->Header->GatewayTxnId) ? $response->Header->GatewayTxnId : null); diff --git a/lib/src/Services/Gateway/HpsDebitService.php b/lib/src/Services/Gateway/HpsDebitService.php index fbb11d1..02cc144 100644 --- a/lib/src/Services/Gateway/HpsDebitService.php +++ b/lib/src/Services/Gateway/HpsDebitService.php @@ -1,7 +1,15 @@ appendChild($this->_hydrateAdditionalTxnFields($details, $xml)); } - $hpsGiftCard->appendChild($hpsBlock1); - $hpsTransaction->appendChild($hpsGiftCard); if (isset($authorizedAmount)) { - $block = $transaction->Item->Block1; - $block->authAmt = $authorizedAmount->value; - $block->authAmtSpecified = true; + $hpsBlock1->appendChild($xml->createElement('hps:authAmt', $authorizedAmount)); + $hpsBlock1->appendChild($xml->createElement('hps:authAmtSpecified', true)); } + $hpsGiftCard->appendChild($hpsBlock1); + $hpsTransaction->appendChild($hpsGiftCard); + $rsp = $this->_submitTransaction($hpsTransaction, 'DebitReversal', $clientTransactionId); $rsp->responseCode = '00'; $rsp->responseText = ''; @@ -166,7 +174,7 @@ public function reverse($transactionId, $amount, $trackData, $authorizedAmount = * @param HpsTransactionDetails $details Group containing additional transaction fields to be included in detail reporting. * @param string $clientTransactionId Optional client transaction ID. * - * @return HpsDebit The Debit Charge result. + * @return HpsDebitSale The Debit Charge result. */ public function charge($amount, $currency, $trackData, $pinBlock, HpsEncryptionData $encryptionData = null, $allowDuplicates = false, $cashBackAmount = null, $allowPartialAuth = false, HpsCardHolder $cardHolder = null, HpsTransactionDetails $details = null, $clientTransactionId = null) { @@ -199,7 +207,14 @@ public function charge($amount, $currency, $trackData, $pinBlock, HpsEncryptionD return $this->_submitTransaction($hpsTransaction, 'DebitSale', $clientTransactionId); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + * @throws null + */ private function _processChargeGatewayResponse($response, $expectedType) { $gatewayRspCode = (isset($response->Header->GatewayRspCode) ? $response->Header->GatewayRspCode : null); @@ -223,7 +238,13 @@ private function _processChargeGatewayResponse($response, $expectedType) HpsGatewayResponseValidation::checkResponse($response, $expectedType); } - + /** + * @param $response + * @param $expectedType + * + * @throws \HpsCreditException + * @throws null + */ private function _processChargeIssuerResponse($response, $expectedType) { $transactionId = (isset($response->Header->GatewayTxnId) ? $response->Header->GatewayTxnId : null); @@ -262,7 +283,17 @@ private function _processChargeIssuerResponse($response, $expectedType) } } } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTxnId + * @param null $cardData + * + * @return null + * @throws \HpsCreditException + * @throws \HpsException + * @throws \HpsGatewayException + */ private function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null) { $options = array(); diff --git a/lib/src/Services/Gateway/HpsGiftCardService.php b/lib/src/Services/Gateway/HpsGiftCardService.php index 72f663c..a309398 100644 --- a/lib/src/Services/Gateway/HpsGiftCardService.php +++ b/lib/src/Services/Gateway/HpsGiftCardService.php @@ -1,12 +1,27 @@ _submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $amount + * @param $currency + * @param $giftCard + * + * @return \HpsGiftCardAlias|string + * @throws \HpsInvalidRequestException + */ public function addValue($amount, $currency, $giftCard) { HpsInputValidation::checkCurrency($currency); @@ -46,7 +68,13 @@ public function addValue($amount, $currency, $giftCard) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $action + * @param $giftCard + * @param $aliasStr + * + * @return \HpsGiftCardAlias|string + */ public function alias($action, $giftCard, $aliasStr) { $txnType = 'GiftCardAlias'; @@ -65,7 +93,11 @@ public function alias($action, $giftCard, $aliasStr) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $giftCard + * + * @return \HpsGiftCardAlias|string + */ public function balance($giftCard) { $txnType = 'GiftCardBalance'; @@ -82,7 +114,11 @@ public function balance($giftCard) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $giftCard + * + * @return \HpsGiftCardAlias|string + */ public function deactivate($giftCard) { $txnType = 'GiftCardDeactivate'; @@ -99,7 +135,12 @@ public function deactivate($giftCard) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $oldGiftCard + * @param $newGiftCard + * + * @return \HpsGiftCardAlias|string + */ public function replace($oldGiftCard, $newGiftCard) { $txnType = 'GiftCardReplace'; @@ -117,7 +158,14 @@ public function replace($oldGiftCard, $newGiftCard) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $cardData + * @param $amount + * @param string $currency + * + * @return \HpsGiftCardAlias|string + * @throws \HpsInvalidRequestException + */ public function reverse($cardData, $amount, $currency = 'usd') { $txnType = 'GiftCardReversal'; @@ -142,7 +190,16 @@ public function reverse($cardData, $amount, $currency = 'usd') return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $giftCard + * @param $amount + * @param string $currency + * @param null $gratuity + * @param null $tax + * + * @return \HpsGiftCardAlias|string + * @throws \HpsInvalidRequestException + */ public function reward($giftCard, $amount, $currency = 'usd', $gratuity = null, $tax = null) { $txnType = 'GiftCardReward'; @@ -172,7 +229,16 @@ public function reward($giftCard, $amount, $currency = 'usd', $gratuity = null, return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $giftCard + * @param $amount + * @param string $currency + * @param null $gratuity + * @param null $tax + * + * @return \HpsGiftCardAlias|string + * @throws \HpsInvalidRequestException + */ public function sale($giftCard, $amount, $currency = 'usd', $gratuity = null, $tax = null) { $txnType = 'GiftCardSale'; @@ -202,7 +268,11 @@ public function sale($giftCard, $amount, $currency = 'usd', $gratuity = null, $t return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $transactionId + * + * @return \HpsGiftCardAlias|string + */ public function void($transactionId) { $txnType = 'GiftCardVoid'; @@ -219,7 +289,17 @@ public function void($transactionId) return $this->_submitTransaction($hpsTransaction, $txnType); } - + /** + * @param $transaction + * @param $txnType + * @param null $clientTxnId + * + * @return \HpsGiftCardAlias|string + * @throws \HpsAuthenticationException + * @throws \HpsCreditException + * @throws \HpsGatewayException + * @throws null + */ private function _submitTransaction($transaction, $txnType, $clientTxnId = null) { $options = array(); diff --git a/lib/src/Services/Gateway/HpsPayPlanService.php b/lib/src/Services/Gateway/HpsPayPlanService.php index fe967a1..cd1d81b 100644 --- a/lib/src/Services/Gateway/HpsPayPlanService.php +++ b/lib/src/Services/Gateway/HpsPayPlanService.php @@ -1,18 +1,27 @@ customer = new HpsPayPlanCustomerService($config); $this->paymentMethod = new HpsPayPlanPaymentMethodService($config); $this->schedule = new HpsPayPlanScheduleService($config); } - + /** + * @param \HpsServicesConfig $config + */ public function setServicesConfig(HpsServicesConfig $config) { $this->customer->setServicesConfig($config); @@ -22,26 +31,48 @@ public function setServicesConfig(HpsServicesConfig $config) /// Customer methods + /** + * @param \HpsPayPlanCustomer $customer + * + * @return mixed + */ public function addCustomer(HpsPayPlanCustomer $customer) { return $this->customer->add($customer); } - + /** + * @param \HpsPayPlanCustomer $customer + * + * @return mixed + */ public function editCustomer(HpsPayPlanCustomer $customer) { return $this->customer->edit($customer); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAllCustomers($searchFields = array()) { return $this->customer->findAll($searchFields); } - + /** + * @param $customer + * + * @return mixed + */ public function getCustomer($customer) { return $this->customer->get($customer); } - + /** + * @param $customer + * @param bool $forceDelete + * + * @return mixed + */ public function deleteCustomer($customer, $forceDelete = false) { return $this->customer->delete($customer, $forceDelete); @@ -49,26 +80,48 @@ public function deleteCustomer($customer, $forceDelete = false) /// PaymentMethod methods + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ public function addPaymentMethod(HpsPayPlanPaymentMethod $paymentMethod) { return $this->paymentMethod->add($paymentMethod); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ public function editPaymentMethod(HpsPayPlanPaymentMethod $paymentMethod) { return $this->paymentMethod->edit($paymentMethod); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAllPaymentMethods($searchFields = array()) { return $this->paymentMethod->findAll($searchFields); } - + /** + * @param $paymentMethod + * + * @return mixed + */ public function getPaymentMethod($paymentMethod) { return $this->paymentMethod->get($paymentMethod); } - + /** + * @param $paymentMethod + * @param bool $forceDelete + * + * @return mixed + */ public function deletePaymentMethod($paymentMethod, $forceDelete = false) { return $this->paymentMethod->delete($paymentMethod, $forceDelete); @@ -76,26 +129,48 @@ public function deletePaymentMethod($paymentMethod, $forceDelete = false) /// Schedule methods + /** + * @param \HpsPayPlanSchedule $schedule + * + * @return mixed + */ public function addSchedule(HpsPayPlanSchedule $schedule) { return $this->schedule->add($schedule); } - + /** + * @param \HpsPayPlanSchedule $schedule + * + * @return mixed + */ public function editSchedule(HpsPayPlanSchedule $schedule) { return $this->schedule->edit($schedule); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAllSchedules($searchFields = array()) { return $this->schedule->findAll($searchFields); } - + /** + * @param $schedule + * + * @return mixed + */ public function getSchedule($schedule) { return $this->schedule->get($schedule); } - + /** + * @param $schedule + * @param bool $forceDelete + * + * @return mixed + */ public function deleteSchedule($schedule, $forceDelete = false) { return $this->schedule->delete($schedule, $forceDelete); diff --git a/lib/src/Services/Gateway/HpsRestGatewayService.php b/lib/src/Services/Gateway/HpsRestGatewayService.php index 908861d..a7c866a 100644 --- a/lib/src/Services/Gateway/HpsRestGatewayService.php +++ b/lib/src/Services/Gateway/HpsRestGatewayService.php @@ -1,5 +1,8 @@ limit = $limit; $this->offset = $offset; return $this; } - + /** + * @param $searchFields + * + * @return $this + */ public function search($searchFields) { $this->searchFields = $searchFields; return $this; } - + /** + * @param null $data + * @param array $options + * + * @return mixed + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + */ protected function doRequest($data = null, $options = array()) { $endpoint = isset($options['endpoint']) ? $options['endpoint'] : ''; @@ -69,7 +88,14 @@ protected function doRequest($data = null, $options = array()) // print "\n" . $encodedData; return $this->submitRequest($url, $header, $encodedData, $verb, $keyType); } - + /** + * @param $curlResponse + * @param $curlInfo + * @param $curlError + * + * @return mixed + * @throws \HpsException + */ protected function processResponse($curlResponse, $curlInfo, $curlError) { // print "\n" . $curlResponse; @@ -88,12 +114,22 @@ protected function processResponse($curlResponse, $curlInfo, $curlError) break; } } - + /** + * @param $result + * @param $type + * + * @return mixed + */ protected function hydrateObject($result, $type) { return call_user_func(array($type, 'fromStdClass'), $result); } - + /** + * @param $resultSet + * @param $type + * + * @return object + */ protected function hydrateSearchResults($resultSet, $type) { $results = array(); @@ -109,7 +145,9 @@ protected function hydrateSearchResults($resultSet, $type) 'results' => $results, ); } - + /** + * @return string + */ private function _gatewayUrlForKey() { if ($this->_config->secretApiKey != null && $this->_config->secretApiKey != "") { diff --git a/lib/src/Services/Gateway/HpsSoapGatewayService.php b/lib/src/Services/Gateway/HpsSoapGatewayService.php index 1c62352..81dfe22 100644 --- a/lib/src/Services/Gateway/HpsSoapGatewayService.php +++ b/lib/src/Services/Gateway/HpsSoapGatewayService.php @@ -1,7 +1,18 @@ saveXML()), ); $data = $xml->saveXML(); - //print "\n" . $data; + // print "\n" . $data; return $this->submitRequest($url, $header, $data); } - + /** + * @param $curlResponse + * @param $curlInfo + * @param $curlError + * + * @return mixed + * @throws \HpsException + */ public function processResponse($curlResponse, $curlInfo, $curlError) { // print "\n" . $curlResponse; @@ -73,7 +91,12 @@ public function processResponse($curlResponse, $curlInfo, $curlError) break; } } - + /** + * @param $details + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateAdditionalTxnFields($details, DOMDocument $xml) { $additionalTxnFields = $xml->createElement('hps:AdditionalTxnFields'); @@ -92,7 +115,13 @@ public function _hydrateAdditionalTxnFields($details, DOMDocument $xml) return $additionalTxnFields; } - + /** + * @param \HpsCardHolder $cardHolder + * @param \DOMDocument $xml + * + * @return \DOMElement + * @throws \HpsInvalidRequestException + */ public function _hydrateCardHolderData(HpsCardHolder $cardHolder, DOMDocument $xml) { //handle both phone and phoneNumber properties as a valid phone @@ -116,7 +145,12 @@ public function _hydrateCardHolderData(HpsCardHolder $cardHolder, DOMDocument $x return $cardHolderData; } - + /** + * @param \HpsCheck $check + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateCheckData(HpsCheck $check, DOMDocument $xml) { $checkData = $xml->createElement('hps:AccountInfo'); @@ -143,7 +177,12 @@ public function _hydrateCheckData(HpsCheck $check, DOMDocument $xml) return $checkData; } - + /** + * @param \HpsCheck $check + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateConsumerInfo(HpsCheck $check, DOMDocument $xml) { $consumerInfo = $xml->createElement('hps:ConsumerInfo'); @@ -200,7 +239,12 @@ public function _hydrateConsumerInfo(HpsCheck $check, DOMDocument $xml) return $consumerInfo; } - + /** + * @param \HpsCPCData $cpcData + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateCPCData(HpsCPCData $cpcData, DOMDocument $xml) { $cpcDataElement = $xml->createElement('hps:CPCData'); @@ -216,7 +260,12 @@ public function _hydrateCPCData(HpsCPCData $cpcData, DOMDocument $xml) return $cpcDataElement; } - + /** + * @param \HpsDirectMarketData $data + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateDirectMarketData(HpsDirectMarketData $data, DOMDocument $xml) { $directMktDataElement = $xml->createElement('hps:DirectMktData'); @@ -226,7 +275,12 @@ public function _hydrateDirectMarketData(HpsDirectMarketData $data, DOMDocument return $directMktDataElement; } - + /** + * @param \HpsEncryptionData $encryptionData + * @param \DOMDocument $xml + * + * @return \DOMElement + */ public function _hydrateEncryptionData(HpsEncryptionData $encryptionData, DOMDocument $xml) { $encData = $xml->createElement('hps:EncryptionData'); @@ -234,11 +288,17 @@ public function _hydrateEncryptionData(HpsEncryptionData $encryptionData, DOMDoc $encData->appendChild($xml->createElement('hps:EncryptedTrackNumber', $encryptionData->encryptedTrackNumber)); } $encData->appendChild($xml->createElement('hps:KSN', $encryptionData->ksn)); - $encData->appendChild($xml->createElement('hps:KTB', $encryptionData->ksn)); + $encData->appendChild($xml->createElement('hps:KTB', $encryptionData->ktb)); $encData->appendChild($xml->createElement('hps:Version', $encryptionData->version)); return $encData; } - + /** + * @param \HpsGiftCard $giftCard + * @param \DOMDocument $xml + * @param string $elementName + * + * @return \DOMElement + */ public function _hydrateGiftCardData(HpsGiftCard $giftCard, DOMDocument $xml, $elementName = 'CardData') { $giftCardData = $xml->createElement('hps:'.$elementName); @@ -262,7 +322,14 @@ public function _hydrateGiftCardData(HpsGiftCard $giftCard, DOMDocument $xml, $e return $giftCardData; } - + /** + * @param \HpsCreditCard $card + * @param \DOMDocument $xml + * @param bool $cardPresent + * @param bool $readerPresent + * + * @return \DOMElement + */ public function _hydrateManualEntry(HpsCreditCard $card, DOMDocument $xml, $cardPresent = false, $readerPresent = false) { $manualEntry = $xml->createElement('hps:ManualEntry'); @@ -288,7 +355,12 @@ public function _hydrateManualEntry(HpsCreditCard $card, DOMDocument $xml, $card return $manualEntry; } - + /** + * @param $data + * @param $xml + * + * @return mixed + */ public function _hydrateSecureEcommerce($data, $xml) { $secureEcommerce = $xml->createElement('hps:SecureECommerce'); @@ -317,6 +389,14 @@ public function _hydrateSecureEcommerce($data, $xml) * @link https://github.com/hps/heartland-php/pull/21 * @description resolves a recursion issue identified in the link above */ + /** + * @param $token + * @param \DOMDocument $xml + * @param bool $cardPresent + * @param bool $readerPresent + * + * @return \DOMElement + */ public function _hydrateTokenData($token, DOMDocument $xml, $cardPresent = false, $readerPresent = false) { if (!$token instanceof HpsTokenData) { @@ -344,7 +424,12 @@ public function _hydrateTokenData($token, DOMDocument $xml, $cardPresent = false $tokenData->appendChild($xml->createElement('hps:ReaderPresent', ($readerPresent ? 'Y' : 'N'))); return $tokenData; } - + /** + * @param \HpsTrackData $trackData + * @param $xml + * + * @return mixed + */ public function _hydrateTrackData(HpsTrackData $trackData, $xml) { $trackDataElement = $xml->createElement('hps:TrackData', $trackData->value); @@ -353,7 +438,9 @@ public function _hydrateTrackData(HpsTrackData $trackData, $xml) $trackDataElement->appendChild($trackDataElementMethod); return $trackDataElement; } - + /** + * @return string + */ private function _gatewayUrlForKey() { if ($this->_config->secretApiKey != null && $this->_config->secretApiKey != "") { @@ -368,7 +455,11 @@ private function _gatewayUrlForKey() return $this->_config->soapServiceUri; } } - + /** + * @param $xml + * + * @return mixed + */ private function _XML2Array($xml) { $envelope = simplexml_load_string($xml, "SimpleXMLElement", 0, 'http://schemas.xmlsoap.org/soap/envelope/'); @@ -377,8 +468,13 @@ private function _XML2Array($xml) return $item; } } + return null; } - + /** + * @param $xml + * + * @return string + */ private function _XMLFault2String($xml) { $dom = new DOMDocument(); diff --git a/lib/src/Services/Gateway/HpsTokenService.php b/lib/src/Services/Gateway/HpsTokenService.php index a72c5dc..bcc0569 100644 --- a/lib/src/Services/Gateway/HpsTokenService.php +++ b/lib/src/Services/Gateway/HpsTokenService.php @@ -1,10 +1,17 @@ _config = new HpsServicesConfig(); @@ -17,7 +24,13 @@ public function __construct($publicAPIKey) $this->_url = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway.Hpf.v1/api/token"; } } - + /** + * @param \HpsCreditCard $cardData + * + * @return mixed + * @throws \HpsAuthenticationException + * @throws \HpsGatewayException + */ public function getToken(HpsCreditCard $cardData) { $data = array(); @@ -35,7 +48,14 @@ public function getToken(HpsCreditCard $cardData) return $this->submitRequest($url, $header, null, 'GET', HpsServicesConfig::KEY_TYPE_PUBLIC); } - + /** + * @param $curlResponse + * @param $curlInfo + * @param $curlError + * + * @return mixed + * @throws \HpsException + */ protected function processResponse($curlResponse, $curlInfo, $curlError) { $response = json_decode($curlResponse); @@ -46,7 +66,9 @@ protected function processResponse($curlResponse, $curlInfo, $curlError) return $response; } - + /** + * @return bool + */ protected function _isConfigInvalid() { return $this->_config->publicApiKey == null || $this->_url == null; diff --git a/lib/src/Services/Gateway/PayPlan/HpsPayPlanCustomerService.php b/lib/src/Services/Gateway/PayPlan/HpsPayPlanCustomerService.php index e511c26..6d7618f 100644 --- a/lib/src/Services/Gateway/PayPlan/HpsPayPlanCustomerService.php +++ b/lib/src/Services/Gateway/PayPlan/HpsPayPlanCustomerService.php @@ -1,7 +1,15 @@ getEditableFieldsWithValues(); @@ -11,7 +19,11 @@ public function add(HpsPayPlanCustomer $customer) )); return $this->hydrateObject($result, 'HpsPayPlanCustomer'); } - + /** + * @param \HpsPayPlanCustomer $customer + * + * @return mixed + */ public function edit(HpsPayPlanCustomer $customer) { $data = $customer->getEditableFieldsWithValues(); @@ -21,7 +33,11 @@ public function edit(HpsPayPlanCustomer $customer) )); return $this->hydrateObject($result, 'HpsPayPlanCustomer'); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAll($searchFields = array()) { // Cannot have an array as the root object @@ -35,7 +51,11 @@ public function findAll($searchFields = array()) return $this->hydrateSearchResults($results, 'HpsPayPlanCustomer'); } - + /** + * @param $customer + * + * @return mixed + */ public function get($customer) { $id = null; @@ -50,7 +70,12 @@ public function get($customer) )); return $this->hydrateObject($result, 'HpsPayPlanCustomer'); } - + /** + * @param $customer + * @param bool $forceDelete + * + * @return mixed + */ public function delete($customer, $forceDelete = false) { $id = null; diff --git a/lib/src/Services/Gateway/PayPlan/HpsPayPlanPaymentMethodService.php b/lib/src/Services/Gateway/PayPlan/HpsPayPlanPaymentMethodService.php index 7dd7d2d..2cadf03 100644 --- a/lib/src/Services/Gateway/PayPlan/HpsPayPlanPaymentMethodService.php +++ b/lib/src/Services/Gateway/PayPlan/HpsPayPlanPaymentMethodService.php @@ -1,7 +1,15 @@ hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ public function edit(HpsPayPlanPaymentMethod $paymentMethod) { $result = null; @@ -23,7 +35,11 @@ public function edit(HpsPayPlanPaymentMethod $paymentMethod) } return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAll($searchFields = array()) { // Cannot have an array as the root object @@ -37,7 +53,11 @@ public function findAll($searchFields = array()) return $this->hydrateSearchResults($results, 'HpsPayPlanPaymentMethod'); } - + /** + * @param $paymentMethod + * + * @return mixed + */ public function get($paymentMethod) { $id = null; @@ -52,7 +72,12 @@ public function get($paymentMethod) )); return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param $paymentMethod + * @param bool $forceDelete + * + * @return mixed + */ public function delete($paymentMethod, $forceDelete = false) { $id = null; @@ -70,7 +95,11 @@ public function delete($paymentMethod, $forceDelete = false) 'endpoint' => 'paymentMethods/'.$id, )); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ private function addCreditCard(HpsPayPlanPaymentMethod $paymentMethod) { $data = $paymentMethod->getEditableFieldsWithValues(); @@ -86,7 +115,11 @@ private function addCreditCard(HpsPayPlanPaymentMethod $paymentMethod) )); return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ private function editCreditCard(HpsPayPlanPaymentMethod $paymentMethod) { $data = $paymentMethod->getEditableFieldsWithValues(); @@ -96,7 +129,11 @@ private function editCreditCard(HpsPayPlanPaymentMethod $paymentMethod) )); return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ private function addACH(HpsPayPlanPaymentMethod $paymentMethod) { $data = $paymentMethod->getEditableFieldsWithValues(); @@ -111,7 +148,11 @@ private function addACH(HpsPayPlanPaymentMethod $paymentMethod) )); return $this->hydrateObject($result, 'HpsPayPlanPaymentMethod'); } - + /** + * @param \HpsPayPlanPaymentMethod $paymentMethod + * + * @return mixed + */ private function editACH(HpsPayPlanPaymentMethod $paymentMethod) { $data = $paymentMethod->getEditableFieldsWithValues(); diff --git a/lib/src/Services/Gateway/PayPlan/HpsPayPlanScheduleService.php b/lib/src/Services/Gateway/PayPlan/HpsPayPlanScheduleService.php index 11b9283..cb05c0e 100644 --- a/lib/src/Services/Gateway/PayPlan/HpsPayPlanScheduleService.php +++ b/lib/src/Services/Gateway/PayPlan/HpsPayPlanScheduleService.php @@ -1,8 +1,15 @@ getEditableFieldsWithValues(); @@ -14,6 +21,11 @@ public function add(HpsPayPlanSchedule $schedule) )); return $this->hydrateObject($result, 'HpsPayPlanSchedule'); } + /** + * @param \HpsPayPlanSchedule $schedule + * + * @return mixed + */ public function edit(HpsPayPlanSchedule $schedule) { $data = $schedule->getEditableFieldsWithValues( $schedule ); @@ -23,7 +35,11 @@ public function edit(HpsPayPlanSchedule $schedule) )); return $this->hydrateObject($result, 'HpsPayPlanSchedule'); } - + /** + * @param array $searchFields + * + * @return object + */ public function findAll($searchFields = array()) { // Cannot have an array as the root object @@ -36,6 +52,11 @@ public function findAll($searchFields = array()) )); return $this->hydrateSearchResults($results, 'HpsPayPlanSchedule'); } + /** + * @param $schedule + * + * @return mixed + */ public function get($schedule) { $id = null; @@ -50,6 +71,12 @@ public function get($schedule) )); return $this->hydrateObject($result, 'HpsPayPlanSchedule'); } + /** + * @param $schedule + * @param bool $forceDelete + * + * @return mixed + */ public function delete($schedule, $forceDelete = false) { $id = null; diff --git a/lib/src/Services/HpsCentinelConfig.php b/lib/src/Services/HpsCentinelConfig.php index fd552a2..6fbdc2f 100644 --- a/lib/src/Services/HpsCentinelConfig.php +++ b/lib/src/Services/HpsCentinelConfig.php @@ -1,5 +1,8 @@ serviceUri; } - + /** + * @param $value + * + * @return mixed|void + */ public function setServiceUri($value) { $this->serviceUri = $value; } - + /** + * @param $keyType + * + * @return bool + */ public function validate($keyType) { return true; diff --git a/lib/src/Services/HpsServicesConfig.php b/lib/src/Services/HpsServicesConfig.php index 2cefcf7..212b2c6 100644 --- a/lib/src/Services/HpsServicesConfig.php +++ b/lib/src/Services/HpsServicesConfig.php @@ -1,5 +1,8 @@ soapServiceUri; } - + /** + * @param $value + * + * @return mixed|void + */ public function setServiceUri($value) { $this->soapServiceUri = $value; } - + /** + * @param $keyType + * + * @return bool + */ public function validate($keyType) { return ($keyType == self::KEY_TYPE_PUBLIC && $this->validatePublicApiKey()) || ($keyType == self::KEY_TYPE_SECRET && $this->validateSecretApiKey()); } - + /** + * @param $keyType + * + * @return string + */ public function getKeyType($keyType) { $key = trim($keyType == self::KEY_TYPE_SECRET ? $this->secretApiKey : $this->publicApiKey); @@ -50,14 +67,18 @@ public function getKeyType($keyType) break; } } - + /** + * @return bool + */ protected function validateSecretApiKey() { return is_string($this->secretApiKey) && $this->getKeyType(self::KEY_TYPE_SECRET) == self::KEY_TYPE_SECRET && strlen($this->secretApiKey) >= 48; } - + /** + * @return bool + */ protected function validatePublicApiKey() { return is_string($this->publicApiKey) From 15d3fd6a139e7dc9a53b4d52afe68ec8ce1de41b Mon Sep 17 00:00:00 2001 From: "charles.simmons" Date: Fri, 24 Feb 2017 17:48:36 -0500 Subject: [PATCH 7/7] some hotfixes --- SecureSubmit.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SecureSubmit.php b/SecureSubmit.php index 4bfba87..dc9abfb 100644 --- a/SecureSubmit.php +++ b/SecureSubmit.php @@ -2024,7 +2024,10 @@ function jal_install(){ global $jal_db_version; global $table_name; - $installed_ver = $this->options['jal_db_version']; + $installed_ver = null; + if (is_array($this->options) && in_array('jal_db_version',$this->options)) { + $installed_ver = $this->options['jal_db_version']; + } if($installed_ver != $jal_db_version){ $sql = "CREATE TABLE $table_name (