simplify 1.2.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
 - data/lib/simplify.rb +4 -1
 - data/lib/simplify/accesstoken.rb +1 -1
 - data/lib/simplify/apiexception.rb +1 -1
 - data/lib/simplify/authentication.rb +1 -1
 - data/lib/simplify/authorization.rb +43 -8
 - data/lib/simplify/cardtoken.rb +4 -4
 - data/lib/simplify/chargeback.rb +4 -4
 - data/lib/simplify/constants.rb +2 -2
 - data/lib/simplify/coupon.rb +8 -7
 - data/lib/simplify/customer.rb +12 -8
 - data/lib/simplify/datatoken.rb +91 -0
 - data/lib/simplify/deposit.rb +4 -4
 - data/lib/simplify/event.rb +1 -1
 - data/lib/simplify/fraudcheck.rb +145 -0
 - data/lib/simplify/invoice.rb +67 -26
 - data/lib/simplify/invoiceitem.rb +4 -4
 - data/lib/simplify/payment.rb +45 -9
 - data/lib/simplify/paymentsapi.rb +43 -2
 - data/lib/simplify/plan.rb +12 -6
 - data/lib/simplify/refund.rb +8 -6
 - data/lib/simplify/subscription.rb +17 -9
 - data/lib/simplify/tax.rb +4 -4
 - data/lib/simplify/transactionreview.rb +128 -0
 - data/lib/simplify/webhook.rb +3 -3
 - metadata +14 -11
 
    
        data/lib/simplify/invoice.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,30 +60,49 @@ class Invoice < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an Invoice object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>billingAddress => city</code>    Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
         
     | 
| 
      
 64 
     | 
    
         
            +
                # * <code>billingAddress => country</code>    Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
         
     | 
| 
      
 65 
     | 
    
         
            +
                # * <code>billingAddress => line1</code>    Billing address line 1 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 66 
     | 
    
         
            +
                # * <code>billingAddress => line2</code>    Billing address line 2 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 67 
     | 
    
         
            +
                # * <code>billingAddress => name</code>    Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255]
         
     | 
| 
      
 68 
     | 
    
         
            +
                # * <code>billingAddress => state</code>    Billing address state of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 69 
     | 
    
         
            +
                # * <code>billingAddress => zip</code>    Billing address zip of the location where the goods or services were supplied. [max length: 32]
         
     | 
| 
      
 70 
     | 
    
         
            +
                # * <code>businessAddress => city</code>    Address city of the business that is sending the invoice. [max length: 255, min length: 2]
         
     | 
| 
      
 71 
     | 
    
         
            +
                # * <code>businessAddress => country</code>    Address country of the business that is sending the invoice. [max length: 2, min length: 2]
         
     | 
| 
      
 72 
     | 
    
         
            +
                # * <code>businessAddress => line1</code>    Address line 1 of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 73 
     | 
    
         
            +
                # * <code>businessAddress => line2</code>    Address line 2 of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 74 
     | 
    
         
            +
                # * <code>businessAddress => name</code>    The name of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 75 
     | 
    
         
            +
                # * <code>businessAddress => state</code>    Address state of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 76 
     | 
    
         
            +
                # * <code>businessAddress => zip</code>    Address zip of the business that is sending the invoice. [max length: 32]
         
     | 
| 
       63 
77 
     | 
    
         
             
                # * <code>currency</code>    Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3, default: USD]
         
     | 
| 
       64 
     | 
    
         
            -
                # * <code>customer</code>    The customer ID of the customer we are invoicing.  This is optional  
     | 
| 
      
 78 
     | 
    
         
            +
                # * <code>customer</code>    The customer ID of the customer we are invoicing.  This is optional if invoiceToCopy or a name and email are provided
         
     | 
| 
      
 79 
     | 
    
         
            +
                # * <code>customerTaxNo</code>    The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255]
         
     | 
| 
       65 
80 
     | 
    
         
             
                # * <code>discountRate</code>    The discount percent as a decimal e.g. 12.5.  This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
         
     | 
| 
       66 
81 
     | 
    
         
             
                # * <code>dueDate</code>    The date invoice payment is due.  If a late fee is provided this will be added to the invoice total is the due date has past.
         
     | 
| 
       67 
     | 
    
         
            -
                # * <code>email</code>    The email of the customer we are invoicing.  This is optional if  
     | 
| 
      
 82 
     | 
    
         
            +
                # * <code>email</code>    The email of the customer we are invoicing.  This is optional if customer or invoiceToCopy is provided.  A new customer will be created using the the name and email.
         
     | 
| 
       68 
83 
     | 
    
         
             
                # * <code>invoiceId</code>    User defined invoice id. If not provided the system will generate a numeric id. [max length: 255]
         
     | 
| 
       69 
     | 
    
         
            -
                # * <code> 
     | 
| 
      
 84 
     | 
    
         
            +
                # * <code>invoiceToCopy</code>    The id of an existing invoice to be copied.  This is optional if customer or a name and email are provided
         
     | 
| 
      
 85 
     | 
    
         
            +
                # * <code>items => amount</code>    Amount of the invoice item (the smallest unit of your currency). Example: 100 = $1.00USD <b>required </b>
         
     | 
| 
       70 
86 
     | 
    
         
             
                # * <code>items => description</code>    The description of the invoice item. [max length: 1024]
         
     | 
| 
       71 
87 
     | 
    
         
             
                # * <code>items => invoice</code>    The ID of the invoice this item belongs to.
         
     | 
| 
       72 
     | 
    
         
            -
                # * <code>items => product</code>    The product this invoice item refers to. 
     | 
| 
      
 88 
     | 
    
         
            +
                # * <code>items => product</code>    The product this invoice item refers to.
         
     | 
| 
       73 
89 
     | 
    
         
             
                # * <code>items => quantity</code>    Quantity of the item.  This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
         
     | 
| 
       74 
90 
     | 
    
         
             
                # * <code>items => reference</code>    User defined reference field. [max length: 255]
         
     | 
| 
       75 
91 
     | 
    
         
             
                # * <code>items => tax</code>    The tax ID of the tax charge in the invoice item.
         
     | 
| 
       76 
     | 
    
         
            -
                # * <code>lateFee</code>    The late fee amount that will be added to the invoice total is the due date is past due.  Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD 
     | 
| 
      
 92 
     | 
    
         
            +
                # * <code>lateFee</code>    The late fee amount that will be added to the invoice total is the due date is past due.  Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD
         
     | 
| 
       77 
93 
     | 
    
         
             
                # * <code>memo</code>    A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
         
     | 
| 
       78 
     | 
    
         
            -
                # * <code>name</code>    The name of the customer we are invoicing.  This is optional if  
     | 
| 
      
 94 
     | 
    
         
            +
                # * <code>name</code>    The name of the customer we are invoicing.  This is optional if customer or invoiceToCopy is provided.  A new customer will be created using the the name and email. [max length: 50, min length: 2]
         
     | 
