Adhere to updated MSS /me response

[MAILPOET-1035]
This commit is contained in:
Pavel Dohnal
2017-07-31 16:47:20 +02:00
parent 7cf3d0960d
commit ccb751b44a
3 changed files with 22 additions and 8 deletions

View File

@@ -64,11 +64,17 @@ class Bridge {
$state_map = array(
200 => self::PREMIUM_KEY_VALID,
401 => self::PREMIUM_KEY_INVALID,
402 => self::PREMIUM_KEY_EXPIRING
402 => self::PREMIUM_KEY_ALREADY_USED
);
if(!empty($result['code']) && isset($state_map[$result['code']])) {
$key_state = $state_map[$result['code']];
if($state_map[$result['code']] == self::PREMIUM_KEY_VALID
&& !empty($result['data']['expire_at'])
) {
$key_state = self::PREMIUM_KEY_EXPIRING;
} else {
$key_state = $state_map[$result['code']];
}
} else {
$key_state = self::PREMIUM_KEY_CHECK_ERROR;
}