Skip to content

Commit

Permalink
v1.3.0 (#29)
Browse files Browse the repository at this point in the history
* Bug/ts 24 Order notes for transactions id are missing after a new order for admin page is added (#20)

* add order note after order created

* debug status

* TS-24: add order note when has T_id

* TR-24: [Integrations]: allow gateway instantiation without wp custom functionality

Co-authored-by: apetrovici <[email protected]>

* Bug/ts 67 bug with issuing refund programmatically (#19)

* TS-67 [Woo-commerce] - refund bug when method is called with testendpoint

* TS-67 [Woocommerce] - update readme file.

* TS-67: [Wocommerce] For testing - all params can be sent

?wc-api=globalpayments_test_refund&order-id=136&reason=something&amount=1

* update version to 1.2.3

* Remove validations at endpoint. code review requested changes.

* TR-67: [WooCommerce]: refine test endpoint

* add validation for amount

* Code standar fix

Co-authored-by: apetrovici <[email protected]>

* TS-65 Add apple pay button style in admin (#21)

* TS-65 Add apple pay button style in admin

* TS-68 bug for order pay in user account

Fix for Apple pay and Google pay

* Remove test endpoint

* Update sdk and fix digital wallets payment

* Fix apple pay payment action text

* tested up to

tested on wordpress 6.0. and woocommerce 6.6

* Change merchant id to Client id

Google pay change.

* minimum php requirement

change 5.5.9 to 7.1 php version

* TR-25: [WooCommerce]: admin pay for order

* TR-25: [WooCommerce]: version udate

* add styling to button pay for order

* modal margin reduce overlap

* TR-25: [WooCommerce]: admin pay for order

* TR-25: [WooCommerce]: update changelog

* TR-25: [WooCommerce] update php sdk

* TR-25: bug fix

* TR-25: update readme

* TR-25: [WooCommerce]: coding standards update

* TR-79: [WooCommerce]: bug fix option

* TR-80: [WooCommerce]: bug fix capture

* TR-25: [WooCommerce]: update comments

* 78-bug-design-button-for-pay-from-pay-for-order

78-bug-design-button-for-pay-from-pay-for-order

* TR-25: [WooCommerce]: bug fix handle empty data

* TR-25: [WooCommerce]: bug fix handle empty data

* TR-77: [WooCommerce]: bug fix retrieve user token

* Revert "78-bug-design-button-for-pay-from-pay-for-order"

This reverts commit e7323c2.

* 78-fix-button-style

* fix for other fields in modal

* TR-78: [WooCommerce]: bug fix button style

Co-authored-by: javiercrac <[email protected]>
  • Loading branch information
apetrovici and javiercrac authored Aug 1, 2022
1 parent 80492c5 commit 72441fb
Show file tree
Hide file tree
Showing 23 changed files with 693 additions and 182 deletions.
19 changes: 19 additions & 0 deletions assets/admin/css/globalpayments-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,22 @@
margin:0;
}

.woocommerce-globalpayments-checkout-error {
background-color:#e2401c;
margin-left:0;
margin-bottom:10px;
border-radius:4px;
color:#fff;
clear:both;
padding:6px 12px;
position:relative;
list-style:none outside;
display:block;
width:100%;
font-size:14px;
}

.globalpayments.card-submit iframe {
min-height:32px;
width:auto;
}
53 changes: 53 additions & 0 deletions assets/admin/js/globalpayments-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,59 @@
*/
attachEventHandlers: function () {
$( document ).on( 'change', this.getLiveModeSelector(), this.toggleCredentialsSettings.bind( this ) );

// Admin Pay for Order
$( '#customer_user' ).on( 'change', this.updatePaymentMethods );
$( '.wc-globalpayments-pay-order' ).on( 'click', this.payForOrder );
$( document.body ).on('wc_backbone_modal_loaded', this.modalLoaded.bind( this ) );
},

updatePaymentMethods: function ( e ) {
// fetch user payment tokens
var customer_id = $( e.target ).val();
globalpayments_admin_params.payment_methods = [];
if ( customer_id > 0 && typeof globalpayments_admin_params !== "undefined" ) {
var data = {
_wpnonce: globalpayments_admin_params._wpnonce,
customer_id: customer_id
};
$( '.wc-globalpayments-pay-order' ).prop( 'disabled', true );
$.get( globalpayments_admin_params.payment_methods_url, data, function ( response ) {
globalpayments_admin_params.payment_methods = response;
$( '.wc-globalpayments-pay-order' ).prop( 'disabled', false );
}, 'json' );
}
},

/**
* Enable modal template.
*
* @param e
*/
payForOrder: function( e ) {
e.preventDefault();
$( this ).WCGlobalPaymentsPayOrderBackboneModal({
template: 'wc-globalpayments-pay-order-modal',
variable: {
customer_id: $( '#customer_user' ).val(),
payment_methods: globalpayments_admin_params.payment_methods,
}
});
},

/**
* Render modal content.
*
* @param e
* @param target
*/
modalLoaded: function ( e, target ) {
switch ( target ) {
case 'wc-globalpayments-pay-order-modal':
$( document.body ).trigger( 'globalpayments_pay_order_modal_loaded' );
$( document.body ).trigger( 'wc-credit-card-form-init' );
break;
}
},

/**
Expand Down
70 changes: 70 additions & 0 deletions assets/admin/js/globalpayments-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*global jQuery */
( function( $ ) {
'use strict';

/**
* WooCommerce Backbone Global Payments Modal plugin
*
* @param {object} options
*/
$.fn.WCGlobalPaymentsPayOrderBackboneModal = function( options ) {
return this.each( function() {
( new $.WCGlobalPaymentsPayOrderBackboneModal( $( this ), options ) );
} );
};

/**
* Initialize the Backbone Modal
*
* @param {object} element [description]
* @param {object} options [description]
*/
$.WCGlobalPaymentsPayOrderBackboneModal = function( element, options ) {
var settings = $.extend( {}, $.WCBackboneModal.defaultOptions, options );

if ( settings.template ) {
new $.WCGlobalPaymentsPayOrderBackboneModal.View( {
target: settings.template,
string: settings.variable
} );
}
};

$.WCGlobalPaymentsPayOrderBackboneModal.View = $.WCBackboneModal.View.extend( {
events: _.extend( $.WCBackboneModal.View.prototype.events, {
'click #place_order': 'payOrder'
} ),
payOrder: function( e ) {
e.preventDefault();
this.block();
$.ajax( {
url: globalpayments_admin_params.payorder_url,
method: 'POST',
data: this.getFormData(),
} ).done( function ( response ) {
if ( response.error ) {
this.unblock();
$( document.body ).trigger( 'globalpayments_pay_order_modal_error', [ response.message ] );
} else {
window.location.href = window.location.href;
}
}.bind( this ) ).fail( function ( xhr, textStatus, errorThrown ) {
this.unblock();
$( document.body ).trigger( 'globalpayments_pay_order_modal_error', [ errorThrown ] );
}.bind( this ) )
$( document.body ).trigger( 'globalpayments_pay_order_modal_response', [ this ] );
},
block: function() {
this.$el.find( '.wc-backbone-modal-content' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
},
unblock: function() {
this.$el.find( '.wc-backbone-modal-content' ).unblock();
},
} );
} )( jQuery );
9 changes: 8 additions & 1 deletion assets/frontend/js/globalpayments-applepay.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
if ( 1 == wc_checkout_params.is_checkout ) {
$( document.body ).on( 'updated_checkout', this.initialize.bind( this ) );
}

// Order Pay
if ( $( document.body ).hasClass( 'woocommerce-order-pay' ) ) {
$( document ).ready( this.initialize.bind( this ) );
return;
}
},

initialize: function () {
Expand All @@ -61,7 +67,8 @@

var self = this
var paymentButton = document.createElement( 'div' );
paymentButton.className = 'apple-pay-button apple-pay-button-white-with-line';

paymentButton.className = 'apple-pay-button apple-pay-button-' + this.gatewayOptions.button_color;
paymentButton.title = 'Pay with Apple Pay';
paymentButton.alt = 'Pay with Apple Pay';
paymentButton.id = self.id;
Expand Down
6 changes: 6 additions & 0 deletions assets/frontend/js/globalpayments-googlepay.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
if ( 1 == wc_checkout_params.is_checkout ) {
$( document.body ).on( 'updated_checkout', this.initialize.bind( this ) );
}

// Order Pay
if ( $( document.body ).hasClass( 'woocommerce-order-pay' ) ) {
$( document ).ready( this.initialize.bind( this ) );
return;
}
},

initialize: function () {
Expand Down
5 changes: 3 additions & 2 deletions assets/frontend/js/globalpayments-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
var savedCardsAvailable = $( this.getStoredPaymentMethodsRadioSelector( selectedPaymentGatewayId ) + '[value!="new"]' ).length > 0;
// user selects (new) card as payment method
var newSavedCardSelected = 'new' === $( this.getStoredPaymentMethodsRadioSelector( selectedPaymentGatewayId ) + ':checked' ).val();

// selected payment method is card or digital wallet
if ( ! savedCardsAvailable || savedCardsAvailable && newSavedCardSelected ) {
$( this.getSubmitButtonTargetSelector( selectedPaymentGatewayId ) ).show();
Expand All @@ -133,7 +132,9 @@
// Checkout
'form[name="checkout"]',
// Add payment method
'form#add_payment_method'
'form#add_payment_method',
// Admin Order Pay
'form#wc-globalpayments-pay-order-form',
];
var forms = document.querySelectorAll( checkoutForms.join( ',' ) );

Expand Down
15 changes: 12 additions & 3 deletions assets/frontend/js/globalpayments-secure-payment-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
$( document ).ready( this.renderPaymentFields.bind( this ) );
return;
}

// Admin Pay for Order
$( document.body ).on( 'globalpayments_pay_order_modal_loaded', this.renderPaymentFields.bind( this ) );
$( document.body ).on( 'globalpayments_pay_order_modal_error', function( event, message ) {
self.showPaymentError( message );
} );
},

/**
Expand Down Expand Up @@ -453,7 +459,9 @@

helper.unblockOnError();

$( document.body ).trigger( 'checkout_error' );
if ( 1 == wc_checkout_params.is_checkout ) {
$( document.body ).trigger( 'checkout_error' );
}
},

/**
Expand Down Expand Up @@ -589,8 +597,9 @@
* @returns {string}
*/
getSubmitButtonText: function () {
return $( '#place_order' ).data( 'value' ) || $( '#place_order' ).attr( 'value' );
}
var selector = helper.getPlaceOrderButtonSelector();
return $( selector ).data( 'value' ) || $( selector ).attr( 'value' );
},
};

new GlobalPaymentsWooCommerce( globalpayments_secure_payment_fields_params, globalpayments_secure_payment_threedsecure_params );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
},
"require": {
"globalpayments/php-sdk": "3.0.5",
"globalpayments/php-sdk": "4.0.4",
"psr/log": "^1.1"
},
"require-dev": {
Expand Down
Loading

0 comments on commit 72441fb

Please sign in to comment.