<?php
/**
 * ChargeRequest
 *
 * PHP version 5
 *
 * @category Class
 * @package  SquareConnect
 * @author   http://github.com/swagger-api/swagger-codegen
 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
 * @link     https://github.com/swagger-api/swagger-codegen
 */
/**
 *  Copyright 2016 Square, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace SquareConnect\Model;

use \ArrayAccess;
/**
 * ChargeRequest Class Doc Comment
 *
 * @category    Class
 * @description Defines the parameters that can be included in the body of\na request to the **Charge** endpoint.
 * @package     SquareConnect
 * @author      http://github.com/swagger-api/swagger-codegen
 * @license     http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
 * @link        https://github.com/swagger-api/swagger-codegen
 */
class ChargeRequest implements ArrayAccess
{
    /**
      * Array of property to type mappings. Used for (de)serialization 
      * @var string[]
      */
    static $swaggerTypes = array(
        'idempotency_key' => 'string',
        'amount_money' => '\SquareConnect\Model\Money',
        'card_nonce' => 'string',
        'customer_card_id' => 'string',
        'delay_capture' => 'bool',
        'reference_id' => 'string',
        'note' => 'string',
        'customer_id' => 'string',
        'billing_address' => '\SquareConnect\Model\Address',
        'shipping_address' => '\SquareConnect\Model\Address'
    );
  
    /** 
      * Array of attributes where the key is the local name, and the value is the original name
      * @var string[] 
      */
    static $attributeMap = array(
        'idempotency_key' => 'idempotency_key',
        'amount_money' => 'amount_money',
        'card_nonce' => 'card_nonce',
        'customer_card_id' => 'customer_card_id',
        'delay_capture' => 'delay_capture',
        'reference_id' => 'reference_id',
        'note' => 'note',
        'customer_id' => 'customer_id',
        'billing_address' => 'billing_address',
        'shipping_address' => 'shipping_address'
    );
  
    /**
      * Array of attributes to setter functions (for deserialization of responses)
      * @var string[]
      */
    static $setters = array(
        'idempotency_key' => 'setIdempotencyKey',
        'amount_money' => 'setAmountMoney',
        'card_nonce' => 'setCardNonce',
        'customer_card_id' => 'setCustomerCardId',
        'delay_capture' => 'setDelayCapture',
        'reference_id' => 'setReferenceId',
        'note' => 'setNote',
        'customer_id' => 'setCustomerId',
        'billing_address' => 'setBillingAddress',
        'shipping_address' => 'setShippingAddress'
    );
  
    /**
      * Array of attributes to getter functions (for serialization of requests)
      * @var string[]
      */
    static $getters = array(
        'idempotency_key' => 'getIdempotencyKey',
        'amount_money' => 'getAmountMoney',
        'card_nonce' => 'getCardNonce',
        'customer_card_id' => 'getCustomerCardId',
        'delay_capture' => 'getDelayCapture',
        'reference_id' => 'getReferenceId',
        'note' => 'getNote',
        'customer_id' => 'getCustomerId',
        'billing_address' => 'getBillingAddress',
        'shipping_address' => 'getShippingAddress'
    );
  
    
    /**
      * $idempotency_key A value you specify that uniquely identifies this\ntransaction among transactions you've created.\n\nIf you're unsure whether a particular transaction succeeded,\nyou can reattempt it with the same idempotency key without\nworrying about double-charging the buyer. Note that *all other fields*\nmust also remain identical in your followup request, or an error will occur.
      * @var string
      */
    protected $idempotency_key;
    
    /**
      * $amount_money The amount of money to collect in the transaction.
      * @var \SquareConnect\Model\Money
      */
    protected $amount_money;
    
    /**
      * $card_nonce A nonce representing the credit card to charge for this transaction.\nDo not provide a value for this field if you provide a value for\n`customer_card_id`.
      * @var string
      */
    protected $card_nonce;
    
    /**
      * $customer_card_id The ID of the customer card on file to charge for this transaction. Do\nnot provide a value for this field if you provide a value for `card_nonce`.
      * @var string
      */
    protected $customer_card_id;
    
    /**
      * $delay_capture If `true`, the request will only perform an Auth on the provided\ncard. You can then later perform either a Capture (with the\n*CaptureTransaction** endpoint) or a Void (with the **VoidTransation**\nendpoint.
      * @var bool
      */
    protected $delay_capture;
    
    /**
      * $reference_id An optional ID you can associate with the transaction for your own\npurposes (such as to associate the transaction with an entity ID in your\nown database).
      * @var string
      */
    protected $reference_id;
    
    /**
      * $note An optional note to associate with the transaction.
      * @var string
      */
    protected $note;
    
    /**
      * $customer_id The ID of the customer to associate this transaction with. This field\nis required if you provide a value for `customer_card_id`, and optional\notherwise.
      * @var string
      */
    protected $customer_id;
    
    /**
      * $billing_address If available, Postal code in the billing address for US and Canada payments may reduce decline rate.
      * @var \SquareConnect\Model\Address
      */
    protected $billing_address;
    
    /**
      * $shipping_address 
      * @var \SquareConnect\Model\Address
      */
    protected $shipping_address;
    

    /**
     * Constructor
     * @param mixed[] $data Associated array of property value initalizing the model
     */
    public function __construct(array $data = null)
    {
        if ($data != null) {
            $this->idempotency_key = $data["idempotency_key"];
            $this->amount_money = $data["amount_money"];
            $this->card_nonce = $data["card_nonce"];
            $this->customer_card_id = $data["customer_card_id"];
            $this->delay_capture = $data["delay_capture"];
            $this->reference_id = $data["reference_id"];
            $this->note = $data["note"];
            $this->customer_id = $data["customer_id"];
            $this->billing_address = $data["billing_address"];
            $this->shipping_address = $data["shipping_address"];
        }
    }
    
