From 2c07f3f63421626d2a0d96314abd67f5de6b081b Mon Sep 17 00:00:00 2001 From: securesubmit-buildmaster Date: Tue, 26 Jan 2021 08:41:20 -0500 Subject: [PATCH] 20210126 deployment --- examples/consumer-authentication/cruise.php | 7 +- examples/echeck/index.html | 2 +- examples/echeck/process.php | 9 +- .../end-to-end/assets/heartland-styles.css | 167 ----------- examples/end-to-end/charge.php | 18 +- examples/end-to-end/index.html | 272 +++--------------- examples/gift/charge.php | 9 +- examples/iframe-pay-invoice/assets/main.js | 231 ++------------- examples/iframe-pay-invoice/charge.php | 10 +- examples/iframe-pay-invoice/index.html | 56 +--- examples/iframe-recurring-signup/charge.php | 8 +- examples/manual-tokenize/charge.php | 6 +- examples/pay-invoice/charge.php | 6 +- examples/point-of-sale/e3-swipe/charge.php | 6 +- examples/recurring-signup-ach/charge.php | 7 +- src/Utils/CardUtils.php | 2 +- 16 files changed, 114 insertions(+), 702 deletions(-) delete mode 100644 examples/end-to-end/assets/heartland-styles.css diff --git a/examples/consumer-authentication/cruise.php b/examples/consumer-authentication/cruise.php index 625ff584..bafa35b2 100644 --- a/examples/consumer-authentication/cruise.php +++ b/examples/consumer-authentication/cruise.php @@ -3,9 +3,9 @@ require 'JWT.php'; use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\EcommerceInfo; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); @@ -19,11 +19,10 @@ print_r($_GET); print ''; - $config = new ServicesConfig(); + $config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MT2PAQB-9VQA5Z1mOXQbzZcH6O5PpdhjWtFhMBoL4A'; - $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; - ServicesContainer::configure($config); + ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['heartlandToken']; diff --git a/examples/echeck/index.html b/examples/echeck/index.html index 242dff1b..97d10e69 100644 --- a/examples/echeck/index.html +++ b/examples/echeck/index.html @@ -107,7 +107,7 @@

Payment Information

Check Information

