Skip to content

Commit

Permalink
Update consumer bank details fields (pronamic/wp-pronamic-pay#336).
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Sep 6, 2022
1 parent 17a5ff0 commit 2f97eb2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1028,12 +1028,16 @@ public static function complement_payment( Payment $payment ) {
$consumer_bank_details = new BankAccountDetails();
}

if ( null === $consumer_bank_details->get_name() && filter_has_var( INPUT_POST, 'pronamic_pay_consumer_bank_details_name' ) ) {
$consumer_bank_details->set_name( filter_input( INPUT_POST, 'pronamic_pay_consumer_bank_details_name', FILTER_SANITIZE_STRING ) );
$consumer_bank_details_name = $payment->get_meta( 'consumer_bank_details_name' );

if ( null === $consumer_bank_details->get_name() && null !== $consumer_bank_details_name ) {
$consumer_bank_details->set_name( $consumer_bank_details_name );
}

if ( null === $consumer_bank_details->get_iban() && filter_has_var( INPUT_POST, 'pronamic_pay_consumer_bank_details_iban' ) ) {
$consumer_bank_details->set_iban( filter_input( INPUT_POST, 'pronamic_pay_consumer_bank_details_iban', FILTER_SANITIZE_STRING ) );
$consumer_bank_details_iban = $payment->get_meta( 'consumer_bank_details_iban' );

if ( null === $consumer_bank_details->get_iban() && null !== $consumer_bank_details_iban ) {
$consumer_bank_details->set_iban( $consumer_bank_details_iban );
}

$payment->set_consumer_bank_details( $consumer_bank_details );
Expand Down

0 comments on commit 2f97eb2

Please sign in to comment.