public static function createFromArray(PaymentMethod $paymentMethod, array $paymentMethodDetails)
 {
     if ($paymentMethod->isIdeal()) {
         return IdealPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     if ($paymentMethod->isCreditCard()) {
         return CreditCardPaymentMethodDetails::fromArray($paymentMethodDetails);
     }
     throw new \InvalidArgumentException('Provided payment method not supported.');
 }
 /**
  * @test
  */
 public function itShouldConvertToArray()
 {
     $this->assertEquals([], CreditCardPaymentMethodDetails::fromArray([])->toArray());
 }