Skip to content

Commit

Permalink
Remove not used methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinamiko committed Dec 4, 2024
1 parent e37d362 commit 21eb11a
Showing 1 changed file with 0 additions and 51 deletions.
51 changes: 0 additions & 51 deletions modules/ppcp-blocks/resources/js/Components/paypal.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ export const PayPalComponent = ( {

let handleShippingOptionsChange = null;
let handleShippingAddressChange = null;
let handleSubscriptionShippingOptionsChange = null;
let handleSubscriptionShippingAddressChange = null;

if ( shippingData.needsShipping && shouldHandleShippingInPayPal() ) {
handleShippingOptionsChange = async ( data, actions ) => {
Expand Down Expand Up @@ -244,55 +242,6 @@ export const PayPalComponent = ( {
actions.reject();
}
};

handleSubscriptionShippingOptionsChange = async ( data, actions ) => {
try {
const shippingOptionId = data.selectedShippingOption?.id;
if ( shippingOptionId ) {
await wp.data
.dispatch( 'wc/store/cart' )
.selectShippingRate( shippingOptionId );
await shippingData.setSelectedRates( shippingOptionId );
}
} catch ( e ) {
console.error( e );

actions.reject();
}
};

handleSubscriptionShippingAddressChange = async ( data, actions ) => {
try {
const address = paypalAddressToWc(
convertKeysToSnakeCase( data.shippingAddress )
);

await wp.data.dispatch( 'wc/store/cart' ).updateCustomerData( {
shipping_address: address,
} );

await shippingData.setShippingAddress( address );

const res = await fetch( config.ajax.update_shipping.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify( {
nonce: config.ajax.update_shipping.nonce,
order_id: data.orderID,
} ),
} );

const json = await res.json();

if ( ! json.success ) {
throw new Error( json.data.message );
}
} catch ( e ) {
console.error( e );

actions.reject();
}
};
}

useEffect( () => {
Expand Down

0 comments on commit 21eb11a

Please sign in to comment.