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

Feature/escape html for order items #119

Open
wants to merge 12 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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ deploy:
tags: true

after_deploy:
- cd ..
- bash ./scripts/deploy_to_wp_svn.sh

script: skip
6 changes: 4 additions & 2 deletions scripts/deploy_to_wp_svn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ $error == 0 ]; then
echo "Tag already exists for version $VERSION, aborting deployment"
exit 1
fi

cd "$PLUGIN_BUILDS_PATH"

# Clean up any previous svn dir
Expand Down Expand Up @@ -77,6 +77,8 @@ rm -fR svn-trunk
mkdir svn/tags/$VERSION
rsync -r -p $PLUGIN/* svn/tags/$VERSION

cd $PLUGIN_BUILDS_PATH

# Add new files to SVN
svn stat svn | grep '^?' | awk '{print $2}' | xargs -I x svn add x@
# Remove deleted files from SVN
Expand All @@ -86,5 +88,5 @@ svn stat svn
# Commit to SVN
svn ci --no-auth-cache --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD svn -m "Deploy version $VERSION"

# Remove SVN temp dir
Remove SVN temp dir
rm -fR svn
14 changes: 7 additions & 7 deletions src/includes/class-paynow-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,25 @@ public function payment_request( WC_Order $order, $return_url, $payment_method_i
foreach ( $order->get_items() as $item ) {
$product = $item->get_product();
$order_items[] = [
'name' => $product->get_title(),
'name' => esc_html( $product->get_title() ),
'category' => WC_Pay_By_Paynow_PL_Helper::get_product_categories( $product->get_id() ),
'quantity' => $item->get_quantity(),
'price' => WC_Pay_By_Paynow_PL_Helper::get_amount( WC_Pay_By_Paynow_PL_Helper::is_old_wc_version() ? wc_price( wc_get_price_including_tax( $product ) ) : $product->get_price_including_tax() )
];
}

$order_items = array_filter( $order_items, function ( $item ) {
return ! empty( $item['category'] );
} );
$order_items = array_filter( $order_items, function ( $item ) {
return ! empty( $item['category'] );
} );

if ( ! empty( $order_items ) ) {
$payment_data['orderItems'] = $order_items;
}
}

if ( $this->settings['use_payment_validity_time_flag'] === 'yes' ) {
$payment_data['validityTime'] = $this->settings['payment_validity_time'];
}
if ( $this->settings['use_payment_validity_time_flag'] === 'yes' ) {
$payment_data['validityTime'] = $this->settings['payment_validity_time'];
}

$idempotency_key = substr( uniqid( $order_id, true ), 0, 36 );
$payment = new Payment( $this->client );
Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-wc-pay-by-paynow-pl-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static function get_product_categories( $product_id ) {

$categories = [];
foreach ( $terms as $term ) {
$categories[] = $term->name;
$categories[] = esc_html($term->name);
}

return implode( ', ', $categories );
Expand Down