- +
diff --git a/examples/echeck/process.php b/examples/echeck/process.php index 7e646adc..828fcf18 100644 --- a/examples/echeck/process.php +++ b/examples/echeck/process.php @@ -3,24 +3,21 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\Entities\Address; -use GlobalPayments\Api\Entities\Enums\AccountType; -use GlobalPayments\Api\Entities\Enums\CheckType; use GlobalPayments\Api\Entities\Enums\EntryMethod; use GlobalPayments\Api\Entities\Enums\SecCode; use GlobalPayments\Api\PaymentMethods\ECheck; -use GlobalPayments\Api\ServicesConfig; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; use GlobalPayments\Api\ServicesContainer; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; -$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; $config->versionNumber = '0000'; $config->developerId = '000000'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $address = new Address(); $address->address = $_POST['holder_address_address']; diff --git a/examples/end-to-end/assets/heartland-styles.css b/examples/end-to-end/assets/heartland-styles.css deleted file mode 100644 index 63bdcb47..00000000 --- a/examples/end-to-end/assets/heartland-styles.css +++ /dev/null @@ -1,167 +0,0 @@ -body { - font-family: sans-serif; -} - -iframe { - width:100%; - float: left; -} -.form-group { - height: 40px; -} -h2 { - margin: 7px 0; -} -#ss-card, -#ss-date, -#ss-cvv { - height: 85px; -} -#ss-card { - margin-bottom: 55px; - display: block; -} -#ss-date { - float: left; - display: block; -} -#ss-cvv.form-group { - float: right; -} -.iframeholder { - width:100%; -} -.ie8 form .iframeholder { - padding: 10px; -} -.iframeholder::after { - content: ''; - display: block; - width: 100%; - height: 0px; - clear: both; - position: relative; -} -.ie8 form .form-group { - margin-bottom: 5px; -} -textarea { - padding: 10px; - font-family: sans-serif; -} -label[for=iframesCardNumber], -label[for=iframesCardExpiration], -label[for=iframesCardCvv] { - text-transform: uppercase; - font-weight: 500; - font-size: 13px; - color: #555; - line-height: 1.5; -} -.ie8 form label { - padding-left: 10px; - margin: 0px; -} -#heartland-frame-cardExpiration, -#heartland-frame-cardCvv, -#heartland-frame-cardNumber, -.ie8 #heartland-frame-cardExpiration, -.ie8 #heartland-frame-cardCvv, -.ie8 #heartland-frame-cardNumber { - width: 100%; -} -iframe { - margin: 0; - padding: 0; - border: none; - width: value; - height: value; -} -#ss-banner { - background: transparent url(images/ss-shield@2x.png) no-repeat left center; - height: 40px; - background-size: 280px 34px; - margin-bottom: 7px; -} -.ie8 #ss-banner { - background: transparent url(images/ss-shield-ie.png) no-repeat left center; -} -.btn-primary { - display: block; - border-radius: 0px; - font-size: 18px; - float: right; - background-color: #36b46e; - border: 1px solid #2a8d56; - margin-bottom: 10px; - height: 50px; - color: #ffffff; - width: 100%; -} -.btn-primary:hover, -.btn-primary:focus { - color: #fff; - background-color: #2a8d56; -} -.ie8 .btn-primary { - width: 15%; -} -.red { - color: #ce2027; - margin-left: 2px; - font-size: 17px; -} -.container { - margin: 5px; -} -#ss-date.form-group, -#ss-cvv.form-group { - width: 100%; -} -@media screen and (min-width: 767px) { - #heartland-frame-cardNumber { - width: 100%; - } -} -@media screen and (min-width: 696px) { - #ss-date.form-group, - #ss-cvv.form-group { - width: 48%; - } -} -@media screen and (min-width: 636px) { - #ss-card { - margin-bottom: 40px; - } -} -@media screen and (min-width: 450px) { - .btn-primary, - .ie8 .btn-primary { - width: 10em; - } - .container { - margin: 20px; - } -} - -#ss-banner { - background: transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-shield@2x.png?raw=true) no-repeat left center; - height: 40px; - background-size: 280px 34px; - margin-bottom: 7px; -} - -user agent stylesheet -div { - display: block; -} - -.form-row { - margin-top: 10px; -} - -.form-wrapper { - display: block; - width: 300px; - margin: 10px auto; -} \ No newline at end of file diff --git a/examples/end-to-end/charge.php b/examples/end-to-end/charge.php index 842dd5be..4adecd39 100644 --- a/examples/end-to-end/charge.php +++ b/examples/end-to-end/charge.php @@ -3,18 +3,16 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; -$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; - -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['token_value']; @@ -28,10 +26,12 @@ try { $response = $card->charge(15) - ->withCurrency('USD') - ->withAddress($address) - ->withAllowDuplicates(true) - ->execute(); + ->withCurrency('USD') + ->withAddress($address) + ->withAllowDuplicates(true) + ->execute(); + + // print_r($response); $body = '

Success!

'; $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $15.

'; diff --git a/examples/end-to-end/index.html b/examples/end-to-end/index.html index 2ac51650..29d3ffee 100644 --- a/examples/end-to-end/index.html +++ b/examples/end-to-end/index.html @@ -4,18 +4,18 @@ - + - + Simple Payment Form Demo - + @@ -128,246 +128,44 @@

PHP SecureSubmit Example

Card Information

