1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 10:52:41 +01:00
phorge-phorge/src/applications/phortune/exception/PhortuneMultiplePaymentProvidersException.php
epriestley f790a2aeec Add basic payment providers to Phortune
Summary: Abstract out the Stripiness of payment providers so we can add a Test provider (and maybe MtGox / Balanced / Paypal / etc). Ref T2787.

Test Plan: Ran unit tests.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D5752
2013-04-25 09:45:43 -07:00

23 lines
869 B
PHP

<?php
final class PhortuneMultiplePaymentProvidersException extends Exception {
public function __construct(PhortunePaymentMethod $method, array $providers) {
assert_instances_of($providers, 'PhortunePaymentProvider');
$type = $method->getMetadataValue('type');
$provider_names = array();
foreach ($providers as $provider) {
$provider_names[] = get_class($provider);
}
return parent::__construct(
"More than one payment provider can handle charging payments for this ".
"payment method. This is ambiguous and likely indicates that a payment ".
"provider is not properly implemented. You may be able to use a ".
"different payment method to complete this transaction. The payment ".
"method type is '{$type}'. The providers claiming to handle it are: ".
implode(', ', $provider_names).'.');
}
}