/**
  * @param Account $account
  * @return string
  */
 public function getExpiryNotification(Account $account)
 {
     $now = new DateTime($this->currentDate);
     $diff = $account->expiresOn()->diff($now);
     $message = '<strong>You have %d days left on your Esendex account %s. </strong>';
     $message .= '<a href="%s" target="_blank">Buy messages</a> to extend your account.';
     return $this->helper()->__($message, $diff->days, $account->reference(), static::TRIAL_EXPIRING_URL);
 }
 public function testGetExpiryNotificationReturnsCorrectMessageWhenNearingExpiry()
 {
     $this->accountNotifications->setCurrentDate('21 December 2014');
     $account = new Account();
     $account->expiresOn(new DateTime('30 December 2014'));
     $account->reference('EX123');
     $notification = $this->accountNotifications->getExpiryNotification($account);
     $expected = '<strong>You have 9 days left on your Esendex account EX123. </strong>';
     $expected .= '<a href="https://www.esendex.com/redirect?i=ecommerce&amp;ls=magento&amp;sc=trialexpirybanner&amp;sd=v1" target="_blank">Buy messages</a> to extend your account.';
     $this->assertEquals($expected, $notification);
 }
Ejemplo n.º 3
0
 private function parseAccount($account)
 {
     $result = new Account();
     $result->id($account["id"]);
     $result->reference($account->reference);
     $result->label($account->label);
     $result->address($account->address);
     $result->alias($account->alias);
     $result->type($account->type);
     $result->messagesRemaining(intval($account->messagesremaining, 10));
     $result->expiresOn($this->parseDateTime($account->expireson));
     $result->defaultDialCode($account->defaultdialcode);
     return $result;
 }