PageSourceSearch

https://www.heracles.nl//wp_app/plugins/woocommerce-paynl-payment-…/assets/js/paynl-blocks.js?ver=1790289446

js heracles.nl collected 2026-09-24 23:10:55 UTC 8,097 bytes, 156 lines download raw bytes

1
2const PaynlComponent = (props) =>{
3    let {image_path, useEffect, gateway} = props
4    const [ selectedIssuer, selectIssuer ] = wp.element.useState('');
5    const [ processingErrorMessage, setErrorMessage ] = wp.element.useState('');
6    const [ cocNumber, setCocNumber ] = wp.element.useState('');
7    const [ vatNumber, setVatNumber ] = wp.element.useState('');
8    const [ dob, selectDate ] = wp.element.useState('');
9    const { eventRegistration, emitResponse } = props;
10    const {onPaymentSetup, onCheckoutValidation, onCheckoutFail} = eventRegistration;
11    let payIssuers = gateway.issuers;
12
13    useEffect(() => {
14        const unsubscribddeProcessing = onCheckoutFail(
15            (props) => {
16                setErrorMessage(props.processingResponse.paymentDetails.errorMessage);
17                return {
18                    type: emitResponse.responseTypes.FAIL,
19                    errorMessage: 'Error',
20                    message: 'Error occurred, please try again',
21                };
22            }
23        );
24        return () => {
25            unsubscribddeProcessing()
26        };
27    }, [onCheckoutFail]);
28
29    useEffect(() => {
30        const unsubscribeCheckoutValidation = onCheckoutValidation(
31            () => {              
32                if (gateway.showVatField == true && gateway.vatRequired == true && !vatNumber.length) {
33                    return {
34                        type: emitResponse.responseTypes.SUCCESS,
35                        errorMessage: gateway.texts.requiredVatNumber
36                    };
37                } else if (gateway.showCocField == true && gateway.cocRequired == true && !cocNumber.length) {
38                    return {
39                        type: emitResponse.responseTypes.SUCCESS,
40                        errorMessage: gateway.texts.requiredCocNumber
41                    };
42                }
43
44                if (gateway.showbirthdate == true && gateway.birthdateRequired == true && !dob.length) {
45                    return {
46                        type: emitResponse.responseTypes.SUCCESS,
47                        errorMessage: gateway.texts.dobRequired
48                    };
49                }
50            }
51        );
52        return () => {
53            unsubscribeCheckoutValidation()
54        };
55    }, [onCheckoutValidation, dob, vatNumber, cocNumber]);
56
57    useEffect(() => {
58        const unsubscribe = onPaymentSetup(() => {
59            let response = {
60                type: emitResponse.responseTypes.SUCCESS,
61                meta: {},
62            };
63            let paymentMethodData = {};
64            paymentMethodData['isblocks'] = '1',
65            paymentMethodData['selectedIssuer'] = selectedIssuer;
66            paymentMethodData['vat_number'] = vatNumber;
67            paymentMethodData['coc_number'] = cocNumber;
68            paymentMethodData[gateway.paymentMethodId + '_birthdate'] = dob;
69            response.meta.paymentMethodData = paymentMethodData;
70            return response;
71        });
72        return () => {
73            unsubscribe();
74        };
75    }, [onPaymentSetup, selectedIssuer, dob, cocNumber, vatNumber]);
76
77        return React.createElement('div', {className: 'PPMFWC_container'},
78                React.createElement('img', {src: image_path}, null),
79                React.createElement('span', {className: 'description'}, gateway.description),
80                React.createElement('span', {className: 'descriptionError'}, processingErrorMessage),
81                React.createElement('div', {},
82                    (gateway.paymentMethodId == 'pay_gateway_ideal' && gateway.issuersSelectionType == 'select' ?
83                        React.createElement('div', {className: 'field'},
84                            React.createElement('span', {className: 'payLabel'}, gateway.texts.issuer),
85                            React.createElement('select',  {onChange: (e)=>{
86                                    selectIssuer(e.target.value)
87                                }},
88                            React.createElement("option", {}, gateway.texts.selectissuer),
89                            ...payIssuers.map(issuer => React.createElement("option", {value: issuer.option_sub_id}, issuer.name))
90                            )
91                        ) : ''),
92                    (gateway.paymentMethodId == 'pay_gateway_ideal' && gateway.issuersSelectionType == 'radio' ?
93                        React.createElement('div', {className: 'field'},              
94                            React.createElement('div', {className: 'issuerlist'},
95                                ...payIssuers.map(
96                                    issuer => 
97                                        React.createElement('div', {className: 'issuerradio'},  
98                                            React.createElement("label", {},
99                                                React.createElement('input', {type: 'radio', value: issuer.option_sub_id, id: 'ideal_'+issuer.option_sub_id, name: 'ideal_issuer_list', onChange: (e)=>{ selectIssuer(e.target.value)}}),                                                                                           
100                                                React.createElement('img', {src: issuer.image_path, className: 'issuerlogo'}, null),  
101                                                issuer.name
102                                            ),                                                                                  
103                                        ),                                                                          
104                                ),                                
105                            ),                                                   
106                        ) : ''),
107                    (gateway.showbirthdate == true ?
108                        React.createElement('div', {className: 'field'},
109                                 React.createElement('span', {className: 'payLabel'}, gateway.texts.enterbirthdate),
110                                 React.createElement('input', {type: 'date', onChange: (e)=>{ selectDate(e.target.value)}})
111                        ) : '' ),
112                    (gateway.showCocField == true ?
113                        React.createElement('div', {className: 'field'},
114                            React.createElement('span', {className: 'payLabel'}, gateway.texts.enterCocNumber),
115                            React.createElement('input', {type: 'text', onChange: (e)=>{ setCocNumber(e.target.value)}})
116                        ) : '' ),
117                    (gateway.showVatField == true ?
118                        React.createElement('div', {className: 'field'},
119                            React.createElement('span', {className: 'payLabel'}, gateway.texts.enterVatNumber),
120                            React.createElement('input', {type: 'text', onChange: (e)=>{ setVatNumber(e.target.value)}})
121                        ) : '' )
122        ))
123
124}
125
126function PaynlLabel({image_path, title})
127{
128    return React.createElement('div', {className: 'PPMFWC_method'},
129        title, React.createElement('img', {src: image_path, style: {float: 'right'}}, null));
130}
131
132const registerPaynlPaymentMethods = ({wc, paynl_gateways}) => {
133    const {registerPaymentMethod} = wc.wcBlocksRegistry;
134    const {useEffect} = wp.element;
135    paynl_gateways.forEach(
136        (gateway) => {
137            registerPaymentMethod(createOptions(gateway, PaynlComponent, useEffect));
138        }
139    );
140}
141
142const createOptions = (gateway, PaynlComponent, useEffect) => {
143    return {
144        name: gateway.paymentMethodId,
145        label: React.createElement(PaynlLabel, {image_path: gateway.image_path, title: gateway.title}),
146        paymentMethodId: gateway.paymentMethodId,
147        edit: React.createElement('div', null, ''),
148        canMakePayment: ({cartTotals, billingData}) => {
149            return true
150        },
151        ariaLabel: gateway.title,
152        content: React.createElement(PaynlComponent, {gateway: gateway, image_path: gateway.image_path, useEffect: useEffect})
153    }
154}
155
156registerPaynlPaymentMethods(window)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.