| 
       79 
95 
     | 
    
         
             
                # * <code>note</code>    This field can be used to store a note that is not displayed to the customer. [max length: 4000]
         
     | 
| 
       80 
96 
     | 
    
         
             
                # * <code>reference</code>    User defined reference field. [max length: 255]
         
     | 
| 
       81 
     | 
    
         
            -
                # * <code> 
     | 
| 
       82 
     | 
    
         
            -
                # * <code> 
     | 
| 
       83 
     | 
    
         
            -
                # * <code> 
     | 
| 
       84 
     | 
    
         
            -
                # * <code> 
     | 
| 
       85 
     | 
    
         
            -
                # * <code> 
     | 
| 
       86 
     | 
    
         
            -
                # * <code> 
     | 
| 
      
 97 
     | 
    
         
            +
                # * <code>shippingAddress => city</code>    Address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
         
     | 
| 
      
 98 
     | 
    
         
            +
                # * <code>shippingAddress => country</code>    Address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
         
     | 
| 
      
 99 
     | 
    
         
            +
                # * <code>shippingAddress => line1</code>    Address line 1 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 100 
     | 
    
         
            +
                # * <code>shippingAddress => line2</code>    Address line 2 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 101 
     | 
    
         
            +
                # * <code>shippingAddress => name</code>    Address name of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 102 
     | 
    
         
            +
                # * <code>shippingAddress => state</code>    Address state of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 103 
     | 
    
         
            +
                # * <code>shippingAddress => zip</code>    Address zip of the location where the goods or services were supplied. [max length: 32]
         
     | 
| 
      
 104 
     | 
    
         
            +
                # * <code>suppliedDate</code>    The date on which the goods or services were supplied.
         
     | 
| 
      
 105 
     | 
    
         
            +
                # * <code>taxNo</code>    The tax number or VAT id of the person who supplied the goods or services. [max length: 255]
         
     | 
| 
       87 
106 
     | 
    
         
             
                # * <code>type</code>    The type of invoice.  One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB]
         
     | 
| 
       88 
107 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       89 
108 
     | 
    
         
             
                # Returns a Invoice object.
         
     | 
| 
         @@ -106,10 +125,10 @@ class Invoice < Hash 
     | 
|
| 
       106 
125 
     | 
    
         | 
| 
       107 
126 
     | 
    
         
             
                # Retrieve Invoice objects.
         
     | 
| 
       108 
127 
     | 
    
         
             
                # criteria:: a hash of parameters; valid keys are: 
         
     | 
| 
       109 
     | 
    
         
            -
                # * <code>filter</code>     
     | 
| 
       110 
     | 
    
         
            -
                # * <code>max</code>    Allows up to a max of 50 list items to return. [max value: 50, default: 20] 
         
     | 
| 
       111 
     | 
    
         
            -
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [default: 0] 
         
     | 
| 
       112 
     | 
    
         
            -
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> id</code><code> invoiceDate</code><code> dueDate</code><code> datePaid</code><code> customer</code><code> status</code>.
         
     | 
| 
      
 128 
     | 
    
         
            +
                # * <code>filter</code>    <table class="filter_list"><tr><td>filter.id</td><td>Filter by the invoice Id</td></tr><tr><td>filter.amount</td><td>Filter by the invoice amount (in the smallest unit of your currency)</td></tr><tr><td>filter.text</td><td>Filter by the name of the invoice</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.datePaidMin<sup>*</sup></td><td>Filter by the minimum invoice paid date you are searching for - Date in UTC millis</td></tr><tr><td>filter.datePaidMax<sup>*</sup></td><td>Filter by the maximum invoice paid date you are searching for - Date in UTC millis</td></tr><tr><td>filter.status</td><td>Filter by the status of the invoice</td></tr><tr><td>filter.statuses</td><td>Filter by multiple statuses of different invoices</td></tr><tr><td>filter.customer</td><td>Filter using the Id of the customer linked to the invoice</td></tr><tr><td>filter.type</td><td>Filter by the invoice type</td></tr><tr><td>filter.types</td><td>Filter by multiple invoice types</td></tr><tr><td>filter.invoiceId</td><td>Filter by the user defined invoice id</td></tr><tr><td>filter.reference</td><td>Filter by the invoice reference text</td></tr></table><br><sup>*</sup>The filters datePaidMin and datePaidMax can be used in the same filter if you want to search between the two dates. The same is for dateCreatedMin/dateCreatedMax. 
         
     | 
| 
      
 129 
     | 
    
         
            +
                # * <code>max</code>    Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] 
         
     | 
| 
      
 130 
     | 
    
         
            +
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0] 
         
     | 
| 
      
 131 
     | 
    
         
            +
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> id</code><code> invoiceDate</code><code> dueDate</code><code> datePaid</code><code> customer</code><code> status</code><code> dateCreated</code>.
         
     | 
| 
       113 
132 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       114 
133 
     | 
    
         
             
                # Returns an object where the <code>list</code> property contains the list of Invoice objects and the <code>total</code>
         
     | 
| 
       115 
134 
     | 
    
         
             
                # property contains the total number of Invoice objects available for the given criteria.
         
     | 
| 
         @@ -142,28 +161,50 @@ class Invoice < Hash 
     | 
|
| 
       142 
161 
     | 
    
         
             
                # Updates this object
         
     | 
| 
       143 
162 
     | 
    
         
             
                #
         
     | 
| 
       144 
163 
     | 
    
         
             
                # The properties that can be updated:
         
     | 
| 
       145 
     | 
    
         
            -
                # * <code> 
     | 
| 
      
 164 
     | 
    
         
            +
                # * <code>billingAddress => city</code> Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
         
     | 
| 
      
 165 
     | 
    
         
            +
            # * <code>billingAddress => country</code> Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
         
     | 
| 
      
 166 
     | 
    
         
            +
            # * <code>billingAddress => line1</code> Billing address line 1 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 167 
     | 
    
         
            +
            # * <code>billingAddress => line2</code> Billing address line 2 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 168 
     | 
    
         
            +
            # * <code>billingAddress => name</code> Billing address name of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 169 
     | 
    
         
            +
            # * <code>billingAddress => state</code> Billing address state of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 170 
     | 
    
         
            +
            # * <code>billingAddress => zip</code> Billing address zip of the location where the goods or services were supplied. [max length: 32]
         
     | 
| 
      
 171 
     | 
    
         
            +
            # * <code>businessAddress => city</code> Business address city of the business that is sending the invoice. [max length: 255, min length: 2]
         
     | 
| 
      
 172 
     | 
    
         
            +
            # * <code>businessAddress => country</code> Business address country of the business that is sending the invoice. [max length: 2, min length: 2]
         
     | 
