Skip to content

Commit

Permalink
Only allow payment methods if the cart total falls within the Mollie …
Browse files Browse the repository at this point in the history
…minimum and maximum amounts [#1]
  • Loading branch information
Mark-H committed Jan 20, 2016
1 parent a0ec360 commit e1d11fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/components/simplecart_mollie/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- Include MIT license in package
- Only allow payment methods if the cart total falls within the Mollie minimum and maximum amounts [#1]

++ Mollie Gateway for SimpleCart v1.1.4-pl
++ Released on November 2, 2015
Expand Down
15 changes: 14 additions & 1 deletion core/components/simplecart_mollie/mollie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,23 @@ public function view() {
}
}

$total = $this->method->cartTotal;

/** @var Mollie_Api_Object_Method[] $methods */
$methods = $this->mollie->methods->all()->getIterator();
foreach ($methods as $key => $method) {
if (!empty($filtered) && !in_array($method->id, $filtered)) { continue; }
if (!empty($filtered) && !in_array($method->id, $filtered)) {
continue;
}

// Only show payment methods that allow transactions within the provided range
if (
($total > (float)$method->amount->maximum)
|| ($total < (float)$method->amount->minimum)
) {
continue;
}


$phs = $mPhs;
$phs['idx'] = $idx;
Expand Down

0 comments on commit e1d11fb

Please sign in to comment.