Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfixes #47

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions SecureSubmit.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ function shortcode($atts) {
var <?php echo $prefix; ?>_card_html = "<div id='<?php echo $prefix; ?>_card_panel'>";
<?php echo $prefix; ?>_card_html += "<div class='back-button'><a href='#shipping' id='<?php echo $prefix; ?>_card_back'>back</a></div>";
<?php echo $prefix; ?>_card_html += "<div class='checkout-card-information'>Card Information</div>";
<?php echo $prefix; ?>_card_html += "<div class='card-number'><input type='text' id='card_number' class='checkout-input checkout-card required' placeholder='4111 - 1111 - 1111 - 1111'></div>";
<?php echo $prefix; ?>_card_html += "<div class='card-number'><input type='text' id='card_number' class='checkout-input checkout-card required' placeholder='Credit Card'></div>";
<?php echo $prefix; ?>_card_html += "<div class='card-exp'><input type='text' id='card_exp' class='checkout-exp required' placeholder='MM/YY'></div>";
<?php echo $prefix; ?>_card_html += "<div class='card-cvc'><input type='text' id='card_cvc' class='checkout-exp' placeholder='CVC'></div>";
<?php echo $prefix; ?>_card_html += "<div class='clearfixcheckout'>&nbsp;</div>";
Expand Down Expand Up @@ -974,10 +974,12 @@ 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') {
var thisEle = jQuery(this);
alert('Please complete all required fields before proceeding.');
continueProcessing = false;
thisEle.focus();
return;
}
});
Expand Down Expand Up @@ -2022,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 (
Expand Down
50 changes: 25 additions & 25 deletions js/secure.submit.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -31,34 +31,34 @@
if(response.message) {
alert(response.message);
} else {
$('#' . prefix . 'securesubmit_token').val(response.token_value);
$('#' + prefix + 'securesubmit_token').val(response.token_value);
chargeToken();
}
}

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)
Expand All @@ -68,7 +68,7 @@
}
else
{
$('#' . prefix . '-donate-response').html(response);
$('#' + prefix + '-donate-response').html(response);
$('#securesubmit-button').show();
}
});
Expand Down
13 changes: 9 additions & 4 deletions lib/src/Abstractions/HpsBuilderAbstract.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class HpsBuilderAbstract
*/
abstract class HpsBuilderAbstract
{
/** @var array(HpsBuilderAction) */
Expand All @@ -11,11 +14,11 @@ abstract class HpsBuilderAbstract
/** @var array(callable) */
public $validations = array();

/** @var HpsRestGatewayService */
/** @var HpsGatewayServiceAbstract|HpsSoapGatewayService|HpsRestGatewayService|HpsFluentCreditService */
protected $service = null;

/**
* @param HpsGatewayServiceAbstract $service
* @param HpsGatewayServiceAbstract|HpsSoapGatewayService|HpsRestGatewayService $service
*
* @return HpsBuilderAbstract
*/
Expand All @@ -36,9 +39,10 @@ public function execute()
$this->executed = true;
return $this;
}

/**
* @return HpsBuilderAbstract
* @param $action
*
* @return \HpsBuilderAbstract
*/
public function addAction($action)
{
Expand Down Expand Up @@ -151,6 +155,7 @@ private function setPropertyIfExists($property, $value)
} else {
throw new HpsUnknownPropertyException($this, $property);
}
return $this;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions lib/src/Abstractions/HpsConfigInterface.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
<?php