| 
      
 173 
     | 
    
         
            +
            # * <code>businessAddress => line1</code> Business address line 1 of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 174 
     | 
    
         
            +
            # * <code>businessAddress => line2</code> Business address line 2 of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 175 
     | 
    
         
            +
            # * <code>businessAddress => name</code> Business address name of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 176 
     | 
    
         
            +
            # * <code>businessAddress => state</code> Business address state of the business that is sending the invoice. [max length: 255]
         
     | 
| 
      
 177 
     | 
    
         
            +
            # * <code>businessAddress => zip</code> Business address zip of the business that is sending the invoice. [max length: 32]
         
     | 
| 
      
 178 
     | 
    
         
            +
            # * <code>currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [max length: 3, min length: 3]
         
     | 
| 
      
 179 
     | 
    
         
            +
            # * <code>customerTaxNo</code> The tax number or VAT id of the person to whom the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 180 
     | 
    
         
            +
            # * <code>datePaid</code> This is the date the invoice was PAID in UTC millis.
         
     | 
| 
       146 
181 
     | 
    
         
             
            # * <code>discountRate</code> The discount percent as a decimal e.g. 12.5.  This is used to calculate the discount amount which is subtracted from the total amount due before any tax is applied. [max length: 6]
         
     | 
| 
       147 
182 
     | 
    
         
             
            # * <code>dueDate</code> The date invoice payment is due.  If a late fee is provided this will be added to the invoice total is the due date has past.
         
     | 
| 
       148 
     | 
    
         
            -
            # * <code> 
     | 
| 
      
 183 
     | 
    
         
            +
            # * <code>email</code> The email of the customer we are invoicing.  This is optional if customer or invoiceToCopy is provided.  A new customer will be created using the the name and email.
         
     | 
| 
      
 184 
     | 
    
         
            +
            # * <code>invoiceId</code> User defined invoice id. If not provided the system will generate a numeric id. [max length: 255]
         
     | 
| 
      
 185 
     | 
    
         
            +
            # * <code>items => amount</code> Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD <b>(required)</b>
         
     | 
| 
       149 
186 
     | 
    
         
             
            # * <code>items => description</code> The description of the invoice item. [max length: 1024]
         
     | 
| 
       150 
187 
     | 
    
         
             
            # * <code>items => invoice</code> The ID of the invoice this item belongs to.
         
     | 
| 
       151 
     | 
    
         
            -
            # * <code>items => product</code> The Id of the product this item refers to. 
     | 
| 
      
 188 
     | 
    
         
            +
            # * <code>items => product</code> The Id of the product this item refers to.
         
     | 
| 
       152 
189 
     | 
    
         
             
            # * <code>items => quantity</code> Quantity of the item.  This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
         
     | 
| 
       153 
190 
     | 
    
         
             
            # * <code>items => reference</code> User defined reference field. [max length: 255]
         
     | 
| 
       154 
191 
     | 
    
         
             
            # * <code>items => tax</code> The tax ID of the tax charge in the invoice item.
         
     | 
| 
       155 
192 
     | 
    
         
             
            # * <code>lateFee</code> The late fee amount that will be added to the invoice total is the due date is past due.  Value provided must be in the smallest unit of your currency. Example: 100 = $1.00USD
         
     | 
| 
       156 
193 
     | 
    
         
             
            # * <code>memo</code> A memo that is displayed to the customer on the invoice payment screen. [max length: 4000]
         
     | 
| 
      
 194 
     | 
    
         
            +
            # * <code>name</code> The name of the customer we are invoicing.  This is optional if customer or invoiceToCopy is provided.  A new customer will be created using the the name and email. [max length: 50, min length: 2]
         
     | 
| 
       157 
195 
     | 
    
         
             
            # * <code>note</code> This field can be used to store a note that is not displayed to the customer. [max length: 4000]
         
     | 
| 
       158 
196 
     | 
    
         
             
            # * <code>payment</code> The ID of the payment.  Use this ID to query the /payment API. [max length: 255]
         
     | 
| 
       159 
197 
     | 
    
         
             
            # * <code>reference</code> User defined reference field. [max length: 255]
         
     | 
| 
       160 
     | 
    
         
            -
            # * <code> 
     | 
| 
       161 
     | 
    
         
            -
            # * <code> 
     | 
| 
       162 
     | 
    
         
            -
            # * <code> 
     | 
| 
       163 
     | 
    
         
            -
            # * <code> 
     | 
| 
       164 
     | 
    
         
            -
            # * <code> 
     | 
| 
       165 
     | 
    
         
            -
            # * <code> 
     | 
| 
      
 198 
     | 
    
         
            +
            # * <code>shippingAddress => city</code> Address city of the location where the goods or services were supplied. [max length: 255, min length: 2]
         
     | 
| 
      
 199 
     | 
    
         
            +
            # * <code>shippingAddress => country</code> Address country of the location where the goods or services were supplied. [max length: 2, min length: 2]
         
     | 
| 
      
 200 
     | 
    
         
            +
            # * <code>shippingAddress => line1</code> Address line 1 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 201 
     | 
    
         
            +
            # * <code>shippingAddress => line2</code> Address line 2 of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 202 
     | 
    
         
            +
            # * <code>shippingAddress => name</code> Address name of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 203 
     | 
    
         
            +
            # * <code>shippingAddress => state</code> Address state of the location where the goods or services were supplied. [max length: 255]
         
     | 
| 
      
 204 
     | 
    
         
            +
            # * <code>shippingAddress => zip</code> Address zip of the location where the goods or services were supplied. [max length: 32]
         
     | 
| 
       166 
205 
     | 
    
         
             
            # * <code>status</code> New status of the invoice.
         
     | 
| 
      
 206 
     | 
    
         
            +
            # * <code>suppliedDate</code> The date on which the goods or services were supplied.
         
     | 
| 
      
 207 
     | 
    
         
            +
            # * <code>taxNo</code> The tax number or VAT id of the person who supplied the goods or services. [max length: 255]
         
     | 
| 
       167 
208 
     | 
    
         
             
                def update()
         
     | 
| 
       168 
209 
     | 
    
         
             
                      h = Simplify::PaymentsApi.execute("invoice", 'update', self, self.authentication)
         
     | 
| 
       169 
210 
     | 
    
         
             
                      self.merge!(h)
         
     | 
    
        data/lib/simplify/invoiceitem.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,10 +60,10 @@ class InvoiceItem < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an InvoiceItem object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
       63 
     | 
    
         
            -
                # * <code>amount</code>    Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD  
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>amount</code>    Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD <b>required </b>
         
     | 
| 
       64 
64 
     | 
    
         
             
                # * <code>description</code>    Individual items of an invoice [max length: 1024]
         
     | 
| 
       65 
65 
     | 
    
         
             
                # * <code>invoice</code>    The ID of the invoice this item belongs to.
         
     | 
