Skip to content

Commit

Permalink
Remove payment ID fallback from formatted payment string (pronamic/wp…
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Jul 3, 2023
1 parent 8da8177 commit 2e0c0a6
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Payments/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,29 +661,20 @@ public function add_subscription( Subscription $subscription ) {
* @return string
*/
public function format_string( $string ) {
$id = $this->get_id();

// Replacements definition.
$replacements = [
'{order_id}' => $this->get_order_id(),
'{payment_id}' => $id,
'{payment_id}' => $this->get_id(),
];

// Find and replace.
$count = 0;

$string = str_replace(
array_keys( $replacements ),
array_values( $replacements ),
$string,
$count
$string
);

// Make sure there is an dynamic part in the order ID.
// @link https://secure.ogone.com/ncol/param_cookbook.asp.
if ( 0 === $count && null !== $id ) {
$string .= $id;
}
$string = trim( $string );

return $string;
}
Expand Down

0 comments on commit 2e0c0a6

Please sign in to comment.