/**
* Interface HpsConfigInterface
*/
interface HpsConfigInterface
{
const KEY_TYPE_SECRET = 'secret';
const KEY_TYPE_PUBLIC = 'public';
const KEY_TYPE_UNKNOWN = 'unknown';
public function serviceUri();
/**
* @param $value
*
* @return mixed
*/
public function setServiceUri($value);
/**
* @param $keyType
*
* @return mixed
*/
public function validate($keyType);
}
34 changes: 29 additions & 5 deletions lib/src/Abstractions/HpsGatewayServiceAbstract.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class HpsGatewayServiceAbstract
*/
abstract class HpsGatewayServiceAbstract
{
protected $_config = null;
Expand All @@ -9,24 +12,43 @@ abstract class HpsGatewayServiceAbstract
protected $_currency = null;
protected $_filterBy = null;
const MIN_OPENSSL_VER = 268439615; //OPENSSL_VERSION_NUMBER openSSL 1.0.1c

/**
* HpsGatewayServiceAbstract constructor.
*
* @param \HpsConfigInterface|null $config
*/
public function __construct(HpsConfigInterface $config = null)
{
if ($config != null) {
$this->_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()) {
Expand Down Expand Up @@ -113,7 +135,9 @@ protected function submitRequest($url, $headers, $data = null, $httpVerb = 'POST
);
}
}

/**
* @return bool
*/
protected function _isConfigInvalid()
{
if ($this->_config == null && (
Expand Down
16 changes: 16 additions & 0 deletions lib/src/Abstractions/HpsGatewayServiceInterface.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
<?php

/**
* Interface HpsGatewayServiceInterface
*/
interface HpsGatewayServiceInterface
{
/**
* @param $data
* @param array $options
*
* @return mixed
*/
public function doRequest($data, $options = array());
/**
* @param $curlResponse
* @param $curlInfo
* @param $curlError
*
* @return mixed
*/
public function processResponse($curlResponse, $curlInfo, $curlError);
}
9 changes: 9 additions & 0 deletions lib/src/Abstractions/HpsLoggerInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php

/**
* Interface HpsLoggerInterface
*/
interface HpsLoggerInterface
{
/**
* @param $message
* @param null $object
*
* @return mixed
*/
public function log($message, $object = null);
}
16 changes: 14 additions & 2 deletions lib/src/Abstractions/HpsPayPlanResourceAbstract.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class HpsPayPlanResourceAbstract
*/
abstract class HpsPayPlanResourceAbstract implements HpsPayPlanResourceInterface
{
/** @var string|null */
Expand All @@ -10,12 +13,21 @@ abstract class HpsPayPlanResourceAbstract implements HpsPayPlanResourceInterface

/** @var string|null */
public $lastChangeDate = null;

/**
* @param $value
*
* @return bool
*/
protected function isNotNullOrEmpty($value)
{
return $value !== null && !empty($value);
}

/**
* @param $class
* @param array $params
*
* @return array
*/
public function getEditableFieldsWithValues($class, $params = array())
{
$array = array_intersect_key(
Expand Down
3 changes: 3 additions & 0 deletions lib/src/Abstractions/HpsPayPlanResourceInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Interface HpsPayPlanResourceInterface
*/
interface HpsPayPlanResourceInterface
{
public static function getEditableFields();
Expand Down
3 changes: 3 additions & 0 deletions lib/src/Entities/AltPayment/HpsAltPaymentAddToBatch.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

/**
* Class HpsAltPaymentAddToBatch
*/
class HpsAltPaymentAddToBatch extends HpsAuthorization
{
}
11 changes: 10 additions & 1 deletion lib/src/Entities/AltPayment/HpsAltPaymentAuth.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<?php

/**
* Class HpsAltPaymentAuth
*/
class HpsAltPaymentAuth extends HpsAltPaymentResponse
{
public $status = null;
public $statusMessage = null;

/**
* @param $rsp
* @param $txnType
* @param string $returnType
*
* @return mixed
*/
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentAuth')
{
$authorize = $rsp->Transaction->$txnType;
Expand Down
11 changes: 10 additions & 1 deletion lib/src/Entities/AltPayment/HpsAltPaymentCapture.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<?php

/**
* Class HpsAltPaymentCapture
*/
class HpsAltPaymentCapture extends HpsAltPaymentResponse
{
public $status = null;
public $statusMessage = null;

/**
* @param $rsp
* @param $txnType
* @param string $returnType
*
* @return mixed
*/
public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentCapture')
{
$addToBatch = $rsp->Transaction->$txnType;
Expand Down
Loading