| 
       66 
     | 
    
         
            -
                # * <code>product</code>    Product ID this item relates to. 
     | 
| 
      
 66 
     | 
    
         
            +
                # * <code>product</code>    Product ID this item relates to.
         
     | 
| 
       67 
67 
     | 
    
         
             
                # * <code>quantity</code>    Quantity of the item.  This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999, default: 1]
         
     | 
| 
       68 
68 
     | 
    
         
             
                # * <code>reference</code>    User defined reference field. [max length: 255]
         
     | 
| 
       69 
69 
     | 
    
         
             
                # * <code>tax</code>    The tax ID of the tax charge in the invoice item.
         
     | 
| 
         @@ -104,7 +104,7 @@ class InvoiceItem < Hash 
     | 
|
| 
       104 
104 
     | 
    
         
             
                # Updates this object
         
     | 
| 
       105 
105 
     | 
    
         
             
                #
         
     | 
| 
       106 
106 
     | 
    
         
             
                # The properties that can be updated:
         
     | 
| 
       107 
     | 
    
         
            -
                # * <code>amount</code> Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1 
     | 
| 
      
 107 
     | 
    
         
            +
                # * <code>amount</code> Amount of the invoice item in the smallest unit of your currency. Example: 100 = $1.00USD [min value: 1]
         
     | 
| 
       108 
108 
     | 
    
         
             
            # * <code>description</code> Individual items of an invoice
         
     | 
| 
       109 
109 
     | 
    
         
             
            # * <code>quantity</code> Quantity of the item.  This total amount of the invoice item is the amount * quantity. [min value: 1, max value: 999999]
         
     | 
| 
       110 
110 
     | 
    
         
             
            # * <code>reference</code> User defined reference field.
         
     | 
    
        data/lib/simplify/payment.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,25 +60,61 @@ class Payment < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an Payment object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
       63 
     | 
    
         
            -
                # * <code>amount</code>    Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD 
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>amount</code>    Amount of the payment (in the smallest unit of your currency). Example: 100 = $1.00USD
         
     | 
| 
       64 
64 
     | 
    
         
             
                # * <code>authorization</code>    The ID of the authorization being used to capture the payment.
         
     | 
| 
       65 
65 
     | 
    
         
             
                # * <code>card => addressCity</code>    City of the cardholder. [max length: 50, min length: 2]
         
     | 
| 
       66 
66 
     | 
    
         
             
                # * <code>card => addressCountry</code>    Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
         
     | 
| 
       67 
67 
     | 
    
         
             
                # * <code>card => addressLine1</code>    Address of the cardholder. [max length: 255]
         
     | 
| 
       68 
68 
     | 
    
         
             
                # * <code>card => addressLine2</code>    Address of the cardholder if needed. [max length: 255]
         
     | 
| 
       69 
     | 
    
         
            -
                # * <code>card => addressState</code>    State  
     | 
| 
       70 
     | 
    
         
            -
                # * <code>card => addressZip</code>    Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length:  
     | 
| 
      
 69 
     | 
    
         
            +
                # * <code>card => addressState</code>    State of residence of the cardholder. For the US, this is a 2-digit USPS code. [max length: 255]
         
     | 
| 
      
 70 
     | 
    
         
            +
                # * <code>card => addressZip</code>    Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. [max length: 32]
         
     | 
| 
       71 
71 
     | 
    
         
             
                # * <code>card => cvc</code>    CVC security code of the card. This is the code on the back of the card. Example: 123
         
     | 
| 
       72 
72 
     | 
    
         
             
                # * <code>card => expMonth</code>    Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12] <b>required </b>
         
     | 
| 
       73 
     | 
    
         
            -
                # * <code>card => expYear</code>    Expiration year of the card. Format is YY. Example: 2013 = 13 [max value: 99] <b>required </b>
         
     | 
| 
      
 73 
     | 
    
         
            +
                # * <code>card => expYear</code>    Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99] <b>required </b>
         
     | 
| 
       74 
74 
     | 
    
         
             
                # * <code>card => name</code>    Name as it appears on the card. [max length: 50, min length: 2]
         
     | 
| 
       75 
75 
     | 
    
         
             
                # * <code>card => number</code>    Card number as it appears on the card. [max length: 19, min length: 13] <b>required </b>
         
     | 
| 
       76 
76 
     | 
    
         
             
                # * <code>currency</code>    Currency code (ISO-4217) for the transaction. Must match the currency associated with your account. [default: USD] <b>required </b>
         
     | 
| 
       77 
77 
     | 
    
         
             
                # * <code>customer</code>    ID of customer. If specified, card on file of customer will be used.
         
     | 
| 
       78 
78 
     | 
    
         
             
                # * <code>description</code>    Free form text field to be used as a description of the payment. This field is echoed back with the payment on any find or list operations. [max length: 1024]
         
     | 
| 
       79 
79 
     | 
    
         
             
                # * <code>invoice</code>    ID of invoice for which this payment is being made.
         
     | 
| 
      
 80 
     | 
    
         
            +
                # * <code>order => commodityCode</code>    Standard classification code for products and services. [max length: 5]
         
     | 
| 
      
 81 
     | 
    
         
            +
                # * <code>order => customer</code>    ID of the customer associated with the order.
         
     | 
| 
      
 82 
     | 
    
         
            +
                # * <code>order => customerEmail</code>    Customer email address.
         
     | 
| 
      
 83 
     | 
    
         
            +
                # * <code>order => customerName</code>    Customer name.
         
     | 
| 
      
 84 
     | 
    
         
            +
                # * <code>order => customerNote</code>    Additional notes provided by the customer. [max length: 255]
         
     | 
| 
      
 85 
     | 
    
         
            +
                # * <code>order => customerReference</code>    A merchant reference for the customer.
         
     | 
| 
      
 86 
     | 
    
         
            +
                # * <code>order => items => amount</code>    Cost of the item.
         
     | 
| 
      
 87 
     | 
    
         
            +
                # * <code>order => items => description</code>    Description of the item.
         
     | 
| 
      
 88 
     | 
    
         
            +
                # * <code>order => items => name</code>    Item name.
         
     | 
| 
      
 89 
     | 
    
         
            +
                # * <code>order => items => product</code>    Product information associated with the item.
         
     | 
| 
      
 90 
     | 
    
         
            +
                # * <code>order => items => quantity</code>    Quantity of the item contained in the order [min value: 1, max value: 999999, default: 1] <b>required </b>
         
     | 
| 
      
 91 
     | 
    
         
            +
                # * <code>order => items => reference</code>    A merchant reference for the item. [max length: 255]
         
     | 
| 
      
 92 
     | 
    
         
            +
                # * <code>order => items => tax</code>    Taxes associated with the item.
         
     | 
