Exemple #1
0
 /**
  * @test
  */
 public function itShouldBeExpired()
 {
     $status = Status::fromString(Status::EXPIRED);
     $this->assertFalse($status->isNew());
     $this->assertFalse($status->isPending());
     $this->assertFalse($status->isProcessing());
     $this->assertFalse($status->isError());
     $this->assertFalse($status->isCompleted());
     $this->assertFalse($status->isCancelled());
     $this->assertTrue($status->isExpired());
 }
 /**
  * @param array $transaction
  * @return Transaction
  */
 public static function fromArray(array $transaction)
 {
     Guard::keyExists($transaction, 'payment_method');
     $paymentMethod = PaymentMethod::fromString($transaction['payment_method']);
     return new static($paymentMethod, PaymentMethodDetails\PaymentMethodDetailsFactory::createFromArray($paymentMethod, array_key_exists('payment_method_details', $transaction) ? $transaction['payment_method_details'] : []), array_key_exists('id', $transaction) ? Uuid::fromString($transaction['id']) : null, array_key_exists('created', $transaction) ? new Carbon($transaction['created']) : null, array_key_exists('modified', $transaction) ? new Carbon($transaction['modified']) : null, array_key_exists('completed', $transaction) ? new Carbon($transaction['completed']) : null, array_key_exists('status', $transaction) ? TransactionStatus::fromString($transaction['status']) : null, array_key_exists('reason', $transaction) ? Reason::fromString($transaction['reason']) : null, array_key_exists('currency', $transaction) ? Currency::fromString($transaction['currency']) : null, array_key_exists('amount', $transaction) ? TransactionAmount::fromInteger($transaction['amount']) : null, array_key_exists('expiration_period', $transaction) ? new \DateInterval($transaction['expiration_period']) : null, array_key_exists('description', $transaction) ? TransactionDescription::fromString($transaction['description']) : null, array_key_exists('balance', $transaction) ? Balance::fromString($transaction['balance']) : null, array_key_exists('payment_url', $transaction) ? Url::fromString($transaction['payment_url']) : null);
 }