    /**
     * Gets idempotency_key
     * @return string
     */
    public function getIdempotencyKey()
    {
        return $this->idempotency_key;
    }
  
    /**
     * Sets idempotency_key
     * @param string $idempotency_key A value you specify that uniquely identifies this\ntransaction among transactions you've created.\n\nIf you're unsure whether a particular transaction succeeded,\nyou can reattempt it with the same idempotency key without\nworrying about double-charging the buyer. Note that *all other fields*\nmust also remain identical in your followup request, or an error will occur.
     * @return $this
     */
    public function setIdempotencyKey($idempotency_key)
    {
        
        $this->idempotency_key = $idempotency_key;
        return $this;
    }
    
    /**
     * Gets amount_money
     * @return \SquareConnect\Model\Money
     */
    public function getAmountMoney()
    {
        return $this->amount_money;
    }
  
    /**
     * Sets amount_money
     * @param \SquareConnect\Model\Money $amount_money The amount of money to collect in the transaction.
     * @return $this
     */
    public function setAmountMoney($amount_money)
    {
        
        $this->amount_money = $amount_money;
        return $this;
    }
    
    /**
     * Gets card_nonce
     * @return string
     */
    public function getCardNonce()
    {
        return $this->card_nonce;
    }
  
    /**
     * Sets card_nonce
     * @param string $card_nonce A nonce representing the credit card to charge for this transaction.\nDo not provide a value for this field if you provide a value for\n`customer_card_id`.
     * @return $this
     */
    public function setCardNonce($card_nonce)
    {
        
        $this->card_nonce = $card_nonce;
        return $this;
    }
    
    /**
     * Gets customer_card_id
     * @return string
     */
    public function getCustomerCardId()
    {
        return $this->customer_card_id;
    }
  
    /**
     * Sets customer_card_id
     * @param string $customer_card_id The ID of the customer card on file to charge for this transaction. Do\nnot provide a value for this field if you provide a value for `card_nonce`.
     * @return $this
     */
    public function setCustomerCardId($customer_card_id)
    {
        
        $this->customer_card_id = $customer_card_id;
        return $this;
    }
    
    /**
     * Gets delay_capture
     * @return bool
     */
    public function getDelayCapture()
    {
        return $this->delay_capture;
    }
  
    /**
     * Sets delay_capture
     * @param bool $delay_capture If `true`, the request will only perform an Auth on the provided\ncard. You can then later perform either a Capture (with the\n*CaptureTransaction** endpoint) or a Void (with the **VoidTransation**\nendpoint.
     * @return $this
     */
    public function setDelayCapture($delay_capture)
    {
        
        $this->delay_capture = $delay_capture;
        return $this;
    }
    
    /**
     * Gets reference_id
     * @return string
     */
    public function getReferenceId()
    {
        return $this->reference_id;
    }
  
    /**
     * Sets reference_id
     * @param string $reference_id An optional ID you can associate with the transaction for your own\npurposes (such as to associate the transaction with an entity ID in your\nown database).
     * @return $this
     */
    public function setReferenceId($reference_id)
    {
        
        $this->reference_id = $reference_id;
        return $this;
    }
    
    /**
     * Gets note
     * @return string
     */
    public function getNote()
    {
        return $this->note;
    }
  
    /**
     * Sets note
     * @param string $note An optional note to associate with the transaction.
     * @return $this
     */
    public function setNote($note)
    {
        
        $this->note = $note;
        return $this;
    }
    
    /**
     * Gets customer_id
     * @return string
     */
    public function getCustomerId()
    {
        return $this->customer_id;
    }
  
    /**
     * Sets customer_id
     * @param string $customer_id The ID of the customer to associate this transaction with. This field\nis required if you provide a value for `customer_card_id`, and optional\notherwise.
     * @return $this
     */
    public function setCustomerId($customer_id)
    {
        
        $this->customer_id = $customer_id;
        return $this;
    }
    
    /**
     * Gets billing_address
     * @return \SquareConnect\Model\Address
     */
    public function getBillingAddress()
    {
        return $this->billing_address;
    }
  
    /**
     * Sets billing_address
     * @param \SquareConnect\Model\Address $billing_address If available, Postal code in the billing address for US and Canada payments may reduce decline rate.
     * @return $this
     */
    public function setBillingAddress($billing_address)
    {
        
        $this->billing_address = $billing_address;
        return $this;
    }
    
    /**
     * Gets shipping_address
     * @return \SquareConnect\Model\Address
     */
    public function getShippingAddress()
    {
        return $this->shipping_address;
    }
  
    /**
     * Sets shipping_address
     * @param \SquareConnect\Model\Address $shipping_address 
     * @return $this
     */
    public function setShippingAddress($shipping_address)
    {
        
        $this->shipping_address = $shipping_address;
        return $this;
    }
    
    /**
     * Returns true if offset exists. False otherwise.
     * @param  integer $offset Offset 
     * @return boolean
     */
    public function offsetExists($offset)
    {
        return isset($this->$offset);
    }
  
    /**
     * Gets offset.
     * @param  integer $offset Offset 
     * @return mixed 
     */
    public function offsetGet($offset)
    {
        return $this->$offset;
    }
  
    /**
     * Sets value based on offset.
     * @param  integer $offset Offset 
     * @param  mixed   $value  Value to be set
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        $this->$offset = $value;
    }
  
    /**
     * Unsets offset.
     * @param  integer $offset Offset 
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->$offset);
    }
  
    /**
     * Gets the string presentation of the object
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) {
            return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
        } else {
            return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this));
        }
    }
}