| 
      
 93 
     | 
    
         
            +
                # * <code>order => merchantNote</code>    Additional notes provided by the merchant. [max length: 255]
         
     | 
| 
      
 94 
     | 
    
         
            +
                # * <code>order => payment</code>    ID of the payment associated with the order.
         
     | 
| 
      
 95 
     | 
    
         
            +
                # * <code>order => reference</code>    A merchant reference for the order. [max length: 255]
         
     | 
| 
      
 96 
     | 
    
         
            +
                # * <code>order => shippingAddress => city</code>    City, town, or municipality. [max length: 255, min length: 2]
         
     | 
| 
      
 97 
     | 
    
         
            +
                # * <code>order => shippingAddress => country</code>    2-character country code. [max length: 2, min length: 2]
         
     | 
| 
      
 98 
     | 
    
         
            +
                # * <code>order => shippingAddress => line1</code>    Street address. [max length: 255]
         
     | 
| 
      
 99 
     | 
    
         
            +
                # * <code>order => shippingAddress => line2</code>    (Opt) Street address continued. [max length: 255]
         
     | 
| 
      
 100 
     | 
    
         
            +
                # * <code>order => shippingAddress => name</code>    Name of the entity being shipped to. [max length: 255]
         
     | 
| 
      
 101 
     | 
    
         
            +
                # * <code>order => shippingAddress => state</code>    State or province. [max length: 255]
         
     | 
| 
      
 102 
     | 
    
         
            +
                # * <code>order => shippingAddress => zip</code>    Postal code. [max length: 32]
         
     | 
| 
      
 103 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => city</code>    City, town, or municipality. [max length: 255, min length: 2]
         
     | 
| 
      
 104 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => country</code>    2-character country code. [max length: 2, min length: 2]
         
     | 
| 
      
 105 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => line1</code>    Street address. [max length: 255]
         
     | 
| 
      
 106 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => line2</code>    (Opt) Street address continued. [max length: 255]
         
     | 
| 
      
 107 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => name</code>    Name of the entity performing the shipping. [max length: 255]
         
     | 
| 
      
 108 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => state</code>    State or province. [max length: 255]
         
     | 
| 
      
 109 
     | 
    
         
            +
                # * <code>order => shippingFromAddress => zip</code>    Postal code. [max length: 32]
         
     | 
| 
      
 110 
     | 
    
         
            +
                # * <code>order => shippingName</code>    Name of the entity being shipped to.
         
     | 
| 
      
 111 
     | 
    
         
            +
                # * <code>order => source</code>    Order source. [default: WEB] <b>required </b>
         
     | 
| 
      
 112 
     | 
    
         
            +
                # * <code>order => status</code>    Status of the order. [default: INCOMPLETE] <b>required </b>
         
     | 
| 
       80 
113 
     | 
    
         
             
                # * <code>reference</code>    Custom reference field to be used with outside systems.
         
     | 
| 
       81 
114 
     | 
    
         
             
                # * <code>replayId</code>    An identifier that can be sent to uniquely identify a payment request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your payments. If supplied, we will check for a payment on your account that matches this identifier. If found will attempt to return an identical response of the original request. [max length: 50, min length: 1]
         
     | 
| 
      
 115 
     | 
    
         
            +
                # * <code>statementDescription => name</code>    Merchant name. <b>required </b>
         
     | 
| 
      
 116 
     | 
    
         
            +
                # * <code>statementDescription => phoneNumber</code>    Merchant contact phone number.
         
     | 
| 
      
 117 
     | 
    
         
            +
                # * <code>taxExempt</code>    Specify true to indicate that the payment is tax-exempt.
         
     | 
| 
       82 
118 
     | 
    
         
             
                # * <code>token</code>    If specified, card associated with card token will be used. [max length: 255]
         
     | 
| 
       83 
119 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       84 
120 
     | 
    
         
             
                # Returns a Payment object.
         
     | 
| 
         @@ -94,10 +130,10 @@ class Payment < Hash 
     | 
|
| 
       94 
130 
     | 
    
         | 
| 
       95 
131 
     | 
    
         
             
                # Retrieve Payment objects.
         
     | 
| 
       96 
132 
     | 
    
         
             
                # criteria:: a hash of parameters; valid keys are: 
         
     | 
| 
       97 
     | 
    
         
            -
                # * <code>filter</code>     
     | 
| 
       98 
     | 
    
         
            -
                # * <code>max</code>    Allows up to a max of 50 list items to return. [max value: 50, default: 20] 
         
     | 
| 
       99 
     | 
    
         
            -
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [default: 0] 
         
     | 
| 
       100 
     | 
    
         
            -
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> dateCreated</code><code> amount</code><code> id</code><code> description</code><code> paymentDate</code>.
         
     | 
| 
      
 133 
     | 
    
         
            +
                # * <code>filter</code>    <table class="filter_list"><tr><td>filter.id</td><td>Filter by the payment Id</td></tr><tr><td>filter.replayId</td><td>Filter by the compoundReplayId</td></tr><tr><td>filter.last4</td><td>Filter by the card number (last 4 digits)</td></tr><tr><td>filter.amount</td><td>Filter by the payment amount (in the smallest unit of your currency)</td></tr><tr><td>filter.text</td><td>Filter by the description of the payment</td></tr><tr><td>filter.amountMin & filter.amountMax</td><td>The filter amountMin must be used with amountMax to find payments with payments amounts between the min and max figures</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.deposit</td><td>Filter by the deposit id connected to the payment</td></tr><tr><td>filter.customer</td><td>Filter using the Id of the customer to find the payments for that customer</td></tr><tr><td>filter.status</td><td>Filter by the payment status text</td></tr><tr><td>filter.reference</td><td>Filter by the payment reference text</td></tr><tr><td>filter.authCode</td><td>Filter by the payment authorization code (Not the authorization ID)</td></tr><tr><td>filter.q</td><td>You can use this to filter by the Id, the authCode or the amount of the payment</td></tr></table><br><sup>*</sup>Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates 
         
     | 
| 
      
 134 
     | 
    
         
            +
                # * <code>max</code>    Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] 
         
     | 
| 
      
 135 
     | 
    
         
            +
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0] 
         
     | 
| 
      
 136 
     | 
    
         
            +
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> dateCreated</code><code> createdBy</code><code> amount</code><code> id</code><code> description</code><code> paymentDate</code>.
         
     | 
| 
       101 
137 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       102 
138 
     | 
    
         
             
                # Returns an object where the <code>list</code> property contains the list of Payment objects and the <code>total</code>
         
     | 
| 
       103 
139 
     | 
    
         
             
                # property contains the total number of Payment objects available for the given criteria.
         
     | 
    
        data/lib/simplify/paymentsapi.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -44,6 +44,8 @@ module Simplify 
     | 
|
| 
       44 
