public static function createFromArray(PaymentMethod $paymentMethod, array $paymentMethodDetails)
 {
     if ($paymentMethod->isIdeal()) {
         return IdealPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     if ($paymentMethod->isCreditCard()) {
         return CreditCardPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     if ($paymentMethod->isBankTransfer()) {
         return SepaPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     if ($paymentMethod->isSofort()) {
         return SofortPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     if ($paymentMethod->isBancontact()) {
         return BancontactPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     throw new \InvalidArgumentException('Provided payment method not supported.');
 }
 /**
  * @test
  */
 public function itShouldConvertToArray()
 {
     $array = ['transaction_id' => 'some-unique-id-abc123', 'consumer_name' => 'FA de Vries', 'consumer_iban' => 'NL91ABNA0417164300', 'consumer_bic' => 'ABNANL2A'];
     $this->assertEquals($array, SofortPaymentMethodDetails::fromArray($array)->toArray());
 }