-
-
- -
- -
- -
-
- -
- -
-
- -
- -
-
- -
-
- -
- -
+
- +
- - diff --git a/examples/gift/charge.php b/examples/gift/charge.php index de9ed97e..41a008ae 100644 --- a/examples/gift/charge.php +++ b/examples/gift/charge.php @@ -3,18 +3,17 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\GiftCard; -use GlobalPayments\Api\ServicesConfig; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; use GlobalPayments\Api\ServicesContainer; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; -$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); try { $card = new GiftCard(); @@ -29,5 +28,3 @@ } catch (Exception $e) { echo $e->getMessage(); } - - diff --git a/examples/iframe-pay-invoice/assets/main.js b/examples/iframe-pay-invoice/assets/main.js index c3857aae..d289d503 100644 --- a/examples/iframe-pay-invoice/assets/main.js +++ b/examples/iframe-pay-invoice/assets/main.js @@ -1,206 +1,27 @@ -(function (document, Heartland) { - // Create a new `HPS` object with the necessary configuration - var hps = new Heartland.HPS({ - publicKey: 'pkapi_cert_P6dRqs1LzfWJ6HgGVZ', - type: 'iframe', - // Configure the iframe fields to tell the library where - // the iframe should be inserted into the DOM and some - // basic options - fields: { - cardNumber: { - target: 'iframesCardNumber', - placeholder: '•••• •••• •••• ••••' - }, - cardExpiration: { - target: 'iframesCardExpiration', - placeholder: 'MM / YYYY' - }, - cardCvv: { - target: 'iframesCardCvv', - placeholder: 'CVV' - }, - submit: { - target: 'iframesSubmit' - } - }, - // Collection of CSS to inject into the iframes. - // These properties can match the site's styles - // to create a seamless experience. - style: { - 'input': { - 'background': '#fff', - 'border': '1px solid', - 'border-color': '#bbb3b9 #c7c1c6 #c7c1c6', - 'box-sizing': 'border-box', - 'font-family': 'serif', - 'font-size': '16px', - 'line-height': '1', - 'margin': '0 .5em 0 0', - 'max-width': '100%', - 'outline': '0', - 'padding': '0.5278em', - 'vertical-align': 'baseline', - 'height': '50px', - 'width': '100% !important' - }, - '#heartland-field': { - 'font-family': 'sans-serif', - 'box-sizing': 'border-box', - 'display': 'block', - 'height': '50px', - 'padding': '6px 12px', - 'font-size': '14px', - 'line-height': '1.42857143', - 'color': '#555', - 'background-color': '#fff', - 'border': '1px solid #ccc', - 'border-radius': '0px', - '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', - 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)', - '-webkit-transition': 'border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s', - '-o-transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', - 'transition': 'border-color ease-in-out .15s,box-shadow ease-in-out .15s', - 'width': '100%' - }, - '#heartland-field[name=submit]': { - 'background-color': '#36b46e', - 'font-family': 'sans-serif', - 'text-transform': 'uppercase', - 'color': '#ffffff', - 'border': '0px solid transparent' - }, - '#heartland-field[name=submit]:focus': { - 'color': '#ffffff', - 'background-color': '#258851', - 'outline': 'none' - }, - '#heartland-field[name=submit]:hover': { - 'background-color': '#258851' - }, - '#heartland-field-wrapper #heartland-field:focus': { - 'border': '1px solid #3989e3', - 'outline': 'none', - 'box-shadow': 'none', - 'height': '50px' - }, - 'heartland-field-wrapper #heartland-field': { - 'height': '50px' - }, - 'input[type=submit]': { - 'box-sizing': 'border-box', - 'display': 'inline-block', - 'padding': '6px 12px', - 'margin-bottom': '0', - 'font-size': '14px', - 'font-weight': '400', - 'line-height': '1.42857143', - 'text-align': 'center', - 'white-space': 'nowrap', - 'vertical-align': 'middle', - '-ms-touch-action': 'manipulation', - 'touch-action': 'manipulation', - 'cursor': 'pointer', - '-webkit-user-select': 'none', - '-moz-user-select': 'none', - '-ms-user-select': 'none', - 'user-select': 'none', - 'background-image': 'none', - 'border': '1px solid transparent', - 'border-radius': '4px', - 'color': '#fff', - 'background-color': '#337ab7', - 'border-color': '#2e6da4' - }, - '#heartland-field[placeholder]': { - 'letter-spacing': '3px' - }, - '#heartland-field[name=cardCvv]': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/cvv1.png?raw=true) no-repeat right', - 'background-size': '63px 40px', - }, - 'input#heartland-field[name=cardNumber]': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-inputcard-blank@2x.png?raw=true) no-repeat right', - 'background-size': '55px 35px'}, - '#heartland-field.invalid.card-type-visa': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right', - 'background-size': '83px 88px', - 'background-position-y': '-44px' - }, - '#heartland-field.valid.card-type-visa': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-visa@2x.png?raw=true) no-repeat right top', - 'background-size': '82px 86px' - }, - '#heartland-field.invalid.card-type-discover': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', - 'background-size': '85px 90px', - 'background-position-y': '-44px' - }, - '#heartland-field.valid.card-type-discover': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-discover@2x.png?raw=true) no-repeat right', - 'background-size': '85px 90px', - 'background-position-y': '1px' - }, - '#heartland-field.invalid.card-type-amex': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right', - 'background-size': '50px 90px', - 'background-position-y': '-44px' - }, - '#heartland-field.valid.card-type-amex': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-savedcards-amex@2x.png?raw=true) no-repeat right top', - 'background-size': '50px 90px' - }, - '#heartland-field.invalid.card-type-mastercard': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', - 'background-size': '62px 105px', - 'background-position-y': '-52px' - }, - '#heartland-field.valid.card-type-mastercard': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-mastercard.png?raw=true) no-repeat right', - 'background-size': '62px 105px', - 'background-position-y': '-1px' - }, - '#heartland-field.invalid.card-type-jcb': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right', - 'background-size': '55px 94px', - 'background-position-y': '-44px' - }, - '#heartland-field.valid.card-type-jcb': { - 'background': 'transparent url(https://github.com/hps/heartland-php/blob/master/examples/end-to-end/assets/images/ss-saved-jcb@2x.png?raw=true) no-repeat right top', - 'background-size': '55px 94px', - 'background-position-y': '2px' - }, - 'input#heartland-field[name=cardNumber]::-ms-clear': { - 'display': 'none' - } - }, - // Callback when a token is received from the service - onTokenSuccess: function (resp) { - document.querySelector("input[name=token_value]").value = resp.token_value; - Heartland.Events.removeHandler(document.getElementById('payment_form'), 'submit'); - document.getElementById('payment_form').submit(); - }, - // Callback when an error is received from the service - onTokenError: function (resp) { - alert('There was an error: ' + resp.error.message); - }, - // Callback when an event is fired within an iFrame - onEvent: function (ev) { - console.log(ev); - } - }); +// Configure account +GlobalPayments.configure({ + publicApiKey: "pkapi_cert_P6dRqs1LzfWJ6HgGVZ" +}); - // Attach a handler to interrupt the form submission - Heartland.Events.addHandler(document.getElementById('iframes'), 'submit', function (e) { - // Prevent the form from continuing to the `action` address - e.preventDefault(); - // Tell the iframes to tokenize the data - hps.Messages.post( - { - accumulateData: true, - action: 'tokenize', - message: 'pkapi_cert_jKc1FtuyAydZhZfbB3' - }, - 'cardNumber' - ); - }); -}(document, Heartland)); \ No newline at end of file +// Create Form +const cardForm = GlobalPayments.creditCard.form("#credit-card", { style: "blank" }); + +// form-level event handlers. examples: +cardForm.ready(() => { + console.log("Registration of all credit card fields occurred"); +}); + +cardForm.on("token-success", (resp) => { + document.querySelector("input[name=token_value]").value = resp.paymentReference; + document.querySelector("input[name=cardholder_name]").value = resp.details.cardholderName; + document.getElementById('payment_form').submit(); +}); + +cardForm.on("token-error", (resp) => { +// show error to the consumer +}); + +// field-level event handlers. example: +cardForm.on("card-number", "register", () => { + console.log("Registration of Card Number occurred"); +}); \ No newline at end of file diff --git a/examples/iframe-pay-invoice/charge.php b/examples/iframe-pay-invoice/charge.php index a75b2a30..be794db2 100644 --- a/examples/iframe-pay-invoice/charge.php +++ b/examples/iframe-pay-invoice/charge.php @@ -3,18 +3,17 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; -$config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['token_value']; @@ -26,7 +25,6 @@ $address->postalCode = preg_replace('/[^0-9]/', '', $_GET["Zip"]); $address->country = "United States"; - try { $response = $card->charge(15) ->withCurrency('USD') @@ -35,7 +33,7 @@ ->execute(); $body = '

Success!

'; - $body .= '

Thank you, ' . $_GET['FirstName'] . ', for your order of $' . $_GET["payment_amount"] . '.

'; + $body .= '

Thank you, ' . $_GET['cardholder_name'] . ', for your order of $' . $_GET["payment_amount"] . '.

'; echo "Transaction Success!
Transaction Id: " . $response->transactionId; echo "
Invoice Number: " . $_GET["invoice_number"]; diff --git a/examples/iframe-pay-invoice/index.html b/examples/iframe-pay-invoice/index.html index 21aaa8fd..15e6f014 100644 --- a/examples/iframe-pay-invoice/index.html +++ b/examples/iframe-pay-invoice/index.html @@ -1,10 +1,11 @@ + - + Simple Payment Form Demo @@ -13,46 +14,34 @@

PHP SecureSubmit Example

Billing Information

-
- -
- -
-
-
- -
- -
-
- +
- +
- +
- +
- @@ -110,10 +99,9 @@

Billing Information

- +
-

Payment Information

@@ -127,42 +115,22 @@

Payment Information

-

Card Information

- -
- -
-
- -
- -
-
- -
- -
-
-
-
+
- -
- +
- - + - + \ No newline at end of file diff --git a/examples/iframe-recurring-signup/charge.php b/examples/iframe-recurring-signup/charge.php index 6c0ffe66..80b9d8bb 100644 --- a/examples/iframe-recurring-signup/charge.php +++ b/examples/iframe-recurring-signup/charge.php @@ -2,7 +2,6 @@ require_once ('../../vendor/autoload.php'); -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; use GlobalPayments\Api\Entities\Customer; @@ -10,12 +9,13 @@ use GlobalPayments\Api\Entities\Enums\PaymentSchedule; use GlobalPayments\Api\PaymentMethods\CreditCardData; use GlobalPayments\Api\Entities\Enums\ScheduleFrequency; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); @@ -80,7 +80,7 @@ function createSchedule($customerKey, $paymentMethodKey, $amount) { $schedule->paymentKey = $paymentMethodKey; $schedule->amount = $amount; $schedule->currency = 'USD'; - $schedule->startDate = date('mdY', strtotime("last day of next month")); + $schedule->startDate = new DateTime("last day of +1 month"); $schedule->paymentSchedule = PaymentSchedule::LAST_DAY_OF_THE_MONTH; //or PaymentSchedule::FIRST_DAY_OF_THE_MONTH $schedule->frequency = ScheduleFrequency::MONTHLY; //'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually' //$schedule->duration = HpsPayPlanScheduleDuration::ONGOING; diff --git a/examples/manual-tokenize/charge.php b/examples/manual-tokenize/charge.php index 35e5e6df..31517720 100644 --- a/examples/manual-tokenize/charge.php +++ b/examples/manual-tokenize/charge.php @@ -3,18 +3,18 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['token_value']; diff --git a/examples/pay-invoice/charge.php b/examples/pay-invoice/charge.php index add3c51f..b7887ea0 100644 --- a/examples/pay-invoice/charge.php +++ b/examples/pay-invoice/charge.php @@ -3,18 +3,18 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['token_value']; diff --git a/examples/point-of-sale/e3-swipe/charge.php b/examples/point-of-sale/e3-swipe/charge.php index 3072fc9f..10052a49 100644 --- a/examples/point-of-sale/e3-swipe/charge.php +++ b/examples/point-of-sale/e3-swipe/charge.php @@ -2,18 +2,18 @@ require_once ('../../vendor/autoload.php'); use GlobalPayments\Api\PaymentMethods\CreditCardData; -use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $card = new CreditCardData(); $card->token = $_GET['securesubmit_token']; diff --git a/examples/recurring-signup-ach/charge.php b/examples/recurring-signup-ach/charge.php index e76855ec..8c56354a 100644 --- a/examples/recurring-signup-ach/charge.php +++ b/examples/recurring-signup-ach/charge.php @@ -13,6 +13,7 @@ use GlobalPayments\Api\PaymentMethods\ECheck; use GlobalPayments\Api\Entities\Enums\ScheduleFrequency; use GlobalPayments\Api\Entities\Enums\PaymentSchedule; +use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig; function SendEmail($to, $from, $subject, $body, $isHtml) { $message = ''; @@ -79,7 +80,7 @@ function createSchedule($customerKey, $paymentMethodKey, $amount) { $schedule->paymentKey = $paymentMethodKey; $schedule->amount = $amount; $schedule->currency = 'USD'; - $schedule->startDate = date('mdY', strtotime("last day of next month")); + $schedule->startDate = new DateTime('last day of +1 month'); $schedule->paymentSchedule = PaymentSchedule::LAST_DAY_OF_THE_MONTH; //or PaymentSchedule::FIRST_DAY_OF_THE_MONTH $schedule->frequency = ScheduleFrequency::MONTHLY; //'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually' //$schedule->duration = HpsPayPlanScheduleDuration::ONGOING; @@ -92,11 +93,11 @@ function createSchedule($customerKey, $paymentMethodKey, $amount) { return $response; } -$config = new ServicesConfig(); +$config = new PorticoConfig(); $config->secretApiKey = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'; $config->serviceUrl = 'https://cert.api2.heartlandportico.com'; -ServicesContainer::configure($config); +ServicesContainer::configureService($config); $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); diff --git a/src/Utils/CardUtils.php b/src/Utils/CardUtils.php index 64207dbd..6f40d05d 100644 --- a/src/Utils/CardUtils.php +++ b/src/Utils/CardUtils.php @@ -50,7 +50,7 @@ class CardUtils 'EnRoute' => '/^2(014|149)/', 'Discover' => '/^6([045]|22)/', 'Jcb' => '/^35/', - "Wex" => "^(?:690046|707138)", + 'Wex' => '/^(?:690046|707138)/', ]; public static function parseTrackData($paymentMethod)