44 
     | 
    
         
             
              @@api_base_sandbox_url = Constants::api_base_sandbox_url
         
     | 
| 
       45 
45 
     | 
    
         
             
              @@oauth_base_url = Constants::oauth_base_url
         
     | 
| 
       46 
46 
     | 
    
         
             
              @@user_agent = nil
         
     | 
| 
      
 47 
     | 
    
         
            +
              @@request_timeout = nil
         
     | 
| 
      
 48 
     | 
    
         
            +
              @@request_options = nil
         
     | 
| 
       47 
49 
     | 
    
         | 
| 
       48 
50 
     | 
    
         | 
| 
       49 
51 
     | 
    
         
             
              # Returns the value of the public API key.
         
     | 
| 
         @@ -106,6 +108,26 @@ module Simplify 
     | 
|
| 
       106 
108 
     | 
    
         
             
                @@user_agent = ua
         
     | 
| 
       107 
109 
     | 
    
         
             
              end
         
     | 
| 
       108 
110 
     | 
    
         | 
| 
      
 111 
     | 
    
         
            +
              # Returns the timeout in seconds for API requests.
         
     | 
| 
      
 112 
     | 
    
         
            +
              def self.request_timeout
         
     | 
| 
      
 113 
     | 
    
         
            +
                @@request_timeout
         
     | 
| 
      
 114 
     | 
    
         
            +
              end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
              # Sets the timeout in seconds for API requests.
         
     | 
| 
      
 117 
     | 
    
         
            +
              def self.request_timeout=(s)
         
     | 
| 
      
 118 
     | 
    
         
            +
                @@request_timeout = s
         
     | 
| 
      
 119 
     | 
    
         
            +
              end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
              #:nodoc:
         
     | 
| 
      
 122 
     | 
    
         
            +
              def self.request_options
         
     | 
| 
      
 123 
     | 
    
         
            +
                @@request_options
         
     | 
| 
      
 124 
     | 
    
         
            +
              end
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
              #:nodoc:
         
     | 
| 
      
 127 
     | 
    
         
            +
              def self.request_options=(o)
         
     | 
| 
      
 128 
     | 
    
         
            +
                @@request_options = o
         
     | 
| 
      
 129 
     | 
    
         
            +
              end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
       109 
131 
     | 
    
         | 
| 
       110 
132 
     | 
    
         
             
              class PaymentsApi
         
     | 
| 
       111 
133 
     | 
    
         | 
| 
         @@ -222,11 +244,20 @@ module Simplify 
     | 
|
| 
       222 
244 
     | 
    
         
             
                    }.merge(opts[:headers] || {})
         
     | 
| 
       223 
245 
     | 
    
         
             
                  })
         
     | 
| 
       224 
246 
     | 
    
         | 
| 
      
 247 
     | 
    
         
            +
                  if Simplify::request_timeout != nil
         
     | 
| 
      
 248 
     | 
    
         
            +
                    opts[:timeout] = Simplify::request_timeout
         
     | 
| 
      
 249 
     | 
    
         
            +
                  end
         
     | 
| 
      
 250 
     | 
    
         
            +
             
     | 
| 
      
 251 
     | 
    
         
            +
                  if Simplify::request_options != nil
         
     | 
| 
      
 252 
     | 
    
         
            +
                    opts.merge!(Simplify::request_options)
         
     | 
| 
      
 253 
     | 
    
         
            +
                  end
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
       225 
255 
     | 
    
         
             
                  begin
         
     | 
| 
       226 
256 
     | 
    
         
             
                    response = RestClient::Request.execute(opts)
         
     | 
| 
       227 
257 
     | 
    
         
             
                    JSON.parse(response.body)
         
     | 
| 
      
 258 
     | 
    
         
            +
                  rescue RestClient::RequestTimeout => e
         
     | 
| 
      
 259 
     | 
    
         
            +
                    raise ApiException.new("request timeout", nil, nil)
         
     | 
| 
       228 
260 
     | 
    
         
             
                  rescue RestClient::Exception => e
         
     | 
| 
       229 
     | 
    
         
            -
             
     | 
| 
       230 
261 
     | 
    
         
             
                    begin
         
     | 
| 
       231 
262 
     | 
    
         
             
                       errorData = JSON.parse(e.response.body)
         
     | 
| 
       232 
263 
     | 
    
         
             
                    rescue JSON::ParserError => e2
         
     | 
| 
         @@ -281,9 +312,19 @@ module Simplify 
     | 
|
| 
       281 
312 
     | 
    
         
             
                    }.merge(opts[:headers] || {})
         
     | 
| 
       282 
313 
     | 
    
         
             
                  })
         
     | 
| 
       283 
314 
     | 
    
         | 
| 
      
 315 
     | 
    
         
            +
                  if Simplify::request_timeout != nil
         
     | 
| 
      
 316 
     | 
    
         
            +
                    opts[:timeout] = Simplify::request_timeout
         
     | 
| 
      
 317 
     | 
    
         
            +
                  end
         
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
                  if Simplify::request_options != nil
         
     | 
| 
      
 320 
     | 
    
         
            +
                    opts.merge!(Simplify::request_options)
         
     | 
| 
      
 321 
     | 
    
         
            +
                  end
         
     | 
| 
      
 322 
     | 
    
         
            +
             
     | 
| 
       284 
323 
     | 
    
         
             
                  begin
         
     | 
| 
       285 
324 
     | 
    
         
             
                    response = RestClient::Request.execute(opts)
         
     | 
| 
       286 
325 
     | 
    
         
             
                    JSON.parse(response.body)
         
     | 
| 
      
 326 
     | 
    
         
            +
                  rescue RestClient::RequestTimeout => e
         
     | 
| 
      
 327 
     | 
    
         
            +
                    raise ApiException.new("request timeout", nil, nil)
         
     | 
| 
       287 
328 
     | 
    
         
             
                  rescue RestClient::Exception => e
         
     | 
| 
       288 
329 
     | 
    
         | 
| 
       289 
330 
     | 
    
         
             
                    begin
         
     | 
    
        data/lib/simplify/plan.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,10 +60,16 @@ class Plan < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an Plan object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
       63 
     | 
    
         
            -
                # * <code>amount</code>    Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD  
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>amount</code>    Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00USD <b>required </b>
         
     | 
| 
      
 64 
     | 
    
         
            +
                # * <code>billingCycle</code>    How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
         
     | 
| 
      
 65 
     | 
    
         
            +
                # * <code>billingCycleLimit</code>    The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
         
     | 
| 
       64 
66 
     | 
    
         
             
                # * <code>currency</code>    Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] <b>required </b>
         
     | 
| 
       65 
     | 
    
         
            -
                # * <code>frequency</code>    Frequency of payment for the plan.  
     | 
| 
      
 67 
     | 
    
         
            +
                # * <code>frequency</code>    Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] <b>required </b>
         
     | 
