Skip to content

Commit ac7be79

Browse files
Merge pull request #4932 from open-formulieren/feature/3457-ogone-custom-title-and-com
Support custom TITLE and COM parameters in Ogone payment plugin
2 parents fd2a376 + 0343550 commit ac7be79

File tree

14 files changed

+640
-12
lines changed

14 files changed

+640
-12
lines changed

src/openforms/forms/tests/test_import_export.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,12 @@ def test_import(self):
304304
self.assertEqual(imported_form.authentication_backends, ["digid"])
305305
self.assertEqual(imported_form.payment_backend, "ogone-legacy")
306306
self.assertEqual(
307-
imported_form.payment_backend_options, {"merchant_id": merchant.id}
307+
imported_form.payment_backend_options,
308+
{
309+
"merchant_id": merchant.id,
310+
"com_template": "",
311+
"title_template": "",
312+
},
308313
)
309314

310315
form_definitions = FormDefinition.objects.order_by("pk")

src/openforms/js/compiled-lang/en.json

+96
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,60 @@
22932293
"value": "The data entered in this component will be removed in accordance with the privacy settings."
22942294
}
22952295
],
2296+
"JHQfjZ": [
2297+
{
2298+
"type": 0,
2299+
"value": "Optional custom template for the the description, included in the payment overviews for the backoffice. Use this to link the payment back to a particular process or form."
2300+
},
2301+
{
2302+
"children": [
2303+
],
2304+
"type": 8,
2305+
"value": "br"
2306+
},
2307+
{
2308+
"type": 0,
2309+
"value": " You can use all form variables (using their keys) and the "
2310+
},
2311+
{
2312+
"children": [
2313+
{
2314+
"type": 0,
2315+
"value": "public_reference"
2316+
}
2317+
],
2318+
"type": 8,
2319+
"value": "code"
2320+
},
2321+
{
2322+
"type": 0,
2323+
"value": " template variable. If unspecified, a default description is used."
2324+
},
2325+
{
2326+
"children": [
2327+
],
2328+
"type": 8,
2329+
"value": "br"
2330+
},
2331+
{
2332+
"type": 0,
2333+
"value": " "
2334+
},
2335+
{
2336+
"children": [
2337+
{
2338+
"type": 0,
2339+
"value": "Note"
2340+
}
2341+
],
2342+
"type": 8,
2343+
"value": "strong"
2344+
},
2345+
{
2346+
"type": 0,
2347+
"value": ": the length of the result is capped to 100 characters."
2348+
}
2349+
],
22962350
"JKq3TC": [
22972351
{
22982352
"type": 0,
@@ -3887,6 +3941,12 @@
38873941
"value": "The processing (\"verwerking\") for queries to the BRP Persoon API."
38883942
}
38893943
],
3944+
"ZSvQcR": [
3945+
{
3946+
"type": 0,
3947+
"value": "TITLE parameter"
3948+
}
3949+
],
38903950
"ZdZ2Mb": [
38913951
{
38923952
"type": 0,
@@ -4445,6 +4505,12 @@
44454505
"value": "'Save row' text"
44464506
}
44474507
],
4508+
"eZJFP7": [
4509+
{
4510+
"type": 0,
4511+
"value": "COM parameter"
4512+
}
4513+
],
44484514
"ee4oWr": [
44494515
{
44504516
"type": 0,
@@ -6243,6 +6309,36 @@
62436309
"value": "The content of the submission confirmation page. It can contain variables that will be templated from the submitted form data. If not specified, the global template will be used."
62446310
}
62456311
],
6312+
"vikURf": [
6313+
{
6314+
"type": 0,
6315+
"value": "Optional custom template for the title displayed on the payment page."
6316+
},
6317+
{
6318+
"children": [
6319+
],
6320+
"type": 8,
6321+
"value": "br"
6322+
},
6323+
{
6324+
"type": 0,
6325+
"value": " You can use all form variables (using their keys) and the "
6326+
},
6327+
{
6328+
"children": [
6329+
{
6330+
"type": 0,
6331+
"value": "public_reference"
6332+
}
6333+
],
6334+
"type": 8,
6335+
"value": "code"
6336+
},
6337+
{
6338+
"type": 0,
6339+
"value": " template variable. If unspecified, a default description is used."
6340+
}
6341+
],
62466342
"vlY36U": [
62476343
{
62486344
"type": 0,

src/openforms/js/compiled-lang/nl.json

+96
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,60 @@
23142314
"value": "Gegevens opgevoerd in dit component worden geschoond volgens de privacy-instellingen."
23152315
}
23162316
],
2317+
"JHQfjZ": [
2318+
{
2319+
"type": 0,
2320+
"value": "Optional custom template for the the description, included in the payment overviews for the backoffice. Use this to link the payment back to a particular process or form."
2321+
},
2322+
{
2323+
"children": [
2324+
],
2325+
"type": 8,
2326+
"value": "br"
2327+
},
2328+
{
2329+
"type": 0,
2330+
"value": " You can use all form variables (using their keys) and the "
2331+
},
2332+
{
2333+
"children": [
2334+
{
2335+
"type": 0,
2336+
"value": "public_reference"
2337+
}
2338+
],
2339+
"type": 8,
2340+
"value": "code"
2341+
},
2342+
{
2343+
"type": 0,
2344+
"value": " template variable. If unspecified, a default description is used."
2345+
},
2346+
{
2347+
"children": [
2348+
],
2349+
"type": 8,
2350+
"value": "br"
2351+
},
2352+
{
2353+
"type": 0,
2354+
"value": " "
2355+
},
2356+
{
2357+
"children": [
2358+
{
2359+
"type": 0,
2360+
"value": "Note"
2361+
}
2362+
],
2363+
"type": 8,
2364+
"value": "strong"
2365+
},
2366+
{
2367+
"type": 0,
2368+
"value": ": the length of the result is capped to 100 characters."
2369+
}
2370+
],
23172371
"JKq3TC": [
23182372
{
23192373
"type": 0,
@@ -3905,6 +3959,12 @@
39053959
"value": "De waarde voor \"verwerking\" die meegestuurd wordt bij het bevragen van de BRP Personen API. Mogelijke waarden hiervoor zijn afhankelijk van je gateway-leverancier."
39063960
}
39073961
],
3962+
"ZSvQcR": [
3963+
{
3964+
"type": 0,
3965+
"value": "TITLE parameter"
3966+
}
3967+
],
39083968
"ZdZ2Mb": [
39093969
{
39103970
"type": 0,
@@ -4467,6 +4527,12 @@
44674527
"value": "'Groep bewaren'-tekst"
44684528
}
44694529
],
4530+
"eZJFP7": [
4531+
{
4532+
"type": 0,
4533+
"value": "COM parameter"
4534+
}
4535+
],
44704536
"ee4oWr": [
44714537
{
44724538
"type": 0,
@@ -6265,6 +6331,36 @@
62656331
"value": "De inhoud van bevestigingspagina na het versturen van de inzending. Dit sjabloon mag variabelen bevatten met inzendings-gegevens. Laat dit veld leeg om de standaardinstelling te gebruiken."
62666332
}
62676333
],
6334+
"vikURf": [
6335+
{
6336+
"type": 0,
6337+
"value": "Optional custom template for the title displayed on the payment page."
6338+
},
6339+
{
6340+
"children": [
6341+
],
6342+
"type": 8,
6343+
"value": "br"
6344+
},
6345+
{
6346+
"type": 0,
6347+
"value": " You can use all form variables (using their keys) and the "
6348+
},
6349+
{
6350+
"children": [
6351+
{
6352+
"type": 0,
6353+
"value": "public_reference"
6354+
}
6355+
],
6356+
"type": 8,
6357+
"value": "code"
6358+
},
6359+
{
6360+
"type": 0,
6361+
"value": " template variable. If unspecified, a default description is used."
6362+
}
6363+
],
62686364
"vlY36U": [
62696365
{
62706366
"type": 0,

src/openforms/js/components/admin/form_design/payments/ogone_legacy/OgoneLegacyOptionsForm.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import {getChoicesFromSchema} from 'utils/json-schema';
1212

1313
import OptionsConfiguration from '../OptionsConfiguration';
14-
import {MerchantID} from './fields';
14+
import {ComTemplate, MerchantID, TitleTemplate} from './fields';
1515

1616
const OgoneLegacyOptionsForm = ({schema, formData, onSubmit}) => {
1717
const validationErrors = useContext(ValidationErrorContext);
@@ -41,6 +41,8 @@ const OgoneLegacyOptionsForm = ({schema, formData, onSubmit}) => {
4141
<ValidationErrorsProvider errors={relevantErrors}>
4242
<Fieldset>
4343
<MerchantID options={merchantChoices} />
44+
<TitleTemplate />
45+
<ComTemplate />
4446
</Fieldset>
4547
</ValidationErrorsProvider>
4648
</OptionsConfiguration>

src/openforms/js/components/admin/form_design/payments/ogone_legacy/fields.js

+73
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import {useField} from 'formik';
12
import PropTypes from 'prop-types';
23
import {FormattedMessage} from 'react-intl';
34

45
import Field from 'components/admin/forms/Field';
56
import FormRow from 'components/admin/forms/FormRow';
7+
import {TextInput} from 'components/admin/forms/Inputs';
68
import ReactSelect from 'components/admin/forms/ReactSelect';
79

810
export const MerchantID = ({options}) => (
@@ -21,6 +23,7 @@ export const MerchantID = ({options}) => (
2123
defaultMessage="Which merchant should be used for payments related to this form."
2224
/>
2325
}
26+
required
2427
>
2528
<ReactSelect name="merchantId" options={options} required />
2629
</Field>
@@ -35,3 +38,73 @@ MerchantID.propTypes = {
3538
})
3639
).isRequired,
3740
};
41+
42+
export const TitleTemplate = () => {
43+
const [fieldProps] = useField('titleTemplate');
44+
return (
45+
<FormRow>
46+
<Field
47+
name="titleTemplate"
48+
label={
49+
<FormattedMessage
50+
description="Ogone legacy payment options 'titleTemplate' label"
51+
defaultMessage="TITLE parameter"
52+
/>
53+
}
54+
helpText={
55+
<FormattedMessage
56+
description="Ogone legacy payment options 'titleTemplate' help text"
57+
defaultMessage={`Optional custom template for the title displayed on the payment page.<br></br>
58+
You can use all form variables (using their keys) and the <code>public_reference</code>
59+
template variable. If unspecified, a default description is used.`}
60+
values={{
61+
br: () => <br />,
62+
code: chunks => <code>{chunks}</code>,
63+
}}
64+
/>
65+
}
66+
>
67+
<TextInput {...fieldProps} />
68+
</Field>
69+
</FormRow>
70+
);
71+
};
72+
73+
TitleTemplate.propTypes = {};
74+
75+
export const ComTemplate = () => {
76+
const [fieldProps] = useField('comTemplate');
77+
return (
78+
<FormRow>
79+
<Field
80+
name="comTemplate"
81+
label={
82+
<FormattedMessage
83+
description="Ogone legacy payment options 'comTemplate' label"
84+
defaultMessage="COM parameter"
85+
/>
86+
}
87+
helpText={
88+
<FormattedMessage
89+
description="Ogone legacy payment options 'comTemplate' help text"
90+
defaultMessage={`Optional custom template for the the description, included in the
91+
payment overviews for the backoffice. Use this to link the payment back to a particular
92+
process or form.<br></br>
93+
You can use all form variables (using their keys) and the <code>public_reference</code>
94+
template variable. If unspecified, a default description is used.<br></br>
95+
<strong>Note</strong>: the length of the result is capped to 100 characters.`}
96+
values={{
97+
br: () => <br />,
98+
code: chunks => <code>{chunks}</code>,
99+
strong: chunks => <strong>{chunks}</strong>,
100+
}}
101+
/>
102+
}
103+
>
104+
<TextInput {...fieldProps} />
105+
</Field>
106+
</FormRow>
107+
);
108+
};
109+
110+
ComTemplate.propTypes = {};

0 commit comments

Comments
 (0)