| 1: | <?php |
| 2: | namespace Hyperwallet\Model; |
| 3: | |
| 4: | /** |
| 5: | * Represents a V3 Bank Card |
| 6: | * |
| 7: | * @property string $token The bank card token |
| 8: | * @property string $type The transfer method type |
| 9: | * |
| 10: | * @property string $status The bank card status |
| 11: | * @property \DateTime $createdOn The bank card creation date |
| 12: | * |
| 13: | * @property string $transferMethodCountry The bank card country |
| 14: | * @property string $transferMethodCurrency The bank card currency |
| 15: | * |
| 16: | * @property string $cardType The bank card type |
| 17: | * |
| 18: | * @property string $cardNumber The bank card number |
| 19: | * @property string $cardBrand The bank card brand |
| 20: | * @property string $cvv The bank card cvv |
| 21: | * @property \DateTime $dateOfExpiry The bank card expiry date |
| 22: | * @property string $processingTime The processing time |
| 23: | * @property bool $isDefaultTransferMethod The flag to denote default account |
| 24: | * |
| 25: | * @package Hyperwallet\Model |
| 26: | */ |
| 27: | class BankCard extends BaseModel { |
| 28: | |
| 29: | /** |
| 30: | * @internal |
| 31: | * |
| 32: | * Read only fields |
| 33: | * |
| 34: | * @var string[] |
| 35: | */ |
| 36: | private static $READ_ONLY_FIELDS = array('token', 'status', 'createdOn', 'cardType', 'cardBrand'); |
| 37: | |
| 38: | const TYPE_BANK_CARD = 'BANK_CARD'; |
| 39: | |
| 40: | const STATUS_ACTIVATED = 'ACTIVATED'; |
| 41: | const STATUS_DECLINED = 'VERIFIED'; |
| 42: | const STATUS_LOCKED = 'INVALID'; |
| 43: | const STATUS_SUSPENDED = 'DE_ACTIVATED'; |
| 44: | |
| 45: | const CARD_TYPE_DEBIT = 'DEBIT'; |
| 46: | |
| 47: | const CARD_BRAND_VISA = 'VISA'; |
| 48: | const CARD_BRAND_MASTERCARD = 'MASTERCARD'; |
| 49: | |
| 50: | public static function FILTERS_ARRAY() { |
| 51: | return array('status', 'createdBefore', 'createdAfter', 'sortBy', 'limit'); |
| 52: | } |
| 53: | |
| 54: | /** |
| 55: | * Creates a instance of BankCard |
| 56: | * |
| 57: | * @param string[] $properties The default properties |
| 58: | */ |
| 59: | public function __construct(array $properties = array()) { |
| 60: | parent::__construct(self::$READ_ONLY_FIELDS, $properties); |
| 61: | } |
| 62: | |
| 63: | /** |
| 64: | * Get the bank card token |
| 65: | * |
| 66: | * @return string |
| 67: | */ |
| 68: | public function getToken() { |
| 69: | return $this->token; |
| 70: | } |
| 71: | |
| 72: | /** |
| 73: | * Get the bank card token |
| 74: | * |
| 75: | * @param string $token |
| 76: | * @return BankCard |
| 77: | */ |
| 78: | public function setToken($token) { |
| 79: | $this->token = $token; |
| 80: | return $this; |
| 81: | } |
| 82: | |
| 83: | /** |
| 84: | * Get the transfer method type |
| 85: | * |
| 86: | * @return string |
| 87: | */ |
| 88: | public function getType() { |
| 89: | return $this->type; |
| 90: | } |
| 91: | |
| 92: | /** |
| 93: | * Set the transfer method type |
| 94: | * |
| 95: | * @param string $type |
| 96: | * @return BankCard |
| 97: | */ |
| 98: | public function setType($type) { |
| 99: | $this->type = $type; |
| 100: | return $this; |
| 101: | } |
| 102: | |
| 103: | /** |
| 104: | * Get the bank card status |
| 105: | * |
| 106: | * @return string |
| 107: | */ |
| 108: | public function getStatus() { |
| 109: | return $this->status; |
| 110: | } |
| 111: | |
| 112: | /** |
| 113: | * Get the bank card creation date |
| 114: | * |
| 115: | * @return \DateTime |
| 116: | */ |
| 117: | public function getCreatedOn() { |
| 118: | return $this->createdOn ? new \DateTime($this->createdOn) : null; |
| 119: | } |
| 120: | |
| 121: | /** |
| 122: | * Get the bank card country |
| 123: | * |
| 124: | * @return string |
| 125: | */ |
| 126: | public function getTransferMethodCountry() { |
| 127: | return $this->transferMethodCountry; |
| 128: | } |
| 129: | |
| 130: | |
| 131: | /** |
| 132: | * Set the bank card country |
| 133: | * |
| 134: | * @param string $transferMethodCountry |
| 135: | * @return BankCard |
| 136: | */ |
| 137: | public function setTransferMethodCountry($transferMethodCountry) { |
| 138: | $this->transferMethodCountry = $transferMethodCountry; |
| 139: | return $this; |
| 140: | } |
| 141: | |
| 142: | |
| 143: | /** |
| 144: | * Get the bank card currency |
| 145: | * |
| 146: | * @return string |
| 147: | */ |
| 148: | public function getTransferMethodCurrency() { |
| 149: | return $this->transferMethodCurrency; |
| 150: | } |
| 151: | |
| 152: | /** |
| 153: | * Set the bank card country |
| 154: | * |
| 155: | * @param string $transferMethodCurrency |
| 156: | * @return BankCard |
| 157: | */ |
| 158: | public function setTransferMethodCurrency($transferMethodCurrency) { |
| 159: | $this->transferMethodCurrency = $transferMethodCurrency; |
| 160: | return $this; |
| 161: | } |
| 162: | |
| 163: | |
| 164: | /** |
| 165: | * Get the bank card brand |
| 166: | * |
| 167: | * @return string |
| 168: | */ |
| 169: | public function getCardBrand() { |
| 170: | return $this->cardBrand; |
| 171: | } |
| 172: | |
| 173: | /** |
| 174: | * Get the bank card number |
| 175: | * |
| 176: | * @return string |
| 177: | */ |
| 178: | public function getCardNumber() { |
| 179: | return $this->cardNumber; |
| 180: | } |
| 181: | |
| 182: | /** |
| 183: | * Set the bank card number |
| 184: | * |
| 185: | * @param string $cardNumber |
| 186: | * @return BankCard |
| 187: | */ |
| 188: | public function setCardNumber($cardNumber) { |
| 189: | $this->cardNumber = $cardNumber; |
| 190: | return $this; |
| 191: | } |
| 192: | |
| 193: | /** |
| 194: | * Get the bank card cvv |
| 195: | * |
| 196: | * @return string |
| 197: | */ |
| 198: | public function getCvv() { |
| 199: | return $this->cvv; |
| 200: | } |
| 201: | |
| 202: | /** |
| 203: | * Set the bank card cvv |
| 204: | * |
| 205: | * @param string $cvv |
| 206: | * @return BankCard |
| 207: | */ |
| 208: | public function setCvv($cvv) { |
| 209: | $this->cvv = $cvv; |
| 210: | return $this; |
| 211: | } |
| 212: | |
| 213: | /** |
| 214: | * Get the bank card type |
| 215: | * |
| 216: | * @return string |
| 217: | */ |
| 218: | public function getCardType() { |
| 219: | return $this->cardType; |
| 220: | } |
| 221: | |
| 222: | /** |
| 223: | * Get the bank card expiry date |
| 224: | * |
| 225: | * @return \DateTime |
| 226: | */ |
| 227: | public function getDateOfExpiry() { |
| 228: | return $this->dateOfExpiry ? new \DateTime($this->dateOfExpiry) : null; |
| 229: | } |
| 230: | |
| 231: | /** |
| 232: | * Set the bank card expiry date |
| 233: | * |
| 234: | * @param \DateTime $dateOfExpiry |
| 235: | * @return BankCard |
| 236: | */ |
| 237: | public function setDateOfExpiry(\DateTime $dateOfExpiry = null) { |
| 238: | $this->dateOfExpiry = $dateOfExpiry == null ? null : $dateOfExpiry->format('Y-m-d'); |
| 239: | return $this; |
| 240: | } |
| 241: | |
| 242: | /** |
| 243: | * Get the bank card processing time |
| 244: | * |
| 245: | * @return string |
| 246: | */ |
| 247: | public function getProcessingTime() { |
| 248: | return $this->processingTime; |
| 249: | } |
| 250: | |
| 251: | /** |
| 252: | * Set the bank card processing time |
| 253: | * |
| 254: | * @param string $processingTime |
| 255: | * @return BankCard |
| 256: | */ |
| 257: | public function setProcessingTime($processingTime) { |
| 258: | $this->processingTime = $processingTime; |
| 259: | return $this; |
| 260: | } |
| 261: | |
| 262: | /** |
| 263: | * Get the is default transfer method |
| 264: | * |
| 265: | * @return bool |
| 266: | */ |
| 267: | public function getIsDefaultTransferMethod() { |
| 268: | return $this->isDefaultTransferMethod; |
| 269: | } |
| 270: | |
| 271: | /** |
| 272: | * Set the is default transfer method |
| 273: | * |
| 274: | * @param bool $isDefaultTransferMethod |
| 275: | * @return BankCard |
| 276: | */ |
| 277: | public function setIsDefaultTransferMethod($isDefaultTransferMethod) { |
| 278: | $this->isDefaultTransferMethod = $isDefaultTransferMethod; |
| 279: | return $this; |
| 280: | } |
| 281: | } |
| 282: |