| 
      
 68 
     | 
    
         
            +
                # * <code>frequencyPeriod</code>    Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] <b>required </b>
         
     | 
| 
       66 
69 
     | 
    
         
             
                # * <code>name</code>    Name of the plan [max length: 50, min length: 2] <b>required </b>
         
     | 
| 
      
 70 
     | 
    
         
            +
                # * <code>renewalReminderLeadDays</code>    If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
         
     | 
| 
      
 71 
     | 
    
         
            +
                # * <code>trialPeriod</code>    Plan free trial period selection.  Must be Days, Weeks, or Month [default: NONE] <b>required </b>
         
     | 
| 
      
 72 
     | 
    
         
            +
                # * <code>trialPeriodQuantity</code>    Quantity of the trial period.  Must be greater than 0 and a whole number. [min value: 1]
         
     | 
| 
       67 
73 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       68 
74 
     | 
    
         
             
                # Returns a Plan object.
         
     | 
| 
       69 
75 
     | 
    
         
             
                def self.create(parms, *auth)
         
     | 
| 
         @@ -85,9 +91,9 @@ class Plan < Hash 
     | 
|
| 
       85 
91 
     | 
    
         | 
| 
       86 
92 
     | 
    
         
             
                # Retrieve Plan objects.
         
     | 
| 
       87 
93 
     | 
    
         
             
                # criteria:: a hash of parameters; valid keys are: 
         
     | 
| 
       88 
     | 
    
         
            -
                # * <code>filter</code>     
     | 
| 
       89 
     | 
    
         
            -
                # * <code>max</code>    Allows up to a max of 50 list items to return. [max value: 50, default: 20] 
         
     | 
| 
       90 
     | 
    
         
            -
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [default: 0] 
         
     | 
| 
      
 94 
     | 
    
         
            +
                # * <code>filter</code>    <table class="filter_list"><tr><td>filter.id</td><td>Filter by the plan Id</td></tr><tr><td>filter.text</td><td>Filter by the name of the plan</td></tr><tr><td>filter.frequency</td><td>Filter by the frequency of the plan</td></tr><tr><td>filter.amountMin & filter.amountMax</td><td>The filter amountMin must be used with amountMax to find plans with plan values between the min and max figures</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.q</td><td>You can use this to filter by the Id, the name or the amount of the plan</td></tr></table><br><sup>*</sup>Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates 
         
     | 
| 
      
 95 
     | 
    
         
            +
                # * <code>max</code>    Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] 
         
     | 
| 
      
 96 
     | 
    
         
            +
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0] 
         
     | 
| 
       91 
97 
     | 
    
         
             
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> dateCreated</code><code> amount</code><code> frequency</code><code> name</code><code> id</code>.
         
     | 
| 
       92 
98 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       93 
99 
     | 
    
         
             
                # Returns an object where the <code>list</code> property contains the list of Plan objects and the <code>total</code>
         
     | 
    
        data/lib/simplify/refund.rb
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,11 +60,13 @@ class Refund < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an Refund object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
       63 
     | 
    
         
            -
                # * <code>amount</code>    Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00USD  
     | 
| 
       64 
     | 
    
         
            -
                # * <code>payment</code>    ID of the payment for the refund 
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>amount</code>    Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00USD <b>required </b>
         
     | 
| 
      
 64 
     | 
    
         
            +
                # * <code>payment</code>    ID of the payment for the refund
         
     | 
| 
       65 
65 
     | 
    
         
             
                # * <code>reason</code>    Reason for the refund
         
     | 
| 
       66 
66 
     | 
    
         
             
                # * <code>reference</code>    Custom reference field to be used with outside systems.
         
     | 
| 
       67 
67 
     | 
    
         
             
                # * <code>replayId</code>    An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request. [max length: 50, min length: 1]
         
     | 
| 
      
 68 
     | 
    
         
            +
                # * <code>statementDescription => name</code>    Merchant name. <b>required </b>
         
     | 
| 
      
 69 
     | 
    
         
            +
                # * <code>statementDescription => phoneNumber</code>    Merchant contact phone number.
         
     | 
| 
       68 
70 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       69 
71 
     | 
    
         
             
                # Returns a Refund object.
         
     | 
| 
       70 
72 
     | 
    
         
             
                def self.create(parms, *auth)
         
     | 
| 
         @@ -79,9 +81,9 @@ class Refund < Hash 
     | 
|
| 
       79 
81 
     | 
    
         | 
| 
       80 
82 
     | 
    
         
             
                # Retrieve Refund objects.
         
     | 
| 
       81 
83 
     | 
    
         
             
                # criteria:: a hash of parameters; valid keys are: 
         
     | 
| 
       82 
     | 
    
         
            -
                # * <code>filter</code>     
     | 
| 
       83 
     | 
    
         
            -
                # * <code>max</code>    Allows up to a max of 50 list items to return. [max value: 50, default: 20] 
         
     | 
| 
       84 
     | 
    
         
            -
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [default: 0] 
         
     | 
| 
      
 84 
     | 
    
         
            +
                # * <code>filter</code>    <table class="filter_list"><tr><td>filter.id</td><td>Filter by the refund Id</td></tr><tr><td>filter.text</td><td>Filter by the refund description text</td></tr><tr><td>filter.replayId</td><td>Filter by the compoundReplayId</td></tr><tr><td>filter.authCode</td><td>Filter by the authorization code (Not authorization ID)</td></tr><tr><td>filter.amount</td><td>Filter by the refund amount (in the smallest unit of your currency)</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.deposit</td><td>Filter by the deposit id</td></tr><tr><td>filter.q</td><td>You can use this to filter by the Id, the authCode or the amount of the refund</td></tr></table><br><sup>*</sup>Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates 
         
     | 
| 
      
 85 
     | 
    
         
            +
                # * <code>max</code>    Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] 
         
     | 
| 
      
 86 
     | 
    
         
            +
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0] 
         
     | 
| 
       85 
87 
     | 
    
         
             
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> id</code><code> amount</code><code> description</code><code> dateCreated</code><code> paymentDate</code>.
         
     | 
| 
       86 
88 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       87 
89 
     | 
    
         
             
                # Returns an object where the <code>list</code> property contains the list of Refund objects and the <code>total</code>
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #
         
     | 
| 
       2 
     | 
    
         
            -
            # Copyright (c) 2013 
     | 
| 
      
 2 
     | 
    
         
            +
            # Copyright (c) 2013 - 2016 MasterCard International Incorporated
         
     | 
| 
       3 
3 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # 
         
     | 
| 
       5 
5 
     | 
    
         
             
            # Redistribution and use in source and binary forms, with or without modification, are 
         
     | 
| 
         @@ -60,14 +60,18 @@ class Subscription < Hash 
     | 
|
| 
       60 
