Skip to content

Commit 7fe72e7

Browse files
Release 1.1.14
1 parent 16add8f commit 7fe72e7

20 files changed

+480
-120
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ This repository contains the PostFinance Checkout WooCommerce plugin that enable
1313

1414
## Documentation
1515

16-
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/1.1.13/docs/en/documentation.html)
16+
* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/woocommerce/1.1.14/docs/en/documentation.html)
1717

1818
## License
1919

20-
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/1.1.13/LICENSE) for more information.
20+
Please see the [license file](https://github.com/pfpayments/woocommerce/blob/1.1.14/LICENSE) for more information.
2121

2222

2323

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292

9393
* Tweakes - Integrated hooks to remove product attribute options
9494

95+
= 1.1.14 - November 21, 2018 =
96+
97+
* Fixes - Improved available payment method caching.
98+
* Fixes - Fixes Refund failure message not displayed.
99+
* Feature - Added ability to use custom 'Date Of Birth' or 'Gender' field in checkout.
100+
95101
= 1.1.2 - May 22, 2018 =
96102

97103
* Fix - Issue with refunds

docs/en/assets/base.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,14 @@ table td[class*="col-"],table th[class*="col-"] {
399399
font-size: 0.875rem;
400400
}
401401

402+
.table-of-contents > .nav > li > .nav > li > .nav > li > a {
403+
padding-left: 2rem;
404+
}
405+
406+
.table-of-contents > .nav > li > .nav > li > .nav > li > a .item-title {
407+
font-size: 0.75rem;
408+
}
409+
402410
.table-of-contents > .nav > li.active > .nav {
403411
display: block;
404412
}

docs/en/documentation.html

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
2121
</a>
2222
</li>
2323
<li>
24-
<a href="https://github.com/pfpayments/woocommerce/releases/tag/1.1.13/">
24+
<a href="https://github.com/pfpayments/woocommerce/releases/tag/1.1.14/">
2525
Source
2626
</a>
2727
</li>
@@ -427,6 +427,109 @@ <h2>
427427
</li>
428428
</ol>
429429
</div> </div>
430+
</div> <div class="section" id="_how_can_i_add_the_value_of_a_strong_date_of_birth_strong_of_strong_gender_strong_input_field_from_my_checkout_form_to_the_whitelabelname_addresses">
431+
<div class="section-title">
432+
<h2>
433+
<span class="title-number">8.5</span>How can I add the value of a <strong>Date Of Birth</strong> of <strong>Gender</strong> input field from my checkout form to the PostFinance Checkout addresses? </h2>
434+
</div>
435+
<div class="section-body">
436+
<div class="section" id="_billing_address_date_of_birth">
437+
<div class="section-title">
438+
<h3>
439+
<span class="title-number">8.5.1</span>Billing Address Date of Birth </h3>
440+
</div>
441+
<div class="section-body">
442+
<div class="paragraph">
443+
<p>For a custom billing date of birth input fiel to be used in the address the following conditions must be fulfilled:</p>
444+
</div><div class="olist arabic">
445+
<ol class="arabic">
446+
<li>
447+
<p>The form field name has to be 'billing_date_of_birth' or '_billing_date_of_birth' or an action has to be registered for the filter 'wc_postfinancecheckout_billing_date_of_birth_field_name' which returns the field name.</p>
448+
</li>
449+
<li>
450+
<p>The field must be submitted in the 'post_data' parameter in the <code>update_order_review</code> request.</p>
451+
</li>
452+
<li>
453+
<p>The date must be saved on the order meta data with the key 'billing_date_of_birth' or '_billing_date_of_birth' or an action has to be registered for the filter 'wc_postfinancecheckout_billing_date_of_birth_order_meta_name' which returns the meta key.</p>
454+
</li>
455+
<li>
456+
<p>The value must be in one of the following formats 'd.m.Y', 'd-m-Y', 'm/d/Y', 'Y-m-d', 'Y/m/d', or an action has to be registered for the filter 'wc_postfinancecheckout_custom_date_of_birth_format' which returns a custom date format. (For more information on the date format check the following link: <a href="https://secure.php.net/manual/en/datetime.createfromformat.php">PHP DateTime Format</a>)</p>
457+
</li>
458+
</ol>
459+
</div> </div>
460+
</div> <div class="section" id="_billing_address_gender">
461+
<div class="section-title">
462+
<h3>
463+
<span class="title-number">8.5.2</span>Billing Address Gender </h3>
464+
</div>
465+
<div class="section-body">
466+
<div class="paragraph">
467+
<p>For a custom billing gender input fiel to be used in the address the following conditions must be fulfilled:</p>
468+
</div><div class="olist arabic">
469+
<ol class="arabic">
470+
<li>
471+
<p>The form field name has to be 'billing_gender' or '_billing_gender' or an action has to be registered for the filter 'wc_postfinancecheckout_billing_gender_field_name' which returns the field name.</p>
472+
</li>
473+
<li>
474+
<p>The field must be submitted in the 'post_data' parameter in the <code>update_order_review</code> request.</p>
475+
</li>
476+
<li>
477+
<p>The date must be saved on the order meta data with the key 'billing_gender' or '_billing_gender' or an action has to be registered for the filter 'wc_postfinancecheckout_billing_gender_order_meta_name' which returns the meta key.</p>
478+
</li>
479+
<li>
480+
<p>The value must be either 'm' or 'male' for male and 'f' or 'female' for female.</p>
481+
</li>
482+
</ol>
483+
</div> </div>
484+
</div> <div class="section" id="_shipping_address_date_of_birth">
485+
<div class="section-title">
486+
<h3>
487+
<span class="title-number">8.5.3</span>Shipping Address Date of Birth </h3>
488+
</div>
489+
<div class="section-body">
490+
<div class="paragraph">
491+
<p>For a custom shipping date of birth input fiel to be used in the address the following conditions must be fulfilled:</p>
492+
</div><div class="olist arabic">
493+
<ol class="arabic">
494+
<li>
495+
<p>The form field name has to be <strong>shipping_date_of_birth</strong> or <strong>_shipping_date_of_birth</strong> or an action has to be registered for the filter <strong>wc_postfinancecheckout_shipping_date_of_birth_field_name</strong> which returns the field name.</p>
496+
</li>
497+
<li>
498+
<p>The field must be submitted in the <strong>post_data</strong> parameter in the <strong>update_order_review</strong> request.</p>
499+
</li>
500+
<li>
501+
<p>The date must be saved on the order meta data with the key <strong>shipping_date_of_birth</strong> or <strong>_shipping_date_of_birth</strong> or an action has to be registered for the filter <strong>wc_postfinancecheckout_shipping_date_of_birth_order_meta_name</strong> which returns the meta key.</p>
502+
</li>
503+
<li>
504+
<p>The value must be in one of the following formats <strong>d.m.Y</strong>, <strong>d-m-Y</strong>, <strong>m/d/Y</strong>, <strong>Y-m-d</strong>, <strong>Y/m/d</strong>, or an action has to be registered for the filter <strong>wc_postfinancecheckout_custom_date_of_birth_format</strong> which returns a custom date format. (For more information on the date format check the following link: <a href="https://secure.php.net/manual/en/datetime.createfromformat.php">PHP DateTime Format</a>)</p>
505+
</li>
506+
</ol>
507+
</div> </div>
508+
</div> <div class="section" id="_shipping_address_gender">
509+
<div class="section-title">
510+
<h3>
511+
<span class="title-number">8.5.4</span>Shipping Address Gender </h3>
512+
</div>
513+
<div class="section-body">
514+
<div class="paragraph">
515+
<p>For a custom shipping gender input fiel to be used in the address the following conditions must be fulfilled:</p>
516+
</div><div class="olist arabic">
517+
<ol class="arabic">
518+
<li>
519+
<p>The form field name has to be 'shipping_gender' or '_shipping_gender' or an action has to be registered for the filter 'wc_postfinancecheckout_shipping_gender_field_name' which returns the field name.</p>
520+
</li>
521+
<li>
522+
<p>The field must be submitted in the 'post_data' parameter in the <code>update_order_review</code> request.</p>
523+
</li>
524+
<li>
525+
<p>The date must be saved on the order meta data with the key 'shipping_gender' or '_shipping_gender' or an action has to be registered for the filter 'wc_postfinancecheckout_shipping_gender_order_meta_name' which returns the meta key.</p>
526+
</li>
527+
<li>
528+
<p>The value must be either 'm' or 'male' for male and 'f' or 'female' for female.</p>
529+
</li>
530+
</ol>
531+
</div> </div>
532+
</div> </div>
430533
</div> </div>
431534
</div> <div class="chapter" id="_support">
432535
<div class="chapter-title">
@@ -554,6 +657,33 @@ <h1>
554657
<span class="item-number">8.4</span>
555658
<span class="item-title">How can I translate the plugin?</span>
556659
</a>
660+
</li> <li class="nav-level-2">
661+
<a href="#_how_can_i_add_the_value_of_a_strong_date_of_birth_strong_of_strong_gender_strong_input_field_from_my_checkout_form_to_the_whitelabelname_addresses">
662+
<span class="item-number">8.5</span>
663+
<span class="item-title">How can I add the value of a &lt;strong&gt;Date Of Birth&lt;/strong&gt; of &lt;strong&gt;Gender&lt;/strong&gt; input field from my checkout form to the PostFinance Checkout addresses?</span>
664+
</a>
665+
<ul class="nav">
666+
<li class="nav-level-3">
667+
<a href="#_billing_address_date_of_birth">
668+
<span class="item-number">8.5.1</span>
669+
<span class="item-title">Billing Address Date of Birth</span>
670+
</a>
671+
</li> <li class="nav-level-3">
672+
<a href="#_billing_address_gender">
673+
<span class="item-number">8.5.2</span>
674+
<span class="item-title">Billing Address Gender</span>
675+
</a>
676+
</li> <li class="nav-level-3">
677+
<a href="#_shipping_address_date_of_birth">
678+
<span class="item-number">8.5.3</span>
679+
<span class="item-title">Shipping Address Date of Birth</span>
680+
</a>
681+
</li> <li class="nav-level-3">
682+
<a href="#_shipping_address_gender">
683+
<span class="item-number">8.5.4</span>
684+
<span class="item-title">Shipping Address Gender</span>
685+
</a>
686+
</li> </ul>
557687
</li> </ul>
558688
</li> <li class="nav-level-1">
559689
<a href="#_support">

includes/admin/class-wc-postfinancecheckout-admin-order-completion.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function execute_completion(){
127127
throw new Exception(__('The line item total does not correspond to the total amount to complete.', 'woo-postfinancecheckout'));
128128
}
129129

130-
wc_transaction_query("start");
130+
WC_PostFinanceCheckout_Helper::instance()->start_database_transaction();
131131
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id($order_id);
132132
if (!$transaction_info->get_id()) {
133133
throw new Exception(__('Could not load corresponding transaction'));
@@ -160,10 +160,10 @@ public static function execute_completion(){
160160
$completion_job->set_amount($completion_amount);
161161
$completion_job->save();
162162
$current_completion_id = $completion_job->get_id();
163-
wc_transaction_query("commit");
163+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
164164
}
165165
catch (Exception $e) {
166-
wc_transaction_query("rollback");
166+
WC_PostFinanceCheckout_Helper::instance()->rollback_database_transaction();
167167
wp_send_json_error(array(
168168
'error' => $e->getMessage()
169169
));
@@ -189,14 +189,14 @@ public static function execute_completion(){
189189
protected static function update_line_items($completion_job_id){
190190
global $wpdb;
191191
$completion_job = WC_PostFinanceCheckout_Entity_Completion_Job::load_by_id($completion_job_id);
192-
wc_transaction_query("start");
192+
WC_PostFinanceCheckout_Helper::instance()->start_database_transaction();
193193
WC_PostFinanceCheckout_Helper::instance()->lock_by_transaction_id($completion_job->get_space_id(), $completion_job->get_transaction_id());
194194
//Reload void job;
195195
$completion_job = WC_PostFinanceCheckout_Entity_Completion_Job::load_by_id($completion_job_id);
196196

197197
if ($completion_job->get_state() != WC_PostFinanceCheckout_Entity_Completion_Job::STATE_CREATED) {
198198
//Already updated in the meantime
199-
wc_transaction_query("rollback");
199+
WC_PostFinanceCheckout_Helper::instance()->rollback_database_transaction();
200200
return;
201201
}
202202
try {
@@ -206,24 +206,24 @@ protected static function update_line_items($completion_job_id){
206206
$line_items);
207207
$completion_job->set_state(WC_PostFinanceCheckout_Entity_Completion_Job::STATE_ITEMS_UPDATED);
208208
$completion_job->save();
209-
wc_transaction_query("commit");
209+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
210210
}
211211
catch (\PostFinanceCheckout\Sdk\ApiException $e) {
212212
if ($e->getResponseObject() instanceof \PostFinanceCheckout\Sdk\Model\ClientError) {
213213
$completion_job->set_state(WC_PostFinanceCheckout_Entity_Completion_Job::STATE_DONE);
214214
$completion_job->save();
215-
wc_transaction_query("commit");
215+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
216216
}
217217
else{
218218
$completion_job->save();
219-
wc_transaction_query("commit");
219+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
220220
WooCommerce_PostFinanceCheckout::instance()->log('Error updating line items. '.$e->getMessage(), WC_Log_Levels::INFO);
221221
throw $e;
222222
}
223223
}
224224
catch (Exception $e) {
225225
$completion_job->save();
226-
wc_transaction_query("commit");
226+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
227227
WooCommerce_PostFinanceCheckout::instance()->log('Error updating line items. '.$e->getMessage(), WC_Log_Levels::INFO);
228228
throw $e;
229229
}
@@ -232,14 +232,14 @@ protected static function update_line_items($completion_job_id){
232232
protected static function send_completion($completion_job_id){
233233
global $wpdb;
234234
$completion_job = WC_PostFinanceCheckout_Entity_Completion_Job::load_by_id($completion_job_id);
235-
wc_transaction_query("start");
235+
WC_PostFinanceCheckout_Helper::instance()->start_database_transaction();
236236
WC_PostFinanceCheckout_Helper::instance()->lock_by_transaction_id($completion_job->get_space_id(), $completion_job->get_transaction_id());
237237
//Reload void job;
238238
$completion_job = WC_PostFinanceCheckout_Entity_Completion_Job::load_by_id($completion_job_id);
239239

240240
if ($completion_job->get_state() != WC_PostFinanceCheckout_Entity_Completion_Job::STATE_ITEMS_UPDATED) {
241241
//Already sent in the meantime
242-
wc_transaction_query("rollback");
242+
WC_PostFinanceCheckout_Helper::instance()->rollback_database_transaction();
243243
return;
244244
}
245245
try {
@@ -250,24 +250,24 @@ protected static function send_completion($completion_job_id){
250250
$completion_job->set_completion_id($completion->getId());
251251
$completion_job->set_state(WC_PostFinanceCheckout_Entity_Completion_Job::STATE_SENT);
252252
$completion_job->save();
253-
wc_transaction_query("commit");
253+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
254254
}
255255
catch (\PostFinanceCheckout\Sdk\ApiException $e) {
256256
if ($e->getResponseObject() instanceof \PostFinanceCheckout\Sdk\Model\ClientError) {
257257
$completion_job->set_state(WC_PostFinanceCheckout_Entity_Completion_Job::STATE_DONE);
258258
$completion_job->save();
259-
wc_transaction_query("commit");
259+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
260260
}
261261
else{
262262
$completion_job->save();
263-
wc_transaction_query("commit");
263+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
264264
WooCommerce_PostFinanceCheckout::instance()->log('Error sending completion. '.$e->getMessage(), WC_Log_Levels::INFO);
265265
throw $e;
266266
}
267267
}
268268
catch (Exception $e) {
269269
$completion_job->save();
270-
wc_transaction_query("commit");
270+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
271271
WooCommerce_PostFinanceCheckout::instance()->log('Error sending completion. '.$e->getMessage(), WC_Log_Levels::INFO);
272272
throw $e;
273273
}

includes/admin/class-wc-postfinancecheckout-admin-order-void.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function execute_void(){
6969
$restock_void_items = 'true' === $_POST['restock_voided_items'];
7070
$current_void_id = null;
7171
try {
72-
wc_transaction_query("start");
72+
WC_PostFinanceCheckout_Helper::instance()->start_database_transaction();
7373
$transaction_info = WC_PostFinanceCheckout_Entity_Transaction_Info::load_by_order_id($order_id);
7474
if (!$transaction_info->get_id()) {
7575
throw new Exception(__('Could not load corresponding transaction'));
@@ -100,10 +100,10 @@ public static function execute_void(){
100100
$void_job->set_order_id($order_id);
101101
$void_job->save();
102102
$current_void_id = $void_job->get_id();
103-
wc_transaction_query("commit");
103+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
104104
}
105105
catch (Exception $e) {
106-
wc_transaction_query("rollback");
106+
WC_PostFinanceCheckout_Helper::instance()->rollback_database_transaction();
107107
wp_send_json_error(array(
108108
'error' => $e->getMessage()
109109
));
@@ -127,13 +127,13 @@ public static function execute_void(){
127127
protected static function send_void($void_job_id){
128128
global $wpdb;
129129
$void_job = WC_PostFinanceCheckout_Entity_Void_Job::load_by_id($void_job_id);
130-
wc_transaction_query("start");
130+
WC_PostFinanceCheckout_Helper::instance()->start_database_transaction();
131131
WC_PostFinanceCheckout_Helper::instance()->lock_by_transaction_id($void_job->get_space_id(), $void_job->get_transaction_id());
132132
//Reload void job;
133133
$void_job = WC_PostFinanceCheckout_Entity_Void_Job::load_by_id($void_job_id);
134134
if ($void_job->get_state() != WC_PostFinanceCheckout_Entity_Void_Job::STATE_CREATED) {
135135
//Already sent in the meantime
136-
wc_transaction_query("rollback");
136+
WC_PostFinanceCheckout_Helper::instance()->rollback_database_transaction();
137137
return;
138138
}
139139
try {
@@ -143,25 +143,24 @@ protected static function send_void($void_job_id){
143143
$void_job->set_void_id($void->getId());
144144
$void_job->set_state(WC_PostFinanceCheckout_Entity_Void_Job::STATE_SENT);
145145
$void_job->save();
146-
wc_transaction_query("commit");
146+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
147147
}
148148
catch (\PostFinanceCheckout\Sdk\ApiException $e) {
149149
if ($e->getResponseObject() instanceof \PostFinanceCheckout\Sdk\Model\ClientError) {
150150
$void_job->set_state(WC_PostFinanceCheckout_Entity_Void_Job::STATE_DONE);
151151
$void_job->save();
152-
wc_transaction_query("commit");
153-
152+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
154153
}
155154
else{
156155
$void_job->save();
157-
wc_transaction_query("commit");
156+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
158157
WooCommerce_PostFinanceCheckout::instance()->log('Error sending void. '.$e->getMessage(), WC_Log_Levels::INFO);
159158
throw $e;
160159
}
161160
}
162161
catch (Exception $e) {
163162
$void_job->save();
164-
wc_transaction_query("commit");
163+
WC_PostFinanceCheckout_Helper::instance()->commit_database_transaction();
165164
WooCommerce_PostFinanceCheckout::instance()->log('Error sending void. '.$e->getMessage(), WC_Log_Levels::INFO);
166165
throw $e;
167166
}

0 commit comments

Comments
 (0)