Payment.php 8.94 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
<?php

namespace Cardinity\Method\Payment;

use Cardinity\Method\ResultObject;

class Payment extends ResultObject
{
    /** @type string ID of the payment.
        Value assigned by Cardinity. */
    private $id;

    /** @type float Amount charged shown in #0.00 format. */
    private $amount;

    /** @type string Three-letter ISO currency code representing the currency in
        which the charge was made.
        Supported currencies: EUR, USD. */
    private $currency;

    /** @type string Payment creation time as defined in RFC 3339 Section 5.6.
        UTC timezone.
        Value assigned by Cardinity. */
    private $created;

    /** @type string Payment type.
        Can be one of the following: authorization, purchase.
        Value assigned by Cardinity. */
    private $type;

    /** @type boolean Indicates whether a payment was made in live or testing
        mode.
        Value assigned by Cardinity. */
    private $live;

    /** @type boolean Optional. Default: true.
        Used to indicate a transaction type while creating a payment: true -
        purchase, false - authorization. */
    private $settle;

    /** @type string Payment status.
        Can be one of the following: pending, approved, declined.
        Value assigned by Cardinity. */
    private $status;

    /** @type string Error message.
        Returned only if status is declined.
        Provides human readable information why the payment failed.
        Value assigned by Cardinity. */
    private $error;

    /** @type string Optional. Order ID provided by a merchant.
        Must be between 2 and 50 characters [A-Za-z0-9'.-]. */
    private $orderId;

    /** @type string Payment description provided by a merchant.
        Maximum length 255 characters. */
    private $description;

    /** @type string Country of a customer provided by a merchant.
        ISO 3166-1 alpha-2 country code. */
    private $country;

    /** @type string Can be one the following: card, recurring. */
    private $paymentMethod;

    /** @type PaymentInstrumentInterface Payment instrument representing earlier described
        payment_method.
        Can be one of the following: card or recurring.
     */
    private $paymentInstrument;

    /** @type string Used to provide additional information (PATCH verb) once
        customer completes authorization process. */
    private $authorizeData;

    /** @type AuthorizationInformation Specific authorization object returned in case additional
        payment authorization is needed (i.e. payment status is pending).
        Value assigned by Cardinity. */
    private $authorizationInformation;

    /**
     * Gets the value of id.
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Sets the value of id.
     * @param mixed $id the id
     * @return void
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * Gets the value of amount.
     * @return mixed
     */
    public function getAmount()
    {
        return $this->amount;
    }

    /**
     * Sets the value of amount.
     * @param mixed $amount the amount
     * @return void
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;
    }

    /**
     * Gets the value of currency.
     * @return mixed
     */
    public function getCurrency()
    {
        return $this->currency;
    }

    /**
     * Sets the value of currency.
     * @param mixed $currency the currency
     * @return void
     */
    public function setCurrency($currency)
    {
        $this->currency = $currency;
    }

    /**
     * Gets the value of created.
     * @return mixed
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Sets the value of created.
     * @param mixed $created the created
     * @return void
     */
    public function setCreated($created)
    {
        $this->created = $created;
    }

    /**
     * Gets the value of type.
     * @return mixed
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Sets the value of type.
     * @param mixed $type the type
     * @return void
     */
    public function setType($type)
    {
        $this->type = $type;
    }

    /**
     * Gets the value of live.
     * @return mixed
     */
    public function getLive()
    {
        return $this->live;
    }

    /**
     * Sets the value of live.
     * @param mixed $live the live
     * @return void
     */
    public function setLive($live)
    {
        $this->live = $live;
    }

    /**
     * Gets the value of settle.
     * @return mixed
     */
    public function getSettle()
    {
        return $this->settle;
    }

    /**
     * Sets the value of settle.
     * @param mixed $settle the settle
     * @return void
     */
    public function setSettle($settle)
    {
        $this->settle = $settle;
    }

    /**
     * Gets the value of status.
     * @return mixed
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Sets the value of status.
     * @param mixed $status the status
     * @return void
     */
    public function setStatus($status)
    {
        $this->status = $status;
    }

    /**
     * Gets the value of error.
     * @return mixed
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * Sets the value of error.
     * @param mixed $error the error
     * @return void
     */
    public function setError($error)
    {
        $this->error = $error;
    }

    /**
     * Gets the value of orderId.
     * @return mixed
     */
    public function getOrderId()
    {
        return $this->orderId;
    }

    /**
     * Sets the value of orderId.
     * @param mixed $orderId the order id
     * @return void
     */
    public function setOrderId($orderId)
    {
        $this->orderId = $orderId;
    }

    /**
     * Gets the value of description.
     * @return mixed
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Sets the value of description.
     * @param mixed $description the description
     * @return void
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * Gets the value of country.
     * @return mixed
     */
    public function getCountry()
    {
        return $this->country;
    }

    /**
     * Sets the value of country.
     * @param mixed $country the country
     * @return void
     */
    public function setCountry($country)
    {
        $this->country = $country;
    }

    /**
     * Gets the value of paymentMethod.
     * @return mixed
     */
    public function getPaymentMethod()
    {
        return $this->paymentMethod;
    }

    /**
     * Sets the value of paymentMethod.
     * @param mixed $paymentMethod the payment method
     * @return void
     */
    public function setPaymentMethod($paymentMethod)
    {
        $this->paymentMethod = $paymentMethod;
    }

    /**
     * Gets the value of paymentInstrument.
     * @return PaymentInstrumentInterface
     */
    public function getPaymentInstrument()
    {
        return $this->paymentInstrument;
    }

    /**
     * Sets the value of paymentInstrument.
     * @param PaymentInstrumentInterface $paymentInstrument the payment instrument
     * @return void
     */
    public function setPaymentInstrument(PaymentInstrumentInterface $paymentInstrument)
    {
        $this->paymentInstrument = $paymentInstrument;
    }

    /**
     * Gets the value of authorizeData.
     * @return mixed
     */
    public function getAuthorizeData()
    {
        return $this->authorizeData;
    }

    /**
     * Sets the value of authorizeData.
     * @param mixed $authorizeData the authorize data
     * @return void
     */
    public function setAuthorizeData($authorizeData)
    {
        $this->authorizeData = $authorizeData;
    }

    /**
     * Gets the value of authorizationInformation.
     * @return AuthorizationInformation
     */
    public function getAuthorizationInformation()
    {
        return $this->authorizationInformation;
    }

    /**
     * Sets the value of authorizationInformation.
     * @param AuthorizationInformation $authorizationInformation the authorization information
     * @return void
     */
    public function setAuthorizationInformation(AuthorizationInformation $authorizationInformation)
    {
        $this->authorizationInformation = $authorizationInformation;
    }

    /**
     * Check if payment is pending
     * @return boolean
     */
    public function isPending()
    {
        return $this->getStatus() === 'pending';
    }

    /**
     * Check if payment is approved
     * @return boolean
     */
    public function isApproved()
    {
        return $this->getStatus() === 'approved';
    }

    /**
     * Check if payment is declined
     * @return boolean
     */
    public function isDeclined()
    {
        return $this->getStatus() === 'declined';
    }
}