60 
     | 
    
         
             
                # Creates an Subscription object
         
     | 
| 
       61 
61 
     | 
    
         
             
                #
         
     | 
| 
       62 
62 
     | 
    
         
             
                # parms:: a hash of parameters; valid keys are:
         
     | 
| 
       63 
     | 
    
         
            -
                # * <code>amount</code>    Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD 
     | 
| 
      
 63 
     | 
    
         
            +
                # * <code>amount</code>    Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD
         
     | 
| 
      
 64 
     | 
    
         
            +
                # * <code>billingCycle</code>    How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
         
     | 
| 
      
 65 
     | 
    
         
            +
                # * <code>billingCycleLimit</code>    The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
         
     | 
| 
       64 
66 
     | 
    
         
             
                # * <code>coupon</code>    Coupon ID associated with the subscription
         
     | 
| 
       65 
67 
     | 
    
         
             
                # * <code>currency</code>    Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
         
     | 
| 
       66 
68 
     | 
    
         
             
                # * <code>customer</code>    Customer that is enrolling in the subscription.
         
     | 
| 
       67 
     | 
    
         
            -
                # * <code>frequency</code>    Frequency of payment for the plan.  
     | 
| 
      
 69 
     | 
    
         
            +
                # * <code>frequency</code>    Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
         
     | 
| 
      
 70 
     | 
    
         
            +
                # * <code>frequencyPeriod</code>    Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
         
     | 
| 
       68 
71 
     | 
    
         
             
                # * <code>name</code>    Name describing subscription
         
     | 
| 
       69 
72 
     | 
    
         
             
                # * <code>plan</code>    The ID of the plan that should be used for the subscription.
         
     | 
| 
       70 
73 
     | 
    
         
             
                # * <code>quantity</code>    Quantity of the plan for the subscription. [min value: 1]
         
     | 
| 
      
 74 
     | 
    
         
            +
                # * <code>renewalReminderLeadDays</code>    If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
         
     | 
| 
       71 
75 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       72 
76 
     | 
    
         
             
                # Returns a Subscription object.
         
     | 
| 
       73 
77 
     | 
    
         
             
                def self.create(parms, *auth)
         
     | 
| 
         @@ -89,10 +93,10 @@ class Subscription < Hash 
     | 
|
| 
       89 
93 
     | 
    
         | 
| 
       90 
94 
     | 
    
         
             
                # Retrieve Subscription objects.
         
     | 
| 
       91 
95 
     | 
    
         
             
                # criteria:: a hash of parameters; valid keys are: 
         
     | 
| 
       92 
     | 
    
         
            -
                # * <code>filter</code>     
     | 
| 
       93 
     | 
    
         
            -
                # * <code>max</code>    Allows up to a max of 50 list items to return. [max value: 50, default: 20] 
         
     | 
| 
       94 
     | 
    
         
            -
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [default: 0] 
         
     | 
| 
       95 
     | 
    
         
            -
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> id</code><code> plan</code>.
         
     | 
| 
      
 96 
     | 
    
         
            +
                # * <code>filter</code>    <table class="filter_list"><tr><td>filter.customer</td><td>Filter by the Id of the customer with the subscription</td></tr><tr><td>filter.plan</td><td>Filter by the Id of the plan linked to the subscription</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.q</td><td>You can use this to filter by the Id, the name or the amount of the subscription</td></tr></table><br><sup>*</sup>Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates 
         
     | 
| 
      
 97 
     | 
    
         
            +
                # * <code>max</code>    Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20] 
         
     | 
| 
      
 98 
     | 
    
         
            +
                # * <code>offset</code>    Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0] 
         
     | 
| 
      
 99 
     | 
    
         
            +
                # * <code>sorting</code>    Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either <code>asc</code> for ascending or <code>desc</code> for descending).  Sortable properties are: <code> dateCreated</code><code> id</code><code> plan</code>.
         
     | 
| 
       96 
100 
     | 
    
         
             
                # auth:: Authentication information used for the API call.  If no value is passed the global keys Simplify::public_key and Simplify::private_key are used.  For backwards compatibility the public and private keys may be passed instead of the authentication object.
         
     | 
| 
       97 
101 
     | 
    
         
             
                # Returns an object where the <code>list</code> property contains the list of Subscription objects and the <code>total</code>
         
     | 
| 
       98 
102 
     | 
    
         
             
                # property contains the total number of Subscription objects available for the given criteria.
         
     | 
| 
         @@ -125,14 +129,18 @@ class Subscription < Hash 
     | 
|
| 
       125 
129 
     | 
    
         
             
                # Updates this object
         
     | 
| 
       126 
130 
     | 
    
         
             
                #
         
     | 
| 
       127 
131 
     | 
    
         
             
                # The properties that can be updated:
         
     | 
| 
       128 
     | 
    
         
            -
                # * <code>amount</code> Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD 
     | 
| 
      
 132 
     | 
    
         
            +
                # * <code>amount</code> Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00USD
         
     | 
| 
      
 133 
     | 
    
         
            +
            # * <code>billingCycle</code> How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
         
     | 
| 
      
 134 
     | 
    
         
            +
            # * <code>billingCycleLimit</code> The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
         
     | 
| 
       129 
135 
     | 
    
         
             
            # * <code>coupon</code> Coupon being assigned to this subscription
         
     | 
| 
       130 
136 
     | 
    
         
             
            # * <code>currency</code> Currency code (ISO-4217). Must match the currency associated with your account. [default: USD]
         
     | 
| 
       131 
     | 
    
         
            -
            # * <code>frequency</code> Frequency of payment for the plan.  
     | 
| 
      
 137 
     | 
    
         
            +
            # * <code>frequency</code> Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
         
     | 
| 
      
 138 
     | 
    
         
            +
            # * <code>frequencyPeriod</code> Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1]
         
     | 
| 
       132 
139 
     | 
    
         
             
            # * <code>name</code> Name describing subscription
         
     | 
| 
       133 
140 
     | 
    
         
             
            # * <code>plan</code> Plan that should be used for the subscription.
         
     | 
| 
       134 
141 
     | 
    
         
             
            # * <code>prorate</code> Whether to prorate existing subscription. [default: true] <b>(required)</b>
         
     | 
| 
       135 
142 
     | 
    
         
             
            # * <code>quantity</code> Quantity of the plan for the subscription. [min value: 1]
         
     | 
| 
      
 143 
     | 
    
         
            +
            # * <code>renewalReminderLeadDays</code> If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null or 0, no emails are sent. Minimum value is 7 if set.
         
     | 
| 
       136 
144 
     | 
    
         
             
                def update()
         
     | 
| 
       137 
145 
     | 
    
         
             
                      h = Simplify::PaymentsApi.execute("subscription", 'update', self, self.authentication)
         
     | 
| 
       138 
146 
     | 
    
         
             
                      self.merge!(h)
         
     |