WooCommerce Square - Version 3.4.0

Version Description

  • 2022-12-05 =
  • Add - Ability to export the Sync with Square status while exporting products.
  • Add - Link to support forum under Sync Setting.
  • Dev - Bump NPM version from 6.0.0 to 8.0.0.
  • Dev - Bump node version from 12.0.0 to 16.0.0.
  • Dev - Remove redundant build-zip npm command.
  • Fix - Address issue with Square variation names containing a pipe character.
  • Update - Blocks forms on the product, cart and checkout pages when a digital wallet payment is being processed.
  • Update - Square PHP SDK to version 19.0.1.20220512.
  • Fix - Ensure we show more accurate error messages.
  • Fix - Hide variation in WooCommerce when the variation is deleted from Square.
  • Fix - Incomplete product import issue when the number of products is very high.
  • Fix - Incorrect coupon discount calculation which results into incorrect tax calculation.
  • Fix - JS error thrown by Digital Wallets on Cart and Checkout pages due to unsupported product types.
  • Fix - Remove unnecessary calls to getLocation when doing a manual sync.
  • Fix - Set price money based on price overrides for a location.
  • Update - Bump minimum supported PHP version to 7.2.
  • Update - Bump minimum supported WooCommerce version to 6.0.
  • Update - Bump minimum supported WordPress version to 5.6.
  • Update - Rename System of Record to Sync Setting.
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Square
Version 3.4.0
Comparing to
See all releases

Code changes from version 3.3.0 to 3.4.0

Files changed (189) hide show
  1. assets/js/admin/wc-square-admin-settings.min.js +1 -1
  2. assets/js/frontend/wc-square-digital-wallet.min.js +1 -1
  3. changelog.txt +21 -0
  4. i18n/languages/woocommerce-square.pot +162 -112
  5. includes/Admin/Sync_Page.php +6 -6
  6. includes/Emails/Sync_Completed.php +16 -15
  7. includes/Framework/Compatibility/Order_Compatibility.php +1 -17
  8. includes/Framework/PaymentGateway/Admin/views/html-admin-gateway-status.php +2 -2
  9. includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor.php +11 -6
  10. includes/Framework/PaymentGateway/Admin/views/html-user-profile-section.php +3 -2
  11. includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php +39 -38
  12. includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php +28 -11
  13. includes/Framework/PaymentGateway/Payment_Gateway_Direct.php +5 -5
  14. includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php +108 -76
  15. includes/Framework/Plugin_Compatibility.php +2 -55
  16. includes/Framework/Plugin_Dependencies.php +4 -4
  17. includes/Gateway/API/Requests/Customers.php +0 -3
  18. includes/Gateway/API/Requests/Orders.php +56 -13
  19. includes/Gateway/API/Requests/Payments.php +0 -5
  20. includes/Gateway/API/Requests/Refunds.php +3 -2
  21. includes/Gateway/API/Requests/Transactions.php +0 -5
  22. includes/Gateway/Digital_Wallet.php +2 -0
  23. includes/Handlers/Background_Job.php +1 -1
  24. includes/Handlers/Product.php +72 -13
  25. includes/Handlers/Products.php +84 -2
  26. includes/Handlers/Sync.php +18 -0
  27. includes/Lifecycle.php +2 -2
  28. includes/Settings.php +28 -19
  29. includes/Sync/Interval_Polling.php +10 -5
  30. includes/Sync/Manual_Synchronization.php +82 -14
  31. includes/Sync/Product_Import.php +5 -7
  32. includes/Sync/Records/Record.php +13 -5
  33. includes/Utilities/Helper.php +3 -58
  34. includes/Utilities/Money_Utility.php +4 -18
  35. readme.txt +25 -4
  36. vendor/apimatic/jsonmapper/.github/workflows/test.yml +3 -1
  37. vendor/apimatic/jsonmapper/.gitignore +20 -1
  38. vendor/apimatic/jsonmapper/README.rst +10 -1
  39. vendor/apimatic/jsonmapper/composer.json +5 -2
  40. vendor/apimatic/jsonmapper/src/JsonMapper.php +973 -139
  41. vendor/apimatic/jsonmapper/src/JsonMapperException.php +191 -2
  42. vendor/apimatic/jsonmapper/src/TypeCombination.php +315 -0
  43. vendor/apimatic/jsonmapper/tests/JsonMapperTest.php +214 -96
  44. vendor/apimatic/jsonmapper/tests/JsonMapperTest/Array.php +27 -0
  45. vendor/apimatic/jsonmapper/tests/JsonMapperTest/DependencyInjector.php +5 -5
  46. vendor/apimatic/jsonmapper/tests/JsonMapperTest/JsonMapperCommentsDiscardedException.php +20 -0
  47. vendor/apimatic/jsonmapper/tests/JsonMapperTest/Php7TypedClass.php +1 -1
  48. vendor/apimatic/jsonmapper/tests/JsonMapperTest/Php7_1TypedClass.php +1 -1
  49. vendor/apimatic/jsonmapper/tests/multitypetest/MultiTypeJsonMapper.php +19 -0
  50. vendor/apimatic/jsonmapper/tests/multitypetest/MultiTypeTest.php +1449 -0
  51. vendor/apimatic/jsonmapper/tests/multitypetest/model/Atom.php +89 -0
  52. vendor/apimatic/jsonmapper/tests/multitypetest/model/Car.php +64 -0
  53. vendor/apimatic/jsonmapper/tests/multitypetest/model/ComplexCaseA.php +95 -0
  54. vendor/apimatic/jsonmapper/tests/multitypetest/model/ComplexCaseB.php +91 -0
  55. vendor/apimatic/jsonmapper/tests/multitypetest/model/DateTimeHelper.php +381 -0
  56. vendor/apimatic/jsonmapper/tests/multitypetest/model/DaysEnum.php +66 -0
  57. vendor/apimatic/jsonmapper/tests/multitypetest/model/Employee.php +236 -0
  58. vendor/apimatic/jsonmapper/tests/multitypetest/model/Evening.php +122 -0
  59. vendor/apimatic/jsonmapper/tests/multitypetest/model/MonthNameEnum.php +78 -0
  60. vendor/apimatic/jsonmapper/tests/multitypetest/model/MonthNumberEnum.php +78 -0
  61. vendor/apimatic/jsonmapper/tests/multitypetest/model/Morning.php +122 -0
  62. vendor/apimatic/jsonmapper/tests/multitypetest/model/Orbit.php +62 -0
  63. vendor/apimatic/jsonmapper/tests/multitypetest/model/OuterArrayCase.php +63 -0
  64. vendor/apimatic/jsonmapper/tests/multitypetest/model/Person.php +232 -0
  65. vendor/apimatic/jsonmapper/tests/multitypetest/model/Postman.php +212 -0
  66. vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCase.php +63 -0
  67. vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCaseA.php +64 -0
  68. vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCaseB.php +63 -0
  69. vendor/apimatic/jsonmapper/tests/multitypetest/model/Vehicle.php +62 -0
  70. vendor/apimatic/jsonmapper/tests/multitypetest/model/Vehicle2.php +62 -0
  71. vendor/apimatic/jsonmapper/tests/namespacetest/NamespaceTest.php +8 -4
  72. vendor/apimatic/unirest-php/.github/workflows/php.yml +34 -0
  73. vendor/apimatic/unirest-php/.gitignore +1 -0
  74. vendor/apimatic/unirest-php/.travis.yml +0 -16
  75. vendor/apimatic/unirest-php/README.md +2 -2
  76. vendor/apimatic/unirest-php/composer.json +1 -1
  77. vendor/apimatic/unirest-php/src/Unirest/OverrideRetry.php +21 -0
  78. vendor/apimatic/unirest-php/src/Unirest/Request.php +325 -55
  79. vendor/apimatic/unirest-php/src/Unirest/Response.php +5 -47
  80. vendor/apimatic/unirest-php/tests/Unirest/RequestChild.php +16 -0
  81. vendor/apimatic/unirest-php/tests/Unirest/RequestTest.php +65 -7
  82. vendor/autoload.php +3 -16
  83. vendor/composer/InstalledVersions.php +7 -7
  84. vendor/composer/autoload_real.php +4 -4
  85. vendor/composer/autoload_static.php +5 -5
  86. vendor/composer/installed.json +30 -27
  87. vendor/composer/installed.php +13 -13
  88. vendor/square/square/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
  89. vendor/square/square/.github/workflows/automerge.yml +0 -33
  90. vendor/square/square/CHANGELOG.md +64 -0
  91. vendor/square/square/CONTRIBUTING.md +21 -0
  92. vendor/square/square/LICENSE +1 -1
  93. vendor/square/square/README.md +54 -307
  94. vendor/square/square/composer.json +5 -5
  95. vendor/square/square/doc/apis/apple-pay.md +2 -2
  96. vendor/square/square/doc/apis/bank-accounts.md +10 -14
  97. vendor/square/square/doc/apis/bookings.md +101 -68
  98. vendor/square/square/doc/apis/cards.md +11 -23
  99. vendor/square/square/doc/apis/cash-drawers.md +10 -17
  100. vendor/square/square/doc/apis/catalog.md +126 -466
  101. vendor/square/square/doc/apis/checkout.md +223 -77
  102. vendor/square/square/doc/apis/customer-custom-attributes.md +547 -0
  103. vendor/square/square/doc/apis/customer-groups.md +15 -25
  104. vendor/square/square/doc/apis/customer-segments.md +7 -10
  105. vendor/square/square/doc/apis/customers.md +32 -60
  106. vendor/square/square/doc/apis/devices.md +10 -18
  107. vendor/square/square/doc/apis/disputes.md +29 -41
  108. vendor/square/square/doc/apis/employees.md +6 -11
  109. vendor/square/square/doc/apis/gift-card-activities.md +16 -36
  110. vendor/square/square/doc/apis/gift-cards.md +34 -47
  111. vendor/square/square/doc/apis/inventory.md +60 -122
  112. vendor/square/square/doc/apis/invoices.md +26 -71
  113. vendor/square/square/doc/apis/labor.md +42 -100
  114. vendor/square/square/doc/apis/locations.md +39 -49
  115. vendor/square/square/doc/apis/loyalty.md +53 -100
  116. vendor/square/square/doc/apis/merchants.md +14 -14
  117. vendor/square/square/doc/apis/mobile-authorization.md +4 -4
  118. vendor/square/square/doc/apis/o-auth.md +14 -20
  119. vendor/square/square/doc/apis/orders.md +33 -241
  120. vendor/square/square/doc/apis/payments.md +19 -38
  121. vendor/square/square/doc/apis/payouts.md +151 -0
  122. vendor/square/square/doc/apis/refunds.md +12 -24
  123. vendor/square/square/doc/apis/sites.md +2 -2
  124. vendor/square/square/doc/apis/snippets.md +10 -14
  125. vendor/square/square/doc/apis/subscriptions.md +156 -39
  126. vendor/square/square/doc/apis/team.md +22 -38
  127. vendor/square/square/doc/apis/terminal.md +203 -55
  128. vendor/square/square/doc/apis/transactions.md +10 -14
  129. vendor/square/square/doc/apis/v1-transactions.md +29 -56
  130. vendor/square/square/doc/apis/vendors.md +315 -0
  131. vendor/square/square/doc/client.md +18 -5
  132. vendor/square/square/doc/models/accept-dispute-response.md +2 -2
  133. vendor/square/square/doc/models/accepted-payment-methods.md +27 -0
  134. vendor/square/square/doc/models/accumulate-loyalty-points-request.md +2 -2
  135. vendor/square/square/doc/models/accumulate-loyalty-points-response.md +2 -2
  136. vendor/square/square/doc/models/ach-details.md +3 -3
  137. vendor/square/square/doc/models/activity-type.md +46 -0
  138. vendor/square/square/doc/models/add-group-to-customer-response.md +2 -2
  139. vendor/square/square/doc/models/additional-recipient.md +6 -6
  140. vendor/square/square/doc/models/address.md +14 -44
  141. vendor/square/square/doc/models/adjust-loyalty-points-request.md +1 -1
  142. vendor/square/square/doc/models/adjust-loyalty-points-response.md +2 -2
  143. vendor/square/square/doc/models/afterpay-details.md +23 -0
  144. vendor/square/square/doc/models/application-details.md +3 -3
  145. vendor/square/square/doc/models/appointment-segment.md +11 -5
  146. vendor/square/square/doc/models/availability.md +6 -13
  147. vendor/square/square/doc/models/bank-account-payment-details.md +10 -7
  148. vendor/square/square/doc/models/bank-account.md +11 -9
  149. vendor/square/square/doc/models/batch-change-inventory-request.md +3 -3
  150. vendor/square/square/doc/models/batch-change-inventory-response.md +3 -3
  151. vendor/square/square/doc/models/batch-delete-catalog-objects-response.md +1 -1
  152. vendor/square/square/doc/models/batch-retrieve-catalog-objects-request.md +3 -2
  153. vendor/square/square/doc/models/batch-retrieve-catalog-objects-response.md +3 -3
  154. vendor/square/square/doc/models/batch-retrieve-inventory-changes-request.md +2 -2
  155. vendor/square/square/doc/models/batch-retrieve-inventory-changes-response.md +4 -4
  156. vendor/square/square/doc/models/batch-retrieve-inventory-counts-request.md +1 -1
  157. vendor/square/square/doc/models/batch-retrieve-inventory-counts-response.md +2 -2
  158. vendor/square/square/doc/models/batch-retrieve-orders-response.md +2 -2
  159. vendor/square/square/doc/models/batch-upsert-catalog-objects-request.md +1 -1
  160. vendor/square/square/doc/models/batch-upsert-catalog-objects-response.md +3 -3
  161. vendor/square/square/doc/models/booking-booking-source.md +18 -0
  162. vendor/square/square/doc/models/booking-creator-details-creator-type.md +16 -0
  163. vendor/square/square/doc/models/booking-creator-details.md +27 -0
  164. vendor/square/square/doc/models/booking.md +31 -15
  165. vendor/square/square/doc/models/break-type.md +4 -4
  166. vendor/square/square/doc/models/bulk-create-team-members-request.md +1 -1
  167. vendor/square/square/doc/models/bulk-create-team-members-response.md +2 -2
  168. vendor/square/square/doc/models/bulk-create-vendors-request.md +60 -0
  169. vendor/square/square/doc/models/bulk-create-vendors-response.md +72 -0
  170. vendor/square/square/doc/models/bulk-retrieve-vendors-request.md +25 -0
  171. vendor/square/square/doc/models/bulk-retrieve-vendors-response.md +54 -0
  172. vendor/square/square/doc/models/bulk-update-team-members-request.md +1 -1
  173. vendor/square/square/doc/models/bulk-update-team-members-response.md +10 -8
  174. vendor/square/square/doc/models/bulk-update-vendors-request.md +69 -0
  175. vendor/square/square/doc/models/bulk-update-vendors-response.md +76 -0
  176. vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md +37 -0
  177. vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-request.md +59 -0
  178. vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md +33 -0
  179. vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-response.md +81 -0
  180. vendor/square/square/doc/models/business-appointment-settings-booking-location-type.md +1 -1
  181. vendor/square/square/doc/models/business-appointment-settings.md +19 -14
  182. vendor/square/square/doc/models/business-booking-profile.md +13 -9
  183. vendor/square/square/doc/models/business-hours-period.md +6 -6
  184. vendor/square/square/doc/models/business-hours.md +3 -19
  185. vendor/square/square/doc/models/buy-now-pay-later-details.md +25 -0
  186. vendor/square/square/doc/models/calculate-loyalty-points-request.md +2 -2
  187. vendor/square/square/doc/models/calculate-loyalty-points-response.md +1 -1
  188. vendor/square/square/doc/models/calculate-order-request.md +2 -2
  189. vendor/square/square/doc/models/calculate-order-response.md +0 -2
assets/js/admin/wc-square-admin-settings.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";jQuery(document).ready($=>{var pagenow=window.pagenow||"";if("woocommerce_page_wc-settings"!==pagenow){return}window.serialize_form=form=>{var form_data=$(form).serializeArray();form_data=$.grep(form_data,e=>{return e.name!=="_wp_http_referer"&&e.name!=="_wpnonce"});form_data.sort((a,b)=>a.name>b.name?1:-1);return form_data};var is_square_settings_page=false;var url_params=new window.URLSearchParams(window.location.search);var new_square_settings;var current_square_settings;var is_sor_set;var location_id=$("#wc_square_location_id, #wc_square_sandbox_location_id").val();var show_changes_message=$(".wc_square_save_changes_message");if("square"===url_params.get("tab")&&(!url_params.get("section")||""!==url_params.get("section"))){is_square_settings_page=true;current_square_settings=serialize_form($("#mainform"))}$(document).on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if(is_sor_set&&location_id&&location_id.length){$import_products_row.show()}else{$import_products_row.hide()}});$("#mainform :input").on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");new_square_settings=serialize_form("#mainform");if(JSON.stringify(current_square_settings)!==JSON.stringify(new_square_settings)){if(e.target.name==="wc_square_sandbox_location_id"||e.target.name==="wc_square_location_id"){return}show_changes_message.show();$import_products.addClass("disabled")}else{show_changes_message.hide();$import_products.removeClass("disabled")}});$("#wc_square_sandbox_location_id, #wc_square_location_id").on("change",function(){location_id=$(this).val()});if(!wc_square_admin_settings.is_sandbox){$("#wc_square_sandbox_settings").hide();$("#wc_square_sandbox_settings").next().hide();$(".wc_square_sandbox_settings").closest("tr").hide()}$("#wc_square_system_of_record").on("change",e=>{var system_of_record=$(e.target).val();var $inventory_sync=$("#wc_square_enable_inventory_sync");var $inventory_sync_row=$inventory_sync.closest("tr");var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if("square"===system_of_record||"woocommerce"===system_of_record){is_sor_set=true;$inventory_sync.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[system_of_record]);$inventory_sync_row.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[system_of_record]);$inventory_sync_row.show();$import_products_row.show()}else{is_sor_set=false;$inventory_sync.prop("checked",false);$inventory_sync_row.hide();$import_products_row.hide()}if("square"===system_of_record){$("#wc_square_hide_missing_products").closest("tr").show()}else{$("#wc_square_hide_missing_products").closest("tr").hide()}}).trigger("change",[true]);$(".js-import-square-products").on("click",function(e){e.preventDefault();if($(this).hasClass("disabled")){return}new $.WCBackboneModal.View({target:"wc-square-import-products"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$("#wc-square-sync").on("click",e=>{e.preventDefault();new $.WCBackboneModal.View({target:"wc-square-sync"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$(document.body).on("wc_backbone_modal_response",(e,target)=>{var data;switch(target){case"wc-square-import-products":$("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function onBlock(){$(".blockUI.blockOverlay").css({position:"fixed"})}});var update_during_import=$("#wc-square-import-product-updates").prop("checked");data={action:"wc_square_import_products_from_square",security:wc_square_admin_settings.import_products_from_square,update_during_import};$.post(wc_square_admin_settings.ajax_url,data,response=>{var message=response.data?response.data:null;if(message){alert(message)}location.reload()});break;case"wc-square-sync":$("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}});$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});$("#wc-square_clear-sync-records").prop("disabled",true);data={action:"wc_square_sync_products_with_square",security:wc_square_admin_settings.sync_products_with_square};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){location.reload()}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.sync").unblock();$("table.records").unblock()}});break;}});var noRecordsFoundRow="<tr><td colspan=\"4\"><em>"+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>";$("#wc-square_clear-sync-records").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var data={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}else{if(response.data){alert(response.data)}console.log(response)}$("table.records").unblock()})});$(".records .actions button.action").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var recordId=$(e.currentTarget).data("id");var action=$(e.currentTarget).data("action");var data={action:"wc_square_handle_sync_records",id:recordId,handle:action,security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){var rowId="#record-"+recordId;if("delete"===action){$(rowId).remove();if(!$("table.records tbody tr").length){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}}else if("resolve"===action||"unsync"===action){$(rowId+" .type").html("<mark class=\"resolved\"><span>"+wc_square_admin_settings.i18n.resolved+"</span></mark>");$(rowId+" .actions").html("&mdash;")}}else{if(response&&response.data){alert(response.data)}console.log({record:recordId,action,response})}$("table.records").unblock()})});$("form").on("submit",e=>{var environment=$("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production";$(e.target).append($("<input>",{type:"hidden",name:"wc_square_environment",value:environment}))});var getSyncStatus=job_id=>{var $progress=$("span.progress");if(!$progress||0===$progress.length){$("p.sync-result").append(" <span class=\"progress\" style=\"display:block\"></span>");$progress=$("span.progress")}var data={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.data){if(response.success&&response.data.id){$("table.sync .spinner").css("visibility","visible");$("#wc-square_clear-sync-records").prop("disabled",true);$("table.records .actions button").prop("disabled",true);if("completed"!==response.data.status&&"failed"!==response.data.status){var progress=" ";if("product_import"===response.data.action){progress+=wc_square_admin_settings.i18n.skipped+": "+parseInt(response.data.skipped_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.updated+": "+parseInt(response.data.updated_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.imported+": "+parseInt(response.data.imported_products_count,10)}else if(response.data.percentage){progress+=parseInt(response.data.percentage,10)+"%"}$progress.html(progress);setTimeout(()=>{getSyncStatus(response.data.id)},30*1000)}else{location.reload()}}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.records .actions button").prop("disabled",false);$("table.sync .spinner").css("visibility","hidden");console.log(response)}}})};if(wc_square_admin_settings.existing_sync_job_id){getSyncStatus(wc_square_admin_settings.existing_sync_job_id)}$("#woocommerce_square_credit_card_enable_digital_wallets").on("change",()=>{var wallet_settings=$(".wc-square-digital-wallet-options");if($("#woocommerce_square_credit_card_enable_digital_wallets").is(":checked")){wallet_settings.closest("tr").show()}else{wallet_settings.closest("tr").hide()}}).trigger("change",[false])});
1
+ "use strict";jQuery(document).ready($=>{var pagenow=window.pagenow||"";if("woocommerce_page_wc-settings"!==pagenow){return}window.serialize_form=form=>{var form_data=$(form).serializeArray();form_data=$.grep(form_data,e=>{return e.name!=="_wp_http_referer"&&e.name!=="_wpnonce"});form_data.sort((a,b)=>a.name>b.name?1:-1);return form_data};var is_square_settings_page=false;var url_params=new window.URLSearchParams(window.location.search);var new_square_settings;var current_square_settings;var is_sor_set;var location_id=$("#wc_square_location_id, #wc_square_sandbox_location_id").val();var show_changes_message=$(".wc_square_save_changes_message");if("square"===url_params.get("tab")&&(!url_params.get("section")||""!==url_params.get("section"))){is_square_settings_page=true;current_square_settings=serialize_form($("#mainform"))}$(document).on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if(is_sor_set&&location_id&&location_id.length){$import_products_row.show()}else{$import_products_row.hide()}});$("#mainform :input").on("change",function(e,ignore){if(ignore){return}var $import_products=$("#wc_square_import_products");new_square_settings=serialize_form("#mainform");if(JSON.stringify(current_square_settings)!==JSON.stringify(new_square_settings)){if(e.target.name==="wc_square_sandbox_location_id"||e.target.name==="wc_square_location_id"){return}show_changes_message.show();$import_products.addClass("disabled")}else{show_changes_message.hide();$import_products.removeClass("disabled")}});$("#wc_square_sandbox_location_id, #wc_square_location_id").on("change",function(){location_id=$(this).val()});if(!wc_square_admin_settings.is_sandbox){$("#wc_square_sandbox_settings").hide();$("#wc_square_sandbox_settings").next().hide();$(".wc_square_sandbox_settings").closest("tr").hide()}$("#wc_square_system_of_record").on("change",e=>{var sync_setting=$(e.target).val();var $inventory_sync=$("#wc_square_enable_inventory_sync");var $inventory_sync_row=$inventory_sync.closest("tr");var $import_products=$("#wc_square_import_products");var $import_products_row=$import_products.closest("tr");if("square"===sync_setting||"woocommerce"===sync_setting){is_sor_set=true;$inventory_sync.next("span").html(wc_square_admin_settings.i18n.sync_inventory_label[sync_setting]);$inventory_sync_row.find(".description").html(wc_square_admin_settings.i18n.sync_inventory_description[sync_setting]);$inventory_sync_row.show();$import_products_row.show()}else{is_sor_set=false;$inventory_sync.prop("checked",false);$inventory_sync_row.hide();$import_products_row.hide()}if("square"===sync_setting){$("#wc_square_hide_missing_products").closest("tr").show()}else{$("#wc_square_hide_missing_products").closest("tr").hide()}}).trigger("change",[true]);$(".js-import-square-products").on("click",function(e){e.preventDefault();if($(this).hasClass("disabled")){return}new $.WCBackboneModal.View({target:"wc-square-import-products"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$("#wc-square-sync").on("click",e=>{e.preventDefault();new $.WCBackboneModal.View({target:"wc-square-sync"});$("#btn-close").on("click",e=>{e.preventDefault();$("button.modal-close").trigger("click")})});$(document.body).on("wc_backbone_modal_response",(e,target)=>{var data;switch(target){case"wc-square-import-products":$("#wpbody").block({message:null,overlayCSS:{opacity:"0.2"},onBlock:function onBlock(){$(".blockUI.blockOverlay").css({position:"fixed"})}});var update_during_import=$("#wc-square-import-product-updates").prop("checked");data={action:"wc_square_import_products_from_square",security:wc_square_admin_settings.import_products_from_square,update_during_import};$.post(wc_square_admin_settings.ajax_url,data,response=>{var message=response.data?response.data:null;if(message){alert(message)}location.href="admin.php?page=wc-settings&tab=square&section=update"});break;case"wc-square-sync":$("table.sync").block({message:null,overlayCSS:{opacity:"0.2"}});$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});$("#wc-square_clear-sync-records").prop("disabled",true);data={action:"wc_square_sync_products_with_square",security:wc_square_admin_settings.sync_products_with_square};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){location.reload()}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.sync").unblock();$("table.records").unblock()}});break;}});var noRecordsFoundRow="<tr><td colspan=\"4\"><em>"+wc_square_admin_settings.i18n.no_records_found+"</em></td></tr>";$("#wc-square_clear-sync-records").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var data={action:"wc_square_handle_sync_records",id:"all",handle:"delete",security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}else{if(response.data){alert(response.data)}console.log(response)}$("table.records").unblock()})});$(".records .actions button.action").on("click",e=>{e.preventDefault();$("table.records").block({message:null,overlayCSS:{opacity:"0.2"}});var recordId=$(e.currentTarget).data("id");var action=$(e.currentTarget).data("action");var data={action:"wc_square_handle_sync_records",id:recordId,handle:action,security:wc_square_admin_settings.handle_sync_with_square_records};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.success){var rowId="#record-"+recordId;if("delete"===action){$(rowId).remove();if(!$("table.records tbody tr").length){$("table.records tbody").html(noRecordsFoundRow);$("#wc-square_clear-sync-records").prop("disabled",true)}}else if("resolve"===action||"unsync"===action){$(rowId+" .type").html("<mark class=\"resolved\"><span>"+wc_square_admin_settings.i18n.resolved+"</span></mark>");$(rowId+" .actions").html("&mdash;")}}else{if(response&&response.data){alert(response.data)}console.log({record:recordId,action,response})}$("table.records").unblock()})});$("form").on("submit",e=>{var environment=$("#wc_square_enable_sandbox").is(":checked")?"sandbox":"production";$(e.target).append($("<input>",{type:"hidden",name:"wc_square_environment",value:environment}))});var getSyncStatus=job_id=>{var $progress=$("span.progress");if(!$progress||0===$progress.length){$("p.sync-result").append(" <span class=\"progress\" style=\"display:block\"></span>");$progress=$("span.progress")}var data={action:"wc_square_get_sync_with_square_status",security:wc_square_admin_settings.get_sync_with_square_status_nonce,job_id};$.post(wc_square_admin_settings.ajax_url,data,response=>{if(response&&response.data){if(response.success&&response.data.id){$("table.sync .spinner").css("visibility","visible");$("#wc-square_clear-sync-records").prop("disabled",true);$("table.records .actions button").prop("disabled",true);if("completed"!==response.data.status&&"failed"!==response.data.status){var progress=" ";if("product_import"===response.data.action){progress+=wc_square_admin_settings.i18n.skipped+": "+parseInt(response.data.skipped_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.updated+": "+parseInt(response.data.updated_products_count,10)+"<br/>";progress+=wc_square_admin_settings.i18n.imported+": "+parseInt(response.data.imported_products_count,10)}else if(response.data.percentage){progress+=parseInt(response.data.percentage,10)+"%"}$progress.html(progress);setTimeout(()=>{location.reload()},30*1000)}else{location.reload()}}else{$("#wc-square_clear-sync-records").prop("disabled",false);$("table.records .actions button").prop("disabled",false);$("table.sync .spinner").css("visibility","hidden");console.log(response)}}})};if(wc_square_admin_settings.existing_sync_job_id){getSyncStatus(wc_square_admin_settings.existing_sync_job_id)}$("#woocommerce_square_credit_card_enable_digital_wallets").on("change",()=>{var wallet_settings=$(".wc-square-digital-wallet-options");if($("#woocommerce_square_credit_card_enable_digital_wallets").is(":checked")){wallet_settings.closest("tr").show()}else{wallet_settings.closest("tr").hide()}}).trigger("change",[false])});
assets/js/frontend/wc-square-digital-wallet.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}jQuery(document).ready($=>{class WC_Square_Digital_Wallet_Handler{constructor(args){this.args=args;this.payment_request=args.payment_request;this.total_amount=args.payment_request.total.amount;this.isPayForOrderPage=args.is_pay_for_order_page;this.orderId=args.order_id;this.id_dasherized=args.gateway_id_dasherized;this.cartForm=".cart";this.wallet="#wc-square-digital-wallet";this.buttons=".wc-square-wallet-buttons";this.isGooglePayHidden=this.args.hide_button_options.includes("google");this.isApplePayHidden=this.args.hide_button_options.includes("apple");if($(this.wallet).length===0){return}$(this.wallet).hide();$(this.buttons).hide();this.build_digital_wallet();this.attach_page_events();this.buildDigitalWalletDebounced=this.debounce(this.build_digital_wallet,500)}build_digital_wallet(){this.block_ui();this.get_payment_request().then(response=>{this.payment_request=JSON.parse(response);this.total_amount=this.payment_request.total.amount;this.load_square_form()},message=>{this.log("[Square] Could not build payment request. "+message,"error");$(this.wallet).hide()})}attach_page_events(){if(this.args.context==="product"){var addToCartButton=$(".single_add_to_cart_button");$("#apple-pay-button, #wc-square-google-pay").on("click",e=>{if(addToCartButton.is(".disabled")){e.stopImmediatePropagation();if(addToCartButton.is(".wc-variation-is-unavailable")){window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text)}else if(addToCartButton.is(".wc-variation-selection-needed")){window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)}return}this.add_to_cart()});$(document.body).on("woocommerce_variation_has_changed",()=>this.build_digital_wallet());$(".quantity").on("input",".qty",()=>this.buildDigitalWalletDebounced())}if(this.args.context==="cart"){$(document.body).on("updated_cart_totals",()=>this.build_digital_wallet())}if(this.args.context==="checkout"){$(document.body).on("updated_checkout",()=>this.build_digital_wallet())}$(document).on("payment_method_selected",()=>{if(!this.isPayForOrderPage){return}$("#payment_method_override").remove()})}load_square_form(){if(this.googlePay){this.googlePay.destroy();this.squareFormLoaded=false}if(this.applePay){this.applePay.destroy();this.squareFormLoaded=false}if(this.squareFormLoaded){return}this.squareFormLoaded=true;this.log("[Square] Building digital wallet payment form");var{applicationId,locationId}=this.get_form_params();this.payments=window.Square.payments(applicationId,locationId);this.initializeDigitalWalletPaymentMethods()}initializeDigitalWalletPaymentMethods(){var _this=this;return _asyncToGenerator(function*(){if(!_this.payments){return}var paymentRequest=_this.payments.paymentRequest(_this.create_payment_request());_this.registerDigitalWalletShippingEventHandlers(paymentRequest);if(!_this.isGooglePayHidden){_this.googlePay=yield _this.payments.googlePay(paymentRequest);_this.googlePay.attach("#wc-square-google-pay",{buttonSizeMode:"fill",buttonType:"long",buttonColor:_this.args.google_pay_color});$("#wc-square-google-pay").on("click",function(){var _ref=_asyncToGenerator(function*(e){return _this.handleGooglePayPaymentMethodSubmission(e,_this.googlePay)});return function(_x){return _ref.apply(this,arguments)}}());$("#wc-square-google-pay").show()}if(!_this.isApplePayHidden){try{_this.applePay=yield _this.payments.applePay(paymentRequest);$("#apple-pay-button").on("click",function(){var _ref2=_asyncToGenerator(function*(e){return _this.handleApplePayPaymentMethodSubmission(e,_this.applePay)});return function(_x2){return _ref2.apply(this,arguments)}}());$("#apple-pay-button").show()}catch(e){console.log(e.message)}}if(_this.googlePay||_this.applePay){$(_this.wallet).show();_this.unblock_ui()}})()}handleGooglePayPaymentMethodSubmission(e){var _arguments=arguments,_this2=this;return _asyncToGenerator(function*(){var googlePay=_arguments.length>1&&_arguments[1]!==undefined?_arguments[1]:null;e.preventDefault();if(!googlePay){return}var result=yield googlePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this2.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}handleApplePayPaymentMethodSubmission(e){var _arguments2=arguments,_this3=this;return _asyncToGenerator(function*(){var applePay=_arguments2.length>1&&_arguments2[1]!==undefined?_arguments2[1]:null;e.preventDefault();if(!applePay){return}var result=yield applePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this3.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}registerDigitalWalletShippingEventHandlers(paymentRequest){paymentRequest.addEventListener("shippingoptionchanged",option=>this.handle_shipping_option_changed(option));paymentRequest.addEventListener("shippingcontactchanged",shippingContact=>this.handle_shipping_address_changed(shippingContact))}get_form_params(){var params={applicationId:this.args.application_id,locationId:this.args.location_id,autobuild:false,applePay:{elementId:"apple-pay-button"},googlePay:{elementId:"wc-square-google-pay"}};if(this.payment_request.requestShippingAddress===false){delete params.callbacks.shippingOptionChanged}if(this.args.hide_button_options.includes("google")){delete params.googlePay}if(this.args.hide_button_options.includes("apple")){delete params.applePay}return params}create_payment_request(){return this.payment_request}methods_supported(methods,unsupportedReason){if(methods.applePay===true||methods.googlePay===true){if(methods.applePay===true){$("#apple-pay-button").show()}if(methods.googlePay===true){$("#wc-square-google-pay").show()}$(this.wallet).show()}else{this.log(unsupportedReason)}}get_payment_request(){return new Promise((resolve,reject)=>{var data={context:this.args.context,security:this.args.payment_request_nonce,is_pay_for_order_page:this.isPayForOrderPage,order_id:this.orderId};if(this.args.context==="product"){var product_data=this.get_product_data();$.extend(data,product_data)}$.post(this.get_ajax_url("get_payment_request"),data,response=>{if(response.success){return resolve(response.data)}return reject(response.data)})})}handle_shipping_address_changed(shippingContact){var _this4=this;return _asyncToGenerator(function*(){var data={context:_this4.args.context,shipping_contact:shippingContact,security:_this4.args.recalculate_totals_nonce,is_pay_for_order_page:_this4.isPayForOrderPage,order_id:_this4.orderId};var response=yield _this4.recalculate_totals(data);return response})()}handle_shipping_option_changed(shippingOption){var _this5=this;return _asyncToGenerator(function*(){var data={context:_this5.args.context,shipping_option:shippingOption.id,security:_this5.args.recalculate_totals_nonce,is_pay_for_order_page:_this5.isPayForOrderPage,order_id:_this5.orderId};var response=yield _this5.recalculate_totals(data);return response})()}handle_card_nonce_response(){var errors=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var nonce=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var cardData=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var billingAndShippingData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(errors){return this.render_errors(errors)}if(!nonce){return this.render_errors(this.args.general_error)}this.block_ui();var orderReviewForm=$("#order_review");var{billingContact={},shippingContact={},shippingOption=null}=billingAndShippingData;var data={action:"",_wpnonce:this.args.process_checkout_nonce,billing_first_name:billingContact.givenName?billingContact.givenName:"",billing_last_name:billingContact.familyName?billingContact.familyName:"",billing_company:$("#billing_company").val(),billing_email:shippingContact.email?shippingContact.email:billingContact.email?billingContact.email:"",billing_phone:shippingContact.phone?shippingContact.phone:"",billing_country:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",billing_address_1:billingContact.addressLines&&billingContact.addressLines[0]?billingContact.addressLines[0]:"",billing_address_2:billingContact.addressLines&&billingContact.addressLines[1]?billingContact.addressLines[1]:"",billing_city:billingContact.city?billingContact.city:"",billing_state:billingContact.state?billingContact.state:"",billing_postcode:billingContact.postalCode?billingContact.postalCode:"",shipping_first_name:shippingContact.givenName?shippingContact.givenName:"",shipping_last_name:shippingContact.familyName?shippingContact.familyName:"",shipping_company:$("#shipping_company").val(),shipping_country:shippingContact.countryCode?shippingContact.countryCode.toUpperCase():"",shipping_address_1:shippingContact.addressLines&&shippingContact.addressLines[0]?shippingContact.addressLines[0]:"",shipping_address_2:shippingContact.addressLines&&shippingContact.addressLines[1]?shippingContact.addressLines[1]:"",shipping_city:shippingContact.city?shippingContact.city:"",shipping_state:shippingContact.state?shippingContact.state:"",shipping_postcode:shippingContact.postalCode?shippingContact.postalCode:"",shipping_method:[!shippingOption?null:shippingOption.id],order_comments:"",payment_method:"square_credit_card",ship_to_different_address:1,terms:1,"wc-square-credit-card-payment-nonce":nonce,"wc-square-credit-card-last-four":cardData.last4?cardData.last4:null,"wc-square-credit-card-exp-month":cardData.expMonth?cardData.expMonth:null,"wc-square-credit-card-exp-year":cardData.expYear?cardData.expYear:null,"wc-square-credit-card-payment-postcode":cardData.billing.postalCode?cardData.billing.postalCode:null,"wc-square-digital-wallet-type":cardData.digital_wallet_type,is_pay_for_order_page:this.isPayForOrderPage};if(this.isPayForOrderPage){var _cardData$billing;if(cardData.last4){$("input[name=wc-".concat(this.id_dasherized,"-last-four]")).val(cardData.last4)}if(cardData.expMonth){$("input[name=wc-".concat(this.id_dasherized,"-exp-month]")).val(cardData.expMonth)}if(cardData.expYear){$("input[name=wc-".concat(this.id_dasherized,"-exp-year]")).val(cardData.expYear)}if(cardData!==null&&cardData!==void 0&&(_cardData$billing=cardData.billing)!==null&&_cardData$billing!==void 0&&_cardData$billing.postalCode){$("input[name=wc-".concat(this.id_dasherized,"-payment-postcode]")).val(cardData.billing.postalCode)}if(cardData.brand){$("input[name=wc-".concat(this.id_dasherized,"-card-type]")).val(cardData.brand)}$("input[name=wc-".concat(this.id_dasherized,"-payment-nonce]")).val(nonce);$("#payment_method_override").remove();$("#payment").after("<input id=\"payment_method_override\" type=\"hidden\" name=\"payment_method\" value=\"square_credit_card\" />")}if(cardData.digital_wallet_type==="GOOGLE_PAY"){if(billingContact.givenName){data.billing_first_name=billingContact.givenName.split(" ").slice(0,1).join(" ");data.billing_last_name=billingContact.givenName.split(" ").slice(1).join(" ")}if(shippingContact.givenName){data.shipping_last_name=shippingContact.givenName.split(" ").slice(0,1).join(" ");data.shipping_last_name=shippingContact.givenName.split(" ").slice(1).join(" ")}}if(!data.billing_phone&&billingContact.phone){data.billing_phone=billingContact.phone}this.log("3DS verification enabled. Verifying buyer");var self=this;try{this.payments.verifyBuyer(nonce,self.get_verification_details(billingContact,shippingContact)).then(verificationResult=>{if(verificationResult.token){if(this.isPayForOrderPage&&orderReviewForm.length){$("input[name=wc-".concat(this.id_dasherized,"-buyer-verification-token]")).val(verificationResult.token);orderReviewForm.trigger("submit");return}self.log("3DS verification successful");data["wc-square-credit-card-buyer-verification-token"]=verificationResult.token;self.do_checkout(data)}})}catch(err){self.log("3DS verification failed");self.log(err);self.render_errors([err.message])}}do_checkout(data){this.process_digital_wallet_checkout(data).then(response=>{window.location=response.redirect},response=>{this.log(response,"error");this.render_errors_html(response.messages)})}get_verification_details(billingContact,shippingContact){var verification_details={intent:"CHARGE",amount:this.total_amount,currencyCode:this.payment_request.currencyCode,billingContact:{familyName:billingContact.familyName?billingContact.familyName:"",givenName:billingContact.givenName?billingContact.givenName:"",email:shippingContact.email?shippingContact.email:"",countryCode:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",state:billingContact.state?billingContact.state:"",city:billingContact.city?billingContact.city:"",postalCode:billingContact.postalCode?billingContact.postalCode:"",phone:shippingContact.phone?shippingContact.phone:"",addressLines:billingContact.addressLines?billingContact.addressLines:""}};this.log(verification_details);return verification_details}recalculate_totals(data){var _this6=this;return _asyncToGenerator(function*(){return new Promise((resolve,reject)=>{return $.post(_this6.get_ajax_url("recalculate_totals"),data,response=>{if(response.success){_this6.total_amount=response.data.total.amount;return resolve(response.data)}return reject(response.data)})})})()}get_product_data(){var product_id=$(".single_add_to_cart_button").val();var attributes={};if($(".single_variation_wrap").length){product_id=$(".single_variation_wrap").find("input[name=\"product_id\"]").val();if($(".variations_form").length){$(".variations_form").find(".variations select").each((index,select)=>{var attribute_name=$(select).data("attribute_name")||$(select).attr("name");var value=$(select).val()||"";return attributes[attribute_name]=value})}}return{product_id,quantity:$(".quantity .qty").val(),attributes}}add_to_cart(){var data={security:this.args.add_to_cart_nonce};var product_data=this.get_product_data();$.extend(data,product_data);$.post(this.get_ajax_url("add_to_cart"),data,response=>{if(response.error){return window.alert(response.data)}var data=JSON.parse(response.data);this.payment_request=data.payment_request;this.args.payment_request_nonce=data.payment_request_nonce;this.args.add_to_cart_nonce=data.add_to_cart_nonce;this.args.recalculate_totals_nonce=data.recalculate_totals_nonce;this.args.process_checkout_nonce=data.process_checkout_nonce})}process_digital_wallet_checkout(data){return new Promise((resolve,reject)=>{$.post(this.get_ajax_url("process_checkout"),data,response=>{if(response.result==="success"){return resolve(response)}return reject(response)})})}get_ajax_url(request){return this.args.ajax_url.replace("%%endpoint%%","square_digital_wallet_"+request)}render_errors_html(errors_html){$(".woocommerce-error, .woocommerce-message").remove();var element="";switch(this.args.context){case"product":element=$(".product");break;case"cart":element=$(".shop_table.cart").closest("form");break;case"checkout":element=$("form[name=\"checkout\"]");break;default:break;}element.before(errors_html);this.unblock_ui();$("html, body").animate({scrollTop:element.offset().top-100},1000)}render_errors(errors){var error_message_html="<ul class=\"woocommerce-error\"><li>"+errors.join("</li><li>")+"</li></ul>";this.render_errors_html(error_message_html)}block_ui(){$(this.buttons).block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}unblock_ui(){$(this.buttons).unblock()}log(message){var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"notice";if(!this.args.logging_enabled){return}if(type==="error"){return console.error(message)}return console.log(message)}debounce(func,wait,immediate){var timeout;return function(){var context=this,args=arguments;var later=function later(){timeout=null;if(!immediate)func.apply(context,args)};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow)func.apply(context,args)}}}window.WC_Square_Digital_Wallet_Handler=WC_Square_Digital_Wallet_Handler});
1
+ "use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}jQuery(document).ready($=>{class WC_Square_Digital_Wallet_Handler{constructor(args){this.args=args;this.payment_request=args.payment_request;this.total_amount=args.payment_request.total.amount;this.isPayForOrderPage=args.is_pay_for_order_page;this.orderId=args.order_id;this.id_dasherized=args.gateway_id_dasherized;this.cartForm=".cart";this.wallet="#wc-square-digital-wallet";this.buttons=".wc-square-wallet-buttons";this.isGooglePayHidden=this.args.hide_button_options.includes("google");this.isApplePayHidden=this.args.hide_button_options.includes("apple");this.productPageForm=$(".product form");this.cartTotalsForms=$(".cart_totals, .woocommerce-cart-form");this.checkoutForm=$("form.checkout, #wc-square-digital-wallet");if($(this.wallet).length===0){return}$(this.wallet).hide();$(this.buttons).hide();this.build_digital_wallet();this.attach_page_events();this.buildDigitalWalletDebounced=this.debounce(this.build_digital_wallet,500)}build_digital_wallet(){this.block_ui();this.get_payment_request().then(response=>{this.payment_request=JSON.parse(response);this.total_amount=this.payment_request.total.amount;this.load_square_form()},message=>{this.log("[Square] Could not build payment request. "+message,"error");$(this.wallet).hide()})}attach_page_events(){if(this.args.context==="product"){var addToCartButton=$(".single_add_to_cart_button");$("#apple-pay-button, #wc-square-google-pay").on("click",e=>{if(addToCartButton.is(".disabled")){e.stopImmediatePropagation();if(addToCartButton.is(".wc-variation-is-unavailable")){window.alert(wc_add_to_cart_variation_params.i18n_unavailable_text)}else if(addToCartButton.is(".wc-variation-selection-needed")){window.alert(wc_add_to_cart_variation_params.i18n_make_a_selection_text)}return}this.add_to_cart()});$(document.body).on("woocommerce_variation_has_changed",()=>this.build_digital_wallet());$(".quantity").on("input",".qty",()=>this.buildDigitalWalletDebounced())}if(this.args.context==="cart"){$(document.body).on("updated_cart_totals",()=>this.build_digital_wallet())}if(this.args.context==="checkout"){$(document.body).on("updated_checkout",()=>this.build_digital_wallet())}$(document).on("payment_method_selected",()=>{if(!this.isPayForOrderPage){return}$("#payment_method_override").remove()})}load_square_form(){if(this.googlePay){this.googlePay.destroy();this.squareFormLoaded=false}if(this.applePay){this.applePay.destroy();this.squareFormLoaded=false}if(this.squareFormLoaded){return}this.squareFormLoaded=true;this.log("[Square] Building digital wallet payment form");var{applicationId,locationId}=this.get_form_params();this.payments=window.Square.payments(applicationId,locationId);this.initializeDigitalWalletPaymentMethods()}initializeDigitalWalletPaymentMethods(){var _this=this;return _asyncToGenerator(function*(){if(!_this.payments){return}var paymentRequest=_this.payments.paymentRequest(_this.create_payment_request());_this.registerDigitalWalletShippingEventHandlers(paymentRequest);if(!_this.isGooglePayHidden){_this.googlePay=yield _this.payments.googlePay(paymentRequest);_this.googlePay.attach("#wc-square-google-pay",{buttonSizeMode:"fill",buttonType:"long",buttonColor:_this.args.google_pay_color});$("#wc-square-google-pay").on("click",function(){var _ref=_asyncToGenerator(function*(e){return _this.handleGooglePayPaymentMethodSubmission(e,_this.googlePay)});return function(_x){return _ref.apply(this,arguments)}}());$("#wc-square-google-pay").show()}if(!_this.isApplePayHidden){try{_this.applePay=yield _this.payments.applePay(paymentRequest);$("#apple-pay-button").on("click",function(){var _ref2=_asyncToGenerator(function*(e){return _this.handleApplePayPaymentMethodSubmission(e,_this.applePay)});return function(_x2){return _ref2.apply(this,arguments)}}());$("#apple-pay-button").show()}catch(e){console.log(e.message)}}if(_this.googlePay||_this.applePay){$(_this.wallet).show()}})()}handleGooglePayPaymentMethodSubmission(e){var _arguments=arguments,_this2=this;return _asyncToGenerator(function*(){var googlePay=_arguments.length>1&&_arguments[1]!==undefined?_arguments[1]:null;e.preventDefault();if(!googlePay){return}_this2.blockedForm=null;switch(_this2.args.context){case"product":_this2.blockedForm=_this2.blockForms(_this2.productPageForm);break;case"cart":_this2.blockedForm=_this2.blockForms(_this2.cartTotalsForms);break;case"checkout":_this2.blockedForm=_this2.blockForms(_this2.checkoutForm);break;default:break;}var result=yield googlePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this2.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}else{if(_this2.blockedForm){_this2.blockedForm.unblock()}}})()}blockForms(jQueryFormEl){jQueryFormEl.block({message:null,overlayCSS:{background:"#fff",opacity:0.6}});return jQueryFormEl}handleApplePayPaymentMethodSubmission(e){var _arguments2=arguments,_this3=this;return _asyncToGenerator(function*(){var applePay=_arguments2.length>1&&_arguments2[1]!==undefined?_arguments2[1]:null;e.preventDefault();if(!applePay){return}var result=yield applePay.tokenize();if(result.status==="OK"){var cardData=_objectSpread(_objectSpread({},result.details.card),{},{digital_wallet_type:result.details.method});var billingAndShippingData={billingContact:result.details.billing};if(result.details.shipping){billingAndShippingData.shippingContact=result.details.shipping.contact;billingAndShippingData.shippingOption=result.details.shipping.option}_this3.handle_card_nonce_response(false,result.token,cardData,billingAndShippingData)}})()}registerDigitalWalletShippingEventHandlers(paymentRequest){paymentRequest.addEventListener("shippingoptionchanged",option=>this.handle_shipping_option_changed(option));paymentRequest.addEventListener("shippingcontactchanged",shippingContact=>this.handle_shipping_address_changed(shippingContact))}get_form_params(){var params={applicationId:this.args.application_id,locationId:this.args.location_id,autobuild:false,applePay:{elementId:"apple-pay-button"},googlePay:{elementId:"wc-square-google-pay"}};if(this.payment_request.requestShippingAddress===false){delete params.callbacks.shippingOptionChanged}if(this.args.hide_button_options.includes("google")){delete params.googlePay}if(this.args.hide_button_options.includes("apple")){delete params.applePay}return params}create_payment_request(){return this.payment_request}methods_supported(methods,unsupportedReason){if(methods.applePay===true||methods.googlePay===true){if(methods.applePay===true){$("#apple-pay-button").show()}if(methods.googlePay===true){$("#wc-square-google-pay").show()}$(this.wallet).show()}else{this.log(unsupportedReason)}}get_payment_request(){return new Promise((resolve,reject)=>{var data={context:this.args.context,security:this.args.payment_request_nonce,is_pay_for_order_page:this.isPayForOrderPage,order_id:this.orderId};if(this.args.context==="product"){var product_data=this.get_product_data();$.extend(data,product_data)}$.post(this.get_ajax_url("get_payment_request"),data,response=>{if(response.success){return resolve(response.data)}return reject(response.data)})})}handle_shipping_address_changed(shippingContact){var _this4=this;return _asyncToGenerator(function*(){var data={context:_this4.args.context,shipping_contact:shippingContact,security:_this4.args.recalculate_totals_nonce,is_pay_for_order_page:_this4.isPayForOrderPage,order_id:_this4.orderId};var response=yield _this4.recalculate_totals(data);return response})()}handle_shipping_option_changed(shippingOption){var _this5=this;return _asyncToGenerator(function*(){var data={context:_this5.args.context,shipping_option:shippingOption.id,security:_this5.args.recalculate_totals_nonce,is_pay_for_order_page:_this5.isPayForOrderPage,order_id:_this5.orderId};var response=yield _this5.recalculate_totals(data);return response})()}handle_card_nonce_response(){var errors=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var nonce=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var cardData=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var billingAndShippingData=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(errors){return this.render_errors(errors)}if(!nonce){return this.render_errors(this.args.general_error)}this.block_ui();var orderReviewForm=$("#order_review");var{billingContact={},shippingContact={},shippingOption=null}=billingAndShippingData;var data={action:"",_wpnonce:this.args.process_checkout_nonce,billing_first_name:billingContact.givenName?billingContact.givenName:"",billing_last_name:billingContact.familyName?billingContact.familyName:"",billing_company:$("#billing_company").val(),billing_email:shippingContact.email?shippingContact.email:billingContact.email?billingContact.email:"",billing_phone:shippingContact.phone?shippingContact.phone:"",billing_country:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",billing_address_1:billingContact.addressLines&&billingContact.addressLines[0]?billingContact.addressLines[0]:"",billing_address_2:billingContact.addressLines&&billingContact.addressLines[1]?billingContact.addressLines[1]:"",billing_city:billingContact.city?billingContact.city:"",billing_state:billingContact.state?billingContact.state:"",billing_postcode:billingContact.postalCode?billingContact.postalCode:"",shipping_first_name:shippingContact.givenName?shippingContact.givenName:"",shipping_last_name:shippingContact.familyName?shippingContact.familyName:"",shipping_company:$("#shipping_company").val(),shipping_country:shippingContact.countryCode?shippingContact.countryCode.toUpperCase():"",shipping_address_1:shippingContact.addressLines&&shippingContact.addressLines[0]?shippingContact.addressLines[0]:"",shipping_address_2:shippingContact.addressLines&&shippingContact.addressLines[1]?shippingContact.addressLines[1]:"",shipping_city:shippingContact.city?shippingContact.city:"",shipping_state:shippingContact.state?shippingContact.state:"",shipping_postcode:shippingContact.postalCode?shippingContact.postalCode:"",shipping_method:[!shippingOption?null:shippingOption.id],order_comments:"",payment_method:"square_credit_card",ship_to_different_address:1,terms:1,"wc-square-credit-card-payment-nonce":nonce,"wc-square-credit-card-last-four":cardData.last4?cardData.last4:null,"wc-square-credit-card-exp-month":cardData.expMonth?cardData.expMonth:null,"wc-square-credit-card-exp-year":cardData.expYear?cardData.expYear:null,"wc-square-credit-card-payment-postcode":cardData.billing.postalCode?cardData.billing.postalCode:null,"wc-square-digital-wallet-type":cardData.digital_wallet_type,is_pay_for_order_page:this.isPayForOrderPage};if(this.isPayForOrderPage){var _cardData$billing;if(cardData.last4){$("input[name=wc-".concat(this.id_dasherized,"-last-four]")).val(cardData.last4)}if(cardData.expMonth){$("input[name=wc-".concat(this.id_dasherized,"-exp-month]")).val(cardData.expMonth)}if(cardData.expYear){$("input[name=wc-".concat(this.id_dasherized,"-exp-year]")).val(cardData.expYear)}if(cardData!==null&&cardData!==void 0&&(_cardData$billing=cardData.billing)!==null&&_cardData$billing!==void 0&&_cardData$billing.postalCode){$("input[name=wc-".concat(this.id_dasherized,"-payment-postcode]")).val(cardData.billing.postalCode)}if(cardData.brand){$("input[name=wc-".concat(this.id_dasherized,"-card-type]")).val(cardData.brand)}$("input[name=wc-".concat(this.id_dasherized,"-payment-nonce]")).val(nonce);$("#payment_method_override").remove();$("#payment").after("<input id=\"payment_method_override\" type=\"hidden\" name=\"payment_method\" value=\"square_credit_card\" />")}if(cardData.digital_wallet_type==="GOOGLE_PAY"){if(billingContact.givenName){data.billing_first_name=billingContact.givenName.split(" ").slice(0,1).join(" ");data.billing_last_name=billingContact.givenName.split(" ").slice(1).join(" ")}if(shippingContact.givenName){data.shipping_last_name=shippingContact.givenName.split(" ").slice(0,1).join(" ");data.shipping_last_name=shippingContact.givenName.split(" ").slice(1).join(" ")}}if(!data.billing_phone&&billingContact.phone){data.billing_phone=billingContact.phone}this.log("3DS verification enabled. Verifying buyer");var self=this;try{this.payments.verifyBuyer(nonce,self.get_verification_details(billingContact,shippingContact)).then(verificationResult=>{if(verificationResult.token){if(this.isPayForOrderPage&&orderReviewForm.length){$("input[name=wc-".concat(this.id_dasherized,"-buyer-verification-token]")).val(verificationResult.token);orderReviewForm.trigger("submit");return}self.log("3DS verification successful");data["wc-square-credit-card-buyer-verification-token"]=verificationResult.token;self.do_checkout(data)}})}catch(err){self.log("3DS verification failed");self.log(err);self.render_errors([err.message])}}do_checkout(data){this.process_digital_wallet_checkout(data).then(response=>{window.location=response.redirect},response=>{this.log(response,"error");this.render_errors_html(response.messages)})}get_verification_details(billingContact,shippingContact){var verification_details={intent:"CHARGE",amount:this.total_amount,currencyCode:this.payment_request.currencyCode,billingContact:{familyName:billingContact.familyName?billingContact.familyName:"",givenName:billingContact.givenName?billingContact.givenName:"",email:shippingContact.email?shippingContact.email:"",countryCode:billingContact.countryCode?billingContact.countryCode.toUpperCase():"",state:billingContact.state?billingContact.state:"",city:billingContact.city?billingContact.city:"",postalCode:billingContact.postalCode?billingContact.postalCode:"",phone:shippingContact.phone?shippingContact.phone:"",addressLines:billingContact.addressLines?billingContact.addressLines:""}};this.log(verification_details);return verification_details}recalculate_totals(data){var _this6=this;return _asyncToGenerator(function*(){return new Promise((resolve,reject)=>{return $.post(_this6.get_ajax_url("recalculate_totals"),data,response=>{if(response.success){_this6.total_amount=response.data.total.amount;return resolve(response.data)}return reject(response.data)})})})()}get_product_data(){var product_id=$(".single_add_to_cart_button").val();var attributes={};if($(".single_variation_wrap").length){product_id=$(".single_variation_wrap").find("input[name=\"product_id\"]").val();if($(".variations_form").length){$(".variations_form").find(".variations select").each((index,select)=>{var attribute_name=$(select).data("attribute_name")||$(select).attr("name");var value=$(select).val()||"";return attributes[attribute_name]=value})}}return{product_id,quantity:$(".quantity .qty").val(),attributes}}add_to_cart(){var data={security:this.args.add_to_cart_nonce};var product_data=this.get_product_data();$.extend(data,product_data);$.post(this.get_ajax_url("add_to_cart"),data,response=>{if(response.error){return window.alert(response.data)}var data=JSON.parse(response.data);this.payment_request=data.payment_request;this.args.payment_request_nonce=data.payment_request_nonce;this.args.add_to_cart_nonce=data.add_to_cart_nonce;this.args.recalculate_totals_nonce=data.recalculate_totals_nonce;this.args.process_checkout_nonce=data.process_checkout_nonce})}process_digital_wallet_checkout(data){return new Promise((resolve,reject)=>{$.post(this.get_ajax_url("process_checkout"),data,response=>{if(response.result==="success"){return resolve(response)}return reject(response)})})}get_ajax_url(request){return this.args.ajax_url.replace("%%endpoint%%","square_digital_wallet_"+request)}render_errors_html(errors_html){$(".woocommerce-error, .woocommerce-message").remove();var element="";switch(this.args.context){case"product":element=$(".product");break;case"cart":element=$(".shop_table.cart").closest("form");break;case"checkout":element=$("form[name=\"checkout\"]");break;default:break;}element.before(errors_html);this.blockedForm.unblock();$("html, body").animate({scrollTop:element.offset().top-100},1000)}render_errors(errors){var error_message_html="<ul class=\"woocommerce-error\"><li>"+errors.join("</li><li>")+"</li></ul>";this.render_errors_html(error_message_html)}block_ui(){$(this.buttons).block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}log(message){var type=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"notice";if(!this.args.logging_enabled){return}if(type==="error"){return console.error(message)}return console.log(message)}debounce(func,wait,immediate){var timeout;return function(){var context=this,args=arguments;var later=function later(){timeout=null;if(!immediate)func.apply(context,args)};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow)func.apply(context,args)}}}window.WC_Square_Digital_Wallet_Handler=WC_Square_Digital_Wallet_Handler});
changelog.txt CHANGED
@@ -1,5 +1,26 @@
1
  *** WooCommerce Square Changelog ***
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 3.3.0 - 2022-11-07 =
4
  * Add - Adds digital wallet buttons in the Pay for Order page.
5
  * Add - Declare support for High-performance Order Systems ("HPOS").
1
  *** WooCommerce Square Changelog ***
2
 
3
+ = 3.4.0 - 2022-12-05 =
4
+ * Add - Ability to export the Sync with Square status while exporting products.
5
+ * Add - Link to support forum under Sync Setting.
6
+ * Dev - Bump NPM version from 6.0.0 to 8.0.0.
7
+ * Dev - Bump node version from 12.0.0 to 16.0.0.
8
+ * Dev - Remove redundant build-zip npm command.
9
+ * Fix - Address issue with Square variation names containing a pipe character.
10
+ * Update - Blocks forms on the product, cart and checkout pages when a digital wallet payment is being processed.
11
+ * Update - Square PHP SDK to version 19.0.1.20220512.
12
+ * Fix - Ensure we show more accurate error messages.
13
+ * Fix - Hide variation in WooCommerce when the variation is deleted from Square.
14
+ * Fix - Incomplete product import issue when the number of products is very high.
15
+ * Fix - Incorrect coupon discount calculation which results into incorrect tax calculation.
16
+ * Fix - JS error thrown by Digital Wallets on Cart and Checkout pages due to unsupported product types.
17
+ * Fix - Remove unnecessary calls to `getLocation` when doing a manual sync.
18
+ * Fix - Set price money based on price overrides for a location.
19
+ * Update - Bump minimum supported PHP version to 7.2.
20
+ * Update - Bump minimum supported WooCommerce version to 6.0.
21
+ * Update - Bump minimum supported WordPress version to 5.6.
22
+ * Update - Rename System of Record to Sync Setting.
23
+
24
  = 3.3.0 - 2022-11-07 =
25
  * Add - Adds digital wallet buttons in the Pay for Order page.
26
  * Add - Declare support for High-performance Order Systems ("HPOS").
i18n/languages/woocommerce-square.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Square 3.3.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
- "POT-Creation-Date: 2022-11-07 04:24:20+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -69,7 +69,7 @@ msgid "Stock must be fetched from Square before editing stock quantity"
69
  msgstr ""
70
 
71
  #: includes/Admin/Privacy.php:43 includes/Admin/Settings_Page.php:54
72
- #: includes/Gateway.php:82 includes/Settings.php:221 includes/Settings.php:762
73
  msgid "Square"
74
  msgstr ""
75
 
@@ -136,7 +136,7 @@ msgstr ""
136
  msgid "Cancel"
137
  msgstr ""
138
 
139
- #: includes/Admin/Settings_Page.php:188 includes/Settings.php:242
140
  msgid "Import Products"
141
  msgstr ""
142
 
@@ -148,9 +148,9 @@ msgstr ""
148
  #. translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s,
149
  #. $4%s - closing </strong> HTML tag
150
  msgid ""
151
- "%1$sSquare%2$s is the system of record. The following data from Square will "
152
- "overwrite WooCommerce data for synced products: %3$sname, price, "
153
- "description, category, inventory%4$s."
154
  msgstr ""
155
 
156
  #: includes/Admin/Sync_Page.php:93
@@ -165,17 +165,17 @@ msgstr ""
165
  #. translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s,
166
  #. %4$s - closing </strong> HTML tag
167
  msgid ""
168
- "%1$sWooCommerce%2$s is the system of record. The following data from "
169
- "WooCommerce will overwrite Square data for synced products: %3$sname, "
170
- "price, inventory, category, image%4$s."
171
  msgstr ""
172
 
173
  #: includes/Admin/Sync_Page.php:125
174
  #. translators: Placeholders: %1$s - opening <strong> HTML tag, %2$s closing
175
  #. </strong> HTML tag
176
  msgid ""
177
- "%1$sNo chosen system of record.%2$s Products will not be synced between "
178
- "Square and WooCommerce."
179
  msgstr ""
180
 
181
  #: includes/Admin/Sync_Page.php:160
@@ -217,7 +217,7 @@ msgstr ""
217
  msgid "Actions"
218
  msgstr ""
219
 
220
- #: includes/Admin/Sync_Page.php:191 includes/Emails/Sync_Completed.php:195
221
  #. translators: Placeholder: %d number of products synced with Square
222
  #. translators: Placeholder: %d products count
223
  msgid "%d product"
@@ -286,18 +286,19 @@ msgid "If a match is not found, a new product will be created in Square."
286
  msgstr ""
287
 
288
  #: includes/Admin/Sync_Page.php:384
289
- #. translators: Placeholders: %1$s - the system of record name (e.g. Square or
290
- #. WooCommerce), %3%s - unordered HTML list of additional information item(s)
 
291
  msgid ""
292
- "You are about to sync products with Square. %1$s is your system of record. "
293
- "For all products synced with Square: %2$s"
294
  msgstr ""
295
 
296
  #: includes/Admin/Sync_Page.php:393
297
  msgid "Start sync"
298
  msgstr ""
299
 
300
- #: includes/Admin.php:143 includes/Handlers/Products.php:175
301
  msgid "Synced with Square"
302
  msgstr ""
303
 
@@ -337,7 +338,7 @@ msgstr ""
337
  msgid "Enable to push inventory changes to Square"
338
  msgstr ""
339
 
340
- #: includes/Admin.php:201 includes/Settings.php:231
341
  msgid "Inventory is fetched from Square periodically and updated in WooCommerce"
342
  msgstr ""
343
 
@@ -365,7 +366,7 @@ msgid ""
365
  msgstr ""
366
 
367
  #: includes/Emails/Access_Token_Email.php:105
368
- #: includes/Emails/Sync_Completed.php:88
369
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
370
  #. </a> HTML link tag
371
  msgid "%1$sInspect status logs%2$s"
@@ -408,27 +409,27 @@ msgstr ""
408
  msgid "Square sync failed"
409
  msgstr ""
410
 
411
- #: includes/Emails/Sync_Completed.php:95
412
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
413
  #. </a> HTML link tag
414
  msgid "%1$sEnable logging%2$s"
415
  msgstr ""
416
 
417
- #: includes/Emails/Sync_Completed.php:103
418
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
419
  #. </a> HTML link tag, %3$s - additional action
420
  msgid "The sync job has failed. %1$sClick for more details%2$s, or %3$s."
421
  msgstr ""
422
 
423
- #: includes/Emails/Sync_Completed.php:112
424
  msgid "Inspect status logs"
425
  msgstr ""
426
 
427
- #: includes/Emails/Sync_Completed.php:114 includes/Settings.php:267
428
  msgid "Enable Logging"
429
  msgstr ""
430
 
431
- #: includes/Emails/Sync_Completed.php:119
432
  #. translators: Placeholders: %s - additional action
433
  msgid "The sync job has failed. Check sync records, or %s."
434
  msgstr ""
@@ -640,7 +641,7 @@ msgstr ""
640
  msgid "-- Select an option --"
641
  msgstr ""
642
 
643
- #: includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor.php:34
644
  msgid "No saved payment tokens"
645
  msgstr ""
646
 
@@ -789,81 +790,83 @@ msgstr ""
789
  msgid "Invalid payment response data"
790
  msgstr ""
791
 
792
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:105
 
793
  msgid ""
794
  "Payment Response:\n"
795
  " %s"
796
  msgstr ""
797
 
798
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:113
799
  msgid "Apple Pay payment authorized."
800
  msgstr ""
801
 
802
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:129
803
  msgid "Gateway processing error."
804
  msgstr ""
805
 
806
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:146
 
807
  msgid "Apple Pay payment failed. %s"
808
  msgstr ""
809
 
810
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:226
811
  msgid "Not available for subscription products."
812
  msgstr ""
813
 
814
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:231
815
  msgid "Not available for pre-order products that are set to charge upon release."
816
  msgstr ""
817
 
818
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:236
819
  msgid "Buy Now is only available for simple products"
820
  msgstr ""
821
 
822
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:241
823
  msgid "Product is not available for purchase."
824
  msgstr ""
825
 
826
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:287
827
  msgid "Cart contains subscriptions."
828
  msgstr ""
829
 
830
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:291
831
  msgid "Cart contains pre-orders."
832
  msgstr ""
833
 
834
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:301
835
  msgid "Apple Pay cannot be used for multiple shipments."
836
  msgstr ""
837
 
838
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:336
839
  msgid "Payment request data is missing."
840
  msgstr ""
841
 
842
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:345
843
  msgid "Cart data is missing."
844
  msgstr ""
845
 
846
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:531
847
  msgid "Subtotal"
848
  msgstr ""
849
 
850
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:541
851
- #: includes/Gateway/API/Requests/Orders.php:77
852
  #: includes/Gateway/Digital_Wallet.php:501
853
  msgid "Discount"
854
  msgstr ""
855
 
856
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:551
857
  #: includes/Gateway/Digital_Wallet.php:485
858
  msgid "Shipping"
859
  msgstr ""
860
 
861
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:561
862
  #: includes/Gateway/Digital_Wallet.php:509
863
  msgid "Fees"
864
  msgstr ""
865
 
866
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:571
867
  msgid "Taxes"
868
  msgstr ""
869
 
@@ -1003,14 +1006,15 @@ msgstr ""
1003
  msgid "or"
1004
  msgstr ""
1005
 
1006
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:72
1007
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:79
1008
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:92
1009
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:101
1010
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:113
1011
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:157
1012
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:167
1013
- #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:169
 
1014
  msgid "Error %d: Unable to create order. Please try again."
1015
  msgstr ""
1016
 
@@ -1674,7 +1678,7 @@ msgid "Nickname"
1674
  msgstr ""
1675
 
1676
  #: includes/Framework/PaymentGateway/Payment_Gateway_My_Payment_Methods.php:692
1677
- #: includes/Sync/Records/Record.php:544
1678
  #: vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php:92
1679
  msgid "Delete"
1680
  msgstr ""
@@ -1739,7 +1743,7 @@ msgstr ""
1739
  msgid "Securely Save to Account"
1740
  msgstr ""
1741
 
1742
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:550
1743
  #. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
1744
  #. tag
1745
  msgid ""
@@ -1747,7 +1751,7 @@ msgid ""
1747
  "data may be at risk. %2$sVerify your site URLs here%3$s"
1748
  msgstr ""
1749
 
1750
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:567
1751
  #. translators: Placeholders: %s - payment gateway name
1752
  msgid ""
1753
  "%s will soon require TLS 1.2 support to process transactions and your "
@@ -1756,7 +1760,7 @@ msgid ""
1756
  "and request they make any necessary updates."
1757
  msgstr ""
1758
 
1759
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:623
1760
  #. translators: Placeholders: %1$s - plugin name, %2$s - a
1761
  #. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
1762
  msgid ""
@@ -1768,7 +1772,7 @@ msgid_plural ""
1768
  msgstr[0] ""
1769
  msgstr[1] ""
1770
 
1771
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:658
1772
  #. translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a>
1773
  #. tag, %3$s - closing </a> tag
1774
  msgid ""
@@ -1777,7 +1781,7 @@ msgid ""
1777
  "processing, we recommend %2$sturning off Debug Mode%3$s"
1778
  msgstr ""
1779
 
1780
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:697
1781
  #. translators: Placeholders: %1$s - payment gateway title (such as
1782
  #. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
1783
  msgid ""
@@ -1785,7 +1789,7 @@ msgid ""
1785
  "tokenization%3$s to activate %1$s for Subscriptions."
1786
  msgstr ""
1787
 
1788
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:715
1789
  #. translators: Placeholders: %1$s - payment gateway title (such as
1790
  #. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
1791
  msgid ""
@@ -1793,13 +1797,13 @@ msgid ""
1793
  "tokenization%3$s to activate %1$s for Pre-Orders."
1794
  msgstr ""
1795
 
1796
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:752
1797
  msgid ""
1798
  "You must enable tokenization for this gateway in order to support automatic "
1799
  "renewal payments with the WooCommerce Subscriptions extension."
1800
  msgstr ""
1801
 
1802
- #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:753
1803
  msgid "Inactive"
1804
  msgstr ""
1805
 
@@ -1918,7 +1922,7 @@ msgstr ""
1918
  #. tag
1919
  msgid ""
1920
  "Hey there! We've noticed that your site is running version %1$s of "
1921
- "WooCommerce, but %2$sWooCommerce 3.0 or higher will soon be required%3$s by "
1922
  "%4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as "
1923
  "soon as possible."
1924
  msgstr ""
@@ -1927,8 +1931,8 @@ msgstr ""
1927
  msgid "Every %d Minutes"
1928
  msgstr ""
1929
 
1930
- #: includes/Gateway/API/Requests/Orders.php:283
1931
- #: includes/Gateway/API/Requests/Orders.php:322
1932
  msgid "Adjustment"
1933
  msgstr ""
1934
 
@@ -2219,14 +2223,19 @@ msgstr ""
2219
  msgid "Disconnect from Square"
2220
  msgstr ""
2221
 
2222
- #: includes/Handlers/Product.php:214
2223
  #. translators: Placeholder: %s category ID
2224
  msgid ""
2225
  "Square category with id (%s) was not imported to your Store. Please run "
2226
  "Import Products from Square settings."
2227
  msgstr ""
2228
 
2229
- #: includes/Handlers/Product.php:348
 
 
 
 
 
2230
  msgid "Product not synced with Square"
2231
  msgstr ""
2232
 
@@ -2250,39 +2259,40 @@ msgstr ""
2250
  msgid "%s has multiple variation attributes and cannot be synced with Square."
2251
  msgstr ""
2252
 
2253
- #: includes/Handlers/Products.php:250
2254
  msgid "Update product data with Square data"
2255
  msgstr ""
2256
 
2257
- #: includes/Handlers/Products.php:250
2258
  msgid "Send product data to Square"
2259
  msgstr ""
2260
 
2261
- #: includes/Handlers/Products.php:255
 
2262
  msgid "Sync with Square"
2263
  msgstr ""
2264
 
2265
- #: includes/Handlers/Products.php:291
2266
  msgid "Sync with Square?"
2267
  msgstr ""
2268
 
2269
- #: includes/Handlers/Products.php:295
2270
  msgid "No change"
2271
  msgstr ""
2272
 
2273
- #: includes/Handlers/Products.php:297
2274
  msgid "No"
2275
  msgstr ""
2276
 
2277
- #: includes/Handlers/Products.php:298
2278
  msgid "Yes"
2279
  msgstr ""
2280
 
2281
- #: includes/Handlers/Products.php:304
2282
  msgid "This product"
2283
  msgstr ""
2284
 
2285
- #: includes/Handlers/Products.php:675
2286
  #. translators: Placeholder: %1$s - date (localized), %2$s - time (localized),
2287
  #. %3$s - opening <a> HTML link tag, %4$s closing </a> HTML link tag
2288
  msgid ""
@@ -2291,13 +2301,20 @@ msgid ""
2291
  "records%4$s."
2292
  msgstr ""
2293
 
2294
- #: includes/Handlers/Sync.php:291
2295
  #. translators: Placeholder: %d number of products processed
2296
  msgid "Updated data for %d product."
2297
  msgid_plural "Updated data for %d products."
2298
  msgstr[0] ""
2299
  msgstr[1] ""
2300
 
 
 
 
 
 
 
 
2301
  #: includes/Lifecycle.php:197
2302
  msgid "Great"
2303
  msgstr ""
@@ -2482,135 +2499,163 @@ msgid ""
2482
  msgstr ""
2483
 
2484
  #: includes/Settings.php:208
2485
- msgid "Product system of record"
2486
  msgstr ""
2487
 
2488
  #: includes/Settings.php:213
2489
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
2490
  #. <a> tag, %4$s - </a> tag
2491
  msgid ""
2492
- "Choose where you will update data for synced products. Inventory in Square "
2493
- "is %1$salways%2$s checked for adjustments when sync is enabled. %3$sClick "
2494
- "here%4$s to read more about choosing a system of record."
 
2495
  msgstr ""
2496
 
2497
- #: includes/Settings.php:220
2498
  msgid "Do not sync product data"
2499
  msgstr ""
2500
 
2501
- #: includes/Settings.php:228
2502
  msgid "Sync inventory"
2503
  msgstr ""
2504
 
2505
- #: includes/Settings.php:229
2506
  msgid "Enable to sync product inventory with Square"
2507
  msgstr ""
2508
 
2509
- #: includes/Settings.php:235
2510
  msgid "Handle missing products"
2511
  msgstr ""
2512
 
2513
- #: includes/Settings.php:236
2514
  msgid "Hide synced products when not found in Square"
2515
  msgstr ""
2516
 
2517
- #: includes/Settings.php:238
2518
  msgid ""
2519
  "Products not found in Square will be hidden in the WooCommerce product "
2520
  "catalog."
2521
  msgstr ""
2522
 
2523
- #: includes/Settings.php:244
2524
  msgid ""
2525
  "Run an import to create new products in this WooCommerce store for each new "
2526
  "product created in Square that has a unique SKU not existing in here. Needs "
2527
  "to be run each time new items are created in Square."
2528
  msgstr ""
2529
 
2530
- #: includes/Settings.php:254
2531
  msgid "Connection"
2532
  msgstr ""
2533
 
2534
- #: includes/Settings.php:271
2535
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
2536
  msgid "Log debug messages to the %1$sWooCommerce status log%2$s"
2537
  msgstr ""
2538
 
2539
- #: includes/Settings.php:319
2540
  msgid "Please choose a location"
2541
  msgstr ""
2542
 
2543
- #: includes/Settings.php:357
2544
  msgid "Import all products from Square"
2545
  msgstr ""
2546
 
2547
- #: includes/Settings.php:359
2548
  msgid ""
2549
  "You have made changes to the settings. Please save the changes to enable "
2550
  "the button."
2551
  msgstr ""
2552
 
2553
- #: includes/Sync/Interval_Polling.php:98
 
2554
  msgid "Updated data for %d category."
2555
  msgid_plural "Updated data for %d categories."
2556
  msgstr[0] ""
2557
  msgstr[1] ""
2558
 
2559
- #: includes/Sync/Interval_Polling.php:108
2560
  msgid ""
2561
  "Product category data could not be updated from Square. Invalid API "
2562
  "response."
2563
  msgstr ""
2564
 
2565
- #: includes/Sync/Manual_Synchronization.php:928
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2566
  #. translators: Placeholder: %s - product ID
2567
  msgid "Product %s could not be updated in Square."
2568
  msgstr ""
2569
 
2570
- #: includes/Sync/Product_Import.php:549
 
 
 
 
 
 
 
 
 
2571
  #. translators: Placeholders: %1$s - Square item name, %2$s - Square item
2572
  #. variation name, %3$s - failure reason
2573
  msgid "Could not import \"%1$s - %2$s\" from Square. %3$s"
2574
  msgstr ""
2575
 
2576
- #: includes/Sync/Product_Import.php:594
2577
  #. translators: Placeholders: %1$s - Square item name, %2$s - failure reason
2578
  msgid "Could not import \"%1$s\" from Square. %2$s"
2579
  msgstr ""
2580
 
2581
- #: includes/Sync/Product_Import.php:623
2582
  msgid "Items with variable pricing cannot be imported."
2583
  msgstr ""
2584
 
2585
- #: includes/Sync/Product_Import.php:627
2586
  msgid "Variations with missing SKUs cannot be imported."
2587
  msgstr ""
2588
 
2589
- #: includes/Sync/Product_Import.php:720 includes/Sync/Product_Import.php:997
2590
  msgid "The SKU already exists on another product"
2591
  msgstr ""
2592
 
2593
- #: includes/Sync/Product_Import.php:912
2594
  #. translators: Placeholders: %1$s - variation ID, %2$s - product name
2595
  msgid "Variation #%1$s of %2$s"
2596
  msgstr ""
2597
 
2598
- #: includes/Sync/Product_Import.php:1291
2599
  #. translators: Placeholders: %s - missing parameter name
2600
  msgid "Missing parameter %s"
2601
  msgstr ""
2602
 
2603
- #: includes/Sync/Product_Import.php:1297
2604
  #. translators: Placeholders: %s - comma separated list of valid product types
2605
  msgid "Invalid product type - the product type must be any of these: %s"
2606
  msgstr ""
2607
 
2608
- #: includes/Sync/Product_Import.php:1348
2609
  #. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
2610
  msgid "Could not update %1$s from Square. %2$s"
2611
  msgstr ""
2612
 
2613
- #: includes/Sync/Product_Import.php:1351
2614
  #. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
2615
  msgid "Could not import %1$s from Square. %2$s"
2616
  msgstr ""
@@ -2627,16 +2672,21 @@ msgstr ""
2627
  msgid "Alert"
2628
  msgstr ""
2629
 
2630
- #: includes/Sync/Records/Record.php:373
 
 
 
 
 
2631
  #. translators: Placeholder: %s - product name
2632
  msgid "%s not found in Square."
2633
  msgstr ""
2634
 
2635
- #: includes/Sync/Records/Record.php:552
2636
  msgid "Ignore"
2637
  msgstr ""
2638
 
2639
- #: includes/Sync/Records/Record.php:561
2640
  msgid "Unlink"
2641
  msgstr ""
2642
 
@@ -3341,21 +3391,21 @@ msgstr[1] ""
3341
  msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
3342
  msgstr ""
3343
 
3344
- #: woocommerce-square.php:354
3345
  #. translators: plugin name
3346
  msgid ""
3347
  "<strong>All features in %1$s have been disabled</strong> due to unsupported "
3348
  "settings:<br>"
3349
  msgstr ""
3350
 
3351
- #: woocommerce-square.php:362
3352
  #. translators: minimum PHP version, current PHP version
3353
  msgid ""
3354
  "&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version "
3355
  "required is %1$s. You are running %2$s.<br>"
3356
  msgstr ""
3357
 
3358
- #: woocommerce-square.php:371
3359
  #. translators: link to documentation
3360
  msgid ""
3361
  "&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href=\"%s\" "
2
  # This file is distributed under the GNU General Public License v3.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Square 3.4.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-square\n"
8
+ "POT-Creation-Date: 2022-12-05 07:12:22+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
69
  msgstr ""
70
 
71
  #: includes/Admin/Privacy.php:43 includes/Admin/Settings_Page.php:54
72
+ #: includes/Gateway.php:82 includes/Settings.php:224 includes/Settings.php:771
73
  msgid "Square"
74
  msgstr ""
75
 
136
  msgid "Cancel"
137
  msgstr ""
138
 
139
+ #: includes/Admin/Settings_Page.php:188 includes/Settings.php:245
140
  msgid "Import Products"
141
  msgstr ""
142
 
148
  #. translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s,
149
  #. $4%s - closing </strong> HTML tag
150
  msgid ""
151
+ "%1$sSquare%2$s is the system of record set in the sync settings. The "
152
+ "following data from Square will overwrite WooCommerce data for synced "
153
+ "products: %3$sname, price, description, category, inventory%4$s."
154
  msgstr ""
155
 
156
  #: includes/Admin/Sync_Page.php:93
165
  #. translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s,
166
  #. %4$s - closing </strong> HTML tag
167
  msgid ""
168
+ "%1$sWooCommerce%2$s is the system of record set in the sync settings. The "
169
+ "following data from WooCommerce will overwrite Square data for synced "
170
+ "products: %3$sname, price, inventory, category, image%4$s."
171
  msgstr ""
172
 
173
  #: includes/Admin/Sync_Page.php:125
174
  #. translators: Placeholders: %1$s - opening <strong> HTML tag, %2$s closing
175
  #. </strong> HTML tag
176
  msgid ""
177
+ "%1$sSync setting not chosen.%2$s Products will not be synced between Square "
178
+ "and WooCommerce."
179
  msgstr ""
180
 
181
  #: includes/Admin/Sync_Page.php:160
217
  msgid "Actions"
218
  msgstr ""
219
 
220
+ #: includes/Admin/Sync_Page.php:191 includes/Emails/Sync_Completed.php:205
221
  #. translators: Placeholder: %d number of products synced with Square
222
  #. translators: Placeholder: %d products count
223
  msgid "%d product"
286
  msgstr ""
287
 
288
  #: includes/Admin/Sync_Page.php:384
289
+ #. translators: Placeholders: %1$s - the name of the system of record set in
290
+ #. the sync settings (e.g. Square or WooCommerce), %3%s - unordered HTML list
291
+ #. of additional information item(s)
292
  msgid ""
293
+ "You are about to sync products with Square. %1$s is your system of record "
294
+ "set in the sync settings. For all products synced with Square: %2$s"
295
  msgstr ""
296
 
297
  #: includes/Admin/Sync_Page.php:393
298
  msgid "Start sync"
299
  msgstr ""
300
 
301
+ #: includes/Admin.php:143 includes/Handlers/Products.php:181
302
  msgid "Synced with Square"
303
  msgstr ""
304
 
338
  msgid "Enable to push inventory changes to Square"
339
  msgstr ""
340
 
341
+ #: includes/Admin.php:201 includes/Settings.php:234
342
  msgid "Inventory is fetched from Square periodically and updated in WooCommerce"
343
  msgstr ""
344
 
366
  msgstr ""
367
 
368
  #: includes/Emails/Access_Token_Email.php:105
369
+ #: includes/Emails/Sync_Completed.php:93
370
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
371
  #. </a> HTML link tag
372
  msgid "%1$sInspect status logs%2$s"
409
  msgid "Square sync failed"
410
  msgstr ""
411
 
412
+ #: includes/Emails/Sync_Completed.php:100
413
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
414
  #. </a> HTML link tag
415
  msgid "%1$sEnable logging%2$s"
416
  msgstr ""
417
 
418
+ #: includes/Emails/Sync_Completed.php:108
419
  #. translators: Placeholders: %1$s - opening <a> HTML link tag, %2$s - closing
420
  #. </a> HTML link tag, %3$s - additional action
421
  msgid "The sync job has failed. %1$sClick for more details%2$s, or %3$s."
422
  msgstr ""
423
 
424
+ #: includes/Emails/Sync_Completed.php:117
425
  msgid "Inspect status logs"
426
  msgstr ""
427
 
428
+ #: includes/Emails/Sync_Completed.php:119 includes/Settings.php:270
429
  msgid "Enable Logging"
430
  msgstr ""
431
 
432
+ #: includes/Emails/Sync_Completed.php:124
433
  #. translators: Placeholders: %s - additional action
434
  msgid "The sync job has failed. Check sync records, or %s."
435
  msgstr ""
641
  msgid "-- Select an option --"
642
  msgstr ""
643
 
644
+ #: includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor.php:37
645
  msgid "No saved payment tokens"
646
  msgstr ""
647
 
790
  msgid "Invalid payment response data"
791
  msgstr ""
792
 
793
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:106
794
+ #. translators: Placeholders: %s - payment response as string
795
  msgid ""
796
  "Payment Response:\n"
797
  " %s"
798
  msgstr ""
799
 
800
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:114
801
  msgid "Apple Pay payment authorized."
802
  msgstr ""
803
 
804
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:130
805
  msgid "Gateway processing error."
806
  msgstr ""
807
 
808
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:148
809
+ #. translators: Placeholders: %s - the error message
810
  msgid "Apple Pay payment failed. %s"
811
  msgstr ""
812
 
813
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:229
814
  msgid "Not available for subscription products."
815
  msgstr ""
816
 
817
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:234
818
  msgid "Not available for pre-order products that are set to charge upon release."
819
  msgstr ""
820
 
821
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:239
822
  msgid "Buy Now is only available for simple products"
823
  msgstr ""
824
 
825
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:244
826
  msgid "Product is not available for purchase."
827
  msgstr ""
828
 
829
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:290
830
  msgid "Cart contains subscriptions."
831
  msgstr ""
832
 
833
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:294
834
  msgid "Cart contains pre-orders."
835
  msgstr ""
836
 
837
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:300
838
  msgid "Apple Pay cannot be used for multiple shipments."
839
  msgstr ""
840
 
841
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:335
842
  msgid "Payment request data is missing."
843
  msgstr ""
844
 
845
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:344
846
  msgid "Cart data is missing."
847
  msgstr ""
848
 
849
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:532
850
  msgid "Subtotal"
851
  msgstr ""
852
 
853
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:542
854
+ #: includes/Gateway/API/Requests/Orders.php:227
855
  #: includes/Gateway/Digital_Wallet.php:501
856
  msgid "Discount"
857
  msgstr ""
858
 
859
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:552
860
  #: includes/Gateway/Digital_Wallet.php:485
861
  msgid "Shipping"
862
  msgstr ""
863
 
864
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:562
865
  #: includes/Gateway/Digital_Wallet.php:509
866
  msgid "Fees"
867
  msgstr ""
868
 
869
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php:572
870
  msgid "Taxes"
871
  msgstr ""
872
 
1006
  msgid "or"
1007
  msgstr ""
1008
 
1009
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:73
1010
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:81
1011
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:95
1012
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:105
1013
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:123
1014
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:173
1015
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:183
1016
+ #: includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php:186
1017
+ #. translators: Placeholders: %s - error code when order creation fails
1018
  msgid "Error %d: Unable to create order. Please try again."
1019
  msgstr ""
1020
 
1678
  msgstr ""
1679
 
1680
  #: includes/Framework/PaymentGateway/Payment_Gateway_My_Payment_Methods.php:692
1681
+ #: includes/Sync/Records/Record.php:552
1682
  #: vendor/woocommerce/action-scheduler/classes/ActionScheduler_ListTable.php:92
1683
  msgid "Delete"
1684
  msgstr ""
1743
  msgid "Securely Save to Account"
1744
  msgstr ""
1745
 
1746
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:552
1747
  #. translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a>
1748
  #. tag
1749
  msgid ""
1751
  "data may be at risk. %2$sVerify your site URLs here%3$s"
1752
  msgstr ""
1753
 
1754
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:572
1755
  #. translators: Placeholders: %s - payment gateway name
1756
  msgid ""
1757
  "%s will soon require TLS 1.2 support to process transactions and your "
1760
  "and request they make any necessary updates."
1761
  msgstr ""
1762
 
1763
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:632
1764
  #. translators: Placeholders: %1$s - plugin name, %2$s - a
1765
  #. currency/comma-separated list of currencies, %3$s - <a> tag, %4$s - </a> tag
1766
  msgid ""
1772
  msgstr[0] ""
1773
  msgstr[1] ""
1774
 
1775
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:671
1776
  #. translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a>
1777
  #. tag, %3$s - closing </a> tag
1778
  msgid ""
1781
  "processing, we recommend %2$sturning off Debug Mode%3$s"
1782
  msgstr ""
1783
 
1784
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:715
1785
  #. translators: Placeholders: %1$s - payment gateway title (such as
1786
  #. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
1787
  msgid ""
1789
  "tokenization%3$s to activate %1$s for Subscriptions."
1790
  msgstr ""
1791
 
1792
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:737
1793
  #. translators: Placeholders: %1$s - payment gateway title (such as
1794
  #. Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag
1795
  msgid ""
1797
  "tokenization%3$s to activate %1$s for Pre-Orders."
1798
  msgstr ""
1799
 
1800
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:778
1801
  msgid ""
1802
  "You must enable tokenization for this gateway in order to support automatic "
1803
  "renewal payments with the WooCommerce Subscriptions extension."
1804
  msgstr ""
1805
 
1806
+ #: includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php:779
1807
  msgid "Inactive"
1808
  msgstr ""
1809
 
1922
  #. tag
1923
  msgid ""
1924
  "Hey there! We've noticed that your site is running version %1$s of "
1925
+ "WooCommerce, but %2$sWooCommerce 6.0 or higher will soon be required%3$s by "
1926
  "%4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as "
1927
  "soon as possible."
1928
  msgstr ""
1931
  msgid "Every %d Minutes"
1932
  msgstr ""
1933
 
1934
+ #: includes/Gateway/API/Requests/Orders.php:326
1935
+ #: includes/Gateway/API/Requests/Orders.php:365
1936
  msgid "Adjustment"
1937
  msgstr ""
1938
 
2223
  msgid "Disconnect from Square"
2224
  msgstr ""
2225
 
2226
+ #: includes/Handlers/Product.php:210
2227
  #. translators: Placeholder: %s category ID
2228
  msgid ""
2229
  "Square category with id (%s) was not imported to your Store. Please run "
2230
  "Import Products from Square settings."
2231
  msgstr ""
2232
 
2233
+ #: includes/Handlers/Product.php:329
2234
+ #. Translators: Placeholder: %1$s - product ID, %2$s - Exception message
2235
+ msgid "Image not updated from Square for product #%1$s. %2$s."
2236
+ msgstr ""
2237
+
2238
+ #: includes/Handlers/Product.php:361
2239
  msgid "Product not synced with Square"
2240
  msgstr ""
2241
 
2259
  msgid "%s has multiple variation attributes and cannot be synced with Square."
2260
  msgstr ""
2261
 
2262
+ #: includes/Handlers/Products.php:256
2263
  msgid "Update product data with Square data"
2264
  msgstr ""
2265
 
2266
+ #: includes/Handlers/Products.php:256
2267
  msgid "Send product data to Square"
2268
  msgstr ""
2269
 
2270
+ #: includes/Handlers/Products.php:261 includes/Handlers/Products.php:753
2271
+ #: includes/Handlers/Products.php:787 includes/Handlers/Products.php:798
2272
  msgid "Sync with Square"
2273
  msgstr ""
2274
 
2275
+ #: includes/Handlers/Products.php:297
2276
  msgid "Sync with Square?"
2277
  msgstr ""
2278
 
2279
+ #: includes/Handlers/Products.php:301
2280
  msgid "No change"
2281
  msgstr ""
2282
 
2283
+ #: includes/Handlers/Products.php:303
2284
  msgid "No"
2285
  msgstr ""
2286
 
2287
+ #: includes/Handlers/Products.php:304
2288
  msgid "Yes"
2289
  msgstr ""
2290
 
2291
+ #: includes/Handlers/Products.php:310
2292
  msgid "This product"
2293
  msgstr ""
2294
 
2295
+ #: includes/Handlers/Products.php:681
2296
  #. translators: Placeholder: %1$s - date (localized), %2$s - time (localized),
2297
  #. %3$s - opening <a> HTML link tag, %4$s closing </a> HTML link tag
2298
  msgid ""
2301
  "records%4$s."
2302
  msgstr ""
2303
 
2304
+ #: includes/Handlers/Sync.php:293
2305
  #. translators: Placeholder: %d number of products processed
2306
  msgid "Updated data for %d product."
2307
  msgid_plural "Updated data for %d products."
2308
  msgstr[0] ""
2309
  msgstr[1] ""
2310
 
2311
+ #: includes/Handlers/Sync.php:440
2312
+ msgid ""
2313
+ "Please do not close or navigate away from this page as the product import "
2314
+ "job is in progress. This page may load several times during the course of "
2315
+ "sync."
2316
+ msgstr ""
2317
+
2318
  #: includes/Lifecycle.php:197
2319
  msgid "Great"
2320
  msgstr ""
2499
  msgstr ""
2500
 
2501
  #: includes/Settings.php:208
2502
+ msgid "Sync settings"
2503
  msgstr ""
2504
 
2505
  #: includes/Settings.php:213
2506
  #. translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s -
2507
  #. <a> tag, %4$s - </a> tag
2508
  msgid ""
2509
+ "Choose where data will be updated for synced products. Inventory in Square "
2510
+ "is %1$salways%2$s checked for adjustments when sync is "
2511
+ "enabled.%3$s%4$sLearn more%5$s about choosing a system of record or "
2512
+ "%6$screate a ticket%7$s if you're experiencing technical issues."
2513
  msgstr ""
2514
 
2515
+ #: includes/Settings.php:223
2516
  msgid "Do not sync product data"
2517
  msgstr ""
2518
 
2519
+ #: includes/Settings.php:231
2520
  msgid "Sync inventory"
2521
  msgstr ""
2522
 
2523
+ #: includes/Settings.php:232
2524
  msgid "Enable to sync product inventory with Square"
2525
  msgstr ""
2526
 
2527
+ #: includes/Settings.php:238
2528
  msgid "Handle missing products"
2529
  msgstr ""
2530
 
2531
+ #: includes/Settings.php:239
2532
  msgid "Hide synced products when not found in Square"
2533
  msgstr ""
2534
 
2535
+ #: includes/Settings.php:241
2536
  msgid ""
2537
  "Products not found in Square will be hidden in the WooCommerce product "
2538
  "catalog."
2539
  msgstr ""
2540
 
2541
+ #: includes/Settings.php:247
2542
  msgid ""
2543
  "Run an import to create new products in this WooCommerce store for each new "
2544
  "product created in Square that has a unique SKU not existing in here. Needs "
2545
  "to be run each time new items are created in Square."
2546
  msgstr ""
2547
 
2548
+ #: includes/Settings.php:257
2549
  msgid "Connection"
2550
  msgstr ""
2551
 
2552
+ #: includes/Settings.php:274
2553
  #. translators: Placeholders: %1$s - <a> tag, %2$s - </a> tag
2554
  msgid "Log debug messages to the %1$sWooCommerce status log%2$s"
2555
  msgstr ""
2556
 
2557
+ #: includes/Settings.php:322
2558
  msgid "Please choose a location"
2559
  msgstr ""
2560
 
2561
+ #: includes/Settings.php:360
2562
  msgid "Import all products from Square"
2563
  msgstr ""
2564
 
2565
+ #: includes/Settings.php:362
2566
  msgid ""
2567
  "You have made changes to the settings. Please save the changes to enable "
2568
  "the button."
2569
  msgstr ""
2570
 
2571
+ #: includes/Sync/Interval_Polling.php:99
2572
+ #. translators: Placeholder %d number of categories
2573
  msgid "Updated data for %d category."
2574
  msgid_plural "Updated data for %d categories."
2575
  msgstr[0] ""
2576
  msgstr[1] ""
2577
 
2578
+ #: includes/Sync/Interval_Polling.php:109
2579
  msgid ""
2580
  "Product category data could not be updated from Square. Invalid API "
2581
  "response."
2582
  msgstr ""
2583
 
2584
+ #: includes/Sync/Interval_Polling.php:180
2585
+ #: includes/Sync/Manual_Synchronization.php:1494
2586
+ #. translators: Placeholder %1$s Product Name, %2$s Exception message
2587
+ msgid "%1$s was deleted in Square but could not be hidden in WooCommerce. %2$s."
2588
+ msgstr ""
2589
+
2590
+ #: includes/Sync/Interval_Polling.php:205
2591
+ #: includes/Sync/Manual_Synchronization.php:1324
2592
+ #. translators: Placeholder %1$s Product Name, %2$s Exception message
2593
+ msgid "Could not sync %1$s data from Square. %2$s."
2594
+ msgstr ""
2595
+
2596
+ #: includes/Sync/Manual_Synchronization.php:702
2597
+ #. translators: Placeholder: %s - product ID
2598
+ msgid "Product #%s could not be updated."
2599
+ msgstr ""
2600
+
2601
+ #: includes/Sync/Manual_Synchronization.php:938
2602
  #. translators: Placeholder: %s - product ID
2603
  msgid "Product %s could not be updated in Square."
2604
  msgstr ""
2605
 
2606
+ #: includes/Sync/Manual_Synchronization.php:1288
2607
+ #. translators: Placeholder %s Product ID
2608
+ msgid "%s does not exist in the Square catalog."
2609
+ msgstr ""
2610
+
2611
+ #: includes/Sync/Manual_Synchronization.php:1299
2612
+ msgid "This product failed to be hidden."
2613
+ msgstr ""
2614
+
2615
+ #: includes/Sync/Product_Import.php:548
2616
  #. translators: Placeholders: %1$s - Square item name, %2$s - Square item
2617
  #. variation name, %3$s - failure reason
2618
  msgid "Could not import \"%1$s - %2$s\" from Square. %3$s"
2619
  msgstr ""
2620
 
2621
+ #: includes/Sync/Product_Import.php:593
2622
  #. translators: Placeholders: %1$s - Square item name, %2$s - failure reason
2623
  msgid "Could not import \"%1$s\" from Square. %2$s"
2624
  msgstr ""
2625
 
2626
+ #: includes/Sync/Product_Import.php:621
2627
  msgid "Items with variable pricing cannot be imported."
2628
  msgstr ""
2629
 
2630
+ #: includes/Sync/Product_Import.php:625
2631
  msgid "Variations with missing SKUs cannot be imported."
2632
  msgstr ""
2633
 
2634
+ #: includes/Sync/Product_Import.php:718 includes/Sync/Product_Import.php:995
2635
  msgid "The SKU already exists on another product"
2636
  msgstr ""
2637
 
2638
+ #: includes/Sync/Product_Import.php:910
2639
  #. translators: Placeholders: %1$s - variation ID, %2$s - product name
2640
  msgid "Variation #%1$s of %2$s"
2641
  msgstr ""
2642
 
2643
+ #: includes/Sync/Product_Import.php:1289
2644
  #. translators: Placeholders: %s - missing parameter name
2645
  msgid "Missing parameter %s"
2646
  msgstr ""
2647
 
2648
+ #: includes/Sync/Product_Import.php:1295
2649
  #. translators: Placeholders: %s - comma separated list of valid product types
2650
  msgid "Invalid product type - the product type must be any of these: %s"
2651
  msgstr ""
2652
 
2653
+ #: includes/Sync/Product_Import.php:1346
2654
  #. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
2655
  msgid "Could not update %1$s from Square. %2$s"
2656
  msgstr ""
2657
 
2658
+ #: includes/Sync/Product_Import.php:1349
2659
  #. translators: Placeholders: %1$s - Square item name, %2$s - Failure reason
2660
  msgid "Could not import %1$s from Square. %2$s"
2661
  msgstr ""
2672
  msgid "Alert"
2673
  msgstr ""
2674
 
2675
+ #: includes/Sync/Records/Record.php:374
2676
+ #. translators: Placeholder: %s - product name
2677
+ msgid "%s variation not found in Square."
2678
+ msgstr ""
2679
+
2680
+ #: includes/Sync/Records/Record.php:380
2681
  #. translators: Placeholder: %s - product name
2682
  msgid "%s not found in Square."
2683
  msgstr ""
2684
 
2685
+ #: includes/Sync/Records/Record.php:560
2686
  msgid "Ignore"
2687
  msgstr ""
2688
 
2689
+ #: includes/Sync/Records/Record.php:569
2690
  msgid "Unlink"
2691
  msgstr ""
2692
 
3391
  msgid "Migrated action with ID %1$d in %2$s to ID %3$d in %4$s"
3392
  msgstr ""
3393
 
3394
+ #: woocommerce-square.php:357
3395
  #. translators: plugin name
3396
  msgid ""
3397
  "<strong>All features in %1$s have been disabled</strong> due to unsupported "
3398
  "settings:<br>"
3399
  msgstr ""
3400
 
3401
+ #: woocommerce-square.php:365
3402
  #. translators: minimum PHP version, current PHP version
3403
  msgid ""
3404
  "&bull;&nbsp;<strong>Invalid PHP version: </strong>The minimum PHP version "
3405
  "required is %1$s. You are running %2$s.<br>"
3406
  msgstr ""
3407
 
3408
+ #: woocommerce-square.php:374
3409
  #. translators: link to documentation
3410
  msgid ""
3411
  "&bull;&nbsp;<strong>Invalid OPcache config: </strong><a href=\"%s\" "
includes/Admin/Sync_Page.php CHANGED
@@ -60,7 +60,7 @@ class Sync_Page {
60
 
61
 
62
  /**
63
- * Outputs notice-like tabular HTML with information on the current system of record handling.
64
  *
65
  * @since 2.0.0
66
  */
@@ -76,7 +76,7 @@ class Sync_Page {
76
  <?php
77
  printf(
78
  /* translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s, $4%s - closing </strong> HTML tag */
79
- esc_html__( '%1$sSquare%2$s is the system of record. The following data from Square will overwrite WooCommerce data for synced products: %3$sname, price, description, category, inventory%4$s.', 'woocommerce-square' ),
80
  '<strong>',
81
  '</strong>',
82
  '<strong>',
@@ -105,7 +105,7 @@ class Sync_Page {
105
  <?php
106
  printf(
107
  /* translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s, %4$s - closing </strong> HTML tag */
108
- esc_html__( '%1$sWooCommerce%2$s is the system of record. The following data from WooCommerce will overwrite Square data for synced products: %3$sname, price, inventory, category, image%4$s.', 'woocommerce-square' ),
109
  '<strong>',
110
  '</strong>',
111
  '<strong>',
@@ -122,7 +122,7 @@ class Sync_Page {
122
  <?php
123
  printf(
124
  /* translators: Placeholders: %1$s - opening <strong> HTML tag, %2$s closing </strong> HTML tag*/
125
- esc_html__( '%1$sNo chosen system of record.%2$s Products will not be synced between Square and WooCommerce.', 'woocommerce-square' ),
126
  '<strong>',
127
  '</strong>'
128
  );
@@ -380,8 +380,8 @@ class Sync_Page {
380
  <?php $additional_info = ob_get_clean(); ?>
381
  <?php
382
  printf(
383
- /* translators: Placeholders: %1$s - the system of record name (e.g. Square or WooCommerce), %3%s - unordered HTML list of additional information item(s) */
384
- esc_html__( 'You are about to sync products with Square. %1$s is your system of record. For all products synced with Square: %2$s', 'woocommerce-square' ),
385
  $square_settings->get_system_of_record_name(),
386
  $additional_info
387
  );
60
 
61
 
62
  /**
63
+ * Outputs notice-like tabular HTML with information on the current Sync setting handling.
64
  *
65
  * @since 2.0.0
66
  */
76
  <?php
77
  printf(
78
  /* translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s, $4%s - closing </strong> HTML tag */
79
+ esc_html__( '%1$sSquare%2$s is the system of record set in the sync settings. The following data from Square will overwrite WooCommerce data for synced products: %3$sname, price, description, category, inventory%4$s.', 'woocommerce-square' ),
80
  '<strong>',
81
  '</strong>',
82
  '<strong>',
105
  <?php
106
  printf(
107
  /* translators: Placeholders: %1$s, %3$s - opening <strong> HTML tag, %2$s, %4$s - closing </strong> HTML tag */
108
+ esc_html__( '%1$sWooCommerce%2$s is the system of record set in the sync settings. The following data from WooCommerce will overwrite Square data for synced products: %3$sname, price, inventory, category, image%4$s.', 'woocommerce-square' ),
109
  '<strong>',
110
  '</strong>',
111
  '<strong>',
122
  <?php
123
  printf(
124
  /* translators: Placeholders: %1$s - opening <strong> HTML tag, %2$s closing </strong> HTML tag*/
125
+ esc_html__( '%1$sSync setting not chosen.%2$s Products will not be synced between Square and WooCommerce.', 'woocommerce-square' ),
126
  '<strong>',
127
  '</strong>'
128
  );
380
  <?php $additional_info = ob_get_clean(); ?>
381
  <?php
382
  printf(
383
+ /* translators: Placeholders: %1$s - the name of the system of record set in the sync settings (e.g. Square or WooCommerce), %3%s - unordered HTML list of additional information item(s) */
384
+ esc_html__( 'You are about to sync products with Square. %1$s is your system of record set in the sync settings. For all products synced with Square: %2$s', 'woocommerce-square' ),
385
  $square_settings->get_system_of_record_name(),
386
  $additional_info
387
  );
includes/Emails/Sync_Completed.php CHANGED
@@ -60,7 +60,12 @@ class Sync_Completed extends Base_Email {
60
  $email_heading = parent::get_default_heading();
61
  }
62
 
63
- /** @see Sync_Completed::get_heading() for filter documentation */
 
 
 
 
 
64
  return apply_filters( 'woocommerce_email_heading_' . $this->id, $this->format_string( $email_heading ), $this->object );
65
  }
66
 
@@ -122,7 +127,12 @@ class Sync_Completed extends Base_Email {
122
  }
123
  }
124
 
125
- /** @see Sync_Completed::get_body() for filter documentation */
 
 
 
 
 
126
  return $this->format_string( (string) apply_filters( "{$this->id}_body", $email_body, $this ) );
127
  }
128
 
@@ -207,23 +217,14 @@ class Sync_Completed extends Base_Email {
207
  // placeholders
208
  $email_merge_tags = array(
209
  'product_count' => $product_count,
210
- 'sync_started_date' => isset( $job->started_at ) ? date( wc_date_format(), strtotime( $job->started_at ) ) : '',
211
- 'sync_started_time' => isset( $job->started_at ) ? date( wc_time_format(), strtotime( $job->started_at ) ) : '',
212
  'sync_completed_date' => $sync_completed_date,
213
  'sync_completed_time' => $sync_completed_time,
214
  );
215
 
216
- // TODO update handling when WooCommerce 3.2 is the minimum required version {FN 2019-05-03}
217
- if ( Plugin_Compatibility::is_wc_version_gte( '3.2' ) ) {
218
- foreach ( $email_merge_tags as $find => $replace ) {
219
- $this->placeholders[ '{' . $find . '}' ] = $replace;
220
- }
221
- } else {
222
-
223
- foreach ( $email_merge_tags as $find => $replace ) {
224
- $this->find[ $find ] = '{' . $find . '}';
225
- $this->replace[ $find ] = $replace;
226
- }
227
  }
228
  }
229
 
60
  $email_heading = parent::get_default_heading();
61
  }
62
 
63
+ /**
64
+ * Filter hook to filter email heading.
65
+ *
66
+ * @see Sync_Completed::get_heading() for filter documentation
67
+ * @since 2.0.0
68
+ **/
69
  return apply_filters( 'woocommerce_email_heading_' . $this->id, $this->format_string( $email_heading ), $this->object );
70
  }
71
 
127
  }
128
  }
129
 
130
+ /**
131
+ * Filter hook to filter email body.
132
+ *
133
+ * @see Sync_Completed::get_body() for filter documentation
134
+ * @since 2.0.0
135
+ **/
136
  return $this->format_string( (string) apply_filters( "{$this->id}_body", $email_body, $this ) );
137
  }
138
 
217
  // placeholders
218
  $email_merge_tags = array(
219
  'product_count' => $product_count,
220
+ 'sync_started_date' => isset( $job->started_at ) ? date( wc_date_format(), strtotime( $job->started_at ) ) : '',
221
+ 'sync_started_time' => isset( $job->started_at ) ? date( wc_time_format(), strtotime( $job->started_at ) ) : '',
222
  'sync_completed_date' => $sync_completed_date,
223
  'sync_completed_time' => $sync_completed_time,
224
  );
225
 
226
+ foreach ( $email_merge_tags as $find => $replace ) {
227
+ $this->placeholders[ '{' . $find . '}' ] = $replace;
 
 
 
 
 
 
 
 
 
228
  }
229
  }
230
 
includes/Framework/Compatibility/Order_Compatibility.php CHANGED
@@ -1,8 +1,7 @@
1
  <?php
2
  namespace WooCommerce\Square\Framework\Compatibility;
3
- use WooCommerce\Square\Framework\Plugin_Compatibility;
4
 
5
- defined( 'ABSPATH' ) or exit;
6
 
7
  /**
8
  * WooCommerce order compatibility class.
@@ -60,21 +59,6 @@ class Order_Compatibility extends Data_Compatibility {
60
  */
61
  public static function get_prop( $object, $prop, $context = 'edit', $compat_props = array() ) {
62
 
63
- // backport a few specific properties to pre-3.0
64
- if ( Plugin_Compatibility::is_wc_version_lt_3_0() ) {
65
-
66
- // convert the shipping_total prop for the edit context
67
- if ( 'shipping_total' === $prop && 'view' !== $context ) {
68
-
69
- $prop = 'order_shipping';
70
-
71
- // get the post_parent and bail early
72
- } elseif ( 'parent_id' === $prop ) {
73
-
74
- return $object->post->post_parent;
75
- }
76
- }
77
-
78
  return parent::get_prop( $object, $prop, $context, self::$compat_props );
79
  }
80
 
1
  <?php
2
  namespace WooCommerce\Square\Framework\Compatibility;
 
3
 
4
+ defined( 'ABSPATH' ) || exit;
5
 
6
  /**
7
  * WooCommerce order compatibility class.
59
  */
60
  public static function get_prop( $object, $prop, $context = 'edit', $compat_props = array() ) {
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  return parent::get_prop( $object, $prop, $context, self::$compat_props );
63
  }
64
 
includes/Framework/PaymentGateway/Admin/views/html-admin-gateway-status.php CHANGED
@@ -17,7 +17,7 @@
17
  *
18
  * Allow actors to add info the start of the gateway system status section.
19
  *
20
- * @since 4.3.0
21
  *
22
  * @param Payment_Gateway $gateway
23
  */
@@ -68,7 +68,7 @@
68
  *
69
  * Allow actors to add info the end of the gateway system status section.
70
  *
71
- * @since 4.3.0
72
  * @param \Payment_Gateway $gateway
73
  */
74
  do_action( 'wc_payment_gateway_' . $gateway->get_id() . '_system_status_end', $gateway );
17
  *
18
  * Allow actors to add info the start of the gateway system status section.
19
  *
20
+ * @since 3.0.0
21
  *
22
  * @param Payment_Gateway $gateway
23
  */
68
  *
69
  * Allow actors to add info the end of the gateway system status section.
70
  *
71
+ * @since 3.0.0
72
  * @param \Payment_Gateway $gateway
73
  */
74
  do_action( 'wc_payment_gateway_' . $gateway->get_id() . '_system_status_end', $gateway );
includes/Framework/PaymentGateway/Admin/views/html-user-payment-token-editor.php CHANGED
@@ -9,8 +9,10 @@
9
  <thead>
10
  <tr>
11
 
12
- <?php // Display a column for each token field
13
- foreach ( $columns as $column_id => $column_title ) : ?>
 
 
14
  <th class="token-<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_title ); ?></th>
15
  <?php endforeach; ?>
16
 
@@ -22,10 +24,11 @@
22
  <?php
23
  /** Fire inside the payment gateway token editor.
24
  *
25
- * @since 4.3.0
26
  * @param int $user_id the current user ID
27
  */
28
- do_action( 'wc_payment_gateway_' . $id . '_token_editor_tokens', $user_id ); ?>
 
29
 
30
  </tbody>
31
 
@@ -35,8 +38,10 @@
35
  </tr>
36
  </tbody>
37
 
38
- <?php // Editor actions
39
- if ( ! empty( $actions ) ) : ?>
 
 
40
 
41
  <tfoot>
42
  <tr>
9
  <thead>
10
  <tr>
11
 
12
+ <?php
13
+ // Display a column for each token field
14
+ foreach ( $columns as $column_id => $column_title ) :
15
+ ?>
16
  <th class="token-<?php echo esc_attr( $column_id ); ?>"><?php echo esc_html( $column_title ); ?></th>
17
  <?php endforeach; ?>
18
 
24
  <?php
25
  /** Fire inside the payment gateway token editor.
26
  *
27
+ * @since 3.0.0
28
  * @param int $user_id the current user ID
29
  */
30
+ do_action( 'wc_payment_gateway_' . $id . '_token_editor_tokens', $user_id );
31
+ ?>
32
 
33
  </tbody>
34
 
38
  </tr>
39
  </tbody>
40
 
41
+ <?php
42
+ // Editor actions
43
+ if ( ! empty( $actions ) ) :
44
+ ?>
45
 
46
  <tfoot>
47
  <tr>
includes/Framework/PaymentGateway/Admin/views/html-user-profile-section.php CHANGED
@@ -13,10 +13,11 @@
13
  <?php
14
  /** Fire inside the payment gateway user settings section.
15
  *
16
- * @since 4.3.0
17
  * @param \WP_User $user the current user object
18
  */
19
- do_action( 'wc_payment_gateway_' . $plugin_id . '_user_profile', $user ); ?>
 
20
 
21
  </tbody>
22
 
13
  <?php
14
  /** Fire inside the payment gateway user settings section.
15
  *
16
+ * @since 3.0.0
17
  * @param \WP_User $user the current user object
18
  */
19
+ do_action( 'wc_payment_gateway_' . $plugin_id . '_user_profile', $user );
20
+ ?>
21
 
22
  </tbody>
23
 
includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay.php CHANGED
@@ -13,14 +13,14 @@
13
  */
14
 
15
  namespace WooCommerce\Square\Framework\PaymentGateway\ApplePay;
 
16
  use WooCommerce\Square\Framework\PaymentGateway\ApplePay\Api as ApplePayApi;
17
  use WooCommerce\Square\Framework as SquareFramework;
18
  use WooCommerce\Square\Framework\Compatibility\Order_Compatibility;
19
  use WooCommerce\Square\Framework\PaymentGateway\Payment_Gateway_Helper;
20
  use WooCommerce\Square\Framework\PaymentGateway\Payment_Gateway_Plugin;
21
- use WooCommerce\Square\Framework\Plugin_Compatibility;
22
 
23
- defined( 'ABSPATH' ) or exit;
24
 
25
  /**
26
  * Sets up Apple Pay support.
@@ -102,6 +102,7 @@ class Payment_Gateway_Apple_Pay {
102
  throw new \Exception( __( 'Invalid payment response data', 'woocommerce-square' ) );
103
  }
104
 
 
105
  $this->log( sprintf( esc_html__( "Payment Response:\n %s", 'woocommerce-square' ) ), $payment_response->to_string_safe() . "\n" );
106
 
107
  $order = Payment_Gateway_Apple_Pay_Orders::create_order( WC()->cart );
@@ -112,7 +113,7 @@ class Payment_Gateway_Apple_Pay {
112
  // from here on out, it's up to the gateway to not screw things up.
113
  $order->add_order_note( __( 'Apple Pay payment authorized.', 'woocommerce-square' ) );
114
 
115
- $order->set_address( $payment_response->get_billing_address(), 'billing' );
116
  $order->set_address( $payment_response->get_shipping_address(), 'shipping' );
117
  $order->save();
118
 
@@ -141,11 +142,13 @@ class Payment_Gateway_Apple_Pay {
141
 
142
  if ( $order ) {
143
 
144
- $order->add_order_note( sprintf(
145
- /** translators: Placeholders: %s - the error message */
146
- esc_html__( 'Apple Pay payment failed. %s', 'woocommerce-square' ),
147
- $e->getMessage()
148
- ) );
 
 
149
  }
150
 
151
  throw $e;
@@ -291,10 +294,6 @@ class Payment_Gateway_Apple_Pay {
291
  throw new \Exception( __( 'Cart contains pre-orders.', 'woocommerce-square' ) );
292
  }
293
 
294
- if ( Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
295
- define( 'WOOCOMMERCE_CHECKOUT', true );
296
- }
297
-
298
  $cart->calculate_totals();
299
 
300
  if ( count( WC()->shipping->get_packages() ) > 1 ) {
@@ -332,7 +331,7 @@ class Payment_Gateway_Apple_Pay {
332
 
333
  $payment_request = $this->get_stored_payment_request();
334
 
335
- if ( empty( $payment_request ) ){
336
  throw new \Exception( __( 'Payment request data is missing.', 'woocommerce-square' ) );
337
  }
338
 
@@ -396,10 +395,6 @@ class Payment_Gateway_Apple_Pay {
396
  */
397
  protected function get_cart_totals( \WC_Cart $cart ) {
398
 
399
- if ( Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
400
- define( 'WOOCOMMERCE_CHECKOUT', true );
401
- }
402
-
403
  $cart->calculate_totals();
404
 
405
  return array(
@@ -436,15 +431,18 @@ class Payment_Gateway_Apple_Pay {
436
  */
437
  public function build_payment_request( $amount, $args = array() ) {
438
 
439
- $args = wp_parse_args( $args, array(
440
- 'currency_code' => get_woocommerce_currency(),
441
- 'country_code' => get_option( 'woocommerce_default_country' ),
442
- 'merchant_name' => get_bloginfo( 'name', 'display' ),
443
- 'merchant_capabilities' => $this->get_capabilities(),
444
- 'supported_networks' => $this->get_supported_networks(),
445
- 'line_totals' => array(),
446
- 'needs_shipping' => false,
447
- ) );
 
 
 
448
 
449
  // set the base required defaults
450
  $request = array(
@@ -513,13 +511,16 @@ class Payment_Gateway_Apple_Pay {
513
  */
514
  public function build_payment_request_lines( $totals ) {
515
 
516
- $totals = wp_parse_args( $totals, array(
517
- 'subtotal' => 0.00,
518
- 'discount' => 0.00,
519
- 'shipping' => 0.00,
520
- 'fees' => 0.00,
521
- 'taxes' => 0.00,
522
- ) );
 
 
 
523
 
524
  $lines = array();
525
 
@@ -685,7 +686,7 @@ class Payment_Gateway_Apple_Pay {
685
  // 1. shipping is available
686
  // 2. billing is not available
687
  // 3. taxes aren't configured to use the shop base
688
- if ( WC()->customer->get_shipping_country() && ! $billing_country && $address[0] !== WC()->countries->get_base_country() ) {
689
 
690
  $address = array(
691
  WC()->customer->get_shipping_country(),
@@ -730,9 +731,9 @@ class Payment_Gateway_Apple_Pay {
730
 
731
  if ( ! $this->api instanceof ApplePayApi\Payment_Gateway_Apple_Pay_API ) {
732
 
733
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api.php' );
734
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Request.php' );
735
- require_once( $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Response.php' );
736
 
737
  $this->api = new ApplePayApi\Payment_Gateway_Apple_Pay_API( $this->get_processing_gateway() );
738
  }
@@ -945,7 +946,7 @@ class Payment_Gateway_Apple_Pay {
945
  Payment_Gateway_Helper::CARD_TYPE_DISCOVER => 'discover',
946
  Payment_Gateway_Helper::CARD_TYPE_MASTERCARD => 'masterCard',
947
  Payment_Gateway_Helper::CARD_TYPE_VISA => 'visa',
948
- 'privateLabel' => 'privateLabel', // ?
949
  );
950
 
951
  $networks = array_intersect_key( $valid_networks, array_flip( $accepted_card_types ) );
13
  */
14
 
15
  namespace WooCommerce\Square\Framework\PaymentGateway\ApplePay;
16
+
17
  use WooCommerce\Square\Framework\PaymentGateway\ApplePay\Api as ApplePayApi;
18
  use WooCommerce\Square\Framework as SquareFramework;
19
  use WooCommerce\Square\Framework\Compatibility\Order_Compatibility;
20
  use WooCommerce\Square\Framework\PaymentGateway\Payment_Gateway_Helper;
21
  use WooCommerce\Square\Framework\PaymentGateway\Payment_Gateway_Plugin;
 
22
 
23
+ defined( 'ABSPATH' ) || exit;
24
 
25
  /**
26
  * Sets up Apple Pay support.
102
  throw new \Exception( __( 'Invalid payment response data', 'woocommerce-square' ) );
103
  }
104
 
105
+ /* translators: Placeholders: %s - payment response as string */
106
  $this->log( sprintf( esc_html__( "Payment Response:\n %s", 'woocommerce-square' ) ), $payment_response->to_string_safe() . "\n" );
107
 
108
  $order = Payment_Gateway_Apple_Pay_Orders::create_order( WC()->cart );
113
  // from here on out, it's up to the gateway to not screw things up.
114
  $order->add_order_note( __( 'Apple Pay payment authorized.', 'woocommerce-square' ) );
115
 
116
+ $order->set_address( $payment_response->get_billing_address(), 'billing' );
117
  $order->set_address( $payment_response->get_shipping_address(), 'shipping' );
118
  $order->save();
119
 
142
 
143
  if ( $order ) {
144
 
145
+ $order->add_order_note(
146
+ sprintf(
147
+ /* translators: Placeholders: %s - the error message */
148
+ esc_html__( 'Apple Pay payment failed. %s', 'woocommerce-square' ),
149
+ $e->getMessage()
150
+ )
151
+ );
152
  }
153
 
154
  throw $e;
294
  throw new \Exception( __( 'Cart contains pre-orders.', 'woocommerce-square' ) );
295
  }
296
 
 
 
 
 
297
  $cart->calculate_totals();
298
 
299
  if ( count( WC()->shipping->get_packages() ) > 1 ) {
331
 
332
  $payment_request = $this->get_stored_payment_request();
333
 
334
+ if ( empty( $payment_request ) ) {
335
  throw new \Exception( __( 'Payment request data is missing.', 'woocommerce-square' ) );
336
  }
337
 
395
  */
396
  protected function get_cart_totals( \WC_Cart $cart ) {
397
 
 
 
 
 
398
  $cart->calculate_totals();
399
 
400
  return array(
431
  */
432
  public function build_payment_request( $amount, $args = array() ) {
433
 
434
+ $args = wp_parse_args(
435
+ $args,
436
+ array(
437
+ 'currency_code' => get_woocommerce_currency(),
438
+ 'country_code' => get_option( 'woocommerce_default_country' ),
439
+ 'merchant_name' => get_bloginfo( 'name', 'display' ),
440
+ 'merchant_capabilities' => $this->get_capabilities(),
441
+ 'supported_networks' => $this->get_supported_networks(),
442
+ 'line_totals' => array(),
443
+ 'needs_shipping' => false,
444
+ )
445
+ );
446
 
447
  // set the base required defaults
448
  $request = array(
511
  */
512
  public function build_payment_request_lines( $totals ) {
513
 
514
+ $totals = wp_parse_args(
515
+ $totals,
516
+ array(
517
+ 'subtotal' => 0.00,
518
+ 'discount' => 0.00,
519
+ 'shipping' => 0.00,
520
+ 'fees' => 0.00,
521
+ 'taxes' => 0.00,
522
+ )
523
+ );
524
 
525
  $lines = array();
526
 
686
  // 1. shipping is available
687
  // 2. billing is not available
688
  // 3. taxes aren't configured to use the shop base
689
+ if ( WC()->customer->get_shipping_country() && ! $billing_country && WC()->countries->get_base_country() !== $address[0] ) {
690
 
691
  $address = array(
692
  WC()->customer->get_shipping_country(),
731
 
732
  if ( ! $this->api instanceof ApplePayApi\Payment_Gateway_Apple_Pay_API ) {
733
 
734
+ require_once $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api.php';
735
+ require_once $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Request.php';
736
+ require_once $this->get_plugin()->get_payment_gateway_framework_path() . '/ApplePay/Api/Payment_Gateway_Apple_Pay_Api_Response.php';
737
 
738
  $this->api = new ApplePayApi\Payment_Gateway_Apple_Pay_API( $this->get_processing_gateway() );
739
  }
946
  Payment_Gateway_Helper::CARD_TYPE_DISCOVER => 'discover',
947
  Payment_Gateway_Helper::CARD_TYPE_MASTERCARD => 'masterCard',
948
  Payment_Gateway_Helper::CARD_TYPE_VISA => 'visa',
949
+ 'privateLabel' => 'privateLabel', // ?
950
  );
951
 
952
  $networks = array_intersect_key( $valid_networks, array_flip( $accepted_card_types ) );
includes/Framework/PaymentGateway/ApplePay/Payment_Gateway_Apple_Pay_Orders.php CHANGED
@@ -13,9 +13,8 @@
13
  namespace WooCommerce\Square\Framework\PaymentGateway\ApplePay;
14
 
15
  use WooCommerce\Square\Framework\Compatibility\Order_Compatibility;
16
- use WooCommerce\Square\Framework\Plugin_Compatibility;
17
 
18
- defined( 'ABSPATH' ) or exit;
19
 
20
  /**
21
  * The Apple Pay order handler.
@@ -36,10 +35,6 @@ class Payment_Gateway_Apple_Pay_Orders {
36
  */
37
  public static function create_order( \WC_Cart $cart ) {
38
 
39
- if ( Plugin_Compatibility::is_wc_version_lt( '3.2' ) && ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
40
- define( 'WOOCOMMERCE_CHECKOUT', true );
41
- }
42
-
43
  $cart->calculate_totals();
44
 
45
  try {
@@ -47,6 +42,11 @@ class Payment_Gateway_Apple_Pay_Orders {
47
  wc_transaction_query( 'start' );
48
 
49
  $order_data = array(
 
 
 
 
 
50
  'status' => apply_filters( 'woocommerce_default_order_status', 'pending' ),
51
  'customer_id' => get_current_user_id(),
52
  'cart_hash' => md5( wp_json_encode( wc_clean( $cart->get_cart_for_session() ) ) . $cart->total ),
@@ -64,11 +64,12 @@ class Payment_Gateway_Apple_Pay_Orders {
64
  'subtotal_tax' => $item['line_subtotal_tax'],
65
  'total' => $item['line_total'],
66
  'tax' => $item['line_tax'],
67
- 'tax_data' => $item['line_tax_data']
68
  ),
69
  );
70
 
71
  if ( ! $order->add_product( $item['data'], $item['quantity'], $args ) ) {
 
72
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 525 ) );
73
  }
74
  }
@@ -76,6 +77,7 @@ class Payment_Gateway_Apple_Pay_Orders {
76
  foreach ( $cart->get_coupons() as $code => $coupon ) {
77
 
78
  if ( ! Order_Compatibility::add_coupon( $order, $code, $cart->get_coupon_discount_amount( $code ), $cart->get_coupon_discount_tax_amount( $code ) ) ) {
 
79
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 529 ) );
80
  }
81
  }
@@ -89,6 +91,7 @@ class Payment_Gateway_Apple_Pay_Orders {
89
  $method = $package['rates'][ $chosen_methods[ $key ] ];
90
 
91
  if ( ! Order_Compatibility::add_shipping( $order, $method ) ) {
 
92
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 527 ) );
93
  }
94
  }
@@ -98,18 +101,25 @@ class Payment_Gateway_Apple_Pay_Orders {
98
  foreach ( $cart->get_fees() as $key => $fee ) {
99
 
100
  if ( ! Order_Compatibility::add_fee( $order, $fee ) ) {
 
101
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 526 ) );
102
  }
103
  }
104
 
105
- $cart_taxes = Plugin_Compatibility::is_wc_version_gte( '3.2' ) ? $cart->get_cart_contents_taxes() : $cart->taxes;
106
- $shipping_taxes = Plugin_Compatibility::is_wc_version_gte( '3.2' ) ? $cart->get_shipping_taxes() : $cart->shipping_taxes;
107
 
108
  foreach ( array_keys( $cart_taxes + $shipping_taxes ) as $rate_id ) {
109
 
 
 
 
 
 
110
  if ( $rate_id && apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) !== $rate_id ) {
111
 
112
  if ( ! Order_Compatibility::add_tax( $order, $rate_id, $cart->get_tax_amount( $rate_id ), $cart->get_shipping_tax_amount( $rate_id ) ) ) {
 
113
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 526 ) );
114
  }
115
  }
@@ -121,6 +131,11 @@ class Payment_Gateway_Apple_Pay_Orders {
121
 
122
  $order->calculate_totals( false ); // false to skip recalculating taxes
123
 
 
 
 
 
 
124
  do_action( 'woocommerce_checkout_update_order_meta', Order_Compatibility::get_prop( $order, 'id' ), array() );
125
 
126
  return $order;
@@ -147,25 +162,27 @@ class Payment_Gateway_Apple_Pay_Orders {
147
 
148
  $order_id = (int) WC()->session->get( 'order_awaiting_payment', 0 );
149
 
150
- if ( $order_id && $order_data['cart_hash'] === get_post_meta( $order_id, '_cart_hash', true ) && ( $order = wc_get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) {
151
 
152
  $order_data['order_id'] = $order_id;
153
 
154
  $order = wc_update_order( $order_data );
155
 
156
  if ( is_wp_error( $order ) ) {
 
157
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 522 ) );
158
  } else {
159
  $order->remove_order_items();
160
  }
161
-
162
  } else {
163
 
164
  $order = wc_create_order( $order_data );
165
 
166
  if ( is_wp_error( $order ) ) {
 
167
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 520 ) );
168
  } elseif ( false === $order ) {
 
169
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 521 ) );
170
  }
171
 
13
  namespace WooCommerce\Square\Framework\PaymentGateway\ApplePay;
14
 
15
  use WooCommerce\Square\Framework\Compatibility\Order_Compatibility;
 
16
 
17
+ defined( 'ABSPATH' ) || exit;
18
 
19
  /**
20
  * The Apple Pay order handler.
35
  */
36
  public static function create_order( \WC_Cart $cart ) {
37
 
 
 
 
 
38
  $cart->calculate_totals();
39
 
40
  try {
42
  wc_transaction_query( 'start' );
43
 
44
  $order_data = array(
45
+ /**
46
+ * Hook to filter default order status.
47
+ *
48
+ * @since 3.0.0
49
+ */
50
  'status' => apply_filters( 'woocommerce_default_order_status', 'pending' ),
51
  'customer_id' => get_current_user_id(),
52
  'cart_hash' => md5( wp_json_encode( wc_clean( $cart->get_cart_for_session() ) ) . $cart->total ),
64
  'subtotal_tax' => $item['line_subtotal_tax'],
65
  'total' => $item['line_total'],
66
  'tax' => $item['line_tax'],
67
+ 'tax_data' => $item['line_tax_data'],
68
  ),
69
  );
70
 
71
  if ( ! $order->add_product( $item['data'], $item['quantity'], $args ) ) {
72
+ /* translators: Placeholders: %s - error code when order creation fails */
73
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 525 ) );
74
  }
75
  }
77
  foreach ( $cart->get_coupons() as $code => $coupon ) {
78
 
79
  if ( ! Order_Compatibility::add_coupon( $order, $code, $cart->get_coupon_discount_amount( $code ), $cart->get_coupon_discount_tax_amount( $code ) ) ) {
80
+ /* translators: Placeholders: %s - error code when order creation fails */
81
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 529 ) );
82
  }
83
  }
91
  $method = $package['rates'][ $chosen_methods[ $key ] ];
92
 
93
  if ( ! Order_Compatibility::add_shipping( $order, $method ) ) {
94
+ /* translators: Placeholders: %s - error code when order creation fails */
95
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 527 ) );
96
  }
97
  }
101
  foreach ( $cart->get_fees() as $key => $fee ) {
102
 
103
  if ( ! Order_Compatibility::add_fee( $order, $fee ) ) {
104
+ /* translators: Placeholders: %s - error code when order creation fails */
105
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 526 ) );
106
  }
107
  }
108
 
109
+ $cart_taxes = $cart->get_cart_contents_taxes();
110
+ $shipping_taxes = $cart->get_shipping_taxes();
111
 
112
  foreach ( array_keys( $cart_taxes + $shipping_taxes ) as $rate_id ) {
113
 
114
+ /**
115
+ * Filter hook to disabled zero rate tax.
116
+ *
117
+ * @since 3.0.0
118
+ */
119
  if ( $rate_id && apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) !== $rate_id ) {
120
 
121
  if ( ! Order_Compatibility::add_tax( $order, $rate_id, $cart->get_tax_amount( $rate_id ), $cart->get_shipping_tax_amount( $rate_id ) ) ) {
122
+ /* translators: Placeholders: %s - error code when order creation fails */
123
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 526 ) );
124
  }
125
  }
131
 
132
  $order->calculate_totals( false ); // false to skip recalculating taxes
133
 
134
+ /**
135
+ * Action hook that runs after order meta is updated.
136
+ *
137
+ * @since 3.0.0
138
+ */
139
  do_action( 'woocommerce_checkout_update_order_meta', Order_Compatibility::get_prop( $order, 'id' ), array() );
140
 
141
  return $order;
162
 
163
  $order_id = (int) WC()->session->get( 'order_awaiting_payment', 0 );
164
 
165
+ if ( $order_id && get_post_meta( $order_id, '_cart_hash', true ) === $order_data['cart_hash'] && ( $order = wc_get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) {
166
 
167
  $order_data['order_id'] = $order_id;
168
 
169
  $order = wc_update_order( $order_data );
170
 
171
  if ( is_wp_error( $order ) ) {
172
+ /* translators: Placeholders: %s - error code when order creation fails */
173
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 522 ) );
174
  } else {
175
  $order->remove_order_items();
176
  }
 
177
  } else {
178
 
179
  $order = wc_create_order( $order_data );
180
 
181
  if ( is_wp_error( $order ) ) {
182
+ /* translators: Placeholders: %s - error code when order creation fails */
183
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 520 ) );
184
  } elseif ( false === $order ) {
185
+ /* translators: Placeholders: %s - error code when order creation fails */
186
  throw new \Exception( sprintf( __( 'Error %d: Unable to create order. Please try again.', 'woocommerce-square' ), 521 ) );
187
  }
188
 
includes/Framework/PaymentGateway/Payment_Gateway_Direct.php CHANGED
@@ -909,15 +909,15 @@ abstract class Payment_Gateway_Direct extends Payment_Gateway {
909
  * @param \WooCommerce\Square\Framework\PaymentGateway\Api\Payment_Gateway_API_Create_Payment_Token_Response $response
910
  */
911
  protected function add_add_payment_method_customer_data( $order, $response ) {
912
- $user_id = $order->get_user_id();
 
 
913
 
914
  // set customer ID from response if available
915
- if ( $this->supports_customer_id() && method_exists( $response, 'get_customer_id' ) && $response->get_customer_id() ) {
916
-
917
- $order->customer_id = $customer_id = $response->get_customer_id();
918
 
919
  } else {
920
-
921
  // default to the customer ID on "order"
922
  $customer_id = $order->customer_id;
923
  }
909
  * @param \WooCommerce\Square\Framework\PaymentGateway\Api\Payment_Gateway_API_Create_Payment_Token_Response $response
910
  */
911
  protected function add_add_payment_method_customer_data( $order, $response ) {
912
+ $user_id = $order->get_user_id();
913
+ $response_data = $response->get_data();
914
+ $card = $response_data instanceof \Square\Models\CreateCardResponse ? $response_data->getCard() : null;
915
 
916
  // set customer ID from response if available
917
+ if ( $this->supports_customer_id() && $card ) {
918
+ $order->customer_id = $customer_id = $card->getCustomerId();
 
919
 
920
  } else {
 
921
  // default to the customer ID on "order"
922
  $customer_id = $order->customer_id;
923
  }
includes/Framework/PaymentGateway/Payment_Gateway_Plugin.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  namespace WooCommerce\Square\Framework\PaymentGateway;
 
4
  use WooCommerce\Square\Framework\Plugin;
5
  use WooCommerce\Square\Framework\Plugin_Compatibility;
6
  use WooCommerce\Square\Framework\PaymentGateway\Admin\Payment_Gateway_Admin_Order;
@@ -8,7 +9,7 @@ use WooCommerce\Square\Framework\PaymentGateway\Admin\Payment_Gateway_Admin_User
8
  use WooCommerce\Square\Framework as SquareFramework;
9
  use WooCommerce\Square\Framework\PaymentGateway\ApplePay as ApplePayFramework;
10
 
11
- defined( 'ABSPATH' ) or exit;
12
 
13
  /**
14
  * # WooCommerce Payment Gateway Plugin Framework
@@ -101,12 +102,15 @@ abstract class Payment_Gateway_Plugin extends Plugin {
101
 
102
  parent::__construct( $id, $version, $args );
103
 
104
- $args = wp_parse_args( $args, array(
105
- 'gateways' => array(),
106
- 'currencies' => array(),
107
- 'supports' => array(),
108
- 'require_ssl' => false,
109
- ) );
 
 
 
110
 
111
  // add each gateway
112
  foreach ( $args['gateways'] as $gateway_id => $gateway_class_name ) {
@@ -224,62 +228,59 @@ abstract class Payment_Gateway_Plugin extends Plugin {
224
  $payment_gateway_framework_path = $this->get_payment_gateway_framework_path();
225
 
226
  // interfaces
227
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api.php' );
228
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_API_Response.php' );
229
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Authorization_Response.php' );
230
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Create_Payment_Token_Response.php' );
231
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Get_Tokenized_Payment_Methods_Response.php' );
232
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Customer_Response.php' );
233
 
234
  // gateway
235
- require_once( $payment_gateway_framework_path . '/Payment_Gateway.php' );
236
- require_once( $payment_gateway_framework_path . '/Payment_Gateway_Direct.php' );
237
- require_once( $payment_gateway_framework_path . '/Payment_Gateway_Payment_Form.php' );
238
- require_once( $payment_gateway_framework_path . '/Payment_Gateway_My_Payment_Methods.php' );
239
 
240
  // handlers
241
- require_once( $payment_gateway_framework_path . '/Handlers/Capture.php' );
242
 
243
  // apple pay
244
- require_once( "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay.php" );
245
- require_once( "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Admin.php" );
246
- require_once( "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Frontend.php" );
247
- require_once( "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Ajax.php" );
248
- require_once( "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Orders.php" );
249
- require_once( "{$payment_gateway_framework_path}/ApplePay/Api/Payment_Gateway_Apple_Pay_Payment_Response.php" );
250
 
251
  // payment tokens
252
- require_once( $payment_gateway_framework_path . '/PaymentTokens/Payment_Gateway_Payment_Token.php' );
253
- require_once( $payment_gateway_framework_path . '/PaymentTokens/Payment_Gateway_Payment_Tokens_Handler.php' );
254
 
255
  // helpers
256
- require_once( $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Response_Message_Helper.php' );
257
- require_once( $payment_gateway_framework_path . '/Payment_Gateway_Helper.php' );
258
 
259
  // admin
260
- require_once( $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_Order.php' );
261
- require_once( $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_User_Handler.php' );
262
- require_once( $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_Payment_Token_Editor.php' );
263
-
264
 
265
  // integrations
266
- require_once( $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration.php' );
267
 
268
  // subscriptions
269
  if ( $this->is_subscriptions_active() ) {
270
- require_once( $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration_Subscriptions.php' );
271
  }
272
 
273
  // pre-orders
274
  if ( $this->is_pre_orders_active() ) {
275
- require_once( $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration_Pre_Orders.php' );
276
  }
277
 
278
  // privacy
279
- if ( Plugin_Compatibility::is_wc_version_gte( '3.4' ) ) {
280
- require_once( "{$payment_gateway_framework_path}/Payment_Gateway_Privacy.php" );
281
- $this->privacy_handler = new Payment_Gateway_Privacy( $this );
282
- }
283
  }
284
 
285
 
@@ -546,30 +547,38 @@ abstract class Payment_Gateway_Plugin extends Plugin {
546
 
547
  if ( $gateway->is_production_environment() && $this->get_admin_notice_handler()->should_display_notice( 'ssl-required' ) ) {
548
 
549
- /* translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a> tag */
550
- $message = sprintf( esc_html__( '%1$s: WooCommerce is not being forced over SSL; your customers\' payment data may be at risk. %2$sVerify your site URLs here%3$s', 'woocommerce-square' ),
 
551
  '<strong>' . $this->get_plugin_name() . '</strong>',
552
  '<a href="' . admin_url( 'options-general.php' ) . '">',
553
  ' &raquo;</a>'
554
  );
555
 
556
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'ssl-required', array(
557
- 'notice_class' => 'error',
558
- ) );
 
 
 
 
559
 
560
  // just show the message once for plugins with multiple gateway support
561
  break;
562
  }
563
-
564
  } elseif ( $gateway->get_api() && is_callable( array( $gateway->get_api(), 'require_tls_1_2' ) ) && is_callable( array( $gateway->get_api(), 'is_tls_1_2_available' ) ) && $gateway->get_api()->require_tls_1_2() && ! $gateway->get_api()->is_tls_1_2_available() ) {
565
 
566
  /* translators: Placeholders: %s - payment gateway name */
567
- $message = sprintf( esc_html__( "%s will soon require TLS 1.2 support to process transactions and your server environment may need to be updated. Please contact your hosting provider to confirm that your site can send and receive TLS 1.2 connections and request they make any necessary updates.", 'woocommerce-square' ), '<strong>' . $gateway->get_method_title() . '</strong>' );
568
 
569
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'tls-1-2-required', array(
570
- 'notice_class' => 'notice-warning',
571
- 'always_show_on_settings' => false,
572
- ) );
 
 
 
 
573
 
574
  // just show the message once for plugins with multiple gateway support
575
  break;
@@ -602,10 +611,10 @@ abstract class Payment_Gateway_Plugin extends Plugin {
602
  }
603
  }
604
 
605
- if ( count( $gateways ) == 0 ) {
606
  // no active gateways with unmet currency requirements
607
  return;
608
- } elseif ( count( $gateways ) == 1 && count( $this->get_gateways() ) > 1 ) {
609
  // one gateway out of many has a currency issue
610
  $suffix = '-' . $gateway->get_id();
611
  $name = $gateway->get_method_title();
@@ -632,9 +641,13 @@ abstract class Payment_Gateway_Plugin extends Plugin {
632
  '</a>'
633
  );
634
 
635
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'accepted-currency' . $suffix, array(
636
- 'notice_class' => 'error',
637
- ) );
 
 
 
 
638
 
639
  }
640
  }
@@ -657,12 +670,17 @@ abstract class Payment_Gateway_Plugin extends Plugin {
657
  /* translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a> tag, %3$s - closing </a> tag */
658
  esc_html__( 'Heads up! %1$s is currently configured to log transaction data for debugging purposes. If you are not experiencing any problems with payment processing, we recommend %2$sturning off Debug Mode%3$s', 'woocommerce-square' ),
659
  $gateway->get_method_title(),
660
- ! $is_gateway_settings ? '<a href="' . esc_url( $this->get_payment_gateway_configuration_url( $gateway->get_id() ) ) . '">' : '', ! $is_gateway_settings ? ' &raquo;</a>' : ''
 
661
  );
662
 
663
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'debug-in-production', array(
664
- 'notice_class' => 'notice-warning',
665
- ) );
 
 
 
 
666
 
667
  break;
668
  }
@@ -692,8 +710,8 @@ abstract class Payment_Gateway_Plugin extends Plugin {
692
  // subscriptions
693
  if ( $this->is_subscriptions_active() && $gateway->is_enabled() && $tokenization_supported_but_not_enabled ) {
694
 
695
- /* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag */
696
  $message = sprintf(
 
697
  esc_html__( '%1$s is inactive for subscription transactions. Please %2$senable tokenization%3$s to activate %1$s for Subscriptions.', 'woocommerce-square' ),
698
  $gateway->get_method_title(),
699
  '<a href="' . $this->get_payment_gateway_configuration_url( $gateway->get_id() ) . '">',
@@ -701,17 +719,21 @@ abstract class Payment_Gateway_Plugin extends Plugin {
701
  );
702
 
703
  // add notice -- allow it to be dismissed even on the settings page as the admin may not want to use subscriptions with a particular gateway
704
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'subscriptions-tokenization-' . $gateway->get_id(), array(
705
- 'always_show_on_settings' => false,
706
- 'notice_class' => 'error',
707
- ) );
 
 
 
 
708
  }
709
 
710
  // pre-orders
711
  if ( $this->is_pre_orders_active() && $gateway->is_enabled() && $tokenization_supported_but_not_enabled ) {
712
 
713
- /* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag */
714
  $message = sprintf(
 
715
  esc_html__( '%1$s is inactive for pre-order transactions. Please %2$senable tokenization%3$s to activate %1$s for Pre-Orders.', 'woocommerce-square' ),
716
  $gateway->get_method_title(),
717
  '<a href="' . $this->get_payment_gateway_configuration_url( $gateway->get_id() ) . '">',
@@ -719,10 +741,14 @@ abstract class Payment_Gateway_Plugin extends Plugin {
719
  );
720
 
721
  // add notice -- allow it to be dismissed even on the settings page as the admin may not want to use pre-orders with a particular gateway
722
- $this->get_admin_notice_handler()->add_admin_notice( $message, 'pre-orders-tokenization-' . $gateway->get_id(), array(
723
- 'always_show_on_settings' => false,
724
- 'notice_class' => 'error',
725
- ) );
 
 
 
 
726
  }
727
  }
728
  }
@@ -752,9 +778,12 @@ abstract class Payment_Gateway_Plugin extends Plugin {
752
  $tool_tip = esc_attr__( 'You must enable tokenization for this gateway in order to support automatic renewal payments with the WooCommerce Subscriptions extension.', 'woocommerce-square' );
753
  $status = esc_html__( 'Inactive', 'woocommerce-square' );
754
 
755
- $html = sprintf( '<a href="%1$s"><span class="sv-wc-payment-gateway-renewal-status-inactive tips" data-tip="%2$s">%3$s</span></a>',
756
- esc_url( $this->get_payment_gateway_configuration_url( $gateway->get_id() ) ),
757
- $tool_tip, $status );
 
 
 
758
  }
759
 
760
  return $html;
@@ -791,7 +820,7 @@ abstract class Payment_Gateway_Plugin extends Plugin {
791
 
792
  $environment = $gateway->get_environment_name();
793
 
794
- include( $this->get_payment_gateway_framework_path() . '/Admin/views/html-admin-gateway-status.php' );
795
  }
796
  }
797
 
@@ -952,8 +981,8 @@ abstract class Payment_Gateway_Plugin extends Plugin {
952
  */
953
  public function is_payment_gateway_configuration_page( $gateway_id ) {
954
 
955
- return isset( $_GET['page'] ) && 'wc-settings' == $_GET['page'] &&
956
- isset( $_GET['tab'] ) && 'checkout' == $_GET['tab'] &&
957
  isset( $_GET['section'] ) && $gateway_id === $_GET['section'];
958
  }
959
 
@@ -968,7 +997,10 @@ abstract class Payment_Gateway_Plugin extends Plugin {
968
  */
969
  public function add_gateway( $gateway_id, $gateway_class_name ) {
970
 
971
- $this->gateways[ $gateway_id ] = array( 'gateway_class_name' => $gateway_class_name, 'gateway' => null );
 
 
 
972
  }
973
 
974
 
1
  <?php
2
 
3
  namespace WooCommerce\Square\Framework\PaymentGateway;
4
+
5
  use WooCommerce\Square\Framework\Plugin;
6
  use WooCommerce\Square\Framework\Plugin_Compatibility;
7
  use WooCommerce\Square\Framework\PaymentGateway\Admin\Payment_Gateway_Admin_Order;
9
  use WooCommerce\Square\Framework as SquareFramework;
10
  use WooCommerce\Square\Framework\PaymentGateway\ApplePay as ApplePayFramework;
11
 
12
+ defined( 'ABSPATH' ) || exit;
13
 
14
  /**
15
  * # WooCommerce Payment Gateway Plugin Framework
102
 
103
  parent::__construct( $id, $version, $args );
104
 
105
+ $args = wp_parse_args(
106
+ $args,
107
+ array(
108
+ 'gateways' => array(),
109
+ 'currencies' => array(),
110
+ 'supports' => array(),
111
+ 'require_ssl' => false,
112
+ )
113
+ );
114
 
115
  // add each gateway
116
  foreach ( $args['gateways'] as $gateway_id => $gateway_class_name ) {
228
  $payment_gateway_framework_path = $this->get_payment_gateway_framework_path();
229
 
230
  // interfaces
231
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api.php';
232
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_API_Response.php';
233
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Authorization_Response.php';
234
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Create_Payment_Token_Response.php';
235
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Get_Tokenized_Payment_Methods_Response.php';
236
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Customer_Response.php';
237
 
238
  // gateway
239
+ require_once $payment_gateway_framework_path . '/Payment_Gateway.php';
240
+ require_once $payment_gateway_framework_path . '/Payment_Gateway_Direct.php';
241
+ require_once $payment_gateway_framework_path . '/Payment_Gateway_Payment_Form.php';
242
+ require_once $payment_gateway_framework_path . '/Payment_Gateway_My_Payment_Methods.php';
243
 
244
  // handlers
245
+ require_once $payment_gateway_framework_path . '/Handlers/Capture.php';
246
 
247
  // apple pay
248
+ require_once "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay.php";
249
+ require_once "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Admin.php";
250
+ require_once "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Frontend.php";
251
+ require_once "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Ajax.php";
252
+ require_once "{$payment_gateway_framework_path}/ApplePay/Payment_Gateway_Apple_Pay_Orders.php";
253
+ require_once "{$payment_gateway_framework_path}/ApplePay/Api/Payment_Gateway_Apple_Pay_Payment_Response.php";
254
 
255
  // payment tokens
256
+ require_once $payment_gateway_framework_path . '/PaymentTokens/Payment_Gateway_Payment_Token.php';
257
+ require_once $payment_gateway_framework_path . '/PaymentTokens/Payment_Gateway_Payment_Tokens_Handler.php';
258
 
259
  // helpers
260
+ require_once $payment_gateway_framework_path . '/Api/Payment_Gateway_Api_Response_Message_Helper.php';
261
+ require_once $payment_gateway_framework_path . '/Payment_Gateway_Helper.php';
262
 
263
  // admin
264
+ require_once $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_Order.php';
265
+ require_once $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_User_Handler.php';
266
+ require_once $payment_gateway_framework_path . '/Admin/Payment_Gateway_Admin_Payment_Token_Editor.php';
 
267
 
268
  // integrations
269
+ require_once $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration.php';
270
 
271
  // subscriptions
272
  if ( $this->is_subscriptions_active() ) {
273
+ require_once $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration_Subscriptions.php';
274
  }
275
 
276
  // pre-orders
277
  if ( $this->is_pre_orders_active() ) {
278
+ require_once $payment_gateway_framework_path . '/Integrations/Payment_Gateway_Integration_Pre_Orders.php';
279
  }
280
 
281
  // privacy
282
+ require_once "{$payment_gateway_framework_path}/Payment_Gateway_Privacy.php";
283
+ $this->privacy_handler = new Payment_Gateway_Privacy( $this );
 
 
284
  }
285
 
286
 
547
 
548
  if ( $gateway->is_production_environment() && $this->get_admin_notice_handler()->should_display_notice( 'ssl-required' ) ) {
549
 
550
+ $message = sprintf(
551
+ /* translators: Placeholders: %1$s - plugin name, %2$s - <a> tag, %3$s - </a> tag */
552
+ esc_html__( '%1$s: WooCommerce is not being forced over SSL; your customers\' payment data may be at risk. %2$sVerify your site URLs here%3$s', 'woocommerce-square' ),
553
  '<strong>' . $this->get_plugin_name() . '</strong>',
554
  '<a href="' . admin_url( 'options-general.php' ) . '">',
555
  ' &raquo;</a>'
556
  );
557
 
558
+ $this->get_admin_notice_handler()->add_admin_notice(
559
+ $message,
560
+ 'ssl-required',
561
+ array(
562
+ 'notice_class' => 'error',
563
+ )
564
+ );
565
 
566
  // just show the message once for plugins with multiple gateway support
567
  break;
568
  }
 
569
  } elseif ( $gateway->get_api() && is_callable( array( $gateway->get_api(), 'require_tls_1_2' ) ) && is_callable( array( $gateway->get_api(), 'is_tls_1_2_available' ) ) && $gateway->get_api()->require_tls_1_2() && ! $gateway->get_api()->is_tls_1_2_available() ) {
570
 
571
  /* translators: Placeholders: %s - payment gateway name */
572
+ $message = sprintf( esc_html__( '%s will soon require TLS 1.2 support to process transactions and your server environment may need to be updated. Please contact your hosting provider to confirm that your site can send and receive TLS 1.2 connections and request they make any necessary updates.', 'woocommerce-square' ), '<strong>' . $gateway->get_method_title() . '</strong>' );
573
 
574
+ $this->get_admin_notice_handler()->add_admin_notice(
575
+ $message,
576
+ 'tls-1-2-required',
577
+ array(
578
+ 'notice_class' => 'notice-warning',
579
+ 'always_show_on_settings' => false,
580
+ )
581
+ );
582
 
583
  // just show the message once for plugins with multiple gateway support
584
  break;
611
  }
612
  }
613
 
614
+ if ( count( $gateways ) === 0 ) {
615
  // no active gateways with unmet currency requirements
616
  return;
617
+ } elseif ( count( $gateways ) === 1 && count( $this->get_gateways() ) > 1 ) {
618
  // one gateway out of many has a currency issue
619
  $suffix = '-' . $gateway->get_id();
620
  $name = $gateway->get_method_title();
641
  '</a>'
642
  );
643
 
644
+ $this->get_admin_notice_handler()->add_admin_notice(
645
+ $message,
646
+ 'accepted-currency' . $suffix,
647
+ array(
648
+ 'notice_class' => 'error',
649
+ )
650
+ );
651
 
652
  }
653
  }
670
  /* translators: Placeholders: %1$s - payment gateway name, %2$s - opening <a> tag, %3$s - closing </a> tag */
671
  esc_html__( 'Heads up! %1$s is currently configured to log transaction data for debugging purposes. If you are not experiencing any problems with payment processing, we recommend %2$sturning off Debug Mode%3$s', 'woocommerce-square' ),
672
  $gateway->get_method_title(),
673
+ ! $is_gateway_settings ? '<a href="' . esc_url( $this->get_payment_gateway_configuration_url( $gateway->get_id() ) ) . '">' : '',
674
+ ! $is_gateway_settings ? ' &raquo;</a>' : ''
675
  );
676
 
677
+ $this->get_admin_notice_handler()->add_admin_notice(
678
+ $message,
679
+ 'debug-in-production',
680
+ array(
681
+ 'notice_class' => 'notice-warning',
682
+ )
683
+ );
684
 
685
  break;
686
  }
710
  // subscriptions
711
  if ( $this->is_subscriptions_active() && $gateway->is_enabled() && $tokenization_supported_but_not_enabled ) {
712
 
 
713
  $message = sprintf(
714
+ /* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag */
715
  esc_html__( '%1$s is inactive for subscription transactions. Please %2$senable tokenization%3$s to activate %1$s for Subscriptions.', 'woocommerce-square' ),
716
  $gateway->get_method_title(),
717
  '<a href="' . $this->get_payment_gateway_configuration_url( $gateway->get_id() ) . '">',
719
  );
720
 
721
  // add notice -- allow it to be dismissed even on the settings page as the admin may not want to use subscriptions with a particular gateway
722
+ $this->get_admin_notice_handler()->add_admin_notice(
723
+ $message,
724
+ 'subscriptions-tokenization-' . $gateway->get_id(),
725
+ array(
726
+ 'always_show_on_settings' => false,
727
+ 'notice_class' => 'error',
728
+ )
729
+ );
730
  }
731
 
732
  // pre-orders
733
  if ( $this->is_pre_orders_active() && $gateway->is_enabled() && $tokenization_supported_but_not_enabled ) {
734
 
 
735
  $message = sprintf(
736
+ /* translators: Placeholders: %1$s - payment gateway title (such as Authorize.net, Braintree, etc), %2$s - <a> tag, %3$s - </a> tag */
737
  esc_html__( '%1$s is inactive for pre-order transactions. Please %2$senable tokenization%3$s to activate %1$s for Pre-Orders.', 'woocommerce-square' ),
738
  $gateway->get_method_title(),
739
  '<a href="' . $this->get_payment_gateway_configuration_url( $gateway->get_id() ) . '">',
741
  );
742
 
743
  // add notice -- allow it to be dismissed even on the settings page as the admin may not want to use pre-orders with a particular gateway
744
+ $this->get_admin_notice_handler()->add_admin_notice(
745
+ $message,
746
+ 'pre-orders-tokenization-' . $gateway->get_id(),
747
+ array(
748
+ 'always_show_on_settings' => false,
749
+ 'notice_class' => 'error',
750
+ )
751
+ );
752
  }
753
  }
754
  }
778
  $tool_tip = esc_attr__( 'You must enable tokenization for this gateway in order to support automatic renewal payments with the WooCommerce Subscriptions extension.', 'woocommerce-square' );
779
  $status = esc_html__( 'Inactive', 'woocommerce-square' );
780
 
781
+ $html = sprintf(
782
+ '<a href="%1$s"><span class="sv-wc-payment-gateway-renewal-status-inactive tips" data-tip="%2$s">%3$s</span></a>',
783
+ esc_url( $this->get_payment_gateway_configuration_url( $gateway->get_id() ) ),
784
+ $tool_tip,
785
+ $status
786
+ );
787
  }
788
 
789
  return $html;
820
 
821
  $environment = $gateway->get_environment_name();
822
 
823
+ include $this->get_payment_gateway_framework_path() . '/Admin/views/html-admin-gateway-status.php';
824
  }
825
  }
826
 
981
  */
982
  public function is_payment_gateway_configuration_page( $gateway_id ) {
983
 
984
+ return isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] &&
985
+ isset( $_GET['tab'] ) && 'checkout' === $_GET['tab'] &&
986
  isset( $_GET['section'] ) && $gateway_id === $_GET['section'];
987
  }
988
 
997
  */
998
  public function add_gateway( $gateway_id, $gateway_class_name ) {
999
 
1000
+ $this->gateways[ $gateway_id ] = array(
1001
+ 'gateway_class_name' => $gateway_class_name,
1002
+ 'gateway' => null,
1003
+ );
1004
  }
1005
 
1006
 
includes/Framework/Plugin_Compatibility.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  namespace WooCommerce\Square\Framework;
4
 
5
- defined( 'ABSPATH' ) or exit;
6
 
7
  class Plugin_Compatibility {
8
 
@@ -18,25 +18,7 @@ class Plugin_Compatibility {
18
  * @param string $version version the message was added in
19
  */
20
  public static function wc_doing_it_wrong( $function, $message, $version ) {
21
-
22
- if ( self::is_wc_version_gte( '3.0' ) ) {
23
-
24
- wc_doing_it_wrong( $function, $message, $version );
25
-
26
- } else {
27
-
28
- $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
29
-
30
- if ( wp_doing_ajax() ) {
31
-
32
- do_action( 'doing_it_wrong_run', $function, $message, $version );
33
- error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
34
-
35
- } else {
36
-
37
- _doing_it_wrong( $function, $message, $version );
38
- }
39
- }
40
  }
41
 
42
  /**
@@ -50,41 +32,6 @@ class Plugin_Compatibility {
50
  return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
51
  }
52
 
53
- /**
54
- * Determines if the installed version of WooCommerce is less than 3.0.
55
- *
56
- * @since 3.0.0
57
- * @return bool
58
- */
59
- public static function is_wc_version_lt_3_0() {
60
- return self::get_wc_version() && version_compare( self::get_wc_version(), '3.0', '<' );
61
- }
62
-
63
-
64
- /**
65
- * Determines if the installed version of WooCommerce is 3.1 or greater.
66
- *
67
- * @since 3.0.0
68
- * @return bool
69
- */
70
- public static function is_wc_version_gte_3_1() {
71
- return self::get_wc_version() && version_compare( self::get_wc_version(), '3.1', '>=' );
72
- }
73
-
74
- /**
75
- * Determines if the installed version of WooCommerce meets or exceeds the
76
- * passed version.
77
- *
78
- * @since 3.0.0
79
- *
80
- * @param string $version version number to compare
81
- * @return bool
82
- */
83
- public static function is_wc_version_gte( $version ) {
84
- return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>=' );
85
- }
86
-
87
-
88
  /**
89
  * Determines if the installed version of WooCommerce is lower than the
90
  * passed version.
2
 
3
  namespace WooCommerce\Square\Framework;
4
 
5
+ defined( 'ABSPATH' ) || exit;
6
 
7
  class Plugin_Compatibility {
8
 
18
  * @param string $version version the message was added in
19
  */
20
  public static function wc_doing_it_wrong( $function, $message, $version ) {
21
+ wc_doing_it_wrong( $function, $message, $version );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
  /**
32
  return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
33
  }
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * Determines if the installed version of WooCommerce is lower than the
37
  * passed version.
includes/Framework/Plugin_Dependencies.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  namespace WooCommerce\Square\Framework;
3
 
4
- defined( 'ABSPATH' ) or exit;
5
 
6
  class Plugin_Dependencies {
7
 
@@ -245,12 +245,12 @@ class Plugin_Dependencies {
245
  $this->add_admin_notice( 'sv-wc-deprecated-php-version', $message, 'error' );
246
  }
247
 
248
- // display a notice that WC < 3.0 support will soon be dropped
249
- if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && Plugin_Compatibility::is_wc_version_lt( '3.0' ) ) {
250
 
251
  $message = sprintf(
252
  /* translators: Placeholders: %1$s - WooCommerce version number, %2$s - <strong>, %3$s - </strong>, %4$s - Plugin name, %5$s - <a> tag, %6$s - </a> tag */
253
- __( 'Hey there! We\'ve noticed that your site is running version %1$s of WooCommerce, but %2$sWooCommerce 3.0 or higher will soon be required%3$s by %4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as soon as possible.', 'woocommerce-square' ),
254
  esc_html( Plugin_Compatibility::get_wc_version() ),
255
  '<strong>',
256
  '</strong>',
1
  <?php
2
  namespace WooCommerce\Square\Framework;
3
 
4
+ defined( 'ABSPATH' ) || exit;
5
 
6
  class Plugin_Dependencies {
7
 
245
  $this->add_admin_notice( 'sv-wc-deprecated-php-version', $message, 'error' );
246
  }
247
 
248
+ // display a notice that WC < 6.0 support will soon be dropped
249
+ if ( isset( $_GET['page'] ) && 'wc-settings' === $_GET['page'] && Plugin_Compatibility::is_wc_version_lt( '6.0' ) ) {
250
 
251
  $message = sprintf(
252
  /* translators: Placeholders: %1$s - WooCommerce version number, %2$s - <strong>, %3$s - </strong>, %4$s - Plugin name, %5$s - <a> tag, %6$s - </a> tag */
253
+ __( 'Hey there! We\'ve noticed that your site is running version %1$s of WooCommerce, but %2$sWooCommerce 6.0 or higher will soon be required%3$s by %4$s. We recommend you %5$supdate WooCommerce%6$s to the latest version as soon as possible.', 'woocommerce-square' ),
254
  esc_html( Plugin_Compatibility::get_wc_version() ),
255
  '<strong>',
256
  '</strong>',
includes/Gateway/API/Requests/Customers.php CHANGED
@@ -92,9 +92,6 @@ class Customers extends API\Requests\Customers {
92
  public static function get_address_from_order( \WC_Order $order ) {
93
 
94
  $address = new \Square\Models\Address();
95
- $address->setFirstName( $order->get_billing_first_name() );
96
- $address->setLastName( $order->get_billing_last_name() );
97
- $address->setOrganization( $order->get_billing_company() );
98
  $address->setAddressLine1( $order->get_billing_address_1() );
99
  $address->setAddressLine2( $order->get_billing_address_2() );
100
  $address->setLocality( $order->get_billing_city() );
92
  public static function get_address_from_order( \WC_Order $order ) {
93
 
94
  $address = new \Square\Models\Address();
 
 
 
95
  $address->setAddressLine1( $order->get_billing_address_1() );
96
  $address->setAddressLine2( $order->get_billing_address_2() );
97
  $address->setLocality( $order->get_billing_city() );
includes/Gateway/API/Requests/Orders.php CHANGED
@@ -66,29 +66,45 @@ class Orders extends API\Request {
66
  $order_model->setCustomerId( $order->square_customer_id );
67
  }
68
 
69
- $line_items = array_merge( $this->get_product_line_items( $order ), $this->get_fee_line_items( $order ), $this->get_shipping_line_items( $order ) );
70
- $taxes = $this->get_order_taxes( $order );
 
 
 
 
71
 
72
- $order_model->setLineItems( $this->get_api_line_items( $order, $line_items, $taxes ) );
73
- $order_model->setTaxes( array_values( $taxes ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
- if ( $order->get_discount_total() ) {
76
- $order_line_item_discount = new \Square\Models\OrderLineItemDiscount();
77
- $order_line_item_discount->setName( __( 'Discount', 'woocommerce-square' ) );
78
- $order_line_item_discount->setType( 'FIXED_AMOUNT' );
79
- $order_line_item_discount->setAmountMoney( Money_Utility::amount_to_money( $order->get_discount_total(), $order->get_currency() ) );
80
- $order_line_item_discount->setScope( 'ORDER' );
81
 
82
- $order_model->setDiscounts( array( $order_line_item_discount ) );
 
83
  }
84
 
 
 
85
  $this->square_request->setIdempotencyKey( wc_square()->get_idempotency_key( $order->unique_transaction_ref ) );
86
  $this->square_request->setOrder( $order_model );
87
 
88
  $this->square_api_args = array( $this->square_request );
89
  }
90
 
91
-
92
  /**
93
  * Gets Square line item objects for an order's product items.
94
  *
@@ -172,7 +188,7 @@ class Orders extends API\Request {
172
  * @param \WC_Order $order
173
  * @param \WC_Order_Item[] $line_items
174
  * @param \Square\Models\OrderLineItemTax[] $taxes
175
- * @return \Square\Models\OrderLineItem[]
176
  */
177
  protected function get_api_line_items( \WC_Order $order, $line_items, $taxes ) {
178
 
@@ -195,6 +211,33 @@ class Orders extends API\Request {
195
 
196
  $line_item->setAppliedTaxes( $applied_taxes );
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  $api_line_items[] = $line_item;
199
  }
200
 
66
  $order_model->setCustomerId( $order->square_customer_id );
67
  }
68
 
69
+ $taxes = $this->get_order_taxes( $order );
70
+ $all_line_items = $this->get_api_line_items(
71
+ $order,
72
+ array_merge( $this->get_product_line_items( $order ), $this->get_fee_line_items( $order ), $this->get_shipping_line_items( $order ) ),
73
+ $taxes
74
+ );
75
 
76
+ $square_order_line_items = array_values(
77
+ array_filter(
78
+ $all_line_items,
79
+ function( $line_item ) {
80
+ return $line_item instanceof \Square\Models\OrderLineItem;
81
+ }
82
+ )
83
+ );
84
+
85
+ $square_discount_line_items = array_values(
86
+ array_filter(
87
+ $all_line_items,
88
+ function( $line_item ) {
89
+ return $line_item instanceof \Square\Models\OrderLineItemDiscount;
90
+ }
91
+ )
92
+ );
93
 
94
+ $order_model->setLineItems( $square_order_line_items );
 
 
 
 
 
95
 
96
+ if ( ! empty( $square_discount_line_items ) ) {
97
+ $order_model->setDiscounts( $square_discount_line_items );
98
  }
99
 
100
+ $order_model->setTaxes( array_values( $taxes ) );
101
+
102
  $this->square_request->setIdempotencyKey( wc_square()->get_idempotency_key( $order->unique_transaction_ref ) );
103
  $this->square_request->setOrder( $order_model );
104
 
105
  $this->square_api_args = array( $this->square_request );
106
  }
107
 
 
108
  /**
109
  * Gets Square line item objects for an order's product items.
110
  *
188
  * @param \WC_Order $order
189
  * @param \WC_Order_Item[] $line_items
190
  * @param \Square\Models\OrderLineItemTax[] $taxes
191
+ * @return mixed[]
192
  */
193
  protected function get_api_line_items( \WC_Order $order, $line_items, $taxes ) {
194
 
211
 
212
  $line_item->setAppliedTaxes( $applied_taxes );
213
 
214
+ if ( $item instanceof \WC_Order_Item_Product ) {
215
+
216
+ $discount = $item->get_subtotal() - $item->get_total();
217
+
218
+ $discount_uid = wc_square()->get_idempotency_key( '', false );
219
+
220
+ if ( $discount > 0 ) {
221
+ $line_item->setAppliedDiscounts(
222
+ array( new \Square\Models\OrderLineItemAppliedDiscount( $discount_uid ) )
223
+ );
224
+
225
+ $order_line_item_discount = new \Square\Models\OrderLineItemDiscount();
226
+ $order_line_item_discount->setUid( $discount_uid );
227
+ $order_line_item_discount->setName( __( 'Discount', 'woocommerce-square' ) );
228
+ $order_line_item_discount->setType( 'FIXED_AMOUNT' );
229
+ $order_line_item_discount->setScope( 'LINE_ITEM' );
230
+ $order_line_item_discount->setAmountMoney(
231
+ Money_Utility::amount_to_money(
232
+ $discount,
233
+ $order->get_currency()
234
+ )
235
+ );
236
+
237
+ $api_line_items[] = $order_line_item_discount;
238
+ }
239
+ }
240
+
241
  $api_line_items[] = $line_item;
242
  }
243
 
includes/Gateway/API/Requests/Payments.php CHANGED
@@ -109,9 +109,6 @@ class Payments extends \WooCommerce\Square\API\Request {
109
  }
110
 
111
  $billing_address = new \Square\Models\Address();
112
- $billing_address->setFirstName( $order->get_billing_first_name() );
113
- $billing_address->setLastName( $order->get_billing_last_name() );
114
- $billing_address->setOrganization( $order->get_billing_company() );
115
  $billing_address->setAddressLine1( $order->get_billing_address_1() );
116
  $billing_address->setAddressLine2( $order->get_billing_address_2() );
117
  $billing_address->setLocality( $order->get_billing_city() );
@@ -124,8 +121,6 @@ class Payments extends \WooCommerce\Square\API\Request {
124
  if ( $order->get_shipping_address_1( 'edit' ) || $order->get_shipping_address_2( 'edit' ) ) {
125
 
126
  $shipping_address = new \Square\Models\Address();
127
- $shipping_address->setFirstName( $order->get_shipping_first_name() );
128
- $shipping_address->setLastName( $order->get_shipping_last_name() );
129
  $shipping_address->setAddressLine1( $order->get_shipping_address_1() );
130
  $shipping_address->setAddressLine2( $order->get_shipping_address_2() );
131
  $shipping_address->setLocality( $order->get_shipping_city() );
109
  }
110
 
111
  $billing_address = new \Square\Models\Address();
 
 
 
112
  $billing_address->setAddressLine1( $order->get_billing_address_1() );
113
  $billing_address->setAddressLine2( $order->get_billing_address_2() );
114
  $billing_address->setLocality( $order->get_billing_city() );
121
  if ( $order->get_shipping_address_1( 'edit' ) || $order->get_shipping_address_2( 'edit' ) ) {
122
 
123
  $shipping_address = new \Square\Models\Address();
 
 
124
  $shipping_address->setAddressLine1( $order->get_shipping_address_1() );
125
  $shipping_address->setAddressLine2( $order->get_shipping_address_2() );
126
  $shipping_address->setLocality( $order->get_shipping_city() );
includes/Gateway/API/Requests/Refunds.php CHANGED
@@ -63,10 +63,11 @@ class Refunds extends \WooCommerce\Square\API\Request {
63
 
64
  $this->square_request = new RefundPaymentRequest(
65
  wc_square()->get_idempotency_key( $order->get_id() . ':' . $refund_obj->get_id() ),
66
- Money_Utility::amount_to_money( $order->refund->amount, $order->get_currency() ),
67
- $order->refund->tender_id
68
  );
69
 
 
 
70
  $this->square_request->setReason( $order->refund->reason );
71
 
72
  $this->square_api_args = array( $this->square_request );
63
 
64
  $this->square_request = new RefundPaymentRequest(
65
  wc_square()->get_idempotency_key( $order->get_id() . ':' . $refund_obj->get_id() ),
66
+ Money_Utility::amount_to_money( $order->refund->amount, $order->get_currency() )
 
67
  );
68
 
69
+ $this->square_request->setPaymentId( $order->refund->tender_id );
70
+
71
  $this->square_request->setReason( $order->refund->reason );
72
 
73
  $this->square_api_args = array( $this->square_request );
includes/Gateway/API/Requests/Transactions.php CHANGED
@@ -116,9 +116,6 @@ class Transactions extends \WooCommerce\Square\API\Request {
116
  }
117
 
118
  $billing_address = new Address();
119
- $billing_address->setFirstName( $order->get_billing_first_name() );
120
- $billing_address->setLastName( $order->get_billing_last_name() );
121
- $billing_address->setOrganization( $order->get_billing_company() );
122
  $billing_address->setAddressLine1( $order->get_billing_address_1() );
123
  $billing_address->setAddressLine2( $order->get_billing_address_2() );
124
  $billing_address->setLocality( $order->get_billing_city() );
@@ -131,8 +128,6 @@ class Transactions extends \WooCommerce\Square\API\Request {
131
  if ( Order_Compatibility::has_shipping_address( $order ) ) {
132
 
133
  $shipping_address = new Address();
134
- $shipping_address->setFirstName( $order->get_shipping_first_name() );
135
- $shipping_address->setLastName( $order->get_shipping_last_name() );
136
  $shipping_address->setAddressLine1( $order->get_shipping_address_1() );
137
  $shipping_address->setAddressLine2( $order->get_shipping_address_2() );
138
  $shipping_address->setLocality( $order->get_shipping_city() );
116
  }
117
 
118
  $billing_address = new Address();
 
 
 
119
  $billing_address->setAddressLine1( $order->get_billing_address_1() );
120
  $billing_address->setAddressLine2( $order->get_billing_address_2() );
121
  $billing_address->setLocality( $order->get_billing_city() );
128
  if ( Order_Compatibility::has_shipping_address( $order ) ) {
129
 
130
  $shipping_address = new Address();
 
 
131
  $shipping_address->setAddressLine1( $order->get_shipping_address_1() );
132
  $shipping_address->setAddressLine2( $order->get_shipping_address_2() );
133
  $shipping_address->setLocality( $order->get_shipping_city() );
includes/Gateway/Digital_Wallet.php CHANGED
@@ -1249,6 +1249,8 @@ class Digital_Wallet {
1249
 
1250
  if ( $is_available && 'product' === $page ) {
1251
  $is_available = $this->allowed_for_product_page();
 
 
1252
  }
1253
 
1254
  return $is_available;
1249
 
1250
  if ( $is_available && 'product' === $page ) {
1251
  $is_available = $this->allowed_for_product_page();
1252
+ } elseif ( $is_available && ( 'cart' === $page || 'checkout' === $page ) ) {
1253
+ $is_available = $this->allowed_for_cart();
1254
  }
1255
 
1256
  return $is_available;
includes/Handlers/Background_Job.php CHANGED
@@ -89,7 +89,7 @@ class Background_Job extends Background_Job_Handler {
89
  'processed_product_ids' => array(), // newly imported products processed
90
  'updated_product_ids' => array(), // updated products processed
91
  'skipped_products' => array(), // remote product IDs that were skipped
92
- 'system_of_record' => $sor, // system of record used
93
  )
94
  )
95
  );
89
  'processed_product_ids' => array(), // newly imported products processed
90
  'updated_product_ids' => array(), // updated products processed
91
  'skipped_products' => array(), // remote product IDs that were skipped
92
+ 'system_of_record' => $sor, // Sync setting used
93
  )
94
  )
95
  );
includes/Handlers/Product.php CHANGED
@@ -22,6 +22,7 @@
22
  */
23
 
24
  namespace WooCommerce\Square\Handlers;
 
25
  use WooCommerce\Square\Utilities\Money_Utility;
26
  use WooCommerce\Square\Sync\Records;
27
 
@@ -61,7 +62,7 @@ class Product {
61
 
62
  $product->update_meta_data( self::SQUARE_ID_META_KEY, $catalog_object->getId() );
63
  $product->update_meta_data( self::SQUARE_VERSION_META_KEY, $catalog_object->getVersion() );
64
- $product->update_meta_data( self::SQUARE_IMAGE_ID_META_KEY, $catalog_object->getImageId() );
65
 
66
  $product->save();
67
  }
@@ -83,7 +84,6 @@ class Product {
83
  $product->save();
84
  }
85
 
86
-
87
  /**
88
  * Updates a WooCommerce product from Square data.
89
  *
@@ -133,9 +133,7 @@ class Product {
133
  $variation->set_name( $variation_name );
134
  }
135
 
136
- if ( $catalog_variation->getItemVariationData()->getPriceMoney() ) {
137
- $variation->set_regular_price( Money_Utility::cents_to_float( $catalog_variation->getItemVariationData()->getPriceMoney()->getAmount() ) );
138
- }
139
 
140
  if ( $with_inventory && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
141
  self::update_stock_from_square( $variation, false );
@@ -166,9 +164,7 @@ class Product {
166
 
167
  $product->update_meta_data( self::SQUARE_VARIATION_ID_META_KEY, $catalog_variation->getId() );
168
 
169
- if ( $catalog_variation->getItemVariationData()->getPriceMoney() ) {
170
- $product->set_regular_price( Money_Utility::cents_to_float( $catalog_variation->getItemVariationData()->getPriceMoney()->getAmount() ) );
171
- }
172
 
173
  if ( $with_inventory && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
174
  self::update_stock_from_square( $product, false );
@@ -269,7 +265,16 @@ class Product {
269
  $product = is_numeric( $given_product ) ? wc_get_product( $given_product ) : $given_product;
270
 
271
  if ( ! $product instanceof \WC_Product ) {
272
- wc_square()->log( sprintf( 'Could not import image from Square at %1$s for attaching to product: Invalid product.', $image_url ) );
 
 
 
 
 
 
 
 
 
273
  return $given_product;
274
  }
275
 
@@ -320,8 +325,16 @@ class Product {
320
  self::set_square_image_id( $product, $image_id );
321
 
322
  } catch ( \Exception $e ) {
 
 
323
 
324
- wc_square()->log( sprintf( 'Could not import image from Square at %1$s for attaching to product #%2$s. %3$s.', $image_url, $product->get_id(), $e->getMessage() ) );
 
 
 
 
 
 
325
  }
326
 
327
  $product->save();
@@ -1344,7 +1357,9 @@ class Product {
1344
  */
1345
  public static function import_remote_meta( $product, $remote_product ) {
1346
 
1347
- $product = is_numeric( $product ) ? wc_get_product( $product ) : $product;
 
 
1348
 
1349
  if ( $product ) {
1350
 
@@ -1353,12 +1368,29 @@ class Product {
1353
  array(
1354
  'item_id' => $remote_product->getId(),
1355
  'item_version' => $remote_product->getVersion(),
1356
- 'item_image_id' => $remote_product->getImageId(),
1357
  )
1358
  );
1359
  }
1360
  }
1361
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1362
 
1363
  /**
1364
  * Gets an InventoryChange object filled with a \Square\Models\InventoryPhysicalCount object for a given product.
@@ -1432,7 +1464,34 @@ class Product {
1432
  }
1433
 
1434
  /**
1435
- * Helper function to get the variation product's parent ID from posts table but only if the parent product still exists.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1436
  *
1437
  * @since 2.5.2
1438
  * @param int|object $variation_id
22
  */
23
 
24
  namespace WooCommerce\Square\Handlers;
25
+
26
  use WooCommerce\Square\Utilities\Money_Utility;
27
  use WooCommerce\Square\Sync\Records;
28
 
62
 
63
  $product->update_meta_data( self::SQUARE_ID_META_KEY, $catalog_object->getId() );
64
  $product->update_meta_data( self::SQUARE_VERSION_META_KEY, $catalog_object->getVersion() );
65
+ $product->update_meta_data( self::SQUARE_IMAGE_ID_META_KEY, self::get_catalog_item_thumbnail_id( $catalog_object ) );
66
 
67
  $product->save();
68
  }
84
  $product->save();
85
  }
86
 
 
87
  /**
88
  * Updates a WooCommerce product from Square data.
89
  *
133
  $variation->set_name( $variation_name );
134
  }
135
 
136
+ self::update_price_money( $variation, $catalog_variation );
 
 
137
 
138
  if ( $with_inventory && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
139
  self::update_stock_from_square( $variation, false );
164
 
165
  $product->update_meta_data( self::SQUARE_VARIATION_ID_META_KEY, $catalog_variation->getId() );
166
 
167
+ self::update_price_money( $product, $catalog_variation );
 
 
168
 
169
  if ( $with_inventory && wc_square()->get_settings_handler()->is_inventory_sync_enabled() ) {
170
  self::update_stock_from_square( $product, false );
265
  $product = is_numeric( $given_product ) ? wc_get_product( $given_product ) : $given_product;
266
 
267
  if ( ! $product instanceof \WC_Product ) {
268
+ $message = sprintf( 'Could not import image from Square: Invalid product.' );
269
+
270
+ wc_square()->log( $message );
271
+ Records::set_record(
272
+ array(
273
+ 'type' => 'alert',
274
+ 'message' => $message,
275
+ )
276
+ );
277
+
278
  return $given_product;
279
  }
280
 
325
  self::set_square_image_id( $product, $image_id );
326
 
327
  } catch ( \Exception $e ) {
328
+ /* Translators: Placeholder: %1$s - product ID, %2$s - Exception message */
329
+ $message = sprintf( esc_html__( 'Image not updated from Square for product #%1$s. %2$s.', 'woocommerce-square' ), $product->get_id(), $e->getMessage() );
330
 
331
+ wc_square()->log( $message );
332
+ Records::set_record(
333
+ array(
334
+ 'type' => 'alert',
335
+ 'message' => $message,
336
+ )
337
+ );
338
  }
339
 
340
  $product->save();
1357
  */
1358
  public static function import_remote_meta( $product, $remote_product ) {
1359
 
1360
+ $product = is_numeric( $product ) ? wc_get_product( $product ) : $product;
1361
+ $item_data = $remote_product->getItemData();
1362
+ $image_ids = $item_data->getImageIds();
1363
 
1364
  if ( $product ) {
1365
 
1368
  array(
1369
  'item_id' => $remote_product->getId(),
1370
  'item_version' => $remote_product->getVersion(),
1371
+ 'item_image_id' => self::get_catalog_item_thumbnail_id( $remote_product ),
1372
  )
1373
  );
1374
  }
1375
  }
1376
 
1377
+ /**
1378
+ * Returns the thumbnail ID of a CatalogItem.
1379
+ *
1380
+ * @param \Square\Models\CatalogObject $catalog_object
1381
+ * @return string
1382
+ */
1383
+ public static function get_catalog_item_thumbnail_id( $catalog_object ) {
1384
+ $catalog_item = $catalog_object->getItemData();
1385
+ $image_ids = $catalog_item->getImageIds();
1386
+
1387
+ if ( is_array( $image_ids ) && count( $image_ids ) > 0 ) {
1388
+ return $image_ids[0];
1389
+ }
1390
+
1391
+ return '';
1392
+ }
1393
+
1394
 
1395
  /**
1396
  * Gets an InventoryChange object filled with a \Square\Models\InventoryPhysicalCount object for a given product.
1464
  }
1465
 
1466
  /**
1467
+ * Checks for location overrides and sets the product/variation's price based on the location
1468
+ *
1469
+ * @since 3.3.1
1470
+ *
1471
+ * @param \WC_Product|\WC_Product_Variation $product
1472
+ * @param \SquareC\Model\CatalogObject $catalog_variation
1473
+ */
1474
+ private static function update_price_money( $product, \Square\Models\CatalogObject $catalog_variation ) {
1475
+ $location_id = wc_square()->get_settings_handler()->get_location_id();
1476
+
1477
+ foreach ( $catalog_variation->getItemVariationData()->getLocationOverrides() as $location_override ) {
1478
+
1479
+ if ( $location_id === $location_override->getLocationId() ) {
1480
+
1481
+ // If there is a price override set, then use that amount.
1482
+ if ( $location_override->getPriceMoney() ) {
1483
+
1484
+ $product->set_regular_price( Money_Utility::cents_to_float( $location_override->getPriceMoney()->getAmount() ) );
1485
+ } elseif ( $catalog_variation->getItemVariationData()->getPriceMoney() ) {
1486
+
1487
+ // No price override amount set; fall back on the base price of item variation.
1488
+ $product->set_regular_price( Money_Utility::cents_to_float( $catalog_variation->getItemVariationData()->getPriceMoney()->getAmount() ) );
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ /** Helper function to get the variation product's parent ID from posts table but only if the parent product still exists.
1495
  *
1496
  * @since 2.5.2
1497
  * @param int|object $variation_id
includes/Handlers/Products.php CHANGED
@@ -76,7 +76,6 @@ class Products {
76
  $this->add_product_sync_hooks();
77
  }
78
 
79
-
80
  /**
81
  * Adds hooks to the admin products edit screen.
82
  *
@@ -99,6 +98,14 @@ class Products {
99
  add_action( 'woocommerce_product_bulk_edit_end', array( $this, 'add_bulk_edit_inputs' ) );
100
  add_action( 'woocommerce_product_quick_edit_save', array( $this, 'set_synced_with_square' ) );
101
  add_action( 'woocommerce_product_bulk_edit_save', array( $this, 'set_synced_with_square' ) );
 
 
 
 
 
 
 
 
102
  }
103
 
104
 
@@ -156,7 +163,6 @@ class Products {
156
  add_action( 'shutdown', array( $this, 'maybe_delete_staged_products' ) );
157
  }
158
 
159
-
160
  /**
161
  * Adds an option to filter products by sync status.
162
  *
@@ -737,4 +743,80 @@ class Products {
737
  return $this->plugin;
738
  }
739
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
740
  }
76
  $this->add_product_sync_hooks();
77
  }
78
 
 
79
  /**
80
  * Adds hooks to the admin products edit screen.
81
  *
98
  add_action( 'woocommerce_product_bulk_edit_end', array( $this, 'add_bulk_edit_inputs' ) );
99
  add_action( 'woocommerce_product_quick_edit_save', array( $this, 'set_synced_with_square' ) );
100
  add_action( 'woocommerce_product_bulk_edit_save', array( $this, 'set_synced_with_square' ) );
101
+
102
+ // export product sync status.
103
+ add_filter( 'woocommerce_product_export_column_names', array( $this, 'add_sync_status_to_column' ) );
104
+ add_filter( 'woocommerce_product_export_product_default_columns', array( $this, 'add_sync_status_to_column' ) );
105
+ add_filter( 'woocommerce_product_export_product_column_wc_square_synced', array( $this, 'export_sync_status_taxonomy' ), 10, 2 );
106
+ add_filter( 'woocommerce_csv_product_import_mapping_options', array( $this, 'register_sync_status_for_importer' ) );
107
+ add_filter( 'woocommerce_csv_product_import_mapping_default_columns', array( $this, 'map_sync_status_column' ) );
108
+ add_filter( 'woocommerce_product_import_pre_insert_product_object', array( $this, 'import_sync_status' ), 10, 2 );
109
  }
110
 
111
 
163
  add_action( 'shutdown', array( $this, 'maybe_delete_staged_products' ) );
164
  }
165
 
 
166
  /**
167
  * Adds an option to filter products by sync status.
168
  *
743
  return $this->plugin;
744
  }
745
 
746
+ /**
747
+ * Adds the sync status column to the export columns.
748
+ *
749
+ * @param array $columns Array of columns
750
+ * @return array
751
+ */
752
+ public function add_sync_status_to_column( $columns ) {
753
+ $columns['wc_square_synced'] = __( 'Sync with Square', 'woocommerce-square' );
754
+ return $columns;
755
+ }
756
+
757
+ /**
758
+ * Sets column data.
759
+ *
760
+ * @param mixed $value Value of a column
761
+ * @param \WC_Product $product WooCommerce product object.
762
+ */
763
+ public function export_sync_status_taxonomy( $value, $product ) {
764
+ $terms = get_terms(
765
+ array(
766
+ 'object_ids' => $product->get_ID(),
767
+ 'taxonomy' => 'wc_square_synced',
768
+ )
769
+ );
770
+
771
+ if ( ! is_wp_error( $terms ) && is_array( $terms ) && count( $terms ) > 0 ) {
772
+ $term = $terms[0];
773
+
774
+ return $term->name;
775
+ }
776
+
777
+ return 'no';
778
+ }
779
+
780
+ /**
781
+ * Registers the sync status to the importer.
782
+ *
783
+ * @param array $columns Array of columns
784
+ * @return array
785
+ */
786
+ public function register_sync_status_for_importer( $columns ) {
787
+ $columns['wc_square_synced'] = __( 'Sync with Square', 'woocommerce-square' );
788
+ return $columns;
789
+ }
790
+
791
+ /**
792
+ * Add automatic mapping support for wc_square_synced column.
793
+ *
794
+ * @param array $columns Array of columns
795
+ * @return array
796
+ */
797
+ public function map_sync_status_column() {
798
+ $columns[ __( 'Sync with Square', 'woocommerce-square' ) ] = 'wc_square_synced';
799
+ return $columns;
800
+ }
801
+
802
+ /**
803
+ * Imports square sync status.
804
+ *
805
+ * @param \WC_Product $product WooCommerce product.
806
+ * @param array Import data.
807
+ *
808
+ * @return array
809
+ */
810
+ public function import_sync_status( $product, $data ) {
811
+ if ( is_a( $product, 'WC_Product' ) ) {
812
+
813
+ if ( ! empty( $data['wc_square_synced'] ) && 'yes' === $data['wc_square_synced'] ) {
814
+ wp_set_object_terms( $product->get_id(), array( 'yes' ), 'wc_square_synced' );
815
+ } else {
816
+ wp_remove_object_terms( $product->get_id(), array( 'yes' ), 'wc_square_synced' );
817
+ }
818
+ }
819
+
820
+ return $product;
821
+ }
822
  }
includes/Handlers/Sync.php CHANGED
@@ -75,6 +75,8 @@ class Sync {
75
 
76
  // run the interval sync when fired by Action Scheduler
77
  add_action( $this->sync_scheduled_event_name, array( $this, 'start_interval_sync' ) );
 
 
78
  }
79
 
80
 
@@ -426,5 +428,21 @@ class Sync {
426
  return $this->plugin;
427
  }
428
 
 
 
 
 
 
 
429
 
 
 
 
 
 
 
 
 
 
 
430
  }
75
 
76
  // run the interval sync when fired by Action Scheduler
77
  add_action( $this->sync_scheduled_event_name, array( $this, 'start_interval_sync' ) );
78
+
79
+ add_action( 'admin_notices', array( $this, 'render_import_no_navigation_warning' ) );
80
  }
81
 
82
 
428
  return $this->plugin;
429
  }
430
 
431
+ /**
432
+ * Show warning not to close or navigate away from the current
433
+ * page when product import is in progress.
434
+ */
435
+ public function render_import_no_navigation_warning() {
436
+ $job_in_progress = wc_square()->get_sync_handler()->get_job_in_progress();
437
 
438
+ if ( $job_in_progress && 'product_import' === $job_in_progress->action ) {
439
+ wc_square()->get_admin_notice_handler()->add_admin_notice(
440
+ __( 'Please do not close or navigate away from this page as the product import job is in progress. This page may load several times during the course of sync.', 'woocommerce-square' ),
441
+ 'wc-square-sync-in-progress-message',
442
+ array(
443
+ 'notice_class' => 'notice-warning',
444
+ )
445
+ );
446
+ }
447
+ }
448
  }
includes/Lifecycle.php CHANGED
@@ -262,7 +262,7 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
262
  *
263
  * @since 2.0.0
264
  *
265
- * @return bool whether a system of record was enabled from migration
266
  */
267
  private function migrate_plugin_settings() {
268
 
@@ -510,7 +510,7 @@ class Lifecycle extends \WooCommerce\Square\Framework\Lifecycle {
510
 
511
 
512
  /**
513
- * Adds the system of record setting to the v2 plugin settings depending on v1 setting values.
514
  *
515
  * @since 2.0.2
516
  *
262
  *
263
  * @since 2.0.0
264
  *
265
+ * @return bool whether a Sync setting was enabled from migration
266
  */
267
  private function migrate_plugin_settings() {
268
 
510
 
511
 
512
  /**
513
+ * Adds the Sync setting setting to the v2 plugin settings depending on v1 setting values.
514
  *
515
  * @since 2.0.2
516
  *
includes/Settings.php CHANGED
@@ -38,23 +38,23 @@ class Settings extends \WC_Settings_API {
38
 
39
 
40
  /**
41
- * Square system of record.
42
  *
43
- * @var string square system of record indicator
44
  */
45
  const SYSTEM_OF_RECORD_SQUARE = 'square';
46
 
47
  /**
48
- * Woocommerce system of record.
49
  *
50
- * @var string square system of record indicator
51
  */
52
  const SYSTEM_OF_RECORD_WOOCOMMERCE = 'woocommerce';
53
 
54
  /**
55
- * Disabled system of record.
56
  *
57
- * @var string system of record indicator for disabled sync
58
  */
59
  const SYSTEM_OF_RECORD_DISABLED = 'disabled';
60
 
@@ -205,15 +205,18 @@ class Settings extends \WC_Settings_API {
205
  );
206
 
207
  $fields['system_of_record'] = array(
208
- 'title' => __( 'Product system of record', 'woocommerce-square' ),
209
  'type' => 'select',
210
  'class' => 'wc-enhanced-select',
211
  'description' => sprintf(
212
  /* translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s - <a> tag, %4$s - </a> tag */
213
- __( 'Choose where you will update data for synced products. Inventory in Square is %1$salways%2$s checked for adjustments when sync is enabled. %3$sClick here%4$s to read more about choosing a system of record.', 'woocommerce-square' ),
214
  '<strong>',
215
  '</strong>',
216
- '<a href="' . esc_url( wc_square()->get_documentation_url() ) . '#section-7">',
 
 
 
217
  '</a>'
218
  ),
219
  'options' => array(
@@ -342,8 +345,8 @@ class Settings extends \WC_Settings_API {
342
  */
343
  public function generate_import_products_html( $id, $field ) {
344
 
345
- $is_location_set = (bool)$this->get_location_id();
346
- $is_sor_set = (bool)$this->get_system_of_record_name();
347
  $display = $is_location_set && $is_sor_set ? '' : 'display: none';
348
 
349
  ob_start();
@@ -519,7 +522,7 @@ class Settings extends \WC_Settings_API {
519
 
520
 
521
  /**
522
- * Determines if WooCommerce is configured to be the system of record.
523
  *
524
  * @since 2.0.0
525
  *
@@ -532,7 +535,7 @@ class Settings extends \WC_Settings_API {
532
 
533
 
534
  /**
535
- * Determines if Square is configured to be the system of record.
536
  *
537
  * @since 2.0.0
538
  *
@@ -545,7 +548,7 @@ class Settings extends \WC_Settings_API {
545
 
546
 
547
  /**
548
- * Determines if there is no system of record.
549
  *
550
  * @since 2.0.0
551
  *
@@ -568,6 +571,11 @@ class Settings extends \WC_Settings_API {
568
  */
569
  public function is_inventory_sync_enabled() {
570
 
 
 
 
 
 
571
  return (bool) apply_filters( 'wc_square_inventory_sync_enabled', 'yes' === get_option( 'woocommerce_manage_stock' ) && $this->is_product_sync_enabled() && 'yes' === $this->get_option( 'enable_inventory_sync' ) );
572
  }
573
 
@@ -692,9 +700,10 @@ class Settings extends \WC_Settings_API {
692
 
693
  $locations_transient_key = 'wc_square_locations_' . $this->get_plugin()->get_version();
694
 
695
- // don't always need to refetch when not on Settings screen.
696
- if ( ! $this->is_admin_settings_screen() ) {
697
 
 
 
698
  $this->locations = get_transient( $locations_transient_key );
699
  }
700
 
@@ -735,7 +744,7 @@ class Settings extends \WC_Settings_API {
735
 
736
 
737
  /**
738
- * Gets the configured system of record.
739
  *
740
  * @since 2.0.0
741
  *
@@ -748,11 +757,11 @@ class Settings extends \WC_Settings_API {
748
 
749
 
750
  /**
751
- * Gets the configured system of record name.
752
  *
753
  * @since 2.0.0
754
  *
755
- * @return string or empty string if no system of record is configured
756
  */
757
  public function get_system_of_record_name() {
758
 
38
 
39
 
40
  /**
41
+ * Square Sync setting.
42
  *
43
+ * @var string square Sync setting indicator
44
  */
45
  const SYSTEM_OF_RECORD_SQUARE = 'square';
46
 
47
  /**
48
+ * Woocommerce Sync setting.
49
  *
50
+ * @var string square Sync setting indicator
51
  */
52
  const SYSTEM_OF_RECORD_WOOCOMMERCE = 'woocommerce';
53
 
54
  /**
55
+ * Disabled Sync setting.
56
  *
57
+ * @var string Sync setting indicator for disabled sync
58
  */
59
  const SYSTEM_OF_RECORD_DISABLED = 'disabled';
60
 
205
  );
206
 
207
  $fields['system_of_record'] = array(
208
+ 'title' => __( 'Sync settings', 'woocommerce-square' ),
209
  'type' => 'select',
210
  'class' => 'wc-enhanced-select',
211
  'description' => sprintf(
212
  /* translators: Placeholders: %1$s - <strong> tag, %2$s - </strong> tag, %3$s - <a> tag, %4$s - </a> tag */
213
+ __( 'Choose where data will be updated for synced products. Inventory in Square is %1$salways%2$s checked for adjustments when sync is enabled.%3$s%4$sLearn more%5$s about choosing a system of record or %6$screate a ticket%7$s if you\'re experiencing technical issues.', 'woocommerce-square' ),
214
  '<strong>',
215
  '</strong>',
216
+ '<br>',
217
+ '<a href="' . esc_url( wc_square()->get_documentation_url() ) . '#section-8">',
218
+ '</a>',
219
+ '<a href="https://wordpress.org/support/plugin/woocommerce-square/">',
220
  '</a>'
221
  ),
222
  'options' => array(
345
  */
346
  public function generate_import_products_html( $id, $field ) {
347
 
348
+ $is_location_set = (bool) $this->get_location_id();
349
+ $is_sor_set = (bool) $this->get_system_of_record_name();
350
  $display = $is_location_set && $is_sor_set ? '' : 'display: none';
351
 
352
  ob_start();
522
 
523
 
524
  /**
525
+ * Determines if WooCommerce is configured to be the Sync setting.
526
  *
527
  * @since 2.0.0
528
  *
535
 
536
 
537
  /**
538
+ * Determines if Square is configured to be the Sync setting.
539
  *
540
  * @since 2.0.0
541
  *
548
 
549
 
550
  /**
551
+ * Determines if there is no Sync setting.
552
  *
553
  * @since 2.0.0
554
  *
571
  */
572
  public function is_inventory_sync_enabled() {
573
 
574
+ /**
575
+ * Filters the inventory sync setting.
576
+ *
577
+ * @since 2.0.0
578
+ */
579
  return (bool) apply_filters( 'wc_square_inventory_sync_enabled', 'yes' === get_option( 'woocommerce_manage_stock' ) && $this->is_product_sync_enabled() && 'yes' === $this->get_option( 'enable_inventory_sync' ) );
580
  }
581
 
700
 
701
  $locations_transient_key = 'wc_square_locations_' . $this->get_plugin()->get_version();
702
 
703
+ $section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
704
 
705
+ // don't always need to refetch when not on Settings screen.
706
+ if ( ! $this->is_admin_settings_screen() || ( $this->is_admin_settings_screen() && 'update' === $section ) ) {
707
  $this->locations = get_transient( $locations_transient_key );
708
  }
709
 
744
 
745
 
746
  /**
747
+ * Gets the configured Sync setting.
748
  *
749
  * @since 2.0.0
750
  *
757
 
758
 
759
  /**
760
+ * Gets the configured Sync setting name.
761
  *
762
  * @since 2.0.0
763
  *
764
+ * @return string or empty string if no Sync setting is configured
765
  */
766
  public function get_system_of_record_name() {
767
 
includes/Sync/Interval_Polling.php CHANGED
@@ -22,6 +22,7 @@
22
  */
23
 
24
  namespace WooCommerce\Square\Sync;
 
25
  use Square\Models\SearchCatalogObjectsResponse;
26
  use Square\Models\BatchRetrieveInventoryCountsResponse;
27
  use WooCommerce\Square\Handlers\Product;
@@ -94,7 +95,7 @@ class Interval_Polling extends Stepped_Job {
94
  array(
95
  'type' => 'info',
96
  'message' => sprintf(
97
- /* translator: Placeholder %d number of categories */
98
  _n( 'Updated data for %d category.', 'Updated data for %d categories.', count( $categories ), 'woocommerce-square' ),
99
  count( $categories )
100
  ),
@@ -175,6 +176,8 @@ class Interval_Polling extends Stepped_Job {
175
  $record['product_hidden'] = true;
176
 
177
  } catch ( \Exception $e ) {
 
 
178
  }
179
  }
180
 
@@ -183,11 +186,11 @@ class Interval_Polling extends Stepped_Job {
183
  } else {
184
 
185
  try {
186
-
187
  Product::update_from_square( $product, $object->getItemData(), false );
188
 
189
- if ( ! $product->get_image_id() && $object->getImageId() ) {
190
- Product::update_image_from_square( $product, $object->getImageId() );
191
  }
192
 
193
  $products_updated[] = $product->get_id();
@@ -198,6 +201,8 @@ class Interval_Polling extends Stepped_Job {
198
  array(
199
  'type' => 'alert',
200
  'product_id' => $product->get_id(),
 
 
201
  )
202
  );
203
  }
@@ -248,7 +253,7 @@ class Interval_Polling extends Stepped_Job {
248
  }
249
 
250
  $response = wc_square()->get_api()->batch_retrieve_inventory_counts( $args );
251
- $cursor = $response->get_data() instanceof BatchRetrieveInventoryCountsResponse ? $response->get_data()->getCursor() : null;
252
 
253
  // store the start timestamp after the first API request was completed but do not save it now
254
  // if cursor is present, then it is not the last page. So, use the inventory_last_synced_at time
22
  */
23
 
24
  namespace WooCommerce\Square\Sync;
25
+
26
  use Square\Models\SearchCatalogObjectsResponse;
27
  use Square\Models\BatchRetrieveInventoryCountsResponse;
28
  use WooCommerce\Square\Handlers\Product;
95
  array(
96
  'type' => 'info',
97
  'message' => sprintf(
98
+ /* translators: Placeholder %d number of categories */
99
  _n( 'Updated data for %d category.', 'Updated data for %d categories.', count( $categories ), 'woocommerce-square' ),
100
  count( $categories )
101
  ),
176
  $record['product_hidden'] = true;
177
 
178
  } catch ( \Exception $e ) {
179
+ /* translators: Placeholder %1$s Product Name, %2$s Exception message */
180
+ $record['message'] = sprintf( esc_html__( '%1$s was deleted in Square but could not be hidden in WooCommerce. %2$s.', 'woocommerce-square' ), '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>', $e->getMessage() );
181
  }
182
  }
183
 
186
  } else {
187
 
188
  try {
189
+ $thumbnail_image_id = Product::get_catalog_item_thumbnail_id( $object );
190
  Product::update_from_square( $product, $object->getItemData(), false );
191
 
192
+ if ( ! $product->get_image_id() && $thumbnail_image_id ) {
193
+ Product::update_image_from_square( $product, $thumbnail_image_id );
194
  }
195
 
196
  $products_updated[] = $product->get_id();
201
  array(
202
  'type' => 'alert',
203
  'product_id' => $product->get_id(),
204
+ /* translators: Placeholder %1$s Product Name, %2$s Exception message */
205
+ 'message' => sprintf( esc_html__( 'Could not sync %1$s data from Square. %2$s.', 'woocommerce-square' ), '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>', $exception->getMessage() ),
206
  )
207
  );
208
  }
253
  }
254
 
255
  $response = wc_square()->get_api()->batch_retrieve_inventory_counts( $args );
256
+ $cursor = $response->get_data() instanceof BatchRetrieveInventoryCountsResponse ? $response->get_data()->getCursor() : null;
257
 
258
  // store the start timestamp after the first API request was completed but do not save it now
259
  // if cursor is present, then it is not the last page. So, use the inventory_last_synced_at time
includes/Sync/Manual_Synchronization.php CHANGED
@@ -22,6 +22,7 @@
22
  */
23
 
24
  namespace WooCommerce\Square\Sync;
 
25
  use Square\Models\BatchRetrieveInventoryCountsResponse;
26
  use Square\Models\BatchUpsertCatalogObjectsResponse;
27
  use Square\Models\BatchRetrieveCatalogObjectsResponse;
@@ -351,7 +352,6 @@ class Manual_Synchronization extends Stepped_Job {
351
  $catalog_category = new \Square\Models\CatalogCategory();
352
  $catalog_category->setName( wp_specialchars_decode( $category->name ) );
353
 
354
-
355
  $catalog_object = new \Square\Models\CatalogObject( 'CATEGORY', $square_id );
356
  $catalog_object->setCategoryData( $catalog_category );
357
 
@@ -670,7 +670,7 @@ class Manual_Synchronization extends Stepped_Job {
670
 
671
  foreach ( $product_ids as $product_id ) {
672
 
673
- $catalog_item = new \Square\Models\CatalogItem();
674
  $catalog_object = new CatalogObject( 'ITEM', Product::get_square_item_id( $product_id ) );
675
  $catalog_object->setItemData( $catalog_item );
676
  $catalog_objects[ $product_id ] = $catalog_object;
@@ -693,7 +693,17 @@ class Manual_Synchronization extends Stepped_Job {
693
 
694
  // at this point, log a failure for any products that weren't processed
695
  foreach ( array_diff( $product_ids, $processed_product_ids ) as $product_id ) {
696
- Records::set_record( $product_id );
 
 
 
 
 
 
 
 
 
 
697
  }
698
 
699
  $this->complete_step( 'upsert_new_products' );
@@ -867,7 +877,7 @@ class Manual_Synchronization extends Stepped_Job {
867
  array(
868
  'item_id' => $remote_item_id,
869
  'item_version' => $remote_catalog_item->getVersion(),
870
- 'item_image_id' => $remote_catalog_item->getImageId(),
871
  )
872
  );
873
 
@@ -1072,16 +1082,17 @@ class Manual_Synchronization extends Stepped_Job {
1072
 
1073
 
1074
  /**
1075
- * Performs a sync when Square is the system of record.
1076
  *
1077
  * @since 2.0.0
1078
  */
1079
  protected function square_sor_sync() {
1080
 
1081
- $synced_product_ids = $this->get_attr( 'validated_product_ids', array() );
1082
- $processed_product_ids = $this->get_attr( 'processed_product_ids', array() );
1083
- $unprocessed_product_ids = array_diff( $synced_product_ids, $processed_product_ids );
1084
- $catalog_processed = $this->get_attr( 'catalog_processed', false );
 
1085
 
1086
  if ( $catalog_processed ) {
1087
 
@@ -1177,6 +1188,32 @@ class Manual_Synchronization extends Stepped_Job {
1177
  continue;
1178
  }
1179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1180
  foreach ( $object->getItemData()->getVariations() as $variation ) {
1181
 
1182
  $found_product_id = wc_get_product_id_by_sku( $variation->getItemVariationData()->getSku() );
@@ -1242,9 +1279,29 @@ class Manual_Synchronization extends Stepped_Job {
1242
 
1243
  $square_object = ! empty( $catalog_objects[ $product->get_id() ] ) ? $catalog_objects[ $product->get_id() ] : null;
1244
 
1245
- // if no Square object was found, log as a failure
1246
  if ( ! $square_object ) {
1247
- throw new \Exception( 'Product does not exist in the Square catalog' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1248
  }
1249
 
1250
  foreach ( $square_object->getItemData()->getVariations() as $variation ) {
@@ -1252,13 +1309,22 @@ class Manual_Synchronization extends Stepped_Job {
1252
  }
1253
 
1254
  Product::update_from_square( $product, $square_object->getItemData(), false );
 
1255
 
1256
- if ( ! $product->get_image_id() && $square_object->getImageId() ) {
1257
- Product::update_image_from_square( $product, $square_object->getImageId() );
1258
  }
1259
  } catch ( \Exception $exception ) {
1260
 
1261
- $this->mark_failed_products( array( $product ) );
 
 
 
 
 
 
 
 
1262
  }
1263
 
1264
  $processed_product_ids[] = $product->get_id();
@@ -1424,6 +1490,8 @@ class Manual_Synchronization extends Stepped_Job {
1424
  $record_data['product_hidden'] = true;
1425
 
1426
  } catch ( \Exception $e ) {
 
 
1427
  }
1428
  }
1429
 
22
  */
23
 
24
  namespace WooCommerce\Square\Sync;
25
+
26
  use Square\Models\BatchRetrieveInventoryCountsResponse;
27
  use Square\Models\BatchUpsertCatalogObjectsResponse;
28
  use Square\Models\BatchRetrieveCatalogObjectsResponse;
352
  $catalog_category = new \Square\Models\CatalogCategory();
353
  $catalog_category->setName( wp_specialchars_decode( $category->name ) );
354
 
 
355
  $catalog_object = new \Square\Models\CatalogObject( 'CATEGORY', $square_id );
356
  $catalog_object->setCategoryData( $catalog_category );
357
 
670
 
671
  foreach ( $product_ids as $product_id ) {
672
 
673
+ $catalog_item = new \Square\Models\CatalogItem();
674
  $catalog_object = new CatalogObject( 'ITEM', Product::get_square_item_id( $product_id ) );
675
  $catalog_object->setItemData( $catalog_item );
676
  $catalog_objects[ $product_id ] = $catalog_object;
693
 
694
  // at this point, log a failure for any products that weren't processed
695
  foreach ( array_diff( $product_ids, $processed_product_ids ) as $product_id ) {
696
+ Records::set_record(
697
+ array(
698
+ 'type' => 'info',
699
+ 'product_id' => $product_id,
700
+ 'message' => sprintf(
701
+ /* translators: Placeholder: %s - product ID */
702
+ esc_html__( 'Product #%s could not be updated.', 'woocommerce-square' ),
703
+ '<a href="' . esc_url( get_edit_post_link( $product_id ) ) . '">' . $product_id . '</a>'
704
+ ),
705
+ )
706
+ );
707
  }
708
 
709
  $this->complete_step( 'upsert_new_products' );
877
  array(
878
  'item_id' => $remote_item_id,
879
  'item_version' => $remote_catalog_item->getVersion(),
880
+ 'item_image_id' => Product::get_catalog_item_thumbnail_id( $remote_catalog_item ),
881
  )
882
  );
883
 
1082
 
1083
 
1084
  /**
1085
+ * Performs a sync when Square is the Sync setting.
1086
  *
1087
  * @since 2.0.0
1088
  */
1089
  protected function square_sor_sync() {
1090
 
1091
+ $synced_product_ids = $this->get_attr( 'validated_product_ids', array() );
1092
+ $processed_product_ids = $this->get_attr( 'processed_product_ids', array() );
1093
+ $deleted_square_variations = $this->get_attr( 'deleted_square_variations', array() );
1094
+ $unprocessed_product_ids = array_diff( array_merge( $synced_product_ids, $deleted_square_variations ), $processed_product_ids );
1095
+ $catalog_processed = $this->get_attr( 'catalog_processed', false );
1096
 
1097
  if ( $catalog_processed ) {
1098
 
1188
  continue;
1189
  }
1190
 
1191
+ $maybe_parent_product = Product::get_product_by_square_id( $object->getId() );
1192
+
1193
+ if ( $maybe_parent_product instanceof \WC_Product && $maybe_parent_product->is_type( 'variable' ) ) {
1194
+ $missing_variations = array();
1195
+ $woo_product_variations = $maybe_parent_product->get_children();
1196
+ $square_product_variations = $object->getItemData()->getVariations();
1197
+ $square_variation_ids = array_map(
1198
+ function( $square_product_variation ) {
1199
+ return wc_get_product_id_by_sku( $square_product_variation->getItemVariationData()->getSku() );
1200
+ },
1201
+ $square_product_variations
1202
+ );
1203
+
1204
+ foreach ( $woo_product_variations as $woo_product_variation_id ) {
1205
+ if ( ! in_array( (int) $woo_product_variation_id, $square_variation_ids, true ) ) {
1206
+ $woo_product_variation = wc_get_product( $woo_product_variation_id );
1207
+ $woo_product_variation->set_status( 'private' );
1208
+ $woo_product_variation->save();
1209
+ $missing_variations[] = $woo_product_variation_id;
1210
+ }
1211
+ }
1212
+
1213
+ $missing_variations = array_diff( $woo_product_variations, $square_variation_ids );
1214
+ $this->set_attr( 'deleted_square_variations', $missing_variations );
1215
+ }
1216
+
1217
  foreach ( $object->getItemData()->getVariations() as $variation ) {
1218
 
1219
  $found_product_id = wc_get_product_id_by_sku( $variation->getItemVariationData()->getSku() );
1279
 
1280
  $square_object = ! empty( $catalog_objects[ $product->get_id() ] ) ? $catalog_objects[ $product->get_id() ] : null;
1281
 
1282
+ // if no Square object was found
1283
  if ( ! $square_object ) {
1284
+ $record = array(
1285
+ 'type' => 'alert',
1286
+ 'product_id' => $product->get_id(),
1287
+ /* translators: Placeholder %s Product ID */
1288
+ 'message' => sprintf( esc_html__( '%s does not exist in the Square catalog.', 'woocommerce-square' ), '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>' ),
1289
+ );
1290
+
1291
+ // if enabled, hide the product from the catalog
1292
+ if ( wc_square()->get_settings_handler()->is_system_of_record_square() && wc_square()->get_settings_handler()->hide_missing_square_products() ) {
1293
+ try {
1294
+ $product->set_catalog_visibility( 'hidden' );
1295
+ $product->save();
1296
+
1297
+ $record['product_hidden'] = true;
1298
+ } catch ( \Exception $e ) {
1299
+ $record['message'] .= esc_html__( 'This product failed to be hidden.', 'woocommerce-square' );
1300
+ }
1301
+ }
1302
+
1303
+ Records::set_record( $record );
1304
+ continue;
1305
  }
1306
 
1307
  foreach ( $square_object->getItemData()->getVariations() as $variation ) {
1309
  }
1310
 
1311
  Product::update_from_square( $product, $square_object->getItemData(), false );
1312
+ $image_id = Product::get_catalog_item_thumbnail_id( $square_object );
1313
 
1314
+ if ( ! $product->get_image_id() && $image_id ) {
1315
+ Product::update_image_from_square( $product, $image_id );
1316
  }
1317
  } catch ( \Exception $exception ) {
1318
 
1319
+ Records::set_record(
1320
+ array(
1321
+ 'type' => 'alert',
1322
+ 'product_id' => $product->get_id(),
1323
+ /* translators: Placeholder %1$s Product Name, %2$s Exception message */
1324
+ 'message' => sprintf( esc_html__( 'Could not sync %1$s data from Square. %2$s.', 'woocommerce-square' ), '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>', $exception->getMessage() ),
1325
+ )
1326
+ );
1327
+
1328
  }
1329
 
1330
  $processed_product_ids[] = $product->get_id();
1490
  $record_data['product_hidden'] = true;
1491
 
1492
  } catch ( \Exception $e ) {
1493
+ /* translators: Placeholder %1$s Product Name, %2$s Exception message */
1494
+ $record['message'] = sprintf( esc_html__( '%1$s was deleted in Square but could not be hidden in WooCommerce. %2$s.', 'woocommerce-square' ), '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>', $e->getMessage() );
1495
  }
1496
  }
1497
 
includes/Sync/Product_Import.php CHANGED
@@ -505,7 +505,7 @@ class Product_Import extends Stepped_Job {
505
  'type' => ( 1 === count( $variations ) && ! ( $product && $product instanceof \WC_Product_Variable ) ) ? 'simple' : 'variable',
506
  'sku' => '', // make sure to reset SKU when simple product is updated to variable
507
  'description' => $catalog_object->getItemData()->getDescription(),
508
- 'image_id' => $catalog_object->getImageId(),
509
  'categories' => array( $category_id ),
510
  'square_meta' => array(
511
  'item_id' => $catalog_object->getId(),
@@ -535,7 +535,6 @@ class Product_Import extends Stepped_Job {
535
  }
536
 
537
  try {
538
-
539
  $data['variations'][] = $this->extract_square_item_variation_data( $variation );
540
 
541
  } catch ( \Exception $exception ) {
@@ -556,7 +555,7 @@ class Product_Import extends Stepped_Job {
556
  }
557
  }
558
 
559
- if ( ! sizeof( $data[ 'variations' ] ) ) {
560
  return null;
561
  }
562
 
@@ -567,7 +566,7 @@ class Product_Import extends Stepped_Job {
567
  'position' => 0,
568
  'visible' => true,
569
  'variation' => true,
570
- 'options' => wp_list_pluck( $data['variations'], 'name' ),
571
  ),
572
  );
573
  } else { // simple product
@@ -600,7 +599,6 @@ class Product_Import extends Stepped_Job {
600
 
601
  return null;
602
  }
603
-
604
  }
605
 
606
  return $data;
@@ -623,7 +621,7 @@ class Product_Import extends Stepped_Job {
623
  throw new \Exception( __( 'Items with variable pricing cannot be imported.', 'woocommerce-square' ) );
624
  }
625
 
626
- if ( in_array( $variation_data->getSku(), array( '', null ) ) ) {
627
  throw new \Exception( __( 'Variations with missing SKUs cannot be imported.', 'woocommerce-square' ) );
628
  }
629
 
@@ -641,7 +639,7 @@ class Product_Import extends Stepped_Job {
641
  array(
642
  'name' => 'Attribute',
643
  'is_variation' => true,
644
- 'option' => $variation_data->getName(),
645
  ),
646
  ),
647
  );
505
  'type' => ( 1 === count( $variations ) && ! ( $product && $product instanceof \WC_Product_Variable ) ) ? 'simple' : 'variable',
506
  'sku' => '', // make sure to reset SKU when simple product is updated to variable
507
  'description' => $catalog_object->getItemData()->getDescription(),
508
+ 'image_id' => Product::get_catalog_item_thumbnail_id( $catalog_object ),
509
  'categories' => array( $category_id ),
510
  'square_meta' => array(
511
  'item_id' => $catalog_object->getId(),
535
  }
536
 
537
  try {
 
538
  $data['variations'][] = $this->extract_square_item_variation_data( $variation );
539
 
540
  } catch ( \Exception $exception ) {
555
  }
556
  }
557
 
558
+ if ( ! count( $data['variations'] ) ) {
559
  return null;
560
  }
561
 
566
  'position' => 0,
567
  'visible' => true,
568
  'variation' => true,
569
+ 'options' => str_replace( '|', ' - ', wp_list_pluck( $data['variations'], 'name' ) ),
570
  ),
571
  );
572
  } else { // simple product
599
 
600
  return null;
601
  }
 
602
  }
603
 
604
  return $data;
621
  throw new \Exception( __( 'Items with variable pricing cannot be imported.', 'woocommerce-square' ) );
622
  }
623
 
624
+ if ( in_array( $variation_data->getSku(), array( '', null ), true ) ) {
625
  throw new \Exception( __( 'Variations with missing SKUs cannot be imported.', 'woocommerce-square' ) );
626
  }
627
 
639
  array(
640
  'name' => 'Attribute',
641
  'is_variation' => true,
642
+ 'option' => str_replace( '|', ' - ', $variation_data->getName() ),
643
  ),
644
  ),
645
  );
includes/Sync/Records/Record.php CHANGED
@@ -368,11 +368,19 @@ class Record {
368
 
369
  if ( '' === $message && ( $product = $this->get_product() ) ) {
370
 
371
- $message = sprintf(
372
- /* translators: Placeholder: %s - product name */
373
- esc_html__( '%s not found in Square.', 'woocommerce-square' ),
374
- '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>'
375
- );
 
 
 
 
 
 
 
 
376
  }
377
 
378
  return $message;
368
 
369
  if ( '' === $message && ( $product = $this->get_product() ) ) {
370
 
371
+ if ( 'variation' === $product->get_type() ) {
372
+ $message = sprintf(
373
+ /* translators: Placeholder: %s - product name */
374
+ esc_html__( '%s variation not found in Square.', 'woocommerce-square' ),
375
+ '<a href="' . esc_url( get_edit_post_link( $product->get_parent_id() ) ) . '">' . $product->get_formatted_name() . '</a>'
376
+ );
377
+ } else {
378
+ $message = sprintf(
379
+ /* translators: Placeholder: %s - product name */
380
+ esc_html__( '%s not found in Square.', 'woocommerce-square' ),
381
+ '<a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_formatted_name() . '</a>'
382
+ );
383
+ }
384
  }
385
 
386
  return $message;
includes/Utilities/Helper.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  namespace WooCommerce\Square\Utilities;
3
- defined( 'ABSPATH' ) or exit;
 
4
 
5
  /**
6
  * WooCommerce Square Helper Class
@@ -60,7 +61,7 @@ class Helper {
60
  /**
61
  * Gets the full URL to the log file for a given $handle
62
  *
63
- * @since 4.0.0
64
  * @param string $handle log handle
65
  * @return string URL to the WC log file identified by $handle
66
  */
@@ -68,52 +69,6 @@ class Helper {
68
  return admin_url( sprintf( 'admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', $handle, sanitize_file_name( wp_hash( $handle ) ) ) );
69
  }
70
 
71
- /**
72
- * Logs a doing_it_wrong message.
73
- *
74
- * Backports wc_doing_it_wrong() to WC 2.6.
75
- *
76
- * @since 5.0.1
77
- *
78
- * @param string $function function used
79
- * @param string $message message to log
80
- * @param string $version version the message was added in
81
- */
82
- public static function wc_doing_it_wrong( $function, $message, $version ) {
83
-
84
- if ( self::is_wc_version_gte( '3.0' ) ) {
85
-
86
- wc_doing_it_wrong( $function, $message, $version );
87
-
88
- } else {
89
-
90
- $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
91
-
92
- if ( wp_doing_ajax() ) {
93
-
94
- do_action( 'doing_it_wrong_run', $function, $message, $version );
95
- error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
96
-
97
- } else {
98
-
99
- _doing_it_wrong( $function, $message, $version );
100
- }
101
- }
102
- }
103
-
104
- /**
105
- * Determines if the installed version of WooCommerce meets or exceeds the
106
- * passed version.
107
- *
108
- * @since 4.7.3
109
- *
110
- * @param string $version version number to compare
111
- * @return bool
112
- */
113
- public static function is_wc_version_gte( $version ) {
114
- return self::get_wc_version() && version_compare( self::get_wc_version(), $version, '>=' );
115
- }
116
-
117
  /**
118
  * Helper method to get the version of the currently installed WooCommerce
119
  *
@@ -124,14 +79,4 @@ class Helper {
124
 
125
  return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
126
  }
127
-
128
- /**
129
- * Determines if the installed version of WooCommerce is 3.0 or greater.
130
- *
131
- * @since 4.6.0
132
- * @return bool
133
- */
134
- public static function is_wc_version_gte_3_0() {
135
- return self::get_wc_version() && version_compare( self::get_wc_version(), '3.0', '>=' );
136
- }
137
  }
1
  <?php
2
  namespace WooCommerce\Square\Utilities;
3
+
4
+ defined( 'ABSPATH' ) || exit;
5
 
6
  /**
7
  * WooCommerce Square Helper Class
61
  /**
62
  * Gets the full URL to the log file for a given $handle
63
  *
64
+ * @since 3.0.0
65
  * @param string $handle log handle
66
  * @return string URL to the WC log file identified by $handle
67
  */
69
  return admin_url( sprintf( 'admin.php?page=wc-status&tab=logs&log_file=%s-%s-log', $handle, sanitize_file_name( wp_hash( $handle ) ) ) );
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  /**
73
  * Helper method to get the version of the currently installed WooCommerce
74
  *
79
 
80
  return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
81
  }
 
 
 
 
 
 
 
 
 
 
82
  }
includes/Utilities/Money_Utility.php CHANGED
@@ -126,26 +126,12 @@ class Money_Utility {
126
  'XPF' => 0,
127
  );
128
 
129
- if ( Plugin_Compatibility::is_wc_version_gte( '3.5' ) ) {
130
 
131
- $locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' );
132
 
133
- $currencies = wp_list_pluck( $locale_info, 'num_decimals', 'currency_code' );
134
-
135
- // ensure the values set in local-info.php always override the above
136
- $currencies = array_merge( $other_currencies, $currencies );
137
-
138
- } else {
139
-
140
- $currencies = array();
141
- $currency_codes = get_woocommerce_currencies();
142
-
143
- foreach ( $currency_codes as $code => $name ) {
144
- $currencies[ $code ] = 2;
145
- }
146
-
147
- $currencies = array_merge( $currencies, $other_currencies );
148
- }
149
 
150
  /**
151
  * Filters the number of decimals to use for a given currency when converting to or from its smallest denomination.
126
  'XPF' => 0,
127
  );
128
 
129
+ $locale_info = include WC()->plugin_path() . '/i18n/locale-info.php';
130
 
131
+ $currencies = wp_list_pluck( $locale_info, 'num_decimals', 'currency_code' );
132
 
133
+ // ensure the values set in local-info.php always override the above
134
+ $currencies = array_merge( $other_currencies, $currencies );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  /**
137
  * Filters the number of decimals to use for a given currency when converting to or from its smallest denomination.
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WooCommerce Square ===
2
  Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
3
  Tags: credit card, square, woocommerce, inventory sync
4
- Requires at least: 4.6
5
  Tested up to: 6.0
6
  Requires PHP: 7.2
7
- Stable tag: 3.3.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -29,8 +29,8 @@ You can also use these advanced features:
29
 
30
  You can sync your product data automatically between WooCommerce and Square.
31
 
32
- - If you sell mainly online, you can choose WooCommerce as your system of record. This will push the WooCommerce product name, inventory, prices, categories, and images to Square. Note that inventory will still be fetched periodically from Square and you must refresh inventory in WooCommerce before editing.
33
- - If you sell in multiple locations and online, you can choose Square as your system of record. This will pull product name, inventory, and prices from Square into your WooCommerce catalog. Product images will also be synced if not already set in WooCommerce.
34
 
35
  == Installation ==
36
 
@@ -71,6 +71,27 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  = 3.3.0 - 2022-11-07 =
75
  * Add - Adds digital wallet buttons in the Pay for Order page.
76
  * Add - Declare support for High-performance Order Systems ("HPOS").
1
  === WooCommerce Square ===
2
  Contributors: woocommerce, automattic, royho, woothemes, bor0, mattdallan, menakas, chickenn00dle, jorgeatorres, jamesgallan, achyuthajoy
3
  Tags: credit card, square, woocommerce, inventory sync
4
+ Requires at least: 5.6
5
  Tested up to: 6.0
6
  Requires PHP: 7.2
7
+ Stable tag: 3.4.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
29
 
30
  You can sync your product data automatically between WooCommerce and Square.
31
 
32
+ - If you sell mainly online, you can choose WooCommerce as your system of record in your sync settings. This will push the WooCommerce product name, inventory, prices, categories, and images to Square. Note that inventory will still be fetched periodically from Square and you must refresh inventory in WooCommerce before editing.
33
+ - If you sell in multiple locations and online, you can choose Square as your system of record in your sync settings. This will pull product name, inventory, and prices from Square into your WooCommerce catalog. Product images will also be synced if not already set in WooCommerce.
34
 
35
  == Installation ==
36
 
71
  2. The payment gateway settings.
72
 
73
  == Changelog ==
74
+ = 3.4.0 - 2022-12-05 =
75
+ * Add - Ability to export the Sync with Square status while exporting products.
76
+ * Add - Link to support forum under Sync Setting.
77
+ * Dev - Bump NPM version from 6.0.0 to 8.0.0.
78
+ * Dev - Bump node version from 12.0.0 to 16.0.0.
79
+ * Dev - Remove redundant build-zip npm command.
80
+ * Fix - Address issue with Square variation names containing a pipe character.
81
+ * Update - Blocks forms on the product, cart and checkout pages when a digital wallet payment is being processed.
82
+ * Update - Square PHP SDK to version 19.0.1.20220512.
83
+ * Fix - Ensure we show more accurate error messages.
84
+ * Fix - Hide variation in WooCommerce when the variation is deleted from Square.
85
+ * Fix - Incomplete product import issue when the number of products is very high.
86
+ * Fix - Incorrect coupon discount calculation which results into incorrect tax calculation.
87
+ * Fix - JS error thrown by Digital Wallets on Cart and Checkout pages due to unsupported product types.
88
+ * Fix - Remove unnecessary calls to `getLocation` when doing a manual sync.
89
+ * Fix - Set price money based on price overrides for a location.
90
+ * Update - Bump minimum supported PHP version to 7.2.
91
+ * Update - Bump minimum supported WooCommerce version to 6.0.
92
+ * Update - Bump minimum supported WordPress version to 5.6.
93
+ * Update - Rename System of Record to Sync Setting.
94
+
95
  = 3.3.0 - 2022-11-07 =
96
  * Add - Adds digital wallet buttons in the Pay for Order page.
97
  * Add - Declare support for High-performance Order Systems ("HPOS").
vendor/apimatic/jsonmapper/.github/workflows/test.yml CHANGED
@@ -10,7 +10,7 @@ jobs:
10
  if: "! contains(toJSON(github.event.head_commit.message), 'skip ci')"
11
  strategy:
12
  matrix:
13
- php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
14
  include:
15
  - php: 5.6
16
  phpunit: 5
@@ -26,6 +26,8 @@ jobs:
26
  phpunit: 7
27
  - php: 8.0
28
  phpunit: 8
 
 
29
  steps:
30
  - name: Checkout
31
  uses: actions/checkout@v2
10
  if: "! contains(toJSON(github.event.head_commit.message), 'skip ci')"
11
  strategy:
12
  matrix:
13
+ php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
14
  include:
15
  - php: 5.6
16
  phpunit: 5
26
  phpunit: 7
27
  - php: 8.0
28
  phpunit: 8
29
+ - php: 8.1
30
+ phpunit: 9
31
  steps:
32
  - name: Checkout
33
  uses: actions/checkout@v2
vendor/apimatic/jsonmapper/.gitignore CHANGED
@@ -7,4 +7,23 @@
7
  .settings
8
  /composer*.lock
9
  /coverage
10
- /.vscode
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  .settings
8
  /composer*.lock
9
  /coverage
10
+ /.vscode
11
+ .idea
12
+
13
+ ### PHPUnit ###
14
+ # Covers PHPUnit
15
+ # Reference: https://phpunit.de/
16
+
17
+ # Generated files
18
+ .phpunit.result.cache
19
+ .phpunit.cache
20
+
21
+ # PHPUnit
22
+ /app/phpunit.xml
23
+ /phpunit.xml
24
+
25
+ # Build data
26
+ /build/
27
+
28
+ # Coverage
29
+ /CodeCoverage/
vendor/apimatic/jsonmapper/README.rst CHANGED
@@ -17,7 +17,9 @@ gives you, but for JSON.
17
  Note that it does not rely on any schema, only your class definitions.
18
 
19
  Type detection works by parsing ``@var`` docblock annotations of
20
- class properties, as well as type hints in setter methods.
 
 
21
 
22
  You do not have to modify your model classes by adding JSON specific code;
23
  it works automatically by parsing already-existing docblocks.
@@ -167,6 +169,13 @@ Map an array of objects (works similarly to ``mapArray``):
167
  $mapper = new JsonMapper();
168
  $contactsArray = $mapper->mapClassArray($jsonContacts, 'Contact');
169
 
 
 
 
 
 
 
 
170
  Property type documentation
171
  ===========================
172
  ``JsonMapper`` uses several sources to detect the correct type of
17
  Note that it does not rely on any schema, only your class definitions.
18
 
19
  Type detection works by parsing ``@var`` docblock annotations of
20
+ class properties, as well as type hints in setter methods. If docblock comments,
21
+ or comments in general are discarded through some configuration setting like ``opcache.save_comments=0``,
22
+ or any other similar configuration, an exception is thrown, blocking any further operation.
23
 
24
  You do not have to modify your model classes by adding JSON specific code;
25
  it works automatically by parsing already-existing docblocks.
169
  $mapper = new JsonMapper();
170
  $contactsArray = $mapper->mapClassArray($jsonContacts, 'Contact');
171
 
172
+ Map a value with any combination of types e.g oneOf(string,int) or anyOf(string,Contact):
173
+
174
+ .. code:: php
175
+
176
+ $mapper = new JsonMapper();
177
+ $contactObject = $mapper->mapFor($value, 'oneOf(string,Contact)');
178
+
179
  Property type documentation
180
  ===========================
181
  ``JsonMapper`` uses several sources to detect the correct type of
vendor/apimatic/jsonmapper/composer.json CHANGED
@@ -27,6 +27,9 @@
27
  },
28
  "require-dev": {
29
  "squizlabs/php_codesniffer": "^3.0.0",
30
- "phpunit/phpunit": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
31
- }
 
 
 
32
  }
27
  },
28
  "require-dev": {
29
  "squizlabs/php_codesniffer": "^3.0.0",
30
+ "phpunit/phpunit": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0"
31
+ },
32
+ "require": {
33
+ "ext-json": "*"
34
+ }
35
  }
vendor/apimatic/jsonmapper/src/JsonMapper.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Part of JsonMapper
4
  *
@@ -13,6 +14,11 @@
13
 
14
  namespace apimatic\jsonmapper;
15
 
 
 
 
 
 
16
  /**
17
  * Automatically map JSON structures into objects.
18
  *
@@ -87,16 +93,90 @@ class JsonMapper
87
  */
88
  protected $arInspectedClasses = array();
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Map data all data in $json into the given $object instance.
92
  *
93
  * @param object $json JSON object structure from json_decode()
94
  * @param object $object Object to map $json data into
 
 
95
  *
96
  * @return object Mapped object is returned.
97
  * @see mapArray()
98
  */
99
- public function map($json, $object)
100
  {
101
  if ($this->bEnforceMapType && !is_object($json)) {
102
  throw new \InvalidArgumentException(
@@ -112,7 +192,7 @@ class JsonMapper
112
  }
113
 
114
  $strClassName = get_class($object);
115
- $rc = new \ReflectionClass($object);
116
  $strNs = $rc->getNamespaceName();
117
  $providedProperties = array();
118
  $additionalPropertiesMethod = $this->getAdditionalPropertiesMethod($rc);
@@ -128,7 +208,7 @@ class JsonMapper
128
  = $this->inspectProperty($rc, $key);
129
  }
130
 
131
- list($hasProperty, $accessor, $type, $factoryMethod)
132
  = $this->arInspectedClasses[$strClassName][$key];
133
 
134
  if ($accessor !== null) {
@@ -137,9 +217,9 @@ class JsonMapper
137
 
138
  if (!$hasProperty) {
139
  if ($this->bExceptionOnUndefinedProperty) {
140
- throw new JsonMapperException(
141
- 'JSON property "' . $key . '" does not exist'
142
- . ' in object of type ' . $strClassName
143
  );
144
  }
145
  $isAdditional = true;
@@ -152,11 +232,13 @@ class JsonMapper
152
 
153
  if ($accessor === null) {
154
  if ($this->bExceptionOnUndefinedProperty) {
155
- throw new JsonMapperException(
156
- 'JSON property "' . $key . '" has no public setter method'
157
- . ' in object of type ' . $strClassName
 
158
  );
159
  }
 
160
  $isAdditional = true;
161
  $this->log(
162
  'info',
@@ -167,9 +249,9 @@ class JsonMapper
167
 
168
  //FIXME: check if type exists, give detailled error message if not
169
  if ($type === '') {
170
- throw new JsonMapperException(
171
- 'Empty type at property "'
172
- . $strClassName . '::$' . $key . '"'
173
  );
174
  }
175
 
@@ -179,13 +261,14 @@ class JsonMapper
179
  }
180
  continue;
181
  }
182
-
183
  $value = $this->getMappedValue(
184
  $jvalue,
185
  $type,
 
186
  $factoryMethod,
187
  $rc->getNamespaceName(),
188
- $rc->getName()
 
189
  );
190
  $this->setProperty($object, $accessor, $value, $strNs);
191
  }
@@ -198,33 +281,128 @@ class JsonMapper
198
  }
199
 
200
  /**
201
- * Get mapped value for a property in an object.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  *
203
- * @param $jvalue mixed Raw normalized data for the property
204
- * @param $type string Type of the data found by inspectProperty()
205
- * @param $factoryMethod string Callable factory method for property
206
- * @param $namespace string Namespace of the class
207
- * @param $className string Name of the class
208
  *
209
- * @return mixed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  */
211
  protected function getMappedValue(
212
  $jvalue,
213
  $type,
214
- $factoryMethod,
 
215
  $namespace,
216
- $className
 
217
  ) {
 
 
 
 
 
 
 
 
 
218
  //use factory method generated value if factory provided
219
- if ($factoryMethod !== null) {
220
- if (!is_callable($factoryMethod)) {
221
- throw new JsonMapperException(
222
- 'Factory method "' . $factoryMethod . '" referenced by "'
223
- . $className . '" is not callable'
224
- );
225
- }
226
- $factoryValue = call_user_func($factoryMethod, $jvalue);
227
- return $factoryValue;
228
  }
229
 
230
  if ($this->isNullable($type)) {
@@ -240,16 +418,22 @@ class JsonMapper
240
  } else if ($this->isObjectOfSameType($type, $jvalue)) {
241
  return $jvalue;
242
  } else if ($this->isSimpleType($type)) {
 
 
 
 
 
 
 
243
  settype($jvalue, $type);
244
  return $jvalue;
245
  }
246
 
247
  $array = null;
248
- $subtype = null;
249
- if (substr($type, -2) == '[]') {
250
- //array
251
  $array = array();
252
- $subtype = substr($type, 0, -2);
253
  } else if (substr($type, -1) == ']') {
254
  list($proptype, $subtype) = explode('[', substr($type, 0, -1));
255
  if (!$this->isSimpleType($proptype)) {
@@ -259,6 +443,7 @@ class JsonMapper
259
  } else if ($type == 'ArrayObject'
260
  || is_subclass_of($type, 'ArrayObject')
261
  ) {
 
262
  $array = $this->createInstance($type);
263
  }
264
 
@@ -272,9 +457,20 @@ class JsonMapper
272
  $this->getFullNamespace($subtype, $namespace)
273
  )
274
  ) {
275
- $child = $this->mapClassArray($jvalue, $subtype);
 
 
 
 
 
276
  } else {
277
- $child = $this->mapArray($jvalue, $array, $subtype);
 
 
 
 
 
 
278
  }
279
  } else if ($this->isFlatType(gettype($jvalue))) {
280
  //use constructor parameter if we have a class
@@ -287,22 +483,582 @@ class JsonMapper
287
  }
288
  } else {
289
  $type = $this->getFullNamespace($type, $namespace);
290
- $child = $this->mapClass($jvalue, $type);
291
  }
292
 
293
  return $child;
294
  }
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  /**
297
  * Map all data in $json into a new instance of $type class.
298
  *
299
- * @param object|null $json JSON object structure from json_decode()
300
- * @param string $type The type of class instance to map into.
 
 
301
  *
302
- * @return object|null Mapped object is returned.
 
303
  * @see mapClassArray()
304
  */
305
- public function mapClass($json, $type)
306
  {
307
  if ($json === null) {
308
  return null;
@@ -324,33 +1080,38 @@ class JsonMapper
324
  );
325
  }
326
 
327
- $rc = new \ReflectionClass($ttype);
328
-
329
  //try and find a class with matching discriminator
330
  $matchedRc = $this->getDiscriminatorMatch($json, $rc);
331
-
332
  //otherwise fallback to an instance of $type class
333
  if ($matchedRc === null) {
334
- $instance = $this->createInstance($ttype, $json);
335
  } else {
336
- $instance = $this->createInstance($matchedRc->getName(), $json);
 
 
 
 
337
  }
338
 
339
- return $this->map($json, $instance);
 
340
  }
341
 
342
  /**
343
  * Get class instance that best matches the class
344
  *
345
- * @param object|null $json JSON object structure from json_decode()
346
- * @param \ReflectionClass $rc Class to get instance of. This method
347
- * will try to first match the discriminator
348
- * field with the discriminator value of
349
- * the current class or its child class.
350
- * If no matches is found, then the current
351
- * class's instance is returned.
352
- *
353
- * @return \ReflectionClass|null Object instance if match is found.
 
 
354
  */
355
  protected function getDiscriminatorMatch($json, $rc)
356
  {
@@ -369,15 +1130,14 @@ class JsonMapper
369
  return $childRc;
370
  }
371
  }
372
- } else {
373
- return null;
374
  }
 
375
  }
376
 
377
  /**
378
  * Get discriminator info
379
  *
380
- * @param \ReflectionClass $rc ReflectionClass of class to inspect
381
  *
382
  * @return array|null An array with discriminator arguments
383
  * Element 1 is discriminator field name
@@ -402,15 +1162,16 @@ class JsonMapper
402
  /**
403
  * Get child classes from a ReflectionClass
404
  *
405
- * @param \ReflectionClass $rc ReflectionClass of class to inspect
406
  *
407
- * @return \ReflectionClass[] ReflectionClass instances for child classes
 
408
  */
409
  protected function getChildClasses($rc)
410
  {
411
  $children = array();
412
  foreach ($this->arChildClasses[$rc->name] as $class) {
413
- $child = new \ReflectionClass($class);
414
  if ($child->isSubclassOf($rc)) {
415
  $children[] = $child;
416
  }
@@ -440,14 +1201,13 @@ class JsonMapper
440
  /**
441
  * Check required properties exist in json
442
  *
443
- * @param array $providedProperties array with json properties
444
- * @param object $rc Reflection class to check
445
- *
446
- * @throws JsonMapperException
447
  *
448
  * @return void
 
449
  */
450
- protected function checkMissingData($providedProperties, \ReflectionClass $rc)
451
  {
452
  foreach ($rc->getProperties() as $property) {
453
  $rprop = $rc->getProperty($property->name);
@@ -456,10 +1216,9 @@ class JsonMapper
456
  if (isset($annotations['required'])
457
  && !isset($providedProperties[$property->name])
458
  ) {
459
- throw new JsonMapperException(
460
- 'Required property "' . $property->name . '" of class '
461
- . $rc->getName()
462
- . ' is missing in JSON data'
463
  );
464
  }
465
  }
@@ -468,11 +1227,11 @@ class JsonMapper
468
  /**
469
  * Get additional properties setter method for the class.
470
  *
471
- * @param \ReflectionClass $rc Reflection class to check
472
  *
473
- * @return \ReflectionMethod Method or null if disabled.
474
  */
475
- protected function getAdditionalPropertiesMethod(\ReflectionClass $rc)
476
  {
477
  if ($this->bExceptionOnUndefinedProperty === false
478
  && $this->sAdditionalPropertiesCollectionMethod !== null
@@ -508,28 +1267,51 @@ class JsonMapper
508
  /**
509
  * Map an array
510
  *
511
- * @param array $json JSON array structure from json_decode()
512
- * @param mixed $array Array or ArrayObject that gets filled with
513
- * data from $json
514
- * @param string|object $class Class name for children objects.
515
- * All children will get mapped onto this type.
516
- * Supports class names and simple types
517
- * like "string".
 
 
 
518
  *
519
  * @return mixed Mapped $array is returned
520
  */
521
- public function mapArray($json, $array, $class = null)
522
- {
523
- foreach ($json as $key => $jvalue) {
 
 
 
 
 
524
  if ($class === null) {
525
  $array[$key] = $jvalue;
 
 
 
 
 
 
 
 
526
  } else if ($this->isFlatType(gettype($jvalue))) {
527
- //use constructor parameter if we have a class
528
  // but only a flat type (i.e. string, int)
529
  if ($jvalue === null) {
530
  $array[$key] = null;
531
  } else {
532
  if ($this->isSimpleType($class)) {
 
 
 
 
 
 
 
533
  settype($jvalue, $class);
534
  $array[$key] = $jvalue;
535
  } else {
@@ -537,8 +1319,12 @@ class JsonMapper
537
  }
538
  }
539
  } else {
540
- $instance = $this->createInstance($class, $jvalue);
541
- $array[$key] = $this->map($jvalue, $instance);
 
 
 
 
542
  }
543
  }
544
  return $array;
@@ -549,11 +1335,16 @@ class JsonMapper
549
  *
550
  * @param array|null $jsonArray JSON array structure from json_decode()
551
  * @param string $type Class name
 
 
 
 
552
  *
553
- * @return array A new array containing object of $type
554
  * which is mapped from $jsonArray
 
555
  */
556
- public function mapClassArray($jsonArray, $type)
557
  {
558
  if ($jsonArray === null) {
559
  return null;
@@ -561,7 +1352,16 @@ class JsonMapper
561
 
562
  $array = array();
563
  foreach ($jsonArray as $key => $jvalue) {
564
- $array[$key] = $this->mapClass($jvalue, $type);
 
 
 
 
 
 
 
 
 
565
  }
566
 
567
  return $array;
@@ -571,8 +1371,8 @@ class JsonMapper
571
  * Try to find out if a property exists in a given class.
572
  * Checks property first, falls back to setter method.
573
  *
574
- * @param object $rc Reflection class to check
575
- * @param string $name Property name
576
  *
577
  * @return array First value: if the property exists
578
  * Second value: the accessor to use (
@@ -580,14 +1380,16 @@ class JsonMapper
580
  * Third value: type of the property
581
  * Fourth value: factory method
582
  */
583
- protected function inspectProperty(\ReflectionClass $rc, $name)
584
  {
585
  $rmeth = null;
586
  $annotations = [];
587
- foreach ($rc->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
 
588
  $annotations = $this->parseAnnotations($method->getDocComment());
589
  if ($name === $this->getMapAnnotationFromParsed($annotations)) {
590
  $rmeth = $method;
 
591
  break;
592
  }
593
  }
@@ -602,7 +1404,6 @@ class JsonMapper
602
  $annotations = $this->parseAnnotations($rmeth->getDocComment());
603
  }
604
  }
605
-
606
  if ($rmeth !== null && $rmeth->isPublic()) {
607
  $type = null;
608
  $factoryMethod = null;
@@ -618,11 +1419,11 @@ class JsonMapper
618
  }
619
 
620
  //support "@factory method_name"
621
- if (isset($annotations['factory'][0])) {
622
- list($factoryMethod) = explode(' ', $annotations['factory'][0]);
623
  }
624
 
625
- return array(true, $rmeth, $type, $factoryMethod);
626
  }
627
 
628
  $rprop = null;
@@ -630,6 +1431,7 @@ class JsonMapper
630
  foreach ($rc->getProperties(\ReflectionProperty::IS_PUBLIC) as $p) {
631
  $mappedName = $this->getMapAnnotation($p);
632
  if ($mappedName !== null && $name == $mappedName) {
 
633
  $rprop = $p;
634
  break;
635
  }
@@ -667,19 +1469,19 @@ class JsonMapper
667
  }
668
 
669
  //support "@factory method_name"
670
- if (isset($annotations['factory'][0])) {
671
- list($factoryMethod) = explode(' ', $annotations['factory'][0]);
672
  }
673
 
674
- return array(true, $rprop, $type, $factoryMethod);
675
  } else {
676
  //no setter, private property
677
- return array(true, null, null, null);
678
  }
679
  }
680
 
681
  //no setter, no property
682
- return array(false, null, null, null);
683
  }
684
 
685
  /**
@@ -698,9 +1500,9 @@ class JsonMapper
698
  if (is_callable([$param, 'hasType']) && $param->hasType()) {
699
  $type = $param->getType();
700
  if ($type->isBuiltIn()) {
701
- $typeName = static::reflectionTypeToString($type);
702
  } else {
703
- $typeName = "\\" . static::reflectionTypeToString($type);
704
  }
705
  return $type->allowsNull() ? "$typeName|null" : $typeName;
706
  }
@@ -711,20 +1513,18 @@ class JsonMapper
711
  /**
712
  * Get name for a ReflectionType instance
713
  *
714
- * @param \ReflectionTpye $type Reflection type instance
715
  *
716
  * @return string
717
- *
718
- * @codeCoverageIgnore
719
  */
720
- protected static function reflectionTypeToString(\ReflectionType $type)
721
  {
722
  if (\class_exists('ReflectionNamedType')
723
  && $type instanceof \ReflectionNamedType
724
  ) {
725
  return $type->getName();
726
  } else {
727
- return (string) $type;
728
  }
729
  }
730
 
@@ -733,15 +1533,12 @@ class JsonMapper
733
  *
734
  * @param object $property Property of a class
735
  *
736
- * @return string|null Map annotation value
737
  */
738
  protected function getMapAnnotation($property)
739
  {
740
  $annotations = $this->parseAnnotations($property->getDocComment());
741
- if (isset($annotations['maps'][0])) {
742
- return $annotations['maps'][0];
743
- }
744
- return null;
745
  }
746
 
747
  /**
@@ -749,7 +1546,7 @@ class JsonMapper
749
  *
750
  * @param array $annotations Parsed annotation list
751
  *
752
- * @return string|null Map annotation value
753
  */
754
  protected function getMapAnnotationFromParsed($annotations)
755
  {
@@ -759,6 +1556,34 @@ class JsonMapper
759
  return null;
760
  }
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  /**
763
  * Set a property on a given object to a given value.
764
  *
@@ -786,21 +1611,24 @@ class JsonMapper
786
  *
787
  * @param string $class Class name to instantiate
788
  * @param object $jobject Use jobject for constructor args
 
 
789
  *
790
  * @return object Freshly created object
 
791
  */
792
- protected function createInstance($class, &$jobject = null)
793
  {
794
- $rc = new \ReflectionClass($class);
795
  $ctor = $rc->getConstructor();
796
  if ($ctor === null
797
  || 0 === $ctorReqParamsCount = $ctor->getNumberOfRequiredParameters()
798
  ) {
799
  return new $class();
800
  } else if ($jobject === null) {
801
- throw new JsonMapperException(
802
- "$class class requires " . $ctor->getNumberOfRequiredParameters()
803
- . " arguments in constructor but none provided"
804
  );
805
  }
806
 
@@ -832,7 +1660,7 @@ class JsonMapper
832
  = $this->inspectProperty($rc, $key);
833
  }
834
 
835
- list($hasProperty, $accessor, $type, $factoryMethod)
836
  = $this->arInspectedClasses[$class][$key];
837
 
838
  if (!$hasProperty) {
@@ -872,23 +1700,26 @@ class JsonMapper
872
  $jtype = $ttype;
873
  }
874
 
875
- $ctorArgs[$rp->getPosition()]
876
- = $this->getMappedValue(
877
- $jvalue,
878
- $jtype,
879
- $factoryMethod,
880
- $rc->getNamespaceName(),
881
- $rc->getName()
882
- );
 
883
 
884
- unset($jobject->{$key});
 
 
885
  unset($ctorRequiredParamsName[$rp->getPosition()]);
886
  }
887
 
888
  if (count($ctorArgs) < $ctorReqParamsCount) {
889
- throw new JsonMapperException(
890
- "Could not find required constructor arguments for $class: "
891
- . \implode(", ", $ctorRequiredParamsName)
892
  );
893
  }
894
 
@@ -948,12 +1779,15 @@ class JsonMapper
948
  /**
949
  * Is type registered with mapper
950
  *
951
- * @param string $type Class name
952
  *
953
- * @return boolean True if registered with $this->arChildClasses
954
  */
955
  protected function isRegisteredType($type)
956
  {
 
 
 
957
  return isset($this->arChildClasses[ltrim($type, "\\")]);
958
  }
959
 
@@ -991,7 +1825,7 @@ class JsonMapper
991
  *
992
  * @return array
993
  */
994
- protected static function parseAnnotations($docblock)
995
  {
996
  $annotations = array();
997
  // Strip away the docblock header and footer
1
  <?php
2
+
3
  /**
4
  * Part of JsonMapper
5
  *
14
 
15
  namespace apimatic\jsonmapper;
16
 
17
+ use Exception;
18
+ use ReflectionClass;
19
+ use ReflectionException;
20
+ use ReflectionMethod;
21
+
22
  /**
23
  * Automatically map JSON structures into objects.
24
  *
93
  */
94
  protected $arInspectedClasses = array();
95
 
96
+ /**
97
+ * An array of directives from php defined configuration files.
98
+ *
99
+ * @var array|null Array of values from the configuration files.
100
+ */
101
+ protected $config = null;
102
+
103
+ protected $zendOptimizerPlusExtensionLoaded = null;
104
+
105
+ /**
106
+ * Constructor for JsonMapper.
107
+ *
108
+ * @throws JsonMapperException
109
+ */
110
+ function __construct()
111
+ {
112
+ $zendOptimizerPlus = "Zend Optimizer+";
113
+ $zendOptimizerPlusSaveCommentKey = "zend_optimizerplus.save_comments";
114
+ $opCacheSaveCommentKey = "opcache.save_comments";
115
+
116
+ if (!isset($this->config)) {
117
+ $iniPath = php_ini_loaded_file();
118
+ if ($iniPath) {
119
+ $this->config = parse_ini_file($iniPath);
120
+ }
121
+ }
122
+ if (!isset($this->zendOptimizerPlusExtensionLoaded)) {
123
+ $this->zendOptimizerPlusExtensionLoaded
124
+ = extension_loaded($zendOptimizerPlus);
125
+ }
126
+
127
+ $zendOptimizerDiscardedComments
128
+ = $this->zendOptimizerPlusExtensionLoaded === true
129
+ && $this->commentsDiscardedFor($zendOptimizerPlusSaveCommentKey);
130
+
131
+ $opCacheDiscardedComments
132
+ = $this->commentsDiscardedFor($opCacheSaveCommentKey);
133
+
134
+ if ($zendOptimizerDiscardedComments || $opCacheDiscardedComments) {
135
+ throw JsonMapperException::commentsDisabledInConfigurationException(
136
+ array($zendOptimizerPlusSaveCommentKey, $opCacheSaveCommentKey)
137
+ );
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Returns true if comments are disabled locally or in php.ini file.
143
+ * However, if comments are enabled locally by overwriting global
144
+ * php.ini configurations then returns false.
145
+ *
146
+ * @param string $configKey Configuration key to be checked.
147
+ *
148
+ * @return bool Whether comments are disabled in environment or php.ini file.
149
+ */
150
+ protected function commentsDiscardedFor($configKey)
151
+ {
152
+ $localConfigVal = strtolower(ini_get($configKey));
153
+ $phpIniConfigVal = !isset($this->config[$configKey]) ? ''
154
+ : strtolower($this->config[$configKey]);
155
+
156
+ $enableValues = ["1", "on", "true", "yes"];
157
+ $disableValues = ["0", "off", "false", "no"];
158
+
159
+ $notEnabled = in_array($localConfigVal, $enableValues, true) === false;
160
+ $isDisabled = in_array($localConfigVal, $disableValues, true) === true;
161
+ $isDisabledInPhpIniFile = in_array(
162
+ $phpIniConfigVal, $disableValues, true
163
+ ) === true;
164
+
165
+ return $notEnabled && ($isDisabled || $isDisabledInPhpIniFile);
166
+ }
167
+
168
  /**
169
  * Map data all data in $json into the given $object instance.
170
  *
171
  * @param object $json JSON object structure from json_decode()
172
  * @param object $object Object to map $json data into
173
+ * @param bool $strict True if looking to map with strict type checking,
174
+ * Default: false
175
  *
176
  * @return object Mapped object is returned.
177
  * @see mapArray()
178
  */
179
+ public function map($json, $object, $strict = false)
180
  {
181
  if ($this->bEnforceMapType && !is_object($json)) {
182
  throw new \InvalidArgumentException(
192
  }
193
 
194
  $strClassName = get_class($object);
195
+ $rc = new ReflectionClass($object);
196
  $strNs = $rc->getNamespaceName();
197
  $providedProperties = array();
198
  $additionalPropertiesMethod = $this->getAdditionalPropertiesMethod($rc);
208
  = $this->inspectProperty($rc, $key);
209
  }
210
 
211
+ list($hasProperty, $accessor, $type, $factoryMethod, $mapsBy)
212
  = $this->arInspectedClasses[$strClassName][$key];
213
 
214
  if ($accessor !== null) {
217
 
218
  if (!$hasProperty) {
219
  if ($this->bExceptionOnUndefinedProperty) {
220
+ throw JsonMapperException::undefinedPropertyException(
221
+ $key,
222
+ $strClassName
223
  );
224
  }
225
  $isAdditional = true;
232
 
233
  if ($accessor === null) {
234
  if ($this->bExceptionOnUndefinedProperty) {
235
+ throw JsonMapperException::undefinedPropertyException(
236
+ $key,
237
+ $strClassName,
238
+ true
239
  );
240
  }
241
+
242
  $isAdditional = true;
243
  $this->log(
244
  'info',
249
 
250
  //FIXME: check if type exists, give detailled error message if not
251
  if ($type === '') {
252
+ throw JsonMapperException::missingTypePropertyException(
253
+ $key,
254
+ $strClassName
255
  );
256
  }
257
 
261
  }
262
  continue;
263
  }
 
264
  $value = $this->getMappedValue(
265
  $jvalue,
266
  $type,
267
+ $mapsBy,
268
  $factoryMethod,
269
  $rc->getNamespaceName(),
270
+ $rc->getName(),
271
+ $strict
272
  );
273
  $this->setProperty($object, $accessor, $value, $strNs);
274
  }
281
  }
282
 
283
  /**
284
+ * Checks if type is an array, and extracts its dimensions and inner type.
285
+ *
286
+ * @param string $type Type to be checked for array.
287
+ * @param int $dimensions Dimensions passed in recursions, initial: 0.
288
+ *
289
+ * @return array
290
+ */
291
+ public function getArrayTypeAndDimensions($type, $dimensions = 0)
292
+ {
293
+ list($isMap, $isArray, $innerType) = TypeCombination::extractTypeInfo($type);
294
+ if ($isMap || $isArray) {
295
+ // if it's an array or map of some type
296
+ // increment dimension and check for innerType
297
+ return $this->getArrayTypeAndDimensions($innerType, ++$dimensions);
298
+ }
299
+ return array($type, $dimensions);
300
+ }
301
+
302
+ /**
303
+ * Try calling the factory method if exists, otherwise throw JsonMapperException
304
+ *
305
+ * @param string $factoryMethod factory method in the format
306
+ * 'path/to/callable/function argType'
307
+ * @param mixed $value value to be passed in as param into factory
308
+ * method.
309
+ * @param string $strClassName strClassName referencing this factory method
310
+ *
311
+ * @return mixed|false
312
+ * @throws JsonMapperException
313
+ */
314
+ protected function callFactoryMethod($factoryMethod, $value, $strClassName)
315
+ {
316
+ $factoryMethod = explode(' ', $factoryMethod)[0];
317
+ if (!is_callable($factoryMethod)) {
318
+ throw JsonMapperException::unCallableFactoryMethodException(
319
+ $factoryMethod,
320
+ $strClassName
321
+ );
322
+ }
323
+
324
+ return call_user_func($factoryMethod, $value);
325
+ }
326
+
327
+ /**
328
+ * Try calling the given function with value, return [true, updatedValue]
329
+ * if call successful.
330
  *
331
+ * @param mixed $value value to be passed in argument of factory method.
332
+ * @param string $factoryMethod factory method string in the format
333
+ * 'path/to/callable/function argType'.
 
 
334
  *
335
+ * @return array Return an array [bool $success, $value] and value will be the
336
+ * failure cause if not success.
337
+ */
338
+ protected function callFactoryWithErrorHandling($value, $factoryMethod)
339
+ {
340
+ $success = true;
341
+ if (version_compare(phpversion(), '7.0', '<')) {
342
+ try {
343
+ $value = $this->callFactoryMethod($factoryMethod, $value, '');
344
+ } catch (Exception $e) {
345
+ // In Php versions < 7.0 catching only exceptions but not typeErrors
346
+ // since strict types were not available for php < 7.0
347
+ // also we can't use throwable since its only available after php 7.0
348
+ $success = false;
349
+ $value = $e->getMessage();
350
+ }
351
+ } else {
352
+ try {
353
+ $value = $this->callFactoryMethod($factoryMethod, $value, '');
354
+ } catch (\Throwable $e) {
355
+ // In Php versions >= 7.0 catching exceptions including typeErrors
356
+ // using Throwable since its base interface for Exceptions & Errors
357
+ // since types can be strict for php >= 7.0
358
+ $success = false;
359
+ $value = $e->getMessage();
360
+ }
361
+ }
362
+ return [$success, $value];
363
+ }
364
+
365
+ /**
366
+ * Get mapped value for a property in an object.
367
+ *
368
+ * @param mixed $jvalue Raw normalized data for the property
369
+ * @param string $type Type found by inspectProperty()
370
+ * @param string|null $mapsBy OneOf/AnyOf types hint found by
371
+ * inspectProperty in mapsBy annotation
372
+ * @param string[]|null $factoryMethods Callable factory methods for property
373
+ * @param string $namespace Namespace of the class
374
+ * @param string $className Name of the class
375
+ * @param bool $strict True if looking to map with strict type
376
+ * checking.
377
+ *
378
+ * @return array|false|mixed|object|null
379
+ * @throws JsonMapperException|ReflectionException
380
  */
381
  protected function getMappedValue(
382
  $jvalue,
383
  $type,
384
+ $mapsBy,
385
+ $factoryMethods,
386
  $namespace,
387
+ $className,
388
+ $strict
389
  ) {
390
+ if ($mapsBy) {
391
+ return $this->mapFor(
392
+ $jvalue,
393
+ $mapsBy,
394
+ $namespace,
395
+ $factoryMethods,
396
+ $className
397
+ );
398
+ }
399
  //use factory method generated value if factory provided
400
+ if ($factoryMethods !== null && isset($factoryMethods[0])) {
401
+ return $this->callFactoryMethod(
402
+ $factoryMethods[0],
403
+ $jvalue,
404
+ $className
405
+ );
 
 
 
406
  }
407
 
408
  if ($this->isNullable($type)) {
418
  } else if ($this->isObjectOfSameType($type, $jvalue)) {
419
  return $jvalue;
420
  } else if ($this->isSimpleType($type)) {
421
+ if ($strict && !$this->isValueOfType($jvalue, $type)[0]) {
422
+ // if mapping strictly for multipleTypes
423
+ throw JsonMapperException::unableToSetTypeException(
424
+ $type,
425
+ json_encode($jvalue)
426
+ );
427
+ }
428
  settype($jvalue, $type);
429
  return $jvalue;
430
  }
431
 
432
  $array = null;
433
+ list($subtype, $dimension) = $this->getArrayTypeAndDimensions($type);
434
+ if ($dimension > 0) {
435
+ // array with some dimensions
436
  $array = array();
 
437
  } else if (substr($type, -1) == ']') {
438
  list($proptype, $subtype) = explode('[', substr($type, 0, -1));
439
  if (!$this->isSimpleType($proptype)) {
443
  } else if ($type == 'ArrayObject'
444
  || is_subclass_of($type, 'ArrayObject')
445
  ) {
446
+ $subtype = null;
447
  $array = $this->createInstance($type);
448
  }
449
 
457
  $this->getFullNamespace($subtype, $namespace)
458
  )
459
  ) {
460
+ $child = $this->mapClassArray(
461
+ $jvalue,
462
+ $subtype,
463
+ $dimension,
464
+ $strict
465
+ );
466
  } else {
467
+ $child = $this->mapArray(
468
+ $jvalue,
469
+ $array,
470
+ $subtype,
471
+ $dimension,
472
+ $strict
473
+ );
474
  }
475
  } else if ($this->isFlatType(gettype($jvalue))) {
476
  //use constructor parameter if we have a class
483
  }
484
  } else {
485
  $type = $this->getFullNamespace($type, $namespace);
486
+ $child = $this->mapClass($jvalue, $type, $strict);
487
  }
488
 
489
  return $child;
490
  }
491
 
492
+ /**
493
+ * Check if an array is Associative (has string keys) or
494
+ * its Indexed (empty or non-string keys), returns [isAssociative, isIndexed]
495
+ *
496
+ * @param mixed $value A value that could be isAssociative or isIndexed array
497
+ *
498
+ * @return array Returns Array of result i.e [isAssociative, isIndexed]
499
+ */
500
+ protected function isAssociativeOrIndexed($value)
501
+ {
502
+ if (is_object($value)) {
503
+ return [true, false];
504
+ }
505
+ if (!is_array($value)) {
506
+ return [false, false];
507
+ }
508
+ foreach ($value as $key => $v) {
509
+ if (is_string($key)) {
510
+ return [true, false];
511
+ }
512
+ }
513
+ return [false, true];
514
+ }
515
+
516
+ /**
517
+ * Gets not nested type for the given value
518
+ *
519
+ * @param mixed $value Value to be checked for type
520
+ *
521
+ * @return string|false Return flat PHP types for the given value
522
+ * and if not flat type return false.
523
+ */
524
+ protected function getFlatType($value)
525
+ {
526
+ $type = gettype($value);
527
+ if (!$this->isFlatType($type)) {
528
+ return false;
529
+ }
530
+ switch ($type) {
531
+ case 'integer':
532
+ $type = 'int';
533
+ break;
534
+ case 'double':
535
+ $type = 'float';
536
+ break;
537
+ case 'boolean':
538
+ $type = 'bool';
539
+ break;
540
+ case 'NULL':
541
+ $type = 'null';
542
+ break;
543
+ }
544
+ return $type;
545
+ }
546
+
547
+ /**
548
+ * Check all given factory methods that can be called with given value.
549
+ *
550
+ * @param mixed $value Any value to be checked with factoryMethods.
551
+ * @param mixed $newVal A copy of value to be updated.
552
+ * @param string $type Extracted type of the value.
553
+ * @param string[] $factoryMethods Methods in the format 'path/to/method argType'
554
+ * which will be converting $value into any
555
+ * desirable type.
556
+ *
557
+ * @return string Returns the type or typeGroup of value based on
558
+ * given factory methods.
559
+ * @throws JsonMapperException
560
+ */
561
+ protected function applyFactoryMethods($value, &$newVal, $type, $factoryMethods)
562
+ {
563
+ $errorMsg = [];
564
+ $types = [$type]; // list of possible types
565
+ foreach ($factoryMethods as $m) {
566
+ // checking each provided factory method
567
+ $method = explode(' ', $m);
568
+ // try calling factory method
569
+ list($success, $val) = $this->callFactoryWithErrorHandling($value, $m);
570
+ if ($success) {
571
+ if ($type == $method[1]) {
572
+ // if method call is successful
573
+ // and given type equals to argType of factory method
574
+ // update the value with returned $val of factory method
575
+ // and return with type early
576
+ $newVal = $val;
577
+ return $type;
578
+ }
579
+ // if method call is successful
580
+ // and given type is not same as argType of factory method
581
+ // then add argType in list of possible types for $value
582
+ array_push($types, $method[1]);
583
+ } elseif ($type == $method[1]) {
584
+ // if method call is failure given type equals to argType of
585
+ // factory method then add reason $val as an error message
586
+ array_push($errorMsg, "$method[0]: $val");
587
+ }
588
+ }
589
+ if (!empty($errorMsg)) {
590
+ // if any error msg is added then throw exception
591
+ throw JsonMapperException::invalidArgumentFactoryMethodException(
592
+ $type,
593
+ join("\n", $errorMsg)
594
+ );
595
+ }
596
+ // converting possible types array into the string format
597
+ // of an anyof typeGroup
598
+ $types = array_unique($types);
599
+ asort($types);
600
+ $type = join(',', $types);
601
+ if (count($types) > 1) {
602
+ // wrap in brackets for multiple types
603
+ $type = "($type)";
604
+ }
605
+ return $type;
606
+ }
607
+
608
+ /**
609
+ * Extract type from any given value.
610
+ *
611
+ * @param mixed $value Any value to be checked for type, should be
612
+ * an array if checking for inner type
613
+ * @param string[] $factory Methods in the format 'path/to/method argType'
614
+ * which will be converting $value into any
615
+ * desirable type, Default: []
616
+ * @param string $start string to be appended at the start of the
617
+ * extracted type, Default: ''
618
+ * @param string $end string to be appended at the end of the
619
+ * extracted type, Default: ''
620
+ *
621
+ * @return string Returns the type that could be mapped on the given value.
622
+ * @throws JsonMapperException
623
+ */
624
+ protected function getType(&$value, $factory = [], $start = '', $end = '')
625
+ {
626
+ $type = $this->getFlatType($value);
627
+ $newVal = $value;
628
+ if (!$type && is_array($value)) {
629
+ if ($this->isAssociativeOrIndexed($value)[0]) {
630
+ // if value is associative array
631
+ $start .= 'array<string,';
632
+ $end = '>' . $end;
633
+ } else {
634
+ // if value is indexed array
635
+ if (empty($value)) {
636
+ return 'array';
637
+ }
638
+ $end = '[]' . $end;
639
+ }
640
+ $types = [];
641
+ foreach ($value as $k => $v) {
642
+ array_push($types, $this->getType($v, $factory));
643
+ $newVal[$k] = $v;
644
+ }
645
+ $types = array_unique($types);
646
+ asort($types);
647
+ $isOneOfOrAnyOf = !empty($types) && substr($types[0], -1) === ')';
648
+ if (count($types) > 1 || $isOneOfOrAnyOf) {
649
+ // wrap in brackets for multiple types or oneof/anyof type
650
+ $start .= '(';
651
+ $end = ')' . $end;
652
+ }
653
+ $type = join(',', $types);
654
+ } elseif (!$type && is_object($value)) {
655
+ $class = get_class($value); // returns full path of class
656
+ $slashPos = strrpos($class, '\\');
657
+ if (!$slashPos) {
658
+ // if slash not found then replace with -1
659
+ $slashPos = -1;
660
+ }
661
+ $type = substr($class, ++$slashPos);
662
+ }
663
+ $type = "$start$type$end";
664
+ if (!empty($factory)) {
665
+ $type = $this->applyFactoryMethods($value, $newVal, $type, $factory);
666
+ }
667
+ $value = $newVal;
668
+ return $type;
669
+ }
670
+
671
+ /**
672
+ * Check the given type/types in the provided typeGroup, return true if
673
+ * type(s) exists in the typeGroup
674
+ *
675
+ * @param TypeCombination|string $typeGroup TypesCombination object or string
676
+ * format for grouped types. All kind
677
+ * of groups are allowed here.
678
+ * @param TypeCombination|string $type Can be a normal type like string[],
679
+ * int, Car, etc. or a combination of
680
+ * types like (CarA,CarB)[], (int,Enum),
681
+ * or array<string,(CarA,CarB)>.
682
+ * @param string $start prefix used by string $type,
683
+ * Default: ""
684
+ * @param string $end postfix used by string $type,
685
+ * Default: ""
686
+ *
687
+ * @return bool
688
+ */
689
+ protected function checkForType($typeGroup, $type, $start = '', $end = '')
690
+ {
691
+ if (is_string($typeGroup)) {
692
+ // convert into TypeCombination object
693
+ $typeGroup = TypeCombination::withFormat($typeGroup);
694
+ }
695
+ if (is_string($type) && strpos($type, '(') !== false) {
696
+ // for combination of types like: (A,B)[] or array<string,(A,(B,C)[])>
697
+ // convert into TypeCombination object
698
+ $type = TypeCombination::withFormat($type);
699
+ }
700
+ $checkAllInner = false; // required when $type instance of TypeCombination.
701
+ if (is_string($type)) {
702
+ // for checking simple types like: string, int[] or Car[]
703
+ if ($typeGroup->getGroupName() == 'map') {
704
+ $start .= 'array<string,';
705
+ $end = '>' . $end;
706
+ } elseif ($typeGroup->getGroupName() == 'array') {
707
+ $end = '[]' . $end;
708
+ }
709
+ foreach ($typeGroup->getTypes() as $t) {
710
+ if (is_string($t)) {
711
+ $matched = $type === "$start$t$end";
712
+ } else {
713
+ $matched = $this->checkForType($t, $type, $start, $end);
714
+ }
715
+ if ($matched) {
716
+ // if any type in the typeGroup matched with given type,
717
+ // then early return true
718
+ return true;
719
+ }
720
+ }
721
+ return false;
722
+ } elseif (in_array($type->getGroupName(), ['array','map'])) {
723
+ // To handle type if its array/map group of types
724
+ // extract all internal groups from the given typeGroup that
725
+ // are similar to $type
726
+ $typeGroup = TypeCombination::with($typeGroup->extractSimilar($type));
727
+ // update type to the innermost level of oneof/anyof
728
+ $type = $type->extractOneOfAnyOfGroup();
729
+ // check all inner elements of $type
730
+ $checkAllInner = true;
731
+ }
732
+ // To handle type if its oneof/anyof group of types
733
+ foreach ($type->getTypes() as $t) {
734
+ $contains = $this->checkForType($typeGroup, $t);
735
+ if (!$checkAllInner && $contains) {
736
+ // if any type is found then
737
+ // type is matched with $typeGroup
738
+ return true;
739
+ }
740
+ if ($checkAllInner && !$contains) {
741
+ // if any type is missing then
742
+ // type is not matched with $typeGroup
743
+ return false;
744
+ }
745
+ }
746
+ return $checkAllInner;
747
+ }
748
+
749
+ /**
750
+ * Converts the given typeCombination into its string format.
751
+ *
752
+ * @param TypeCombination|string $type Combined type/Single type.
753
+ *
754
+ * @return string
755
+ */
756
+ protected function formatType($type)
757
+ {
758
+ return is_string($type) ? $type : $type->getFormat();
759
+ }
760
+
761
+ /**
762
+ * Checks if type of the given value is present in the type group,
763
+ * also updates the value when necessary.
764
+ *
765
+ * @param string $typeGroup String format for grouped types, i.e.
766
+ * oneof(Car,Atom)
767
+ * @param mixed $value Any value to be checked in type group
768
+ * @param array $factoryMethods Callable factory methods for the value, that
769
+ * are required to serialize it into any of the
770
+ * provided types in typeGroup in the format:
771
+ * 'path/to/method argType', Default: []
772
+ *
773
+ * @return mixed Returns the same value or updated one if any factory method
774
+ * is applied
775
+ * @throws JsonMapperException Throws exception if a factory method is provided
776
+ * but applicable on value, or also throws an
777
+ * exception if type of value didn't match with type
778
+ * group
779
+ */
780
+ public function checkTypeGroupFor($typeGroup, $value, $factoryMethods = [])
781
+ {
782
+ $type = self::getType($value, $factoryMethods);
783
+ if ($this->checkForType($typeGroup, $type)) {
784
+ return $value;
785
+ }
786
+ throw JsonMapperException::unableToMapException('Type', $type, $typeGroup);
787
+ }
788
+
789
+ /**
790
+ * Map the data in $value by the provided $typeGroup i.e. oneOf(A,B)
791
+ * will try to map value with only one of A or B, that matched. While
792
+ * anyOf(A,B) will try to map it with any of A or B and sets its type to
793
+ * the first one that matched.
794
+ *
795
+ * @param mixed $value Raw normalized value to be
796
+ * mapped with any typeGroup
797
+ * @param string|TypeCombination $typeGroup TypesCombination object or
798
+ * string format for grouped types
799
+ * @param string $namespace Namespace of any customType
800
+ * class that's present in the
801
+ * provided typeGroup.
802
+ * @param string[]|null $factoryMethods Callable factory methods for
803
+ * the value, that are required
804
+ * to deserialize it into any of
805
+ * the provided types in typeGroup
806
+ * like ['path/to/method argType']
807
+ * @param string|null $className Name of the parent class that's
808
+ * holding this property (if any)
809
+ *
810
+ * @return array|mixed|object
811
+ * @throws JsonMapperException|ReflectionException
812
+ */
813
+ public function mapFor(
814
+ $value,
815
+ $typeGroup,
816
+ $namespace = '',
817
+ $factoryMethods = null,
818
+ $className = null
819
+ ) {
820
+ if (is_string($typeGroup)) {
821
+ // convert into TypeCombination object
822
+ $typeGroup = TypeCombination::withFormat(
823
+ $typeGroup,
824
+ isset($factoryMethods) ? $factoryMethods : []
825
+ );
826
+ }
827
+ $isArrayGroup = $typeGroup->getGroupName() == 'array';
828
+ $isMapGroup = $typeGroup->getGroupName() == 'map';
829
+ if ($isArrayGroup || $isMapGroup) {
830
+ list($isAssociative, $isIndexed) = $this->isAssociativeOrIndexed($value);
831
+ if (($isMapGroup && !$isAssociative) || ($isArrayGroup && !$isIndexed)) {
832
+ // Throw exception:
833
+ // IF value is not associative array with groupType == map
834
+ // Or value is not indexed array with groupType == array
835
+ $typeName = $isMapGroup ? 'Associative Array' : 'Array';
836
+ throw JsonMapperException::unableToMapException(
837
+ $typeName,
838
+ $this->formatType($typeGroup),
839
+ json_encode($value)
840
+ );
841
+ }
842
+ $mappedObject = [];
843
+ foreach ($value as $k => $v) {
844
+ $mappedObject[$k] = $this->mapFor(
845
+ $v,
846
+ $typeGroup->getTypes()[0],
847
+ $namespace,
848
+ null,
849
+ $className
850
+ );
851
+ }
852
+ return $mappedObject;
853
+ }
854
+ return $this->checkMappingsFor(
855
+ $typeGroup,
856
+ $value,
857
+ $className,
858
+ $namespace,
859
+ function ($type, $value, $factoryMethods, $nspace, $className) {
860
+ if (is_string($type)) {
861
+ return $this->getMappedValue(
862
+ $value,
863
+ $type,
864
+ null,
865
+ $factoryMethods,
866
+ $nspace,
867
+ $className,
868
+ true
869
+ );
870
+ }
871
+ return $this->mapFor(
872
+ $value,
873
+ $type,
874
+ $nspace,
875
+ null,
876
+ $className
877
+ );
878
+ }
879
+ );
880
+ }
881
+
882
+ /**
883
+ * Checks mappings for all types with mappedObject, provided by
884
+ * mappedObjectCallback.
885
+ *
886
+ * @param TypeCombination $type TypesCombination object or string
887
+ * format for grouped types
888
+ * @param mixed $json Json value to check for mappings of
889
+ * each of the types.
890
+ * @param string|null $className Name of the class
891
+ * @param string $namespace Namespace of the class
892
+ * @param callable $mappedObjCallback Callback function to be called with
893
+ * each type in provided types, this
894
+ * function must return the mapped
895
+ * Object, for which the mapping will
896
+ * be checked, and to ignore any type,
897
+ * it can throw JsonMapperException
898
+ *
899
+ * @return false|mixed|null Returns the final mapped object after checking
900
+ * for oneOf and anyOf cases
901
+ * @throws JsonMapperException|ReflectionException
902
+ */
903
+ protected function checkMappingsFor(
904
+ $type,
905
+ $json,
906
+ $className,
907
+ $namespace,
908
+ $mappedObjCallback
909
+ ) {
910
+ $mappedObject = null;
911
+ $mappedWith = '';
912
+ $deserializers = $type->getDeserializers();
913
+ $selectedDeserializer = null;
914
+ // check json value for each type in types array
915
+ foreach ($type->getTypes() as $typ) {
916
+ try {
917
+ if (is_string($typ)) {
918
+ list($m, $meth) = $this->isValueOfType(
919
+ $json,
920
+ $typ,
921
+ $namespace,
922
+ $deserializers
923
+ );
924
+ if (!$m) {
925
+ // skip this type as it can't be mapped on the given value.
926
+ continue;
927
+ }
928
+ $selectedDeserializer = isset($meth) ? [$meth] : null;
929
+ }
930
+ $mappedObject = call_user_func(
931
+ $mappedObjCallback,
932
+ $typ,
933
+ $json,
934
+ $selectedDeserializer,
935
+ $namespace,
936
+ $className
937
+ );
938
+ } catch (Exception $e) {
939
+ continue; // ignore the type if it can't be mapped for given value
940
+ }
941
+ $matchedType = $typ;
942
+ if ($type->getGroupName() == 'oneOf' && $mappedWith) {
943
+ // if its oneOf and we have a value that is already mapped,
944
+ // then throw jsonMapperException
945
+ throw JsonMapperException::moreThanOneOfException(
946
+ $this->formatType($matchedType),
947
+ $this->formatType($mappedWith),
948
+ json_encode($json)
949
+ );
950
+ }
951
+ $mappedWith = $matchedType;
952
+ if ($type->getGroupName() == 'anyOf') {
953
+ break; // break if its anyOf, and we already have mapped its value
954
+ }
955
+ }
956
+
957
+ if (!$mappedWith) {
958
+ throw JsonMapperException::cannotMapAnyOfException(
959
+ $this->formatType($type),
960
+ json_encode($json)
961
+ );
962
+ }
963
+
964
+ return $mappedObject;
965
+ }
966
+
967
+ /**
968
+ * Checks types against the value.
969
+ *
970
+ * @param mixed $value param's value
971
+ * @param string $type type defined in param's typehint
972
+ * @param string $namespace Namespace of the class, Default: ''
973
+ * @param string[] $deserializers deserializer functions array in the format
974
+ * ["pathToCallableFunction typeOfValue", ...]
975
+ * Default: []
976
+ *
977
+ * @return array array(bool $matched, ?string $method) $matched represents if
978
+ * Type matched with value, $method represents the selected
979
+ * factory method (if any)
980
+ * @throws ReflectionException
981
+ * @throws JsonMapperException
982
+ */
983
+ protected function isValueOfType(
984
+ $value,
985
+ $type,
986
+ $namespace = '',
987
+ $deserializers = []
988
+ ) {
989
+ if (!empty($deserializers)) {
990
+ $methodFound = false;
991
+ foreach ($deserializers as $method) {
992
+ if (isset($method) && explode(' ', $method)[1] == $type) {
993
+ $methodFound = true;
994
+ if ($this->callFactoryWithErrorHandling($value, $method)[0]) {
995
+ return array(true, $method);
996
+ }
997
+ }
998
+ }
999
+ if ($methodFound) {
1000
+ // if method was found but couldn't deserialize value
1001
+ return array(false, null);
1002
+ }
1003
+ }
1004
+ list($isMap, $isArray, $innerType) = TypeCombination::extractTypeInfo($type);
1005
+ if ($isMap || $isArray) {
1006
+ // if type is array like int[] or map like array<string,int>
1007
+ list($isAssociative, $isIndexed) = $this->isAssociativeOrIndexed($value);
1008
+ if (($isMap && $isAssociative) || ($isArray && $isIndexed)) {
1009
+ // Value must be associativeArray/object for MapType
1010
+ // Or it must be indexed array for ArrayType
1011
+ foreach ($value as $v) {
1012
+ if (!$this->isValueOfType($v, $innerType, $namespace)[0]) {
1013
+ // false if any element is not of same type
1014
+ return array(false, null);
1015
+ }
1016
+ }
1017
+ // true only if all elements in the array/map are of same type
1018
+ return array(true, null);
1019
+ }
1020
+ return array(false, null); // false if type is array/map but value is not
1021
+ }
1022
+ // Check for simple types
1023
+ $matched = $type == 'mixed'
1024
+ || ($type == 'string' && is_string($value))
1025
+ || ($type == 'bool' && is_bool($value))
1026
+ || ($type == 'int' && is_int($value))
1027
+ || ($type == 'float' && is_float($value))
1028
+ || ($type == 'array' && (is_array($value) || is_object($value)))
1029
+ || ($type == 'null' && is_null($value));
1030
+
1031
+ // Check for complex types if not matched with simple types
1032
+ if (!$matched && $type != 'null' && !$this->isSimpleType($type)
1033
+ && is_object($value)
1034
+ ) {
1035
+ $matched = true;
1036
+ $rc = new ReflectionClass($this->getFullNamespace($type, $namespace));
1037
+ $discriminator = $this->getDiscriminator($rc);
1038
+ if ($discriminator) {
1039
+ list($key, $val) = $discriminator;
1040
+ if (!isset($value->{$key}) || $value->{$key} !== $val) {
1041
+ // check if discriminator didn't match in its key, or value
1042
+ $matched = false;
1043
+ }
1044
+ } // keep ($matched: true) if there is no discriminator
1045
+ }
1046
+ return array($matched, null);
1047
+ }
1048
+
1049
  /**
1050
  * Map all data in $json into a new instance of $type class.
1051
  *
1052
+ * @param object|null $json JSON object structure from json_decode()
1053
+ * @param string $type The type of class instance to map into.
1054
+ * @param bool $strict True if looking to map with strict type checking,
1055
+ * Default: false
1056
  *
1057
+ * @return object|null Mapped object is returned.
1058
+ * @throws ReflectionException|JsonMapperException
1059
  * @see mapClassArray()
1060
  */
1061
+ public function mapClass($json, $type, $strict = false)
1062
  {
1063
  if ($json === null) {
1064
  return null;
1080
  );
1081
  }
1082
 
1083
+ $rc = new ReflectionClass($ttype);
 
1084
  //try and find a class with matching discriminator
1085
  $matchedRc = $this->getDiscriminatorMatch($json, $rc);
 
1086
  //otherwise fallback to an instance of $type class
1087
  if ($matchedRc === null) {
1088
+ $instance = $this->createInstance($ttype, $json, $strict);
1089
  } else {
1090
+ $instance = $this->createInstance(
1091
+ $matchedRc->getName(),
1092
+ $json,
1093
+ $strict
1094
+ );
1095
  }
1096
 
1097
+
1098
+ return $this->map($json, $instance, $strict);
1099
  }
1100
 
1101
  /**
1102
  * Get class instance that best matches the class
1103
  *
1104
+ * @param object|null $json JSON object structure from json_decode()
1105
+ * @param ReflectionClass $rc Class to get instance of. This method
1106
+ * will try to first match the
1107
+ * discriminator field with the
1108
+ * discriminator value of the current
1109
+ * class or its child class. If no
1110
+ * matches is found, then the current
1111
+ * class's instance is returned.
1112
+ *
1113
+ * @return ReflectionClass|null Object instance if match is found.
1114
+ * @throws ReflectionException
1115
  */
1116
  protected function getDiscriminatorMatch($json, $rc)
1117
  {
1130
  return $childRc;
1131
  }
1132
  }
 
 
1133
  }
1134
+ return null;
1135
  }
1136
 
1137
  /**
1138
  * Get discriminator info
1139
  *
1140
+ * @param ReflectionClass $rc ReflectionClass of class to inspect
1141
  *
1142
  * @return array|null An array with discriminator arguments
1143
  * Element 1 is discriminator field name
1162
  /**
1163
  * Get child classes from a ReflectionClass
1164
  *
1165
+ * @param ReflectionClass $rc ReflectionClass of class to inspect
1166
  *
1167
+ * @return ReflectionClass[] ReflectionClass instances for child classes
1168
+ * @throws ReflectionException
1169
  */
1170
  protected function getChildClasses($rc)
1171
  {
1172
  $children = array();
1173
  foreach ($this->arChildClasses[$rc->name] as $class) {
1174
+ $child = new ReflectionClass($class);
1175
  if ($child->isSubclassOf($rc)) {
1176
  $children[] = $child;
1177
  }
1201
  /**
1202
  * Check required properties exist in json
1203
  *
1204
+ * @param array $providedProperties array with json properties
1205
+ * @param ReflectionClass $rc Reflection class to check
 
 
1206
  *
1207
  * @return void
1208
+ * @throws JsonMapperException
1209
  */
1210
+ protected function checkMissingData($providedProperties, ReflectionClass $rc)
1211
  {
1212
  foreach ($rc->getProperties() as $property) {
1213
  $rprop = $rc->getProperty($property->name);
1216
  if (isset($annotations['required'])
1217
  && !isset($providedProperties[$property->name])
1218
  ) {
1219
+ throw JsonMapperException::requiredPropertyMissingException(
1220
+ $property->name,
1221
+ $rc->getName()
 
1222
  );
1223
  }
1224
  }
1227
  /**
1228
  * Get additional properties setter method for the class.
1229
  *
1230
+ * @param ReflectionClass $rc Reflection class to check
1231
  *
1232
+ * @return ReflectionMethod Method or null if disabled.
1233
  */
1234
+ protected function getAdditionalPropertiesMethod(ReflectionClass $rc)
1235
  {
1236
  if ($this->bExceptionOnUndefinedProperty === false
1237
  && $this->sAdditionalPropertiesCollectionMethod !== null
1267
  /**
1268
  * Map an array
1269
  *
1270
+ * @param array $jsonArray JSON array structure from json_decode()
1271
+ * @param mixed $array Array or ArrayObject that gets filled with
1272
+ * data from $json.
1273
+ * @param string|object $class Class name for children objects. All children
1274
+ * will get mapped onto this type. Supports class
1275
+ * names and simple types like "string".
1276
+ * @param int $dimension Dimension of array to map, i.e. 2 for 2D
1277
+ * array, Default: 1
1278
+ * @param bool $strict True if looking to map with strict type
1279
+ * checking, Default: false
1280
  *
1281
  * @return mixed Mapped $array is returned
1282
  */
1283
+ public function mapArray(
1284
+ $jsonArray,
1285
+ $array,
1286
+ $class = null,
1287
+ $dimension = 1,
1288
+ $strict = false
1289
+ ) {
1290
+ foreach ($jsonArray as $key => $jvalue) {
1291
  if ($class === null) {
1292
  $array[$key] = $jvalue;
1293
+ } else if ($dimension > 1) {
1294
+ $array[$key] = $this->mapArray(
1295
+ $jvalue,
1296
+ array(),
1297
+ $class,
1298
+ $dimension - 1,
1299
+ $strict
1300
+ );
1301
  } else if ($this->isFlatType(gettype($jvalue))) {
1302
+ // use constructor parameter if we have a class
1303
  // but only a flat type (i.e. string, int)
1304
  if ($jvalue === null) {
1305
  $array[$key] = null;
1306
  } else {
1307
  if ($this->isSimpleType($class)) {
1308
+ if ($strict && !$this->isValueOfType($jvalue, $class)[0]) {
1309
+ // if mapping strictly for multipleTypes
1310
+ throw JsonMapperException::unableToSetTypeException(
1311
+ $class,
1312
+ json_encode($jvalue)
1313
+ );
1314
+ }
1315
  settype($jvalue, $class);
1316
  $array[$key] = $jvalue;
1317
  } else {
1319
  }
1320
  }
1321
  } else {
1322
+ $instance = $this->createInstance(
1323
+ $class,
1324
+ $jvalue,
1325
+ $strict
1326
+ );
1327
+ $array[$key] = $this->map($jvalue, $instance, $strict);
1328
  }
1329
  }
1330
  return $array;
1335
  *
1336
  * @param array|null $jsonArray JSON array structure from json_decode()
1337
  * @param string $type Class name
1338
+ * @param int $dimension Dimension of array to map, i.e. 2 for 2D array,
1339
+ * Default: 1
1340
+ * @param bool $strict True if looking to map with strict type checking,
1341
+ * Default: false
1342
  *
1343
+ * @return array|null A new array containing object of $type
1344
  * which is mapped from $jsonArray
1345
+ * @throws ReflectionException|JsonMapperException
1346
  */
1347
+ public function mapClassArray($jsonArray, $type, $dimension = 1, $strict = false)
1348
  {
1349
  if ($jsonArray === null) {
1350
  return null;
1352
 
1353
  $array = array();
1354
  foreach ($jsonArray as $key => $jvalue) {
1355
+ if ($dimension > 1) {
1356
+ $array[$key] = $this->mapClassArray(
1357
+ $jvalue,
1358
+ $type,
1359
+ $dimension - 1,
1360
+ $strict
1361
+ );
1362
+ } else {
1363
+ $array[$key] = $this->mapClass($jvalue, $type, $strict);
1364
+ }
1365
  }
1366
 
1367
  return $array;
1371
  * Try to find out if a property exists in a given class.
1372
  * Checks property first, falls back to setter method.
1373
  *
1374
+ * @param ReflectionClass $rc Reflection class to check
1375
+ * @param string $name Property name
1376
  *
1377
  * @return array First value: if the property exists
1378
  * Second value: the accessor to use (
1380
  * Third value: type of the property
1381
  * Fourth value: factory method
1382
  */
1383
+ protected function inspectProperty(ReflectionClass $rc, $name)
1384
  {
1385
  $rmeth = null;
1386
  $annotations = [];
1387
+ $mapsBy = null;
1388
+ foreach ($rc->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
1389
  $annotations = $this->parseAnnotations($method->getDocComment());
1390
  if ($name === $this->getMapAnnotationFromParsed($annotations)) {
1391
  $rmeth = $method;
1392
+ $mapsBy = $this->getMapByAnnotationFromParsed($annotations);
1393
  break;
1394
  }
1395
  }
1404
  $annotations = $this->parseAnnotations($rmeth->getDocComment());
1405
  }
1406
  }
 
1407
  if ($rmeth !== null && $rmeth->isPublic()) {
1408
  $type = null;
1409
  $factoryMethod = null;
1419
  }
1420
 
1421
  //support "@factory method_name"
1422
+ if (isset($annotations['factory'])) {
1423
+ $factoryMethod = $annotations['factory'];
1424
  }
1425
 
1426
+ return array(true, $rmeth, $type, $factoryMethod, $mapsBy);
1427
  }
1428
 
1429
  $rprop = null;
1431
  foreach ($rc->getProperties(\ReflectionProperty::IS_PUBLIC) as $p) {
1432
  $mappedName = $this->getMapAnnotation($p);
1433
  if ($mappedName !== null && $name == $mappedName) {
1434
+ $mapsBy = $this->getMapByAnnotation($p);
1435
  $rprop = $p;
1436
  break;
1437
  }
1469
  }
1470
 
1471
  //support "@factory method_name"
1472
+ if (isset($annotations['factory'])) {
1473
+ $factoryMethod = $annotations['factory'];
1474
  }
1475
 
1476
+ return array(true, $rprop, $type, $factoryMethod, $mapsBy);
1477
  } else {
1478
  //no setter, private property
1479
+ return array(true, null, null, null, $mapsBy);
1480
  }
1481
  }
1482
 
1483
  //no setter, no property
1484
+ return array(false, null, null, null, $mapsBy);
1485
  }
1486
 
1487
  /**
1500
  if (is_callable([$param, 'hasType']) && $param->hasType()) {
1501
  $type = $param->getType();
1502
  if ($type->isBuiltIn()) {
1503
+ $typeName = $this->reflectionTypeToString($type);
1504
  } else {
1505
+ $typeName = "\\" . $this->reflectionTypeToString($type);
1506
  }
1507
  return $type->allowsNull() ? "$typeName|null" : $typeName;
1508
  }
1513
  /**
1514
  * Get name for a ReflectionType instance
1515
  *
1516
+ * @param \ReflectionType $type Reflection type instance
1517
  *
1518
  * @return string
 
 
1519
  */
1520
+ protected function reflectionTypeToString($type)
1521
  {
1522
  if (\class_exists('ReflectionNamedType')
1523
  && $type instanceof \ReflectionNamedType
1524
  ) {
1525
  return $type->getName();
1526
  } else {
1527
+ return (string)$type;
1528
  }
1529
  }
1530
 
1533
  *
1534
  * @param object $property Property of a class
1535
  *
1536
+ * @return string|null Map annotation value
1537
  */
1538
  protected function getMapAnnotation($property)
1539
  {
1540
  $annotations = $this->parseAnnotations($property->getDocComment());
1541
+ return $this->getMapAnnotationFromParsed($annotations);
 
 
 
1542
  }
1543
 
1544
  /**
1546
  *
1547
  * @param array $annotations Parsed annotation list
1548
  *
1549
+ * @return string|null Map annotation value
1550
  */
1551
  protected function getMapAnnotationFromParsed($annotations)
1552
  {
1556
  return null;
1557
  }
1558
 
1559
+ /**
1560
+ * Get mapBy annotation value for a property
1561
+ *
1562
+ * @param object $property Property of a class
1563
+ *
1564
+ * @return string|null MapBy annotation value
1565
+ */
1566
+ protected function getMapByAnnotation($property)
1567
+ {
1568
+ $annotations = $this->parseAnnotations($property->getDocComment());
1569
+ return $this->getMapByAnnotationFromParsed($annotations);
1570
+ }
1571
+
1572
+ /**
1573
+ * Get mapsBy annotation value from a parsed annotation list
1574
+ *
1575
+ * @param array $annotations Parsed annotation list
1576
+ *
1577
+ * @return string|null MapsBy annotation value
1578
+ */
1579
+ protected function getMapByAnnotationFromParsed($annotations)
1580
+ {
1581
+ if (isset($annotations['mapsBy'][0])) {
1582
+ return $annotations['mapsBy'][0];
1583
+ }
1584
+ return null;
1585
+ }
1586
+
1587
  /**
1588
  * Set a property on a given object to a given value.
1589
  *
1611
  *
1612
  * @param string $class Class name to instantiate
1613
  * @param object $jobject Use jobject for constructor args
1614
+ * @param bool $strict True if looking to map with strict type checking,
1615
+ * Default: false
1616
  *
1617
  * @return object Freshly created object
1618
+ * @throws ReflectionException|JsonMapperException
1619
  */
1620
+ protected function createInstance($class, &$jobject = null, $strict = false)
1621
  {
1622
+ $rc = new ReflectionClass($class);
1623
  $ctor = $rc->getConstructor();
1624
  if ($ctor === null
1625
  || 0 === $ctorReqParamsCount = $ctor->getNumberOfRequiredParameters()
1626
  ) {
1627
  return new $class();
1628
  } else if ($jobject === null) {
1629
+ throw JsonMapperException::noArgumentsException(
1630
+ $class,
1631
+ $ctor->getNumberOfRequiredParameters()
1632
  );
1633
  }
1634
 
1660
  = $this->inspectProperty($rc, $key);
1661
  }
1662
 
1663
+ list($hasProperty, $accessor, $type, $factoryMethod, $mapsBy)
1664
  = $this->arInspectedClasses[$class][$key];
1665
 
1666
  if (!$hasProperty) {
1700
  $jtype = $ttype;
1701
  }
1702
 
1703
+ $ctorArgs[$rp->getPosition()] = $this->getMappedValue(
1704
+ $jvalue,
1705
+ $jtype,
1706
+ $mapsBy,
1707
+ $factoryMethod,
1708
+ $rc->getNamespaceName(),
1709
+ $rc->getName(),
1710
+ $strict
1711
+ );
1712
 
1713
+ if (!$strict) {
1714
+ unset($jobject->{$key});
1715
+ }
1716
  unset($ctorRequiredParamsName[$rp->getPosition()]);
1717
  }
1718
 
1719
  if (count($ctorArgs) < $ctorReqParamsCount) {
1720
+ throw JsonMapperException::fewerArgumentsException(
1721
+ $class,
1722
+ $ctorRequiredParamsName
1723
  );
1724
  }
1725
 
1779
  /**
1780
  * Is type registered with mapper
1781
  *
1782
+ * @param string|null $type Class name
1783
  *
1784
+ * @return boolean True if registered with $this->arChildClasses
1785
  */
1786
  protected function isRegisteredType($type)
1787
  {
1788
+ if (!isset($type)) {
1789
+ return false;
1790
+ }
1791
  return isset($this->arChildClasses[ltrim($type, "\\")]);
1792
  }
1793
 
1825
  *
1826
  * @return array
1827
  */
1828
+ protected function parseAnnotations($docblock)
1829
  {
1830
  $annotations = array();
1831
  // Strip away the docblock header and footer
vendor/apimatic/jsonmapper/src/JsonMapperException.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Part of JsonMapper
4
  *
@@ -13,6 +14,8 @@
13
 
14
  namespace apimatic\jsonmapper;
15
 
 
 
16
  /**
17
  * Simple exception
18
  *
@@ -22,7 +25,193 @@ namespace apimatic\jsonmapper;
22
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
23
  * @link http://www.netresearch.de/
24
  */
25
- class JsonMapperException extends \Exception
26
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
- ?>
1
  <?php
2
+
3
  /**
4
  * Part of JsonMapper
5
  *
14
 
15
  namespace apimatic\jsonmapper;
16
 
17
+ use Exception;
18
+
19
  /**
20
  * Simple exception
21
  *
25
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
26
  * @link http://www.netresearch.de/
27
  */
28
+ class JsonMapperException extends Exception
29
  {
30
+ /**
31
+ * Exception for discarded comments setting in configuration.
32
+ *
33
+ * @param array $concernedKeys Keys (PHP directives) with issues.
34
+ *
35
+ * @return JsonMapperException
36
+ */
37
+ static function commentsDisabledInConfigurationException($concernedKeys)
38
+ {
39
+ return new self(
40
+ "Comments cannot be discarded in the configuration file i.e." .
41
+ " the php.ini file; doc comments are a requirement for JsonMapper." .
42
+ " Following configuration keys must have a value set to \"1\": " .
43
+ implode(", ", $concernedKeys) . "."
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Exception for non-existent key in an object.
49
+ *
50
+ * @param string $key The missing key/property.
51
+ * @param string $class The class in which the key is missing.
52
+ * @param bool $setterException Raise an exception specific to
53
+ * missing a setter within the class for
54
+ * the specified string.
55
+ *
56
+ * @return JsonMapperException
57
+ */
58
+ static function undefinedPropertyException(
59
+ $key,
60
+ $class,
61
+ $setterException = false
62
+ ) {
63
+ $err = $setterException ? 'has no public setter method' : 'does not exist';
64
+ return new self("JSON property '$key' $err in object of type '$class'");
65
+ }
66
+
67
+ /**
68
+ * Exception for non-existent key in an object.
69
+ *
70
+ * @param string $key The property missing type.
71
+ * @param string $strClassName The class in which the property is missing type.
72
+ *
73
+ * @return JsonMapperException
74
+ */
75
+ static function missingTypePropertyException($key, $strClassName)
76
+ {
77
+ return new self("Empty type at property '$strClassName::$$key'");
78
+ }
79
+
80
+ /**
81
+ * Exception for an unCallable Factory Method.
82
+ *
83
+ * @param string $factoryMethod The concerned factory method.
84
+ * @param string $strClassName Related class name.
85
+ *
86
+ * @return JsonMapperException
87
+ */
88
+ static function unCallableFactoryMethodException($factoryMethod, $strClassName)
89
+ {
90
+ return new self(
91
+ "Factory method '$factoryMethod' referenced by " .
92
+ "'$strClassName' is not callable."
93
+ );
94
+ }
95
+
96
+ /**
97
+ * Exception for not able to call factory method with the given value.
98
+ *
99
+ * @param string $argType Type of the argument passed in method.
100
+ * @param string $reasons Exception message received from factory method.
101
+ *
102
+ * @return JsonMapperException
103
+ */
104
+ static function invalidArgumentFactoryMethodException($argType, $reasons)
105
+ {
106
+ return new self(
107
+ "Provided factory methods are not callable with " .
108
+ "the value of Type: $argType\n$reasons"
109
+ );
110
+ }
111
+
112
+ /**
113
+ * Exception when it is not possible to map an object to a specific type.
114
+ *
115
+ * @param string $typeName Name of type to map json object on.
116
+ * @param string $typeGroup Group name of the type provided.
117
+ * @param string $value Value that should be mapped by typeGroup
118
+ * i.e. JSON string.
119
+ *
120
+ * @return JsonMapperException
121
+ */
122
+ static function unableToMapException($typeName, $typeGroup, $value)
123
+ {
124
+ return new self("Unable to map $typeName: $typeGroup on: $value");
125
+ }
126
+
127
+ /**
128
+ * Exception raised when a json object maps to more
129
+ * than one type within the types specified within OneOf.
130
+ *
131
+ * @param string $matchedType First type.
132
+ * @param string $mappedWith Second type.
133
+ * @param string $json JSON string.
134
+ *
135
+ * @return JsonMapperException
136
+ */
137
+ static function moreThanOneOfException($matchedType, $mappedWith, $json)
138
+ {
139
+ return new self(
140
+ "Cannot map more than OneOf { $matchedType and $mappedWith } on: $json"
141
+ );
142
+ }
143
+
144
+ /**
145
+ * JSON does not match any of the types provided.
146
+ *
147
+ * @param string $type The type JSON could not be mapped to.
148
+ * @param string $json JSON string.
149
+ *
150
+ * @return JsonMapperException
151
+ */
152
+ static function cannotMapAnyOfException($type, $json)
153
+ {
154
+ return new self("Unable to map AnyOf $type on: $json");
155
+ }
156
+
157
+ /**
158
+ * A property marked as required was missing in the object provided.
159
+ *
160
+ * @param string $propertyName Concerned property's name.
161
+ * @param string $className The class name in which the property wasn't found.
162
+ *
163
+ * @return JsonMapperException
164
+ */
165
+ static function requiredPropertyMissingException($propertyName, $className)
166
+ {
167
+ return new self(
168
+ "Required property '$propertyName' of class " .
169
+ "'$className' is missing in JSON data"
170
+ );
171
+ }
172
+
173
+ /**
174
+ * No required arguments were provided.
175
+ *
176
+ * @param string $class The concerned class name.
177
+ * @param int $ctorReqParamNumber The number of req params in constructor.
178
+ *
179
+ * @return JsonMapperException
180
+ */
181
+ static function noArgumentsException($class, $ctorReqParamNumber)
182
+ {
183
+ return new self(
184
+ "$class class requires $ctorReqParamNumber "
185
+ . "arguments in constructor but none provided"
186
+ );
187
+ }
188
+
189
+ /**
190
+ * Provided arguments were less than required.
191
+ *
192
+ * @param string $class The concerned class name.
193
+ * @param array $ctorRequiredParamsName Required parameters array.
194
+ *
195
+ * @return JsonMapperException
196
+ */
197
+ static function fewerArgumentsException($class, $ctorRequiredParamsName)
198
+ {
199
+ return new self(
200
+ "Could not find required constructor arguments for $class: "
201
+ . implode(", ", $ctorRequiredParamsName)
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Provided type was not applicable on the given value.
207
+ *
208
+ * @param string $type The type value could not be mapped to.
209
+ * @param string $value Concerned value.
210
+ *
211
+ * @return JsonMapperException
212
+ */
213
+ static function unableToSetTypeException($type, $value)
214
+ {
215
+ return new self("Could not set type '$type' on value: $value");
216
+ }
217
  }
 
vendor/apimatic/jsonmapper/src/TypeCombination.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of JsonMapper
4
+ *
5
+ * PHP version 5
6
+ *
7
+ * @category Apimatic
8
+ * @package JsonMapper
9
+ * @author Asad Ali <asad.ali@apimatic.io>
10
+ * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
11
+ * @link https://www.apimatic.io/
12
+ */
13
+ namespace apimatic\jsonmapper;
14
+
15
+ /**
16
+ * Data class to hold the groups of multiple types.
17
+ *
18
+ * @category Apimatic
19
+ * @package JsonMapper
20
+ * @author Asad Ali <asad.ali@apimatic.io>
21
+ * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
22
+ * @link https://www.apimatic.io/
23
+ */
24
+ class TypeCombination
25
+ {
26
+ /**
27
+ * String format of this typeCombinator group.
28
+ *
29
+ * @var string
30
+ */
31
+ private $_format;
32
+
33
+ /**
34
+ * Name of this typeCombinator group i.e. oneOf/anyOf.
35
+ *
36
+ * @var string
37
+ */
38
+ private $_groupName;
39
+
40
+ /**
41
+ * Array of string types or TypeCombination objects
42
+ *
43
+ * @var array
44
+ */
45
+ private $_types;
46
+
47
+ /**
48
+ * A list of factory methods to deserialize the given object,
49
+ * for one of the wrapped types in this group
50
+ *
51
+ * @var string[]
52
+ */
53
+ private $_deserializers;
54
+
55
+ /**
56
+ * Private constructor for TypeCombination class
57
+ *
58
+ * @param string $format string format value
59
+ * @param string $groupName group name value
60
+ * @param array $types types value
61
+ * @param string[] $deserializers deserializers value
62
+ */
63
+ private function __construct($format, $groupName, $types, $deserializers)
64
+ {
65
+ $this->_format = $format;
66
+ $this->_groupName = $groupName;
67
+ $this->_types = $types;
68
+ $this->_deserializers = $deserializers;
69
+ }
70
+
71
+ /**
72
+ * String format of this typeCombinator group.
73
+ *
74
+ * @return string
75
+ */
76
+ public function getFormat()
77
+ {
78
+ return $this->_format;
79
+ }
80
+
81
+ /**
82
+ * Name of this typeCombinator group i.e. oneOf/anyOf/array/map.
83
+ *
84
+ * @return string
85
+ */
86
+ public function getGroupName()
87
+ {
88
+ return $this->_groupName;
89
+ }
90
+
91
+ /**
92
+ * Array of string types or TypeCombination objects
93
+ *
94
+ * @return array
95
+ */
96
+ public function getTypes()
97
+ {
98
+ return $this->_types;
99
+ }
100
+
101
+ /**
102
+ * A list of factory methods to deserialize the given object,
103
+ * for one of the wrapped types in this group
104
+ *
105
+ * @return string[]
106
+ */
107
+ public function getDeserializers()
108
+ {
109
+ return $this->_deserializers;
110
+ }
111
+
112
+ /**
113
+ * Extract innermost oneof/anyof group hidden inside array/map
114
+ * type group
115
+ *
116
+ * @return TypeCombination
117
+ */
118
+ public function extractOneOfAnyOfGroup()
119
+ {
120
+ $innerType = $this->getTypes()[0];
121
+ if (in_array($this->getGroupName(), ["array", "map"])
122
+ && $innerType instanceof TypeCombination
123
+ ) {
124
+ return $innerType->extractOneOfAnyOfGroup();
125
+ }
126
+ return $this;
127
+ }
128
+
129
+ /**
130
+ * Extract all internal groups similar to the given group as a list of
131
+ * TypeCombination objects, it will only return similar array/map groups
132
+ *
133
+ * @param TypeCombination $group All inner groups similar to this array/map
134
+ * type group will be extracted
135
+ *
136
+ * @return TypeCombination[] A list of similar TypeCombination objects
137
+ */
138
+ public function extractSimilar($group)
139
+ {
140
+ $result = [];
141
+ if (!in_array($this->getGroupName(), ["array", "map"])) {
142
+ // if group is neither array nor map then call extractSimilar for
143
+ // each of the internal groups
144
+ foreach ($this->getTypes() as $typ) {
145
+ if ($typ instanceof TypeCombination) {
146
+ $result = array_merge($result, $typ->extractSimilar($group));
147
+ }
148
+ }
149
+ } elseif ($group->getGroupName() == $this->getGroupName()) {
150
+ // if groupName is same then check inner group type
151
+ $internal = $this->getTypes()[0];
152
+ $group = $group->getTypes()[0];
153
+ if (in_array($group->getGroupName(), ["array", "map"])) {
154
+ // if inner group is array/map then return result after
155
+ // extraction of groups similar to innerGroup
156
+ $result = $internal->extractSimilar($group);
157
+ } else {
158
+ // if inner group is oneof/anyof then only extract $internal
159
+ $result = [$internal];
160
+ }
161
+ }
162
+ return $result;
163
+ }
164
+
165
+ /**
166
+ * Extract type info like: isMap, isArray, and inner type for maps/arrays.
167
+ *
168
+ * @param string $type Type to be checked and extracted for information.
169
+ *
170
+ * @return array An array with type info in the format:
171
+ * (bool isMap, bool isArray, string $internalType).
172
+ */
173
+ public static function extractTypeInfo($type)
174
+ {
175
+ $mapStart = 'array<string,';
176
+ // Check if container is array or map?
177
+ $isMap = substr($type, -1) == '>' && strpos($type, $mapStart) === 0;
178
+ $isArray = substr($type, -2) == '[]';
179
+ // Extracting inner type for arrays/maps
180
+ // Inner type will be same as actual type for non-container type
181
+ $innerType = $isMap ? substr($type, strlen($mapStart), -1)
182
+ : ($isArray ? substr($type, 0, -2) : $type);
183
+ return [$isMap, $isArray, $innerType];
184
+ }
185
+
186
+ /**
187
+ * Create an oneof/anyof TypeCombination instance, by specifying inner types
188
+ *
189
+ * @param array $types types array: (TypeCombination,string)[]
190
+ * @param string $gName group name value (anyof, oneof),
191
+ * Default: anyof
192
+ * @param string[] $deserializers deserializers array, Default: []
193
+ *
194
+ * @return TypeCombination
195
+ */
196
+ public static function with($types, $gName = 'anyof', array $deserializers = [])
197
+ {
198
+ $format = join(
199
+ ',',
200
+ array_map(
201
+ function ($t) {
202
+ return is_string($t) ? $t : $t->getFormat();
203
+ },
204
+ $types
205
+ )
206
+ );
207
+ return new self(
208
+ "$gName($format)",
209
+ $gName,
210
+ $types,
211
+ $deserializers
212
+ );
213
+ }
214
+
215
+ /**
216
+ * Wrap the given typeGroup string in the TypeCombination class,
217
+ * i.e. getTypes() method will return all the grouped types,
218
+ * while deserializing factory methods can be obtained by
219
+ * getDeserializers() and group name can be obtained from getGroupName()
220
+ *
221
+ * @param string $typeGroup Format of multiple types i.e. oneOf(int,bool)[]
222
+ * onyOf(int[],bool,anyOf(string,float)[],...),
223
+ * array<string,oneOf(int,float)[]>, here []
224
+ * represents array types, and array<string,T>
225
+ * represents map types, oneOf/anyOf are group
226
+ * names, while default group name is anyOf.
227
+ * @param string[] $deserializers Callable factory methods for the property,
228
+ * Default: []
229
+ *
230
+ * @return TypeCombination
231
+ */
232
+ public static function withFormat($typeGroup, $deserializers = [])
233
+ {
234
+ $groupName = 'anyOf';
235
+ $start = strpos($typeGroup, '(');
236
+ $end = strrpos($typeGroup, ')');
237
+ if ($start !== false && $end !== false) {
238
+ list($isMap, $isArray, $innerType) = self::extractTypeInfo($typeGroup);
239
+ if ($isMap || $isArray) {
240
+ return self::_createTypeGroup(
241
+ $isMap ? 'map' : 'array',
242
+ $innerType,
243
+ $deserializers
244
+ );
245
+ }
246
+ $name = substr($typeGroup, 0, $start);
247
+ $groupName = empty($name) ? $groupName : $name;
248
+ $typeGroup = substr($typeGroup, $start + 1, -1);
249
+ }
250
+ $format = "($typeGroup)";
251
+ $types = [];
252
+ $type = '';
253
+ $groupCount = 0;
254
+ foreach (str_split($typeGroup) as $c) {
255
+ if ($c == '(' || $c == '<') {
256
+ $groupCount++;
257
+ }
258
+ if ($c == ')' || $c == '>') {
259
+ $groupCount--;
260
+ }
261
+ if ($c == ',' && $groupCount == 0) {
262
+ self::_insertType($types, $type, $deserializers);
263
+ $type = '';
264
+ continue;
265
+ }
266
+ $type .= $c;
267
+ }
268
+ self::_insertType($types, $type, $deserializers);
269
+ return new self($format, $groupName, $types, $deserializers);
270
+ }
271
+
272
+ /**
273
+ * Creates a TypeCombination object with the given name and inner
274
+ * types group that must be another typeCombination object
275
+ *
276
+ * @param string $name Group name for the outer typeCombination
277
+ * object.
278
+ * @param string $innerGroup typeGroup to be created and inserted
279
+ * @param string[] $deserializers deserializer for the type group
280
+ *
281
+ * @return TypeCombination
282
+ */
283
+ private static function _createTypeGroup($name, $innerGroup, $deserializers)
284
+ {
285
+ $format = $name == 'map' ? "array<string,$innerGroup>" : $innerGroup . '[]';
286
+ return new self(
287
+ $format,
288
+ $name,
289
+ [self::withFormat($innerGroup, $deserializers)],
290
+ $deserializers
291
+ );
292
+ }
293
+
294
+ /**
295
+ * Insert the type in the types array which is passed by reference,
296
+ * Also check if type is not empty
297
+ *
298
+ * @param array $types types array reference
299
+ * @param string $type type to be inserted
300
+ * @param string[] $deserializers deserializer for the type group
301
+ *
302
+ * @return void
303
+ */
304
+ private static function _insertType(&$types, $type, $deserializers)
305
+ {
306
+ $type = trim($type);
307
+ if (strpos($type, '(') !== false && strrpos($type, ')') !== false) {
308
+ // If type is Grouped, creating TypeCombination instance for it
309
+ $type = self::withFormat($type, $deserializers);
310
+ }
311
+ if (!empty($type)) {
312
+ array_push($types, $type);
313
+ }
314
+ }
315
+ }
vendor/apimatic/jsonmapper/tests/JsonMapperTest.php CHANGED
@@ -10,6 +10,7 @@
10
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
11
  * @link http://www.netresearch.de/
12
  */
 
13
  require_once 'JsonMapperTest/Array.php';
14
  require_once 'JsonMapperTest/Broken.php';
15
  require_once 'JsonMapperTest/DependencyInjector.php';
@@ -26,6 +27,7 @@ require_once 'JsonMapperTest/FactoryMethodWithError.php';
26
  require_once 'JsonMapperTest/MapsWithSetters.php';
27
  require_once 'JsonMapperTest/ClassWithCtor.php';
28
  require_once 'JsonMapperTest/ComplexClassWithCtor.php';
 
29
 
30
  if (PHP_VERSION_ID >= 70000) {
31
  require_once 'JsonMapperTest/Php7TypedClass.php';
@@ -46,6 +48,9 @@ use apimatic\jsonmapper\JsonMapperException;
46
  * @author Christian Weiske <christian.weiske@netresearch.de>
47
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
48
  * @link http://www.netresearch.de/
 
 
 
49
  */
50
  class JsonMapperTest extends \PHPUnit\Framework\TestCase
51
  {
@@ -59,7 +64,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
59
  json_decode('{"str":"stringvalue"}'),
60
  new JsonMapperTest_Simple()
61
  );
62
- $this->assertInternalType('string', $sn->str);
63
  $this->assertEquals('stringvalue', $sn->str);
64
  }
65
 
@@ -73,7 +78,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
73
  json_decode('{"str":"stringvalue"}'),
74
  'JsonMapperTest_Simple'
75
  );
76
- $this->assertInternalType('string', $sn->str);
77
  $this->assertEquals('stringvalue', $sn->str);
78
  }
79
 
@@ -87,7 +92,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
87
  json_decode('{"fl":"1.2"}'),
88
  new JsonMapperTest_Simple()
89
  );
90
- $this->assertInternalType('float', $sn->fl);
91
  $this->assertEquals(1.2, $sn->fl);
92
  }
93
 
@@ -101,7 +106,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
101
  json_decode('{"db":"1.2"}'),
102
  new JsonMapperTest_Simple()
103
  );
104
- $this->assertInternalType('float', $sn->db);
105
  $this->assertEquals(1.2, $sn->db);
106
  }
107
 
@@ -115,7 +120,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
115
  json_decode('{"pbool":"1"}'),
116
  new JsonMapperTest_Simple()
117
  );
118
- $this->assertInternalType('boolean', $sn->pbool);
119
  $this->assertEquals(true, $sn->pbool);
120
  }
121
 
@@ -129,7 +134,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
129
  json_decode('{"pboolean":"0"}'),
130
  new JsonMapperTest_Simple()
131
  );
132
- $this->assertInternalType('boolean', $sn->pboolean);
133
  $this->assertEquals(false, $sn->pboolean);
134
  }
135
 
@@ -143,7 +148,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
143
  json_decode('{"pint":"123"}'),
144
  new JsonMapperTest_Simple()
145
  );
146
- $this->assertInternalType('integer', $sn->pint);
147
  $this->assertEquals(123, $sn->pint);
148
  }
149
 
@@ -157,7 +162,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
157
  json_decode('{"pinteger":"12345"}'),
158
  new JsonMapperTest_Simple()
159
  );
160
- $this->assertInternalType('integer', $sn->pinteger);
161
  $this->assertEquals(12345, $sn->pinteger);
162
  }
163
 
@@ -171,14 +176,14 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
171
  json_decode('{"mixed":12345}'),
172
  new JsonMapperTest_Simple()
173
  );
174
- $this->assertInternalType('integer', $sn->mixed);
175
  $this->assertEquals('12345', $sn->mixed);
176
 
177
  $sn = $jm->map(
178
  json_decode('{"mixed":"12345"}'),
179
  new JsonMapperTest_Simple()
180
  );
181
- $this->assertInternalType('string', $sn->mixed);
182
  $this->assertEquals(12345, $sn->mixed);
183
  }
184
 
@@ -192,7 +197,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
192
  json_decode('{"pnullable":0}'),
193
  new JsonMapperTest_Simple()
194
  );
195
- $this->assertInternalType('integer', $sn->pnullable);
196
  $this->assertEquals(0, $sn->pnullable);
197
  }
198
 
@@ -206,7 +211,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
206
  json_decode('{"pnullable":null}'),
207
  new JsonMapperTest_Simple()
208
  );
209
- $this->assertInternalType('null', $sn->pnullable);
210
  $this->assertEquals(null, $sn->pnullable);
211
  }
212
 
@@ -220,7 +225,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
220
  json_decode('{"pnullable":"12345"}'),
221
  new JsonMapperTest_Simple()
222
  );
223
- $this->assertInternalType('integer', $sn->pnullable);
224
  $this->assertEquals(12345, $sn->pnullable);
225
  }
226
 
@@ -234,7 +239,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
234
  json_decode('{"notype":{"k":"v"}}'),
235
  new JsonMapperTest_Simple()
236
  );
237
- $this->assertInternalType('object', $sn->notype);
238
  $this->assertEquals((object) array('k' => 'v'), $sn->notype);
239
  }
240
 
@@ -248,7 +253,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
248
  json_decode('{"under_score":"f"}'),
249
  new JsonMapperTest_Simple()
250
  );
251
- $this->assertInternalType('string', $sn->under_score);
252
  $this->assertEquals('f', $sn->under_score);
253
  }
254
 
@@ -262,9 +267,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
262
  json_decode('{"under_score_setter":"blubb"}'),
263
  new JsonMapperTest_Simple()
264
  );
265
- $this->assertInternalType(
266
- 'string', $sn->internalData['under_score_setter']
267
- );
268
  $this->assertEquals(
269
  'blubb', $sn->internalData['under_score_setter']
270
  );
@@ -280,7 +283,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
280
  json_decode('{"simple":{"str":"stringvalue"}}'),
281
  new JsonMapperTest_Simple()
282
  );
283
- $this->assertInternalType('object', $sn->simple);
284
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->simple);
285
  $this->assertEquals('stringvalue', $sn->simple->str);
286
  }
@@ -291,11 +294,12 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
291
  public function testMapTypedArray()
292
  {
293
  $jm = new JsonMapper();
 
294
  $sn = $jm->map(
295
  json_decode('{"typedArray":[{"str":"stringvalue"},{"fl":"1.2"}]}'),
296
  new JsonMapperTest_Array()
297
  );
298
- $this->assertInternalType('array', $sn->typedArray);
299
  $this->assertEquals(2, count($sn->typedArray));
300
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArray[0]);
301
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArray[1]);
@@ -303,6 +307,50 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
303
  $this->assertEquals(1.2, $sn->typedArray[1]->fl);
304
  }
305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  public function testMapTypedWithNullValue(Type $var = null)
307
  {
308
  $jm = new JsonMapper();
@@ -321,7 +369,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
321
  json_decode('{"typedSimpleArray":["2014-01-02",null,"2014-05-07"]}'),
322
  new JsonMapperTest_Array()
323
  );
324
- $this->assertInternalType('array', $sn->typedSimpleArray);
325
  $this->assertEquals(3, count($sn->typedSimpleArray));
326
  $this->assertInstanceOf('DateTime', $sn->typedSimpleArray[0]);
327
  $this->assertNull($sn->typedSimpleArray[1]);
@@ -341,7 +389,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
341
  json_decode('{"str":"stringvalue"}'),
342
  'JsonMapperTest_Simple'
343
  );
344
- $this->assertInternalType('string', $sn->str);
345
  $this->assertEquals('stringvalue', $sn->str);
346
  }
347
 
@@ -352,32 +400,56 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
352
  $this->assertEquals(null, $sn);
353
  }
354
 
355
- /**
356
- * @expectedException InvalidArgumentException
357
- * @expectedExceptionMessage JsonMapper::mapClass() requires first argument to be an object, integer given.
358
- */
359
  public function testMapClassWithNonObject()
360
  {
 
 
361
  $jm = new JsonMapper();
362
  $sn = $jm->mapClass(123, 'JsonMapperTest_Simple');
363
  }
364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  /**
366
- * @expectedException InvalidArgumentException
367
- * @expectedExceptionMessage JsonMapper::map() requires first argument to be an object, NULL given.
 
368
  */
 
 
 
 
 
 
 
 
369
  public function testMapNullJson()
370
  {
 
 
371
  $jm = new JsonMapper();
372
  $sn = $jm->map(null, new JsonMapperTest_Simple());
373
  }
374
 
375
- /**
376
- * @expectedException InvalidArgumentException
377
- * @expectedExceptionMessage JsonMapper::map() requires second argument to be an object, NULL given.
378
- */
379
  public function testMapNullObject()
380
  {
 
 
381
  $jm = new JsonMapper();
382
  $sn = $jm->map(new stdClass(), null);
383
  }
@@ -400,7 +472,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
400
  json_decode('{"flArray":[1.23,3.14,2.048]}'),
401
  new JsonMapperTest_Array()
402
  );
403
- $this->assertInternalType('array', $sn->flArray);
404
  $this->assertEquals(3, count($sn->flArray));
405
  $this->assertTrue(is_float($sn->flArray[0]));
406
  $this->assertTrue(is_float($sn->flArray[1]));
@@ -417,11 +489,80 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
417
  json_decode('{"strArray":["str",false,2.048]}'),
418
  new JsonMapperTest_Array()
419
  );
420
- $this->assertInternalType('array', $sn->strArray);
421
  $this->assertEquals(3, count($sn->strArray));
422
- $this->assertInternalType('string', $sn->strArray[0]);
423
- $this->assertInternalType('string', $sn->strArray[1]);
424
- $this->assertInternalType('string', $sn->strArray[2]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  }
426
 
427
  /**
@@ -476,20 +617,19 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
476
  );
477
  $this->assertInstanceOf('ArrayObject', $sn->pSimpleArrayObject);
478
  $this->assertEquals(2, count($sn->pSimpleArrayObject));
479
- $this->assertInternalType('int', $sn->pSimpleArrayObject['eins']);
480
- $this->assertInternalType('int', $sn->pSimpleArrayObject['zwei']);
481
  $this->assertEquals(1, $sn->pSimpleArrayObject['eins']);
482
  $this->assertEquals(1, $sn->pSimpleArrayObject['zwei']);
483
  }
484
 
485
  /**
486
  * Test for "@var "
487
- *
488
- * @expectedException apimatic\jsonmapper\JsonMapperException
489
- * @expectedExceptionMessage Empty type at property "JsonMapperTest_Simple::$empty"
490
  */
491
  public function testMapEmpty()
492
  {
 
 
493
  $jm = new JsonMapper();
494
  $sn = $jm->map(
495
  json_decode(
@@ -555,7 +695,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
555
  new JsonMapperTest_Simple()
556
  );
557
 
558
- $this->assertInternalType('object', $sn->internalData['typehint']);
559
  $this->assertInstanceOf(
560
  'JsonMapperTest_Simple', $sn->internalData['typehint']
561
  );
@@ -575,7 +715,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
575
  json_decode('{"simpleSetterOnlyDocblock":{"str":"stringvalue"}}'),
576
  new JsonMapperTest_Simple()
577
  );
578
- $this->assertInternalType('object', $sn->internalData['docblock']);
579
  $this->assertInstanceOf(
580
  'JsonMapperTest_Simple', $sn->internalData['docblock']
581
  );
@@ -594,7 +734,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
594
  json_decode('{"simpleSetterOnlyNoType":{"str":"stringvalue"}}'),
595
  new JsonMapperTest_Simple()
596
  );
597
- $this->assertInternalType('object', $sn->internalData['notype']);
598
  $this->assertInstanceOf(
599
  'stdClass', $sn->internalData['notype']
600
  );
@@ -615,7 +755,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
615
  json_decode('{"protectedStrNoSetter":"stringvalue"}'),
616
  new JsonMapperTest_Simple()
617
  );
618
- $this->assertInternalType('null', $sn->getProtectedStrNoSetter());
619
  $this->assertEquals(
620
  array(
621
  array(
@@ -655,12 +795,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
655
  $this->assertNull($sn->datetime);
656
  }
657
 
658
- /**
659
- * @expectedException apimatic\jsonmapper\JsonMapperException
660
- * @expectedExceptionMessage Required property "pMissingData" of class JsonMapperTest_Broken is missing in JSON data
661
- */
662
  public function testMissingDataException()
663
  {
 
 
664
  $jm = new JsonMapper();
665
  $jm->bExceptionOnMissingData = true;
666
  $sn = $jm->map(
@@ -683,12 +821,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
683
  $this->assertTrue(true);
684
  }
685
 
686
- /**
687
- * @expectedException apimatic\jsonmapper\JsonMapperException
688
- * @expectedExceptionMessage JSON property "undefinedProperty" does not exist in object of type JsonMapperTest_Broken
689
- */
690
  public function testUndefinedPropertyException()
691
  {
 
 
692
  $jm = new JsonMapper();
693
  $jm->bExceptionOnUndefinedProperty = true;
694
  $sn = $jm->map(
@@ -711,12 +847,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
711
  $this->assertTrue(empty($logger->log));
712
  }
713
 
714
- /**
715
- * @expectedException apimatic\jsonmapper\JsonMapperException
716
- * @expectedExceptionMessage JSON property "privateNoSetter" has no public setter method in object of type PrivateWithSetter
717
- */
718
  public function testPrivatePropertyWithNoSetter()
719
  {
 
 
720
  $jm = new JsonMapper();
721
  $jm->bExceptionOnUndefinedProperty = true;
722
  $logger = new JsonMapperTest_Logger();
@@ -729,12 +863,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
729
  $this->assertTrue(empty($logger->log));
730
  }
731
 
732
- /**
733
- * @expectedException apimatic\jsonmapper\JsonMapperException
734
- * @expectedExceptionMessage JSON property "privatePropertyPrivateSetter" has no public setter method in object of type PrivateWithSetter
735
- */
736
  public function testPrivatePropertyWithPrivateSetter()
737
  {
 
 
738
  $jm = new JsonMapper();
739
  $jm->bExceptionOnUndefinedProperty = true;
740
  $logger = new JsonMapperTest_Logger();
@@ -751,7 +883,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
751
  json_decode('{"setterPreferredOverProperty":"foo"}'),
752
  new JsonMapperTest_Simple()
753
  );
754
- $this->assertInternalType('string', $sn->setterPreferredOverProperty);
755
  $this->assertEquals(
756
  'set via setter: foo', $sn->setterPreferredOverProperty
757
  );
@@ -801,12 +933,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
801
  $this->assertEquals('database', $sn->simple->db);
802
  }
803
 
804
- /**
805
- * @expectedException apimatic\JsonMapper\JsonMapperException
806
- * @expectedExceptionMessage ClassWithCtor class requires 2 arguments in constructor but none provided
807
- */
808
  public function testDependencyInjectionWithMissingCtorArgs()
809
  {
 
 
810
  $jm = new JsonMapperTest_DependencyInjector();
811
  $jm->createInstance('ClassWithCtor');
812
  }
@@ -882,12 +1012,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
882
  $this->assertEquals('incorrect!', $sn->type);
883
  }
884
 
885
- /**
886
- * @expectedException \InvalidArgumentException
887
- * @expectedExceptionMessage JsonMapper::mapClass() requires second argument to be a class name, InvalidClassThatDoesNotExist given
888
- */
889
  public function testDiscriminatorWithInvalidClassName()
890
  {
 
 
891
  $jm = new JsonMapper();
892
 
893
  $sn = $jm->mapClass(
@@ -946,7 +1074,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
946
  'JsonMapperTest_SimpleBase'
947
  );
948
 
949
- $this->assertInternalType('array', $sn);
950
  $this->assertInstanceOf('JsonMapperTest_SimpleBase', $sn[0]);
951
  $this->assertInstanceOf('JsonMapperTest_DerivedClass', $sn[1]);
952
  $this->assertInstanceOf('JsonMapperTest_DerivedClass2', $sn[2]);
@@ -1006,7 +1134,7 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
1006
  $this->assertEquals("hello world", $fm->simple);
1007
  $this->assertEquals("value is 123", $fm->value);
1008
  $this->assertEquals(false, $fm->bool);
1009
- $this->assertInternalType('bool', $fm->bool);
1010
  $this->assertInstanceOf('DateTime', $fm->datetime);
1011
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->object);
1012
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->objObj);
@@ -1015,12 +1143,10 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
1015
  $this->assertEquals("value is 4242", $fm->getPrivateValue());
1016
  }
1017
 
1018
- /**
1019
- * @expectedException apimatic\jsonmapper\JsonMapperException
1020
- * @expectedExceptionMessage Factory method "NonExistentMethod" referenced by "FactoryMethodWithError" is not callable
1021
- */
1022
  public function testFactoryMethodException()
1023
  {
 
 
1024
  $jm = new JsonMapper();
1025
  $fm = $jm->map(
1026
  json_decode('{"simple":"hello world"}'),
@@ -1054,34 +1180,28 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
1054
  $this->assertEquals(2, count($fm->additional));
1055
  }
1056
 
1057
- /**
1058
- * @expectedException \InvalidArgumentException
1059
- * @expectedExceptionMessage privateAddAdditionalProperty method is not public on the given class.
1060
- */
1061
  public function testAdditionalPropertiesWithPrivateMethod()
1062
  {
 
 
1063
  $jm = new JsonMapper();
1064
  $jm->sAdditionalPropertiesCollectionMethod = 'privateAddAdditionalProperty';
1065
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
1066
  }
1067
-
1068
- /**
1069
- * @expectedException \InvalidArgumentException
1070
- * @expectedExceptionMessage brokenAddAdditionalProperty method does not receive two args, $key and $value.
1071
- */
1072
  public function testAdditionalPropertiesWithBrokenMethod()
1073
  {
 
 
1074
  $jm = new JsonMapper();
1075
  $jm->sAdditionalPropertiesCollectionMethod = 'brokenAddAdditionalProperty';
1076
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
1077
  }
1078
-
1079
- /**
1080
- * @expectedException \InvalidArgumentException
1081
- * @expectedExceptionMessage missingMethod method is not available on the given class.
1082
- */
1083
  public function testAdditionalPropertiesWithMissingMethod()
1084
  {
 
 
1085
  $jm = new JsonMapper();
1086
  $jm->sAdditionalPropertiesCollectionMethod = 'missingMethod';
1087
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
@@ -1100,13 +1220,11 @@ class JsonMapperTest extends \PHPUnit\Framework\TestCase
1100
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->getAttr2());
1101
  $this->assertEquals(123123, $fm->getAttr2()->getValue());
1102
  }
1103
-
1104
- /**
1105
- * @expectedException apimatic\JsonMapper\JsonMapperException
1106
- * @expectedExceptionMessage Could not find required constructor arguments for ClassWithCtor: attr2
1107
- */
1108
  public function testMapTypeWithCtorMissingArgument()
1109
  {
 
 
1110
  $jm = new JsonMapper();
1111
  $fm = $jm->mapClass(
1112
  json_decode('{"attr1":"hello"}'),
10
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
11
  * @link http://www.netresearch.de/
12
  */
13
+
14
  require_once 'JsonMapperTest/Array.php';
15
  require_once 'JsonMapperTest/Broken.php';
16
  require_once 'JsonMapperTest/DependencyInjector.php';
27
  require_once 'JsonMapperTest/MapsWithSetters.php';
28
  require_once 'JsonMapperTest/ClassWithCtor.php';
29
  require_once 'JsonMapperTest/ComplexClassWithCtor.php';
30
+ require_once 'JsonMapperTest/JsonMapperCommentsDiscardedException.php';
31
 
32
  if (PHP_VERSION_ID >= 70000) {
33
  require_once 'JsonMapperTest/Php7TypedClass.php';
48
  * @author Christian Weiske <christian.weiske@netresearch.de>
49
  * @license OSL-3.0 http://opensource.org/licenses/osl-3.0
50
  * @link http://www.netresearch.de/
51
+ * @covers \apimatic\jsonmapper\JsonMapper
52
+ * @covers \apimatic\jsonmapper\TypeCombination
53
+ * @covers \apimatic\jsonmapper\JsonMapperException
54
  */
55
  class JsonMapperTest extends \PHPUnit\Framework\TestCase
56
  {
64
  json_decode('{"str":"stringvalue"}'),
65
  new JsonMapperTest_Simple()
66
  );
67
+ $this->assertTrue(is_string($sn->str));
68
  $this->assertEquals('stringvalue', $sn->str);
69
  }
70
 
78
  json_decode('{"str":"stringvalue"}'),
79
  'JsonMapperTest_Simple'
80
  );
81
+ $this->assertTrue(is_string($sn->str));
82
  $this->assertEquals('stringvalue', $sn->str);
83
  }
84
 
92
  json_decode('{"fl":"1.2"}'),
93
  new JsonMapperTest_Simple()
94
  );
95
+ $this->assertTrue(is_float($sn->fl));
96
  $this->assertEquals(1.2, $sn->fl);
97
  }
98
 
106
  json_decode('{"db":"1.2"}'),
107
  new JsonMapperTest_Simple()
108
  );
109
+ $this->assertTrue(is_float($sn->db));
110
  $this->assertEquals(1.2, $sn->db);
111
  }
112
 
120
  json_decode('{"pbool":"1"}'),
121
  new JsonMapperTest_Simple()
122
  );
123
+ $this->assertTrue(is_bool($sn->pbool));
124
  $this->assertEquals(true, $sn->pbool);
125
  }
126
 
134
  json_decode('{"pboolean":"0"}'),
135
  new JsonMapperTest_Simple()
136
  );
137
+ $this->assertTrue(is_bool($sn->pboolean));
138
  $this->assertEquals(false, $sn->pboolean);
139
  }
140
 
148
  json_decode('{"pint":"123"}'),
149
  new JsonMapperTest_Simple()
150
  );
151
+ $this->assertTrue(is_int($sn->pint));
152
  $this->assertEquals(123, $sn->pint);
153
  }
154
 
162
  json_decode('{"pinteger":"12345"}'),
163
  new JsonMapperTest_Simple()
164
  );
165
+ $this->assertTrue(is_int($sn->pinteger));
166
  $this->assertEquals(12345, $sn->pinteger);
167
  }
168
 
176
  json_decode('{"mixed":12345}'),
177
  new JsonMapperTest_Simple()
178
  );
179
+ $this->assertTrue(is_int($sn->mixed));
180
  $this->assertEquals('12345', $sn->mixed);
181
 
182
  $sn = $jm->map(
183
  json_decode('{"mixed":"12345"}'),
184
  new JsonMapperTest_Simple()
185
  );
186
+ $this->assertTrue(is_string($sn->mixed));
187
  $this->assertEquals(12345, $sn->mixed);
188
  }
189
 
197
  json_decode('{"pnullable":0}'),
198
  new JsonMapperTest_Simple()
199
  );
200
+ $this->assertTrue(is_int($sn->pnullable));
201
  $this->assertEquals(0, $sn->pnullable);
202
  }
203
 
211
  json_decode('{"pnullable":null}'),
212
  new JsonMapperTest_Simple()
213
  );
214
+ $this->assertNull($sn->pnullable);
215
  $this->assertEquals(null, $sn->pnullable);
216
  }
217
 
225
  json_decode('{"pnullable":"12345"}'),
226
  new JsonMapperTest_Simple()
227
  );
228
+ $this->assertTrue(is_int($sn->pnullable));
229
  $this->assertEquals(12345, $sn->pnullable);
230
  }
231
 
239
  json_decode('{"notype":{"k":"v"}}'),
240
  new JsonMapperTest_Simple()
241
  );
242
+ $this->assertTrue(is_object($sn->notype));
243
  $this->assertEquals((object) array('k' => 'v'), $sn->notype);
244
  }
245
 
253
  json_decode('{"under_score":"f"}'),
254
  new JsonMapperTest_Simple()
255
  );
256
+ $this->assertTrue(is_string($sn->under_score));
257
  $this->assertEquals('f', $sn->under_score);
258
  }
259
 
267
  json_decode('{"under_score_setter":"blubb"}'),
268
  new JsonMapperTest_Simple()
269
  );
270
+ $this->assertTrue(is_string($sn->internalData['under_score_setter']));
 
 
271
  $this->assertEquals(
272
  'blubb', $sn->internalData['under_score_setter']
273
  );
283
  json_decode('{"simple":{"str":"stringvalue"}}'),
284
  new JsonMapperTest_Simple()
285
  );
286
+ $this->assertTrue(is_object($sn->simple));
287
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->simple);
288
  $this->assertEquals('stringvalue', $sn->simple->str);
289
  }
294
  public function testMapTypedArray()
295
  {
296
  $jm = new JsonMapper();
297
+ $jm->arChildClasses['JsonMapperTest_Simple'] = array();
298
  $sn = $jm->map(
299
  json_decode('{"typedArray":[{"str":"stringvalue"},{"fl":"1.2"}]}'),
300
  new JsonMapperTest_Array()
301
  );
302
+ $this->assertTrue(is_array($sn->typedArray));
303
  $this->assertEquals(2, count($sn->typedArray));
304
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArray[0]);
305
  $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArray[1]);
307
  $this->assertEquals(1.2, $sn->typedArray[1]->fl);
308
  }
309
 
310
+ /**
311
+ * Test for a map of classes "@var array<string,Classname>"
312
+ */
313
+ public function testMapTypedMap()
314
+ {
315
+ $jm = new JsonMapper();
316
+ $jm->arChildClasses['JsonMapperTest_Simple'] = array();
317
+ $sn = $jm->map(
318
+ json_decode('{"typedMap":{"key0":{"str":"stringvalue"},"key1":{"fl":"1.2"}}}'),
319
+ new JsonMapperTest_Array()
320
+ );
321
+ $this->assertTrue(is_array($sn->typedMap));
322
+ $this->assertEquals(2, count($sn->typedMap));
323
+ $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedMap['key0']);
324
+ $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedMap['key1']);
325
+ $this->assertEquals('stringvalue', $sn->typedMap['key0']->str);
326
+ $this->assertEquals(1.2, $sn->typedMap['key1']->fl);
327
+ }
328
+
329
+ /**
330
+ * Test for an array of map of classes "@var array<string,Classname>[]"
331
+ */
332
+ public function testMapTypedArrayOfMap()
333
+ {
334
+ $jm = new JsonMapper();
335
+ $jm->arChildClasses['JsonMapperTest_Simple'] = array();
336
+ $sn = $jm->map(
337
+ json_decode('{"typedArrayOfMap":[{"class1":{"str":"stringvalue"},"class2":{"fl":"1.2"}},{"class3":{"pbool":true}}]}'),
338
+ new JsonMapperTest_Array()
339
+ );
340
+ $this->assertTrue(is_array($sn->typedArrayOfMap));
341
+ $this->assertEquals(2, count($sn->typedArrayOfMap));
342
+ $this->assertTrue(is_array($sn->typedArrayOfMap[0]));
343
+ $this->assertTrue(is_array($sn->typedArrayOfMap[1]));
344
+ $this->assertEquals(2, count($sn->typedArrayOfMap[0]));
345
+ $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArrayOfMap[0]['class1']);
346
+ $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArrayOfMap[0]['class2']);
347
+ $this->assertEquals(1, count($sn->typedArrayOfMap[1]));
348
+ $this->assertInstanceOf('JsonMapperTest_Simple', $sn->typedArrayOfMap[1]['class3']);
349
+ $this->assertEquals('stringvalue', $sn->typedArrayOfMap[0]['class1']->str);
350
+ $this->assertEquals(1.2, $sn->typedArrayOfMap[0]['class2']->fl);
351
+ $this->assertEquals(true, $sn->typedArrayOfMap[1]['class3']->pbool);
352
+ }
353
+
354
  public function testMapTypedWithNullValue(Type $var = null)
355
  {
356
  $jm = new JsonMapper();
369
  json_decode('{"typedSimpleArray":["2014-01-02",null,"2014-05-07"]}'),
370
  new JsonMapperTest_Array()
371
  );
372
+ $this->assertTrue(is_array($sn->typedSimpleArray));
373
  $this->assertEquals(3, count($sn->typedSimpleArray));
374
  $this->assertInstanceOf('DateTime', $sn->typedSimpleArray[0]);
375
  $this->assertNull($sn->typedSimpleArray[1]);
389
  json_decode('{"str":"stringvalue"}'),
390
  'JsonMapperTest_Simple'
391
  );
392
+ $this->assertTrue(is_string($sn->str));
393
  $this->assertEquals('stringvalue', $sn->str);
394
  }
395
 
400
  $this->assertEquals(null, $sn);
401
  }
402
 
 
 
 
 
403
  public function testMapClassWithNonObject()
404
  {
405
+ $this->expectException(InvalidArgumentException::class);
406
+ $this->expectExceptionMessage('JsonMapper::mapClass() requires first argument to be an object, integer given.');
407
  $jm = new JsonMapper();
408
  $sn = $jm->mapClass(123, 'JsonMapperTest_Simple');
409
  }
410
 
411
+ public function testOpCacheSaveCommentsDiscarded()
412
+ {
413
+ $enable = ["1", "on", "true", "yes"];
414
+ if (in_array(strtolower(ini_get("opcache.save_comments")), $enable, true)) {
415
+ // if save_comments is enabled locally then JsonMapperException
416
+ // could never be thrown, since we can't use ini_set(save_comments).
417
+ // So we are not running the actual test of expectExceptionMessage
418
+ $this->assertInstanceOf(JsonMapper::class, new JsonMapper());
419
+ }
420
+ else {
421
+ $this->expectException(JsonMapperException::class);
422
+ $this->expectExceptionMessage("Comments cannot be discarded in the configuration file i.e. the php.ini file; doc comments are a requirement for JsonMapper. Following configuration keys must have a value set to \"1\": zend_optimizerplus.save_comments, opcache.save_comments.");
423
+
424
+ new JsonMapperCommentsDiscardedException(["opcache.save_comments" => "0"]);
425
+ }
426
+ }
427
+
428
  /**
429
+ * This test assumes that zend_optimizerplus.save_comments key is either not present in the local PHP directives or is set to "0".
430
+ * This is true, at the time of writing, for the Github Actions environment, hence an exception is thrown.
431
+ * Furthermore, the class JsonMapperCommentsDiscardedException mocks the loading of Zend Optimizer+ extension.
432
  */
433
+ public function testZendOptimizerPlusCommentsDiscarded()
434
+ {
435
+ $this->expectException(JsonMapperException::class);
436
+ $this->expectExceptionMessage("Comments cannot be discarded in the configuration file i.e. the php.ini file; doc comments are a requirement for JsonMapper. Following configuration keys must have a value set to \"1\": zend_optimizerplus.save_comments, opcache.save_comments.");
437
+
438
+ new JsonMapperCommentsDiscardedException(["zend_optimizerplus.save_comments" => "0"]);
439
+ }
440
+
441
  public function testMapNullJson()
442
  {
443
+ $this->expectException(InvalidArgumentException::class);
444
+ $this->expectExceptionMessage('JsonMapper::map() requires first argument to be an object, NULL given.');
445
  $jm = new JsonMapper();
446
  $sn = $jm->map(null, new JsonMapperTest_Simple());
447
  }
448
 
 
 
 
 
449
  public function testMapNullObject()
450
  {
451
+ $this->expectException(InvalidArgumentException::class);
452
+ $this->expectExceptionMessage('JsonMapper::map() requires second argument to be an object, NULL given.');
453
  $jm = new JsonMapper();
454
  $sn = $jm->map(new stdClass(), null);
455
  }
472
  json_decode('{"flArray":[1.23,3.14,2.048]}'),
473
  new JsonMapperTest_Array()
474
  );
475
+ $this->assertTrue(is_array($sn->flArray));
476
  $this->assertEquals(3, count($sn->flArray));
477
  $this->assertTrue(is_float($sn->flArray[0]));
478
  $this->assertTrue(is_float($sn->flArray[1]));
489
  json_decode('{"strArray":["str",false,2.048]}'),
490
  new JsonMapperTest_Array()
491
  );
492
+ $this->assertTrue(is_array($sn->strArray));
493
  $this->assertEquals(3, count($sn->strArray));
494
+ $this->assertTrue(is_string($sn->strArray[0]));
495
+ $this->assertTrue(is_string($sn->strArray[1]));
496
+ $this->assertTrue(is_string($sn->strArray[2]));
497
+ }
498
+
499
+ /**
500
+ * Test for a map of strings - "@var array<string,string>"
501
+ */
502
+ public function testStrMap()
503
+ {
504
+ $jm = new JsonMapper();
505
+ $sn = $jm->map(
506
+ json_decode('{"strMap":{"key0":"str","key1":false,"key2":2.048}}'),
507
+ new JsonMapperTest_Array()
508
+ );
509
+ $this->assertTrue(is_array($sn->strMap));
510
+ $this->assertEquals(3, count($sn->strMap));
511
+ $this->assertTrue(is_string($sn->strMap['key0']));
512
+ $this->assertTrue(is_string($sn->strMap['key1']));
513
+ $this->assertTrue(is_string($sn->strMap['key2']));
514
+ }
515
+
516
+ /**
517
+ * Test for a map of array of strings - "@var array<string,string[]>"
518
+ */
519
+ public function testStrMapOfArray()
520
+ {
521
+ $jm = new JsonMapper();
522
+ $sn = $jm->map(
523
+ json_decode('{"strMapOfArray":{"key0":["str","other"],"key1":[false,3],"key2":[2.048,"asad"]}}'),
524
+ new JsonMapperTest_Array()
525
+ );
526
+ $this->assertTrue(is_array($sn->strMapOfArray));
527
+ $this->assertEquals(3, count($sn->strMapOfArray));
528
+ $this->assertTrue(is_array($sn->strMapOfArray['key0']));
529
+ $this->assertEquals(2, count($sn->strMapOfArray['key0']));
530
+ $this->assertTrue(is_string($sn->strMapOfArray['key0'][0]));
531
+ $this->assertTrue(is_string($sn->strMapOfArray['key0'][1]));
532
+ $this->assertTrue(is_array($sn->strMapOfArray['key1']));
533
+ $this->assertEquals(2, count($sn->strMapOfArray['key1']));
534
+ $this->assertTrue(is_string($sn->strMapOfArray['key1'][0]));
535
+ $this->assertTrue(is_string($sn->strMapOfArray['key1'][1]));
536
+ $this->assertTrue(is_array($sn->strMapOfArray['key2']));
537
+ $this->assertEquals(2, count($sn->strMapOfArray['key2']));
538
+ $this->assertTrue(is_string($sn->strMapOfArray['key2'][0]));
539
+ $this->assertTrue(is_string($sn->strMapOfArray['key2'][1]));
540
+ }
541
+
542
+ /**
543
+ * Test for an array of map of strings - "@var array<string,string>[]"
544
+ */
545
+ public function testStrArrayOfMap()
546
+ {
547
+ $jm = new JsonMapper();
548
+ $sn = $jm->map(
549
+ json_decode('{"strArrayOfMap":[{"key0":"str","key1":"other"},{"key0":false,"key1":3},{"key0":2.048,"key1":"asad"}]}'),
550
+ new JsonMapperTest_Array()
551
+ );
552
+ $this->assertTrue(is_array($sn->strArrayOfMap));
553
+ $this->assertEquals(3, count($sn->strArrayOfMap));
554
+ $this->assertTrue(is_array($sn->strArrayOfMap[0]));
555
+ $this->assertEquals(2, count($sn->strArrayOfMap[0]));
556
+ $this->assertTrue(is_string($sn->strArrayOfMap[0]['key0']));
557
+ $this->assertTrue(is_string($sn->strArrayOfMap[0]['key1']));
558
+ $this->assertTrue(is_array($sn->strArrayOfMap[1]));
559
+ $this->assertEquals(2, count($sn->strArrayOfMap[1]));
560
+ $this->assertTrue(is_string($sn->strArrayOfMap[1]['key0']));
561
+ $this->assertTrue(is_string($sn->strArrayOfMap[1]['key1']));
562
+ $this->assertTrue(is_array($sn->strArrayOfMap[2]));
563
+ $this->assertEquals(2, count($sn->strArrayOfMap[2]));
564
+ $this->assertTrue(is_string($sn->strArrayOfMap[2]['key0']));
565
+ $this->assertTrue(is_string($sn->strArrayOfMap[2]['key1']));
566
  }
567
 
568
  /**
617
  );
618
  $this->assertInstanceOf('ArrayObject', $sn->pSimpleArrayObject);
619
  $this->assertEquals(2, count($sn->pSimpleArrayObject));
620
+ $this->assertTrue(is_int($sn->pSimpleArrayObject['eins']));
621
+ $this->assertTrue(is_int($sn->pSimpleArrayObject['zwei']));
622
  $this->assertEquals(1, $sn->pSimpleArrayObject['eins']);
623
  $this->assertEquals(1, $sn->pSimpleArrayObject['zwei']);
624
  }
625
 
626
  /**
627
  * Test for "@var "
 
 
 
628
  */
629
  public function testMapEmpty()
630
  {
631
+ $this->expectException(JsonMapperException::class);
632
+ $this->expectExceptionMessage("Empty type at property 'JsonMapperTest_Simple::\$empty'");
633
  $jm = new JsonMapper();
634
  $sn = $jm->map(
635
  json_decode(
695
  new JsonMapperTest_Simple()
696
  );
697
 
698
+ $this->assertTrue(is_object($sn->internalData['typehint']));
699
  $this->assertInstanceOf(
700
  'JsonMapperTest_Simple', $sn->internalData['typehint']
701
  );
715
  json_decode('{"simpleSetterOnlyDocblock":{"str":"stringvalue"}}'),
716
  new JsonMapperTest_Simple()
717
  );
718
+ $this->assertTrue(is_object($sn->internalData['docblock']));
719
  $this->assertInstanceOf(
720
  'JsonMapperTest_Simple', $sn->internalData['docblock']
721
  );
734
  json_decode('{"simpleSetterOnlyNoType":{"str":"stringvalue"}}'),
735
  new JsonMapperTest_Simple()
736
  );
737
+ $this->assertTrue(is_object($sn->internalData['notype']));
738
  $this->assertInstanceOf(
739
  'stdClass', $sn->internalData['notype']
740
  );
755
  json_decode('{"protectedStrNoSetter":"stringvalue"}'),
756
  new JsonMapperTest_Simple()
757
  );
758
+ $this->assertNull($sn->getProtectedStrNoSetter());
759
  $this->assertEquals(
760
  array(
761
  array(
795
  $this->assertNull($sn->datetime);
796
  }
797
 
 
 
 
 
798
  public function testMissingDataException()
799
  {
800
+ $this->expectException(JsonMapperException::class);
801
+ $this->expectExceptionMessage("Required property 'pMissingData' of class 'JsonMapperTest_Broken' is missing in JSON data");
802
  $jm = new JsonMapper();
803
  $jm->bExceptionOnMissingData = true;
804
  $sn = $jm->map(
821
  $this->assertTrue(true);
822
  }
823
 
 
 
 
 
824
  public function testUndefinedPropertyException()
825
  {
826
+ $this->expectException(JsonMapperException::class);
827
+ $this->expectExceptionMessage("JSON property 'undefinedProperty' does not exist in object of type 'JsonMapperTest_Broken'");
828
  $jm = new JsonMapper();
829
  $jm->bExceptionOnUndefinedProperty = true;
830
  $sn = $jm->map(
847
  $this->assertTrue(empty($logger->log));
848
  }
849
 
 
 
 
 
850
  public function testPrivatePropertyWithNoSetter()
851
  {
852
+ $this->expectException(JsonMapperException::class);
853
+ $this->expectExceptionMessage("JSON property 'privateNoSetter' has no public setter method in object of type 'PrivateWithSetter'");
854
  $jm = new JsonMapper();
855
  $jm->bExceptionOnUndefinedProperty = true;
856
  $logger = new JsonMapperTest_Logger();
863
  $this->assertTrue(empty($logger->log));
864
  }
865
 
 
 
 
 
866
  public function testPrivatePropertyWithPrivateSetter()
867
  {
868
+ $this->expectException(JsonMapperException::class);
869
+ $this->expectExceptionMessage("JSON property 'privatePropertyPrivateSetter' has no public setter method in object of type 'PrivateWithSetter'");
870
  $jm = new JsonMapper();
871
  $jm->bExceptionOnUndefinedProperty = true;
872
  $logger = new JsonMapperTest_Logger();
883
  json_decode('{"setterPreferredOverProperty":"foo"}'),
884
  new JsonMapperTest_Simple()
885
  );
886
+ $this->assertTrue(is_string($sn->setterPreferredOverProperty));
887
  $this->assertEquals(
888
  'set via setter: foo', $sn->setterPreferredOverProperty
889
  );
933
  $this->assertEquals('database', $sn->simple->db);
934
  }
935
 
 
 
 
 
936
  public function testDependencyInjectionWithMissingCtorArgs()
937
  {
938
+ $this->expectException(JsonMapperException::class);
939
+ $this->expectExceptionMessage('ClassWithCtor class requires 2 arguments in constructor but none provided');
940
  $jm = new JsonMapperTest_DependencyInjector();
941
  $jm->createInstance('ClassWithCtor');
942
  }
1012
  $this->assertEquals('incorrect!', $sn->type);
1013
  }
1014
 
 
 
 
 
1015
  public function testDiscriminatorWithInvalidClassName()
1016
  {
1017
+ $this->expectException(InvalidArgumentException::class);
1018
+ $this->expectExceptionMessage('JsonMapper::mapClass() requires second argument to be a class name, InvalidClassThatDoesNotExist given');
1019
  $jm = new JsonMapper();
1020
 
1021
  $sn = $jm->mapClass(
1074
  'JsonMapperTest_SimpleBase'
1075
  );
1076
 
1077
+ $this->assertTrue(is_array($sn));
1078
  $this->assertInstanceOf('JsonMapperTest_SimpleBase', $sn[0]);
1079
  $this->assertInstanceOf('JsonMapperTest_DerivedClass', $sn[1]);
1080
  $this->assertInstanceOf('JsonMapperTest_DerivedClass2', $sn[2]);
1134
  $this->assertEquals("hello world", $fm->simple);
1135
  $this->assertEquals("value is 123", $fm->value);
1136
  $this->assertEquals(false, $fm->bool);
1137
+ $this->assertTrue(is_bool($fm->bool));
1138
  $this->assertInstanceOf('DateTime', $fm->datetime);
1139
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->object);
1140
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->objObj);
1143
  $this->assertEquals("value is 4242", $fm->getPrivateValue());
1144
  }
1145
 
 
 
 
 
1146
  public function testFactoryMethodException()
1147
  {
1148
+ $this->expectException(JsonMapperException::class);
1149
+ $this->expectExceptionMessage("Factory method 'NonExistentMethod' referenced by 'FactoryMethodWithError' is not callable");
1150
  $jm = new JsonMapper();
1151
  $fm = $jm->map(
1152
  json_decode('{"simple":"hello world"}'),
1180
  $this->assertEquals(2, count($fm->additional));
1181
  }
1182
 
 
 
 
 
1183
  public function testAdditionalPropertiesWithPrivateMethod()
1184
  {
1185
+ $this->expectException(InvalidArgumentException::class);
1186
+ $this->expectExceptionMessage('privateAddAdditionalProperty method is not public on the given class.');
1187
  $jm = new JsonMapper();
1188
  $jm->sAdditionalPropertiesCollectionMethod = 'privateAddAdditionalProperty';
1189
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
1190
  }
1191
+
 
 
 
 
1192
  public function testAdditionalPropertiesWithBrokenMethod()
1193
  {
1194
+ $this->expectException(InvalidArgumentException::class);
1195
+ $this->expectExceptionMessage('brokenAddAdditionalProperty method does not receive two args, $key and $value.');
1196
  $jm = new JsonMapper();
1197
  $jm->sAdditionalPropertiesCollectionMethod = 'brokenAddAdditionalProperty';
1198
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
1199
  }
1200
+
 
 
 
 
1201
  public function testAdditionalPropertiesWithMissingMethod()
1202
  {
1203
+ $this->expectException(InvalidArgumentException::class);
1204
+ $this->expectExceptionMessage('missingMethod method is not available on the given class.');
1205
  $jm = new JsonMapper();
1206
  $jm->sAdditionalPropertiesCollectionMethod = 'missingMethod';
1207
  $fm = $jm->map(new stdClass, new JsonMapperTest_Simple());
1220
  $this->assertInstanceOf('JsonMapperTest_ValueObject', $fm->getAttr2());
1221
  $this->assertEquals(123123, $fm->getAttr2()->getValue());
1222
  }
1223
+
 
 
 
 
1224
  public function testMapTypeWithCtorMissingArgument()
1225
  {
1226
+ $this->expectException(JsonMapperException::class);
1227
+ $this->expectExceptionMessage('Could not find required constructor arguments for ClassWithCtor: attr2');
1228
  $jm = new JsonMapper();
1229
  $fm = $jm->mapClass(
1230
  json_decode('{"attr1":"hello"}'),
vendor/apimatic/jsonmapper/tests/JsonMapperTest/Array.php CHANGED
@@ -33,12 +33,39 @@ class JsonMapperTest_Array
33
  */
34
  public $strArray;
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * @var JsonMapperTest_Simple[]
38
  * @see http://phpdoc.org/docs/latest/references/phpdoc/types.html#arrays
39
  */
40
  public $typedArray;
41
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  /**
43
  * @var DateTime[]
44
  */
33
  */
34
  public $strArray;
35
 
36
+ /**
37
+ * @var array<string,string>
38
+ */
39
+ public $strMap;
40
+
41
+ /**
42
+ * @var array<string,string[]>
43
+ */
44
+ public $strMapOfArray;
45
+
46
+ /**
47
+ * @var array<string,string>[]
48
+ */
49
+ public $strArrayOfMap;
50
+
51
  /**
52
  * @var JsonMapperTest_Simple[]
53
  * @see http://phpdoc.org/docs/latest/references/phpdoc/types.html#arrays
54
  */
55
  public $typedArray;
56
 
57
+ /**
58
+ * @var array<string,JsonMapperTest_Simple>
59
+ * @see http://phpdoc.org/docs/latest/references/phpdoc/types.html#arrays
60
+ */
61
+ public $typedMap;
62
+
63
+ /**
64
+ * @var array<string,JsonMapperTest_Simple>[]
65
+ * @see http://phpdoc.org/docs/latest/references/phpdoc/types.html#arrays
66
+ */
67
+ public $typedArrayOfMap;
68
+
69
  /**
70
  * @var DateTime[]
71
  */
vendor/apimatic/jsonmapper/tests/JsonMapperTest/DependencyInjector.php CHANGED
@@ -7,16 +7,16 @@ class JsonMapperTest_DependencyInjector extends \apimatic\jsonmapper\JsonMapper
7
  * This method exists to be overwritten in child classes,
8
  * so you can do dependency injection or so.
9
  *
10
- * @param string $class Class name to instantiate
11
- * @param boolean $useParameter Pass $parameter to the constructor or not
12
- * @param mixed $parameter Constructor parameter
13
  *
14
  * @return object Freshly created object
15
  */
16
  public function createInstance(
17
- $class, &$jobject = null
18
  ) {
19
- $object = parent::createInstance($class, $jobject);
20
 
21
  //dummy dependency injection
22
  $object->db = 'database';
7
  * This method exists to be overwritten in child classes,
8
  * so you can do dependency injection or so.
9
  *
10
+ * @param string $class Class name to instantiate
11
+ * @param object $jobject Use jobject for constructor args
12
+ * @param bool $forMultipleTypes True if looking to map for multiple types, Default: false
13
  *
14
  * @return object Freshly created object
15
  */
16
  public function createInstance(
17
+ $class, &$jobject = null, $forMultipleTypes = false
18
  ) {
19
+ $object = parent::createInstance($class, $jobject, $forMultipleTypes);
20
 
21
  //dummy dependency injection
22
  $object->db = 'database';
vendor/apimatic/jsonmapper/tests/JsonMapperTest/JsonMapperCommentsDiscardedException.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use apimatic\jsonmapper\JsonMapperException;
4
+ use apimatic\jsonmapper\JsonMapper;
5
+
6
+ class JsonMapperCommentsDiscardedException extends JsonMapper
7
+ {
8
+ /**
9
+ * @throws JsonMapperException
10
+ */
11
+ function __construct($config)
12
+ {
13
+ $this->config = $config;
14
+
15
+ $this->zendOptimizerPlusExtensionLoaded = true;
16
+
17
+ parent::__construct();
18
+ }
19
+ }
20
+ ?>
vendor/apimatic/jsonmapper/tests/JsonMapperTest/Php7TypedClass.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- require_once 'JsonMapperTest/ValueObject.php';
4
 
5
  class Php7TypedClass
6
  {
1
  <?php
2
 
3
+ require_once 'ValueObject.php';
4
 
5
  class Php7TypedClass
6
  {
vendor/apimatic/jsonmapper/tests/JsonMapperTest/Php7_1TypedClass.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- require_once 'JsonMapperTest/ValueObject.php';
4
 
5
  class Php7_1TypedClass
6
  {
1
  <?php
2
 
3
+ require_once 'ValueObject.php';
4
 
5
  class Php7_1TypedClass
6
  {
vendor/apimatic/jsonmapper/tests/multitypetest/MultiTypeJsonMapper.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest;
4
+
5
+ use apimatic\jsonmapper\JsonMapper;
6
+
7
+ class MultiTypeJsonMapper extends JsonMapper
8
+ {
9
+ public function getType(&$value, $factoryMethods = [], $start = '', $end = '')
10
+ {
11
+ return parent::getType($value, $factoryMethods, $start, $end);
12
+ }
13
+
14
+ public function checkForType($typeGroup, $type, $start = '', $end = '')
15
+ {
16
+ return parent::checkForType($typeGroup, $type, $start, $end);
17
+ }
18
+
19
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/MultiTypeTest.php ADDED
@@ -0,0 +1,1449 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace multitypetest;
3
+ require_once __DIR__ . '/MultiTypeJsonMapper.php';
4
+ require_once __DIR__ . '/model/SimpleCaseA.php'; // have field value with anyOf("int[]","float[]","bool")
5
+ require_once __DIR__ . '/model/SimpleCaseB.php'; // have field value with oneOf("bool","int[]","array")
6
+ require_once __DIR__ . '/model/ComplexCaseA.php';
7
+ // have field value with oneOf("DateTime[]",anyOf("DateTime","string"),"ComplexCaseA")
8
+ // have field optional with oneOf("ComplexCaseA","ComplexCaseB","SimpleCaseA")
9
+ require_once __DIR__ . '/model/ComplexCaseB.php';
10
+ // have field value with anyOf("Evening[]","Morning[]","Employee","Person[]",oneOf("Vehicle","Car"))
11
+ // have field optional with anyOf("ComplexCaseA","SimpleCaseB[]","array")
12
+ require_once __DIR__ . '/model/SimpleCase.php';
13
+ require_once __DIR__ . '/model/Person.php';
14
+ require_once __DIR__ . '/model/Employee.php';
15
+ require_once __DIR__ . '/model/Postman.php';
16
+ require_once __DIR__ . '/model/Morning.php';
17
+ require_once __DIR__ . '/model/Evening.php';
18
+ require_once __DIR__ . '/model/Vehicle.php';
19
+ require_once __DIR__ . '/model/Vehicle2.php';
20
+ require_once __DIR__ . '/model/Car.php';
21
+ require_once __DIR__ . '/model/Atom.php';
22
+ require_once __DIR__ . '/model/Orbit.php';
23
+ require_once __DIR__ . '/model/OuterArrayCase.php';
24
+ require_once __DIR__ . '/model/DaysEnum.php';
25
+ require_once __DIR__ . '/model/MonthNameEnum.php';
26
+ require_once __DIR__ . '/model/MonthNumberEnum.php';
27
+
28
+ use apimatic\jsonmapper\JsonMapper;
29
+ use apimatic\jsonmapper\JsonMapperException;
30
+ use multitypetest\model\Atom;
31
+ use multitypetest\model\Car;
32
+ use multitypetest\model\Vehicle;
33
+ use PHPUnit\Framework\TestCase;
34
+ use PHPUnit\Util\Json;
35
+
36
+ /**
37
+ * @covers \apimatic\jsonmapper\JsonMapper
38
+ * @covers \apimatic\jsonmapper\TypeCombination
39
+ * @covers \apimatic\jsonmapper\JsonMapperException
40
+ */
41
+ class MultiTypeTest extends TestCase
42
+ {
43
+ public function testSimpleCaseAWithFieldFloatArray()
44
+ {
45
+ $mapper = new JsonMapper();
46
+ $json = '{"value":[1.2,3.4]}';
47
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
48
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
49
+ }
50
+
51
+ public function testSimpleCaseAWithFieldIntArray()
52
+ {
53
+ $mapper = new JsonMapper();
54
+ $json = '{"value":[1,2]}';
55
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
56
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
57
+ }
58
+
59
+ public function testSimpleCaseAWithFieldBoolean()
60
+ {
61
+ $mapper = new JsonMapper();
62
+ $json = '{"value":true}';
63
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
64
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
65
+ }
66
+
67
+ public function testSimpleCaseAFailWithConstructorArgumentMissing()
68
+ {
69
+ $this->expectException(JsonMapperException::class);
70
+ $this->expectExceptionMessage('Could not find required constructor arguments for multitypetest\model\SimpleCaseA: value');
71
+ $mapper = new JsonMapper();
72
+ $json = '{"key":true}';
73
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
74
+ }
75
+
76
+ public function testSimpleCaseAFailWithFieldBoolArray()
77
+ {
78
+ $this->expectException(JsonMapperException::class);
79
+ $this->expectExceptionMessage('Unable to map AnyOf (int[],float[],bool) on: [false,true]');
80
+ $mapper = new JsonMapper();
81
+ $json = '{"value":[false,true]}';
82
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
83
+ }
84
+
85
+ public function testSimpleCaseAFailWithFieldString()
86
+ {
87
+ $this->expectException(JsonMapperException::class);
88
+ $this->expectExceptionMessage('Unable to map AnyOf (int[],float[],bool) on: "some string"');
89
+ $mapper = new JsonMapper();
90
+ $json = '{"value":"some string"}';
91
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseA');
92
+ }
93
+
94
+ public function testSimpleCaseBWithFieldBoolean()
95
+ {
96
+ $mapper = new JsonMapper();
97
+ $json = '{"value":true}';
98
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseB');
99
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseB', $res);
100
+ }
101
+
102
+ public function testSimpleCaseBWithFieldArray()
103
+ {
104
+ $mapper = new JsonMapper();
105
+ $json = '{"value":["some","value"]}';
106
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseB');
107
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseB', $res);
108
+ }
109
+
110
+ public function testSimpleCaseBFailWithFieldIntArray()
111
+ {
112
+ $this->expectException(JsonMapperException::class);
113
+ $this->expectExceptionMessage('Cannot map more than OneOf { array and int[] } on: [2,3]');
114
+ $mapper = new JsonMapper();
115
+ $json = '{"value":[2,3]}';
116
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCaseB');
117
+ }
118
+
119
+ public function testStringOrStringList()
120
+ {
121
+ $mapper = new JsonMapper();
122
+ $json = '"some value"';
123
+ $res = $mapper->mapFor(json_decode($json), 'anyOf(string[],string)');
124
+ $this->assertEquals('some value', $res);
125
+
126
+ $json = '["some","value"]';
127
+ $res = $mapper->mapFor(json_decode($json), 'anyOf(string[],string)');
128
+ $this->assertEquals('value', $res[1]);
129
+ }
130
+
131
+ public function testNeitherStringNorStringList()
132
+ {
133
+ $this->expectException(JsonMapperException::class);
134
+ $this->expectExceptionMessage('Unable to map AnyOf (string[],string) on: [false,"value"]');
135
+ $mapper = new JsonMapper();
136
+ $json = '[false,"value"]';
137
+ $mapper->mapFor(json_decode($json), 'anyOf(string[],string)');
138
+ }
139
+
140
+ public function testAssociativeArray()
141
+ {
142
+ $mapper = new JsonMapper();
143
+ $json = ["key0" => "myString","key1" => "otherString"]; // should be mapped only by array<string,string>
144
+ $res = $mapper->mapFor($json, 'oneOf(string[],array<string,string>)');
145
+ self::assertTrue(is_array($res));
146
+ self::assertTrue(is_string($res['key0']));
147
+ self::assertTrue(is_string($res['key1']));
148
+ }
149
+
150
+ public function testEmptyArrayAndMap()
151
+ {
152
+ $mapper = new JsonMapper();
153
+ $json = '[]'; // should be mapped only by string[]
154
+ $res = $mapper->mapFor(json_decode($json), 'oneOf(string[],array<string,string>,array<string,int>)');
155
+ self::assertTrue(is_array($res));
156
+
157
+ $json = '{}'; // should be mapped only by array<string,string>
158
+ $res = $mapper->mapFor(json_decode($json), 'oneOf(string[],int[],array<string,string>)');
159
+ self::assertTrue(is_array($res));
160
+ }
161
+
162
+ public function testEmptyArrayFail()
163
+ {
164
+ $this->expectException(JsonMapperException::class);
165
+ $this->expectExceptionMessage('Cannot map more than OneOf { int[] and string[] } on: []');
166
+ $mapper = new JsonMapper();
167
+ $json = '[]';
168
+ $mapper->mapFor(json_decode($json), 'oneOf(string[],int[],array<string,int>)');
169
+ }
170
+
171
+ public function testEmptyMapFail()
172
+ {
173
+ $this->expectException(JsonMapperException::class);
174
+ $this->expectExceptionMessage('Cannot map more than OneOf { array<string,string> and array<string,int> } on: {}');
175
+ $mapper = new JsonMapper();
176
+ $json = '{}';
177
+ $mapper->mapFor(json_decode($json), 'oneOf(array<string,int>,array<string,string>,string[])');
178
+ }
179
+
180
+ public function testNullableObjectOrBool()
181
+ {
182
+ $mapper = new JsonMapper();
183
+ $json = '["some","value"]';
184
+ $res = $mapper->mapFor(json_decode($json), 'oneOf(anyOf(array,null),bool)');
185
+ $this->assertEquals('value', $res[1]);
186
+
187
+ $json = '{"key":false}';
188
+ $res = $mapper->mapFor(json_decode($json), 'oneOf(anyOf(array,null),bool)');
189
+ $this->assertEquals('key', array_keys($res)[0]);
190
+ $this->assertEquals(false, array_values($res)[0]);
191
+
192
+ $res = $mapper->mapFor(false, 'oneOf(anyOf(array,null),bool)');
193
+ $this->assertEquals(false, $res);
194
+
195
+ $res = $mapper->mapFor(null, 'oneOf(anyOf(array,null),bool)');
196
+ $this->assertEquals(null, $res);
197
+ }
198
+
199
+ public function testNullableOnNonNullable()
200
+ {
201
+ $mapper = new JsonMapper();
202
+ $this->expectException(JsonMapperException::class);
203
+ $this->expectExceptionMessage('Unable to map AnyOf (array,bool) on: null');
204
+ $mapper->mapFor(null, 'oneOf(array,bool)');
205
+ }
206
+
207
+ public function testMixedOrInt()
208
+ {
209
+ $mapper = new JsonMapper();
210
+ $json = '{"passed":false}';
211
+ $res = $mapper->mapFor(json_decode($json), 'oneOf(mixed,int)');
212
+ $this->assertEquals(false, $res->passed);
213
+
214
+ $json = 'passed string';
215
+ $res = $mapper->mapFor($json, 'oneOf(mixed,int)');
216
+ $this->assertEquals('passed string', $res);
217
+ }
218
+
219
+ public function testMixedAndIntFail()
220
+ {
221
+ $mapper = new JsonMapper();
222
+ $this->expectException(JsonMapperException::class);
223
+ $this->expectExceptionMessage('Cannot map more than OneOf { int and mixed } on: 502');
224
+ $mapper->mapFor(502, 'oneOf(mixed,int)');
225
+ }
226
+
227
+ public function testOneOfModelsWithSameReqFieldNameAndDifferentType()
228
+ {
229
+ $mapper = new JsonMapper();
230
+ $json = '{"numberOfTyres":"2"}';
231
+ $res = $mapper->mapFor(
232
+ json_decode($json),
233
+ 'oneOf(Vehicle,Vehicle2)',
234
+ 'multitypetest\model'
235
+ );
236
+ $this->assertInstanceOf('\multitypetest\model\Vehicle', $res);
237
+
238
+ $json = '{"numberOfTyres":2}';
239
+ $res = $mapper->mapFor(
240
+ json_decode($json),
241
+ 'oneOf(Vehicle,Vehicle2)',
242
+ 'multitypetest\model'
243
+ );
244
+ $this->assertInstanceOf('\multitypetest\model\Vehicle2', $res);
245
+
246
+ $json = '{"value":[2,6]}';
247
+ $res = $mapper->mapFor(
248
+ json_decode($json),
249
+ 'oneOf(SimpleCase,SimpleCaseA)',
250
+ 'multitypetest\model'
251
+ );
252
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
253
+
254
+ $json = '{"value":["3","2"]}';
255
+ $res = $mapper->mapFor(
256
+ json_decode($json),
257
+ 'oneOf(SimpleCase,SimpleCaseA)',
258
+ 'multitypetest\model'
259
+ );
260
+ $this->assertInstanceOf('\multitypetest\model\SimpleCase', $res);
261
+ }
262
+
263
+ public function testMapClassWithoutStrictType()
264
+ {
265
+ $mapper = new JsonMapper();
266
+ $json = '{"numberOfTyres":"2"}';
267
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\Vehicle2');
268
+ $this->assertInstanceOf('\multitypetest\model\Vehicle2', $res);
269
+ }
270
+
271
+ public function testMapClassWithStrictTypeFail()
272
+ {
273
+ $mapper = new JsonMapper();
274
+ $this->expectException(JsonMapperException::class);
275
+ $this->expectExceptionMessage("Could not set type 'int' on value: \"2\"");
276
+ $json = '{"numberOfTyres":"2"}';
277
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\Vehicle2', true);
278
+ }
279
+
280
+ public function testMapClassContainingArrayWithoutStrictType()
281
+ {
282
+ $mapper = new JsonMapper();
283
+ $json = '{"value":[2,6]}';
284
+ $res = $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCase');
285
+ $this->assertInstanceOf('\multitypetest\model\SimpleCase', $res);
286
+ }
287
+
288
+ public function testMapClassContainingArrayWithStrictTypeFail()
289
+ {
290
+ $mapper = new JsonMapper();
291
+ $this->expectException(JsonMapperException::class);
292
+ $this->expectExceptionMessage("Could not set type 'string' on value: 2");
293
+ $json = '{"value":[2,6]}';
294
+ $mapper->mapClass(json_decode($json), '\multitypetest\model\SimpleCase', true);
295
+ }
296
+
297
+ public function testStringOrSimpleCaseA()
298
+ {
299
+ $mapper = new JsonMapper();
300
+ $json = '{"value":[1.2]}';
301
+ $res = $mapper->mapFor(
302
+ json_decode($json),
303
+ 'oneOf(string,SimpleCaseA)',
304
+ 'multitypetest\model'
305
+ );
306
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
307
+
308
+ $json = '{"value":[1.2]}';
309
+ $res = $mapper->mapFor(
310
+ $json,
311
+ 'oneOf(string,SimpleCaseA)',
312
+ 'multitypetest\model'
313
+ );
314
+ $this->assertEquals('{"value":[1.2]}', $res);
315
+ }
316
+
317
+ public function testOneOfSimpleCases()
318
+ {
319
+ $mapper = new JsonMapper();
320
+ $json = '{"value":["aplha","beta","gamma"]}';
321
+ $res = $mapper->mapFor(
322
+ json_decode($json),
323
+ 'oneOf(SimpleCaseA,SimpleCaseB)',
324
+ 'multitypetest\model'
325
+ );
326
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseB', $res);
327
+ }
328
+
329
+ public function testOneOfSimpleCasesWithFieldArrayAndFloatArrayFail()
330
+ {
331
+ $this->expectException(JsonMapperException::class);
332
+ $this->expectExceptionMessage('Cannot map more than OneOf { SimpleCaseB and SimpleCaseA } on: {"value":[2.2,3.3]}');
333
+ $mapper = new JsonMapper();
334
+ $json = '{"value":[2.2,3.3]}';
335
+ $mapper->mapFor(
336
+ json_decode($json),
337
+ 'oneOf(SimpleCaseA,SimpleCaseB)',
338
+ 'multitypetest\model'
339
+ );
340
+ }
341
+
342
+ public function testAnyOfSimpleCases()
343
+ {
344
+ $mapper = new JsonMapper();
345
+ $json = '{"value":[2.2,3.3]}';
346
+ $res = $mapper->mapFor(
347
+ json_decode($json),
348
+ 'anyOf(SimpleCaseA,SimpleCaseB)',
349
+ 'multitypetest\model'
350
+ );
351
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res);
352
+
353
+ $json = '{"value":[2.2,3.3]}';
354
+ $res = $mapper->mapFor(
355
+ json_decode($json),
356
+ 'anyOf(SimpleCaseB,SimpleCaseA)',
357
+ 'multitypetest\model'
358
+ );
359
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseB', $res);
360
+
361
+ $json = '{"value":["string1","string2"]}';
362
+ $res = $mapper->mapFor(
363
+ json_decode($json),
364
+ 'anyOf(SimpleCaseA,SimpleCaseB)',
365
+ 'multitypetest\model'
366
+ );
367
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseB', $res);
368
+ }
369
+
370
+ public function testAnyOfSimpleCasesFailWithFieldString()
371
+ {
372
+ $this->expectException(JsonMapperException::class);
373
+ $this->expectExceptionMessage('Unable to map AnyOf (SimpleCaseA,SimpleCaseB) on: {"value":"some value"}');
374
+ $mapper = new JsonMapper();
375
+ $json = '{"value":"some value"}';
376
+ $mapper->mapFor(
377
+ json_decode($json),
378
+ 'anyOf(SimpleCaseA,SimpleCaseB)',
379
+ 'multitypetest\model'
380
+ );
381
+ }
382
+
383
+ public function testArrayAndObject()
384
+ {
385
+ $mapper = new JsonMapper();
386
+ $json = '{"numberOfElectrons":4}';
387
+ // oneof array of int & Atom (having all int fields)
388
+ $res = $mapper->mapFor(
389
+ json_decode($json),
390
+ 'oneOf(Atom,int[])',
391
+ 'multitypetest\model'
392
+ );
393
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res);
394
+ }
395
+
396
+ public function testMapAndObject()
397
+ {
398
+ $mapper = new JsonMapper();
399
+ $this->expectException(JsonMapperException::class);
400
+ $this->expectExceptionMessage('Cannot map more than OneOf { array<string,int> and Atom } on: {"numberOfElectrons":4}');
401
+ $json = '{"numberOfElectrons":4}';
402
+ // oneof map of int & Atom (having all int fields)
403
+ $mapper->mapFor(
404
+ json_decode($json),
405
+ 'oneOf(Atom,array<string,int>)',
406
+ 'multitypetest\model'
407
+ );
408
+ }
409
+
410
+ public function testArrayOfMapAndArrayOfObject()
411
+ {
412
+ $mapper = new JsonMapper();
413
+ $this->expectException(JsonMapperException::class);
414
+ $this->expectExceptionMessage('Cannot map more than OneOf { array<string,int>[] and Atom[] } on: [{"numberOfElectrons":4,"numberOfProtons":2}]');
415
+ $json = '[{"numberOfElectrons":4,"numberOfProtons":2}]';
416
+ // oneof arrayOfmap of int & array of Atom (having all int fields)
417
+ $mapper->mapFor(
418
+ json_decode($json),
419
+ 'oneOf(Atom[],array<string,int>[])',
420
+ 'multitypetest\model'
421
+ );
422
+ }
423
+
424
+ public function testArrayOfMapOrArrayOfObject()
425
+ {
426
+ $mapper = new JsonMapper();
427
+ $json = '[{"numberOfElectrons":4,"numberOfProtons":2}]';
428
+ $res = $mapper->mapFor(
429
+ json_decode($json),
430
+ 'anyOf(Atom[],int[][])',
431
+ 'multitypetest\model'
432
+ );
433
+ $this->assertTrue(is_array($res));
434
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0]);
435
+ }
436
+
437
+ public function testOneOfObjectsFailWithSameRequiredFields()
438
+ {
439
+ $this->expectException(JsonMapperException::class);
440
+ $this->expectExceptionMessage('Cannot map more than OneOf { Orbit and Atom } on: {"numberOfProtons":4,"numberOfElectrons":4}');
441
+ $mapper = new JsonMapper();
442
+ $json = '{"numberOfProtons":4,"numberOfElectrons":4}';
443
+ // oneof Orbit (did not have # of protons) & Atom (have # of protons optional)
444
+ $mapper->mapFor(
445
+ json_decode($json),
446
+ 'oneOf(Atom,Orbit)',
447
+ 'multitypetest\model'
448
+ );
449
+ }
450
+
451
+ public function testComplexCases()
452
+ {
453
+ $mapper = new JsonMapper();
454
+ $mapper->arChildClasses['multitypetest\model\Vehicle'] = [
455
+ 'multitypetest\model\Car',
456
+ ];
457
+
458
+ $json = '{"value": "199402-19", "optional": {"value": [23,24]}}';
459
+ $res = $mapper->mapClass(json_decode($json),'\multitypetest\model\ComplexCaseA');
460
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseA', $res);
461
+ $this->assertTrue(is_string($res->getValue()));
462
+ $this->assertInstanceOf('\multitypetest\model\SimpleCaseA', $res->getOptional());
463
+ $this->assertTrue(is_int($res->getOptional()->getValue()[0]));
464
+
465
+ $json = '{"value": "1994-02-12", "optional": {"value": ["1994-02-13","1994-02-14"],
466
+ "optional": {"value": {"numberOfTyres":"4"}, "optional":[234,567]}}}';
467
+ $res = $mapper->mapClass(json_decode($json),'\multitypetest\model\ComplexCaseA');
468
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseA', $res);
469
+ $this->assertInstanceOf('\DateTime', $res->getValue());
470
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseA', $res->getOptional());
471
+ $this->assertInstanceOf('\DateTime', $res->getOptional()->getValue()[0]);
472
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseB', $res->getOptional()->getOptional());
473
+ $this->assertInstanceOf('\multitypetest\model\Vehicle', $res->getOptional()->getOptional()->getValue());
474
+ $this->assertTrue(is_int($res->getOptional()->getOptional()->getOptional()[0]));
475
+ }
476
+
477
+ public function testComplexCasesWithDiscriminators()
478
+ {
479
+ $mapper = new JsonMapper();
480
+ $mapper->arChildClasses['multitypetest\model\Person'] = [
481
+ 'multitypetest\model\Postman',
482
+ 'multitypetest\model\Employee',
483
+ ];
484
+ $json = '{"value":[{"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321",' .
485
+ '"birthday":"1994-02-13","personType":"Per"},{"name":"Shahid Khaliq","age":5147483645,' .
486
+ '"address":"H # 531, S # 20","uid":"123321","birthday":"1994-02-13","personType":"Per"},' .
487
+ '{"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321",' .
488
+ '"birthday":"1994-02-13","personType":"Per"}]}';
489
+ $res = $mapper->mapFor(
490
+ json_decode($json),
491
+ 'anyOf(ComplexCaseA,ComplexCaseB)',
492
+ 'multitypetest\model'
493
+ );
494
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseB', $res);
495
+ $this->assertInstanceOf('\multitypetest\model\Person', $res->getValue()[0]);
496
+ $this->assertInstanceOf('\multitypetest\model\Person', $res->getValue()[1]);
497
+ $this->assertInstanceOf('\multitypetest\model\Person', $res->getValue()[2]);
498
+
499
+ $json = '{"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321",' .
500
+ '"birthday":"1994-02-13","personType":"Empl"}';
501
+ $res = $mapper->mapFor(
502
+ json_decode($json),
503
+ 'oneOf(Employee,Person)',
504
+ 'multitypetest\model'
505
+ );
506
+ $this->assertInstanceOf('\multitypetest\model\Employee', $res);
507
+
508
+ $json = '{"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321",' .
509
+ '"birthday":"1994-02-13","personType":"Empl"}';
510
+ $res = $mapper->mapFor(
511
+ json_decode($json),
512
+ 'anyOf(Person,Employee)',
513
+ 'multitypetest\model'
514
+ );
515
+ $this->assertInstanceOf('\multitypetest\model\Employee', $res);
516
+
517
+ $json = '{"startsAt":"15:00","endsAt":"21:00","sessionType":"Evening"}';
518
+ $res = $mapper->mapFor(
519
+ json_decode($json),
520
+ 'oneOf(Evening,Morning)',
521
+ 'multitypetest\model'
522
+ );
523
+ $this->assertInstanceOf('\multitypetest\model\Evening', $res);
524
+
525
+ $json = '{"value": [{"startsAt":"15:00","endsAt":"21:00","sessionType":"Evening"},' .
526
+ '{"startsAt":"15:00","endsAt":"21:00","sessionType":"Evening"}]}';
527
+ $res = $mapper->mapFor(
528
+ json_decode($json),
529
+ 'anyOf(ComplexCaseA,ComplexCaseB)',
530
+ 'multitypetest\model'
531
+ );
532
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseB', $res);
533
+ $this->assertInstanceOf('\multitypetest\model\Evening', $res->getValue()[0]);
534
+ $this->assertInstanceOf('\multitypetest\model\Evening', $res->getValue()[1]);
535
+
536
+ $json = '{"value": [{"startsAt":"15:00","endsAt":"21:00","sessionType":"Morning"},' .
537
+ '{"startsAt":"15:00","endsAt":"21:00","sessionType":"Morning"}]}';
538
+ $res = $mapper->mapFor(
539
+ json_decode($json),
540
+ 'anyOf(ComplexCaseA,ComplexCaseB)',
541
+ 'multitypetest\model'
542
+ );
543
+ $this->assertInstanceOf('\multitypetest\model\ComplexCaseB', $res);
544
+ $this->assertInstanceOf('\multitypetest\model\Morning', $res->getValue()[0]);
545
+ $this->assertInstanceOf('\multitypetest\model\Morning', $res->getValue()[1]);
546
+ }
547
+
548
+ public function testDiscriminatorsFailWithDiscriminatorMatchesParent()
549
+ {
550
+ $mapper = new JsonMapper();
551
+ $mapper->arChildClasses['multitypetest\model\Person'] = [
552
+ 'multitypetest\model\Postman',
553
+ 'multitypetest\model\Employee',
554
+ ];
555
+ $this->expectException(JsonMapperException::class);
556
+ $this->expectExceptionMessage('Unable to map AnyOf (Postman,Employee) on: {"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321","birthday":"1994-02-13","personType":"Per"}');
557
+ $json = '{"name":"Shahid Khaliq","age":5147483645,"address":"H # 531, S # 20","uid":"123321",' .
558
+ '"birthday":"1994-02-13","personType":"Per"}';
559
+ $mapper->mapFor(
560
+ json_decode($json),
561
+ 'anyOf(Postman,Employee)',
562
+ 'multitypetest\model'
563
+ );
564
+ }
565
+
566
+ public function testDiscriminatorsMatchedButFailedWithOneOf()
567
+ {
568
+ $mapper = new JsonMapper();
569
+ $this->expectException(JsonMapperException::class);
570
+ $this->expectExceptionMessage('Cannot map more than OneOf { array and Morning } on: {"startsAt":"15:00","endsAt":"21:00","sessionType":"Morning"}');
571
+ $json = '{"startsAt":"15:00","endsAt":"21:00","sessionType":"Morning"}';
572
+ $mapper->mapFor(
573
+ json_decode($json),
574
+ 'oneOf(Morning,Evening,array)',
575
+ 'multitypetest\model'
576
+ );
577
+ }
578
+
579
+ public function testArrays()
580
+ {
581
+ $mapper = new JsonMapper();
582
+ $json = '[true,false]';
583
+ $res = $mapper->mapFor(json_decode($json),'oneOf(bool[],int[])');
584
+ $this->assertTrue(is_array($res));
585
+ $this->assertTrue(is_bool($res[0]));
586
+ $this->assertTrue(is_bool($res[1]));
587
+ }
588
+
589
+ public function testMaps()
590
+ {
591
+ $mapper = new JsonMapper();
592
+ $json = '{"value1":31,"value2":32}';
593
+ $res = $mapper->mapFor(json_decode($json),'oneOf(array<string,bool>,array<string,int>)');
594
+ $this->assertTrue(is_array($res));
595
+ $this->assertTrue(is_int($res['value1']));
596
+ $this->assertTrue(is_int($res['value2']));
597
+ }
598
+
599
+ public function testMapOfArrays()
600
+ {
601
+ $mapper = new JsonMapper();
602
+ $json = '{"value":[true,false]}';
603
+ $res = $mapper->mapFor(json_decode($json),'oneOf(array<string,bool[]>,array<string,int[]>)');
604
+ $this->assertTrue(is_array($res));
605
+ $this->assertTrue(is_array($res['value']));
606
+ $this->assertTrue(is_bool($res['value'][0]));
607
+
608
+ $json = '{"value":[{"numberOfElectrons":4},{"numberOfElectrons":9}]}';
609
+ $res = $mapper->mapFor(
610
+ json_decode($json),
611
+ 'oneOf(array<string,Atom[]>,array<string,Car[]>)',
612
+ 'multitypetest\model'
613
+ );
614
+ $this->assertTrue(is_array($res));
615
+ $this->assertTrue(is_array($res['value']));
616
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['value'][0]);
617
+ }
618
+
619
+ public function testArrayOfMaps()
620
+ {
621
+ $mapper = new JsonMapper();
622
+ $json = '[{"value":true,"value2":false},{"someBool":false}]';
623
+ $res = $mapper->mapFor(
624
+ json_decode($json),
625
+ 'oneOf(array<string,bool>[],array<string,int>[])',
626
+ 'multitypetest\model'
627
+ );
628
+ $this->assertTrue(is_array($res));
629
+ $this->assertTrue(is_array($res[0]));
630
+ $this->assertTrue(is_array($res[1]));
631
+ $this->assertTrue(is_bool($res[0]['value']));
632
+ $this->assertTrue(is_bool($res[0]['value2']));
633
+ $this->assertTrue(is_bool($res[1]['someBool']));
634
+
635
+ $json = '[{"atom1":{"numberOfElectrons":4},"atom2":{"numberOfElectrons":9}}]';
636
+ $res = $mapper->mapFor(
637
+ json_decode($json),
638
+ 'oneOf(array<string,Atom>[],array<string,Car>[])',
639
+ 'multitypetest\model'
640
+ );
641
+ $this->assertTrue(is_array($res));
642
+ $this->assertTrue(is_array($res[0]));
643
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0]['atom1']);
644
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0]['atom2']);
645
+ }
646
+
647
+ public function testMultiDimensionalMaps()
648
+ {
649
+ $mapper = new JsonMapper();
650
+ $json = '{"key0":{"value":true,"value2":false},"key1":{"someBool":false}}';
651
+ $res = $mapper->mapFor(
652
+ json_decode($json),
653
+ 'oneOf(array<string,array<string,bool>>,array<string,array<string,int>>)',
654
+ 'multitypetest\model'
655
+ );
656
+ $this->assertTrue(is_array($res));
657
+ $this->assertTrue(is_array($res['key0']));
658
+ $this->assertTrue(is_array($res['key1']));
659
+ $this->assertTrue(is_bool($res['key0']['value']));
660
+ $this->assertTrue(is_bool($res['key0']['value2']));
661
+ $this->assertTrue(is_bool($res['key1']['someBool']));
662
+
663
+ $json = '{"key":{"atom1":{"numberOfElectrons":4},"atom2":{"numberOfElectrons":9}}}';
664
+ $res = $mapper->mapFor(
665
+ json_decode($json),
666
+ 'oneOf(array<string,array<string,Atom>>,array<string,array<string,Car>>)',
667
+ 'multitypetest\model'
668
+ );
669
+ $this->assertTrue(is_array($res));
670
+ $this->assertTrue(is_array($res['key']));
671
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['key']['atom1']);
672
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['key']['atom2']);
673
+ }
674
+
675
+ public function testMultiDimensionalArrays()
676
+ {
677
+ $mapper = new JsonMapper();
678
+ $json = '[[true,false],[false,false]]';
679
+ $res = $mapper->mapFor(
680
+ json_decode($json),
681
+ 'oneOf(bool[][],int[][])',
682
+ 'multitypetest\model'
683
+ );
684
+ $this->assertTrue(is_array($res));
685
+ $this->assertTrue(is_array($res[0]));
686
+ $this->assertTrue(is_array($res[1]));
687
+ $this->assertTrue(is_bool($res[0][0]));
688
+ $this->assertTrue(is_bool($res[0][1]));
689
+
690
+ $json = '[[{"numberOfElectrons":4},{"numberOfElectrons":9}],[{"numberOfElectrons":2}]]';
691
+ $res = $mapper->mapFor(
692
+ json_decode($json),
693
+ 'oneOf(Atom[][],Car[][])',
694
+ 'multitypetest\model'
695
+ );
696
+ $this->assertTrue(is_array($res));
697
+ $this->assertTrue(is_array($res[0]));
698
+ $this->assertTrue(is_array($res[1]));
699
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0][0]);
700
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[1][0]);
701
+ }
702
+
703
+ public function testOuterArrayInModelField()
704
+ {
705
+ $mapper = new JsonMapper();
706
+ $json = '{"value":[true,[1,2],"abc"]}';
707
+ $res = $mapper->mapClass(
708
+ json_decode($json),
709
+ '\multitypetest\model\OuterArrayCase'
710
+ );
711
+ $this->assertInstanceOf('\multitypetest\model\OuterArrayCase', $res);
712
+ }
713
+
714
+ public function testOuterArray()
715
+ {
716
+ $mapper = new JsonMapper();
717
+ $json = '[true,{"numberOfElectrons":4,"numberOfProtons":2},false]';
718
+ $res = $mapper->mapFor(
719
+ json_decode($json),
720
+ 'oneOf(bool,Atom)[]',
721
+ 'multitypetest\model'
722
+ );
723
+ $this->assertTrue(is_array($res));
724
+ $this->assertTrue($res[0] === true);
725
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[1]);
726
+ $this->assertTrue($res[2] === false);
727
+ }
728
+
729
+ public function testOuterMap()
730
+ {
731
+ $mapper = new JsonMapper();
732
+ $json = '{"key1":true,"key2":{"numberOfElectrons":4,"numberOfProtons":2},"key3":false}';
733
+ $res = $mapper->mapFor(
734
+ json_decode($json),
735
+ 'array<string,oneOf(bool,Atom)>',
736
+ 'multitypetest\model'
737
+ );
738
+ $this->assertTrue(is_array($res));
739
+ $this->assertTrue($res['key1'] === true);
740
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['key2']);
741
+ $this->assertTrue($res['key3'] === false);
742
+ }
743
+
744
+ public function testOuterMapOfArrays()
745
+ {
746
+ $mapper = new JsonMapper();
747
+ $json = '{"value":[{"numberOfElectrons":4},{"haveTrunk":false,"numberOfTyres":"6"}]}';
748
+ $res = $mapper->mapFor(
749
+ json_decode($json),
750
+ 'array<string,oneOf(Atom,Car)[]>',
751
+ 'multitypetest\model'
752
+ );
753
+ $this->assertTrue(is_array($res));
754
+ $this->assertTrue(is_array($res['value']));
755
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['value'][0]);
756
+ $this->assertInstanceOf('\multitypetest\model\Car', $res['value'][1]);
757
+
758
+ $json = '{"value":[[[{"numberOfElectrons":4}]],[[true,true],[false,true]]]}';
759
+ $res = $mapper->mapFor(
760
+ json_decode($json),
761
+ 'array<string,oneOf(Atom[][],bool[][])[]>',
762
+ 'multitypetest\model'
763
+ );
764
+ $this->assertTrue(is_array($res));
765
+ $this->assertTrue(is_array($res['value']));
766
+ $this->assertTrue(is_array($res['value'][0]));
767
+ $this->assertTrue(is_array($res['value'][0][0]));
768
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['value'][0][0][0]);
769
+ $this->assertTrue(is_array($res['value'][1]));
770
+ $this->assertTrue(is_array($res['value'][1][0]));
771
+ $this->assertTrue(is_bool($res['value'][1][0][0]));
772
+ $this->assertTrue(is_array($res['value'][1][1]));
773
+ $this->assertTrue(is_bool($res['value'][1][1][0]));
774
+
775
+ $json = '{"key0":["alpha",true],"key1":["beta",[12,{"numberOfElectrons":4}],[1,3]],"key2":[false,true]}';
776
+ $res = $mapper->mapFor(
777
+ json_decode($json),
778
+ 'array<string,anyOf(bool,oneOf(int,Atom)[],string)[]>',
779
+ 'multitypetest\model'
780
+ );
781
+ $this->assertTrue(is_array($res));
782
+ $this->assertTrue(is_array($res['key0']));
783
+ $this->assertTrue($res['key0'][0] === 'alpha');
784
+ $this->assertTrue(is_array($res['key1']));
785
+ $this->assertTrue($res['key1'][0] === 'beta');
786
+ $this->assertTrue(is_array($res['key1'][1]));
787
+ $this->assertTrue($res['key1'][1][0] === 12);
788
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['key1'][1][1]);
789
+ $this->assertTrue(is_array($res['key2']));
790
+ $this->assertTrue($res['key2'][0] === false);
791
+ }
792
+
793
+ public function testOuterArrayOfMaps()
794
+ {
795
+ $mapper = new JsonMapper();
796
+ $json = '[{"key0":{"numberOfElectrons":4},"key1":{"haveTrunk":false,"numberOfTyres":"6"}}]';
797
+ $res = $mapper->mapFor(
798
+ json_decode($json),
799
+ 'array<string,oneOf(Atom,Car)>[]',
800
+ 'multitypetest\model'
801
+ );
802
+ $this->assertTrue(is_array($res));
803
+ $this->assertTrue(is_array($res[0]));
804
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0]['key0']);
805
+ $this->assertInstanceOf('\multitypetest\model\Car', $res[0]['key1']);
806
+
807
+ $json = '[{"key0":[[{"numberOfElectrons":4}]],"key1":[[true,true],[false,true]]}]';
808
+ $res = $mapper->mapFor(
809
+ json_decode($json),
810
+ 'array<string,oneOf(Atom[][],bool[][])>[]',
811
+ 'multitypetest\model'
812
+ );
813
+ $this->assertTrue(is_array($res));
814
+ $this->assertTrue(is_array($res[0]));
815
+ $this->assertTrue(is_array($res[0]['key0']));
816
+ $this->assertTrue(is_array($res[0]['key0'][0]));
817
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0]['key0'][0][0]);
818
+ $this->assertTrue(is_array($res[0]['key1']));
819
+ $this->assertTrue(is_array($res[0]['key1'][0]));
820
+ $this->assertTrue(is_bool($res[0]['key1'][0][0]));
821
+ $this->assertTrue(is_array($res[0]['key1'][1]));
822
+ $this->assertTrue(is_bool($res[0]['key1'][1][0]));
823
+
824
+ $json = '[{"key0":"alpha","key1":true},{"key0":"beta","key1":[12,{"numberOfElectrons":4}],"key2":[1,3]},{"key0":false,"key1":true}]';
825
+ $res = $mapper->mapFor(
826
+ json_decode($json),
827
+ 'array<string,anyOf(bool,oneOf(int,Atom)[],string)>[]',
828
+ 'multitypetest\model'
829
+ );
830
+ $this->assertTrue(is_array($res));
831
+ $this->assertTrue(is_array($res[0]));
832
+ $this->assertTrue($res[0]['key0'] === 'alpha');
833
+ $this->assertTrue(is_bool($res[0]['key1']));
834
+ $this->assertTrue(is_array($res[1]));
835
+ $this->assertTrue($res[1]['key0'] === 'beta');
836
+ $this->assertTrue(is_array($res[1]['key1']));
837
+ $this->assertTrue($res[1]['key1'][0] === 12);
838
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[1]['key1'][1]);
839
+ $this->assertTrue(is_array($res[1]['key2']));
840
+ $this->assertTrue($res[1]['key2'][0] === 1);
841
+ $this->assertTrue(is_array($res[2]));
842
+ $this->assertTrue($res[2]['key0'] === false);
843
+ $this->assertTrue($res[2]['key1'] === true);
844
+ }
845
+
846
+ public function testOuterMultiDimensionalMaps()
847
+ {
848
+ $mapper = new JsonMapper();
849
+ $json = '{"item":{"key0":{"numberOfElectrons":4},"key1":{"haveTrunk":false,"numberOfTyres":"6"}}}';
850
+ $res = $mapper->mapFor(
851
+ json_decode($json),
852
+ 'array<string,array<string,oneOf(Atom,Car)>>',
853
+ 'multitypetest\model'
854
+ );
855
+ $this->assertTrue(is_array($res));
856
+ $this->assertTrue(is_array($res['item']));
857
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['item']['key0']);
858
+ $this->assertInstanceOf('\multitypetest\model\Car', $res['item']['key1']);
859
+
860
+ $json = '{"item":{"key0":[[{"numberOfElectrons":4}]],"key1":[[true,true],[false,true]]}}';
861
+ $res = $mapper->mapFor(
862
+ json_decode($json),
863
+ 'array<string,array<string,oneOf(Atom[][],bool[][])>>',
864
+ 'multitypetest\model'
865
+ );
866
+ $this->assertTrue(is_array($res));
867
+ $this->assertTrue(is_array($res['item']));
868
+ $this->assertTrue(is_array($res['item']['key0']));
869
+ $this->assertTrue(is_array($res['item']['key0'][0]));
870
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['item']['key0'][0][0]);
871
+ $this->assertTrue(is_array($res['item']['key1']));
872
+ $this->assertTrue(is_array($res['item']['key1'][0]));
873
+ $this->assertTrue(is_bool($res['item']['key1'][0][0]));
874
+ $this->assertTrue(is_array($res['item']['key1'][1]));
875
+ $this->assertTrue(is_bool($res['item']['key1'][1][0]));
876
+
877
+ $json = '{"item0":{"key0":"alpha","key1":true},"item1":{"key0":"beta","key1":[12,{"numberOfElectrons":4}],"key2":[1,3]},"item2":{"key0":false,"key1":true}}';
878
+ $res = $mapper->mapFor(
879
+ json_decode($json),
880
+ 'array<string,array<string,anyOf(bool,oneOf(int,Atom)[],string)>>',
881
+ 'multitypetest\model'
882
+ );
883
+ $this->assertTrue(is_array($res));
884
+ $this->assertTrue(is_array($res['item0']));
885
+ $this->assertTrue($res['item0']['key0'] === 'alpha');
886
+ $this->assertTrue(is_bool($res['item0']['key1']));
887
+ $this->assertTrue(is_array($res['item1']));
888
+ $this->assertTrue($res['item1']['key0'] === 'beta');
889
+ $this->assertTrue(is_array($res['item1']['key1']));
890
+ $this->assertTrue($res['item1']['key1'][0] === 12);
891
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res['item1']['key1'][1]);
892
+ $this->assertTrue(is_array($res['item1']['key2']));
893
+ $this->assertTrue($res['item1']['key2'][0] === 1);
894
+ $this->assertTrue(is_array($res['item2']));
895
+ $this->assertTrue($res['item2']['key0'] === false);
896
+ $this->assertTrue($res['item2']['key1'] === true);
897
+ }
898
+
899
+ public function testOuterMultiDimensionalArray()
900
+ {
901
+ $mapper = new JsonMapper();
902
+ $json = '[[{"numberOfElectrons":4},{"haveTrunk":false,"numberOfTyres":"6"}]]';
903
+ $res = $mapper->mapFor(
904
+ json_decode($json),
905
+ 'oneOf(Atom,Car)[][]',
906
+ 'multitypetest\model'
907
+ );
908
+ $this->assertTrue(is_array($res));
909
+ $this->assertTrue(is_array($res[0]));
910
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0][0]);
911
+ $this->assertInstanceOf('\multitypetest\model\Car', $res[0][1]);
912
+
913
+ $json = '[[[[{"numberOfElectrons":4}]],[[true,true],[false,true]]]]';
914
+ $res = $mapper->mapFor(
915
+ json_decode($json),
916
+ 'oneOf(Atom[][],bool[][])[][]',
917
+ 'multitypetest\model'
918
+ );
919
+ $this->assertTrue(is_array($res));
920
+ $this->assertTrue(is_array($res[0]));
921
+ $this->assertTrue(is_array($res[0][0]));
922
+ $this->assertTrue(is_array($res[0][0][0]));
923
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[0][0][0][0]);
924
+ $this->assertTrue(is_array($res[0][1]));
925
+ $this->assertTrue(is_array($res[0][1][0]));
926
+ $this->assertTrue(is_bool($res[0][1][0][0]));
927
+ $this->assertTrue(is_array($res[0][1][1]));
928
+ $this->assertTrue(is_bool($res[0][1][1][0]));
929
+
930
+ $json = '[["alpha",true],["beta",[12,{"numberOfElectrons":4}],[1,3]],[false,true]]';
931
+ $res = $mapper->mapFor(
932
+ json_decode($json),
933
+ 'anyOf(bool,oneOf(int,Atom)[],string)[][]',
934
+ 'multitypetest\model'
935
+ );
936
+ $this->assertTrue(is_array($res));
937
+ $this->assertTrue(is_array($res[0]));
938
+ $this->assertTrue($res[0][0] === 'alpha');
939
+ $this->assertTrue(is_array($res[1]));
940
+ $this->assertTrue($res[1][0] === 'beta');
941
+ $this->assertTrue(is_array($res[1][1]));
942
+ $this->assertTrue($res[1][1][0] === 12);
943
+ $this->assertInstanceOf('\multitypetest\model\Atom', $res[1][1][1]);
944
+ $this->assertTrue(is_array($res[2]));
945
+ $this->assertTrue($res[2][0] === false);
946
+ }
947
+
948
+ public function testOuterArrayFailWithAnyOf()
949
+ {
950
+ $mapper = new JsonMapper();
951
+ $this->expectException(JsonMapperException::class);
952
+ $this->expectExceptionMessage('Unable to map AnyOf (float[],anyOf(bool,oneOf(int,Atom)[],string)[][]) on: {"key0":["alpha",true],"key2":[false,true],"key3":[1.1,3.3],"key1":["beta",[12,{"numberOfElectrons":4}],[1,3]]}');
953
+ $json = '{"key0":["alpha",true],"key2":[false,true],"key3":[1.1,3.3]' .
954
+ ',"key1":["beta",[12,{"numberOfElectrons":4}],[1,3]]}';
955
+ $mapper->mapFor(
956
+ json_decode($json),
957
+ 'anyOf(float[],anyOf(bool,oneOf(int,Atom)[],string)[][])',
958
+ 'multitypetest\model'
959
+ );
960
+ }
961
+
962
+ public function testOuterArrayFailWith2DMapOfAtomAnd2DMapOfIntArray()
963
+ {
964
+ $mapper = new JsonMapper();
965
+ $this->expectException(JsonMapperException::class);
966
+ $this->expectExceptionMessage('Cannot map more than OneOf { array<string,array<string,anyOf(bool,array<string,oneOf(int,Atom)>,string)>> and array<string,array<string,array<string,int>>> } on: {"key":{"element":{"atom":1,"orbits":9},"compound":{"num1":4,"num2":8}}}');
967
+ $json = '{"key":{"element":{"atom":1,"orbits":9},"compound":{"num1":4,"num2":8}}}';
968
+ $mapper->mapFor(
969
+ json_decode($json),
970
+ 'oneOf(array<string,array<string,array<string,int>>>,array<string,array<string,anyOf(bool,array<string,oneOf(int,Atom)>,string)>>)',
971
+ 'multitypetest\model'
972
+ );
973
+ }
974
+
975
+ public function testOuterArrayFailWithStringInsteadOfArrayOfString()
976
+ {
977
+ $mapper = new JsonMapper();
978
+ $this->expectException(JsonMapperException::class);
979
+ $this->expectExceptionMessage('Unable to map Array: anyOf(bool,oneOf(int,Atom)[],string)[] on: "alpha"');
980
+ $json = '{"key0":["beta",[12,{"numberOfElectrons":4}],[1,3]],"key1":"alpha"' .
981
+ ',"key2":[false,true]}';
982
+ $mapper->mapFor(
983
+ json_decode($json),
984
+ 'array<string,anyOf(bool,oneOf(int,Atom)[],string)[]>',
985
+ 'multitypetest\model'
986
+ );
987
+ }
988
+
989
+ public function testOuterArrayFailWithMapOfStringInsteadOfArrayOfString()
990
+ {
991
+ $mapper = new JsonMapper();
992
+ $this->expectException(JsonMapperException::class);
993
+ $this->expectExceptionMessage('Unable to map Array: anyOf(bool,oneOf(int,Atom)[],string)[] on: {"item":"alpha"}');
994
+ $json = '{"key0":["beta",[12,{"numberOfElectrons":4}],[1,3]],"key1":{"item":"alpha"}' .
995
+ ',"key2":[false,true]}';
996
+ $mapper->mapFor(
997
+ json_decode($json),
998
+ 'array<string,anyOf(bool,oneOf(int,Atom)[],string)[]>',
999
+ 'multitypetest\model'
1000
+ );
1001
+ }
1002
+
1003
+ public function testOuterMapFailWithStringInsteadOfMapOfString()
1004
+ {
1005
+ $mapper = new JsonMapper();
1006
+ $this->expectException(JsonMapperException::class);
1007
+ $this->expectExceptionMessage('Unable to map Associative Array: array<string,anyOf(bool,oneOf(int,Atom)[],string)> on: "alpha"');
1008
+ $json = '{"key0":{"item0":"beta","item1":[12,{"numberOfElectrons":4}],"item2":[1,3]},"key1":"alpha"' .
1009
+ ',"key2":{"item0":false,"item1":true}}';
1010
+ $mapper->mapFor(
1011
+ json_decode($json),
1012
+ 'array<string,array<string,anyOf(bool,oneOf(int,Atom)[],string)>>',
1013
+ 'multitypetest\model'
1014
+ );
1015
+ }
1016
+
1017
+ public function testOuterMapFailWithArrayOfStringInsteadOfMapOfString()
1018
+ {
1019
+ $mapper = new JsonMapper();
1020
+ $this->expectException(JsonMapperException::class);
1021
+ $this->expectExceptionMessage('Unable to map Associative Array: array<string,anyOf(bool,oneOf(int,Atom)[],string)> on: ["alpha"]');
1022
+ $json = '{"key0":{"item0":"beta","item1":[12,{"numberOfElectrons":4}],"item2":[1,3]},"key1":["alpha"]' .
1023
+ ',"key2":{"item0":false,"item1":true}}';
1024
+ $mapper->mapFor(
1025
+ json_decode($json),
1026
+ 'array<string,array<string,anyOf(bool,oneOf(int,Atom)[],string)>>',
1027
+ 'multitypetest\model'
1028
+ );
1029
+ }
1030
+
1031
+ public function testCheckTypeGroupFor()
1032
+ {
1033
+ $mapper = new JsonMapper();
1034
+ $res = $mapper->checkTypeGroupFor('oneof(string,int)', "this is string");
1035
+ $this->assertTrue(is_string($res));
1036
+ $this->assertEquals("this is string", $res);
1037
+
1038
+ $res = $mapper->checkTypeGroupFor('oneof(Car,Atom)', new Car("3", true));
1039
+ $this->assertInstanceOf(Car::class, $res);
1040
+
1041
+ $res = $mapper->checkTypeGroupFor('oneof(Car,Atom)[]', [
1042
+ new Car("3", true),
1043
+ new Atom(34)
1044
+ ]);
1045
+ $this->assertInstanceOf(Car::class, $res[0]);
1046
+ $this->assertInstanceOf(Atom::class, $res[1]);
1047
+
1048
+ $res = $mapper->checkTypeGroupFor('oneof(int,DaysEnum)', "Monday", [
1049
+ 'multitypetest\model\DaysEnum::checkValue DaysEnum'
1050
+ ]);
1051
+ $this->assertEquals("Monday", $res);
1052
+
1053
+ $res = $mapper->checkTypeGroupFor('oneof(int,DaysEnum)[]', ["Monday", "Tuesday"], [
1054
+ 'multitypetest\model\DaysEnum::checkValue DaysEnum[]'
1055
+ ]);
1056
+ $this->assertTrue(is_array($res));
1057
+ $this->assertEquals("Monday", $res[0]);
1058
+ $this->assertEquals("Tuesday", $res[1]);
1059
+
1060
+ $res = $mapper->checkTypeGroupFor('oneof(DateTime,null)', null);
1061
+ $this->assertTrue(is_null($res));
1062
+
1063
+ $res = $mapper->checkTypeGroupFor('anyof(string,DateTime)[]', [null, null], [
1064
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1065
+ ]);
1066
+ $this->assertTrue(is_array($res));
1067
+ $this->assertTrue(is_null($res[0]));
1068
+ $this->assertTrue(is_null($res[1]));
1069
+
1070
+ $res = $mapper->checkTypeGroupFor('anyof(string,DateTime)[]', ["some string"], [
1071
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTimeArray DateTime[]'
1072
+ ]);
1073
+ $this->assertTrue(is_array($res));
1074
+ $this->assertEquals("some string", $res[0]);
1075
+
1076
+ $res = $mapper->checkTypeGroupFor('oneof(string,DateTime)[]', [new \DateTime("2022-06-10")], [
1077
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTimeArray DateTime[]'
1078
+ ]);
1079
+ $this->assertTrue(is_array($res));
1080
+ $this->assertEquals('Fri, 10 Jun 2022 00:00:00 GMT', $res[0]);
1081
+
1082
+ $res = $mapper->checkTypeGroupFor('oneof(string,DateTime)[]', [new \DateTime("2022-06-10")], [
1083
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1084
+ ]);
1085
+ $this->assertTrue(is_array($res));
1086
+ $this->assertEquals('Fri, 10 Jun 2022 00:00:00 GMT', $res[0]);
1087
+
1088
+ $res = $mapper->checkTypeGroupFor('oneof(DateTime,null)', null, [
1089
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1090
+ ]);
1091
+ $this->assertTrue(is_null($res));
1092
+ }
1093
+
1094
+ public function testCheckTypeGroupFailure() {
1095
+ $this->expectException(JsonMapperException::class);
1096
+ $this->expectExceptionMessage("Unable to map Type: Vehicle on: oneof(Atom,Car)");
1097
+ $mapper = new JsonMapper();
1098
+
1099
+ $mapper->checkTypeGroupFor('oneof(Atom,Car)', new Vehicle("6"));
1100
+ }
1101
+
1102
+ public function testCheckTypeGroupFailure2() {
1103
+ $this->expectException(JsonMapperException::class);
1104
+ $this->expectExceptionMessage("Unable to map Type: ((DaysEnum,string),string)[] on: oneof(int,DaysEnum)[]");
1105
+ $mapper = new JsonMapper();
1106
+
1107
+ $mapper->checkTypeGroupFor('oneof(int,DaysEnum)[]', ["Monday", "string"], [
1108
+ 'multitypetest\model\DaysEnum::checkValue DaysEnum'
1109
+ ]);
1110
+ }
1111
+
1112
+ /**
1113
+ * This is a test for protected method JsonMapper->getType
1114
+ */
1115
+ public function testGetTypeOfSimpleValues()
1116
+ {
1117
+ $mapper = new MultiTypeJsonMapper();
1118
+ $value = "this is string";
1119
+ $this->assertEquals('string', $mapper->getType($value));
1120
+ $value = "23";
1121
+ $this->assertEquals('string', $mapper->getType($value));
1122
+ $value = 23.98;
1123
+ $this->assertEquals('float', $mapper->getType($value));
1124
+ $value = 23;
1125
+ $this->assertEquals('int', $mapper->getType($value));
1126
+ $value = false;
1127
+ $this->assertEquals('bool', $mapper->getType($value));
1128
+ $value = [];
1129
+ $this->assertEquals('array', $mapper->getType($value));
1130
+ $value = [false, true];
1131
+ $this->assertEquals('bool[]', $mapper->getType($value));
1132
+ $value = ["key1" => 23, "key2" => 34];
1133
+ $this->assertEquals('array<string,int>', $mapper->getType($value));
1134
+ $value = ["key1" => 23, "key2" => 34.9];
1135
+ $this->assertEquals('array<string,(float,int)>', $mapper->getType($value));
1136
+ $value = [false, true, null, 23];
1137
+ $this->assertEquals('(bool,int,null)[]', $mapper->getType($value));
1138
+ $value = [null, null];
1139
+ $this->assertEquals('null[]', $mapper->getType($value));
1140
+
1141
+ $value = ["key1" => 23, "key2" => [34, 46]];
1142
+ $this->assertEquals('array<string,(int,int[])>', $mapper->getType($value));
1143
+ $value = [23, [34, "46"], [[true, "46"]]];
1144
+ $this->assertEquals('((bool,string)[][],(int,string)[],int)[]', $mapper->getType($value));
1145
+ $value = ["key1" => ["string", 2.3], "key2" => [21.3, "some"]];
1146
+ $this->assertEquals('array<string,(float,string)[]>', $mapper->getType($value));
1147
+ $value = [["key1" => ["some string"]], ["key1" => [false]]];
1148
+ $this->assertEquals('(array<string,bool[]>,array<string,string[]>)[]', $mapper->getType($value));
1149
+ $value = [["key1" => ["some string"]], ["key1" => ["false"]]];
1150
+ $this->assertEquals('array<string,string[]>[]', $mapper->getType($value));
1151
+ $value = ["key" => [["some string"]], ["key" => ["some string"]]];
1152
+ $this->assertEquals('array<string,(array<string,string[]>,string[][])>', $mapper->getType($value));
1153
+ $value = ["key" => [["key" => 23]], [["key" => 34]]];
1154
+ $this->assertEquals('array<string,array<string,int>[]>', $mapper->getType($value));
1155
+ }
1156
+
1157
+ /**
1158
+ * This is a test for protected method JsonMapper->getType
1159
+ */
1160
+ public function testGetTypeOfComplexValues()
1161
+ {
1162
+ $mapper = new MultiTypeJsonMapper();
1163
+ $value = new \DateTime();
1164
+ $this->assertEquals('DateTime', $mapper->getType($value));
1165
+ $value = new Car("3", true);
1166
+ $this->assertEquals('Car', $mapper->getType($value));
1167
+ $value = [new \DateTime(), new \DateTime()];
1168
+ $this->assertEquals('DateTime[]', $mapper->getType($value));
1169
+ $value = [new Car("3", true), new \DateTime()];
1170
+ $this->assertEquals('(Car,DateTime)[]', $mapper->getType($value));
1171
+ $value = [new Car("3", true), true, new Car("6", false)];
1172
+ $this->assertEquals('(Car,bool)[]', $mapper->getType($value));
1173
+ $value = ["key1" => true, "key2" => new Car("6", false)];
1174
+ $this->assertEquals('array<string,(Car,bool)>', $mapper->getType($value));
1175
+ $value = [new Car("3", true), new Atom(6), null];
1176
+ $this->assertEquals('(Atom,Car,null)[]', $mapper->getType($value));
1177
+ }
1178
+
1179
+ /**
1180
+ * This is a test for protected method JsonMapper->getType
1181
+ */
1182
+ public function testGetTypeWithFactoryMethods()
1183
+ {
1184
+ $mapper = new MultiTypeJsonMapper();
1185
+ // a value that did not require factory methods
1186
+ $value = "this is string";
1187
+ $this->assertEquals('string', $mapper->getType($value, [
1188
+ 'multitypetest\model\DateTimeHelper::toSimpleDate DateTime',
1189
+ 'multitypetest\model\DateTimeHelper::toSimpleDateArray DateTime[]'
1190
+ ]));
1191
+ $this->assertTrue(is_string($value));
1192
+ $this->assertEquals("this is string", $value);
1193
+
1194
+ // a string value that is also an enum
1195
+ $value = "Friday";
1196
+ $this->assertEquals('(DaysEnum,string)', $mapper->getType($value, [
1197
+ 'multitypetest\model\DateTimeHelper::toSimpleDate DateTime',
1198
+ 'multitypetest\model\DaysEnum::checkValue DaysEnum'
1199
+ ]));
1200
+ $this->assertTrue(is_string($value));
1201
+ $this->assertEquals("Friday", $value);
1202
+
1203
+ // a string value that can be in 2 Enums
1204
+ $value = "December";
1205
+ $this->assertEquals('(DaysEnum,MonthNameEnum,string)', $mapper->getType($value, [
1206
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1207
+ 'multitypetest\model\DaysEnum::checkValue DaysEnum'
1208
+ ]));
1209
+ $this->assertTrue(is_string($value));
1210
+ $this->assertEquals("December", $value);
1211
+
1212
+ // an int value that can be also be an Enum
1213
+ $value = 12;
1214
+ $this->assertEquals('(MonthNumberEnum,int)', $mapper->getType($value, [
1215
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1216
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum'
1217
+ ]));
1218
+ $this->assertTrue(is_int($value));
1219
+ $this->assertEquals(12, $value);
1220
+
1221
+ // an int array which can also be Enum array
1222
+ $value = [12,1];
1223
+ $this->assertEquals('(((MonthNumberEnum[],int))[],MonthNumberEnum[])', $mapper->getType($value, [
1224
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1225
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum[]'
1226
+ ]));
1227
+ $this->assertTrue(is_array($value));
1228
+ $this->assertEquals(12, $value[0]);
1229
+ $this->assertEquals(1, $value[1]);
1230
+
1231
+ // an int 2D array which can also be Enum 2D array
1232
+ $value = [[12,1]];
1233
+ $this->assertEquals('(((((MonthNumberEnum[][],int))[],MonthNumberEnum[][]))[],MonthNumberEnum[][])', $mapper->getType($value, [
1234
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1235
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum[][]'
1236
+ ]));
1237
+ $this->assertTrue(is_array($value));
1238
+ $this->assertTrue(is_array($value[0]));
1239
+ $this->assertEquals(12, $value[0][0]);
1240
+ $this->assertEquals(1, $value[0][1]);
1241
+
1242
+ // an int array whose inner values can be also be Enum
1243
+ $value = [12,1];
1244
+ $this->assertEquals('(((MonthNumberEnum,int))[],MonthNumberEnum)', $mapper->getType($value, [
1245
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1246
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum'
1247
+ ]));
1248
+ $this->assertTrue(is_array($value));
1249
+ $this->assertEquals(12, $value[0]);
1250
+ $this->assertEquals(1, $value[1]);
1251
+
1252
+ // an array whose inner values can be also be Enum
1253
+ $value = [12,"1"];
1254
+ $this->assertEquals('((MonthNumberEnum,int),string)[]', $mapper->getType($value, [
1255
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1256
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum'
1257
+ ]));
1258
+ $this->assertTrue(is_array($value));
1259
+ $this->assertEquals(12, $value[0]);
1260
+ $this->assertEquals("1", $value[1]);
1261
+
1262
+ // an array whose inner values can be also be Enum of 2 types
1263
+ $value = [12,"January"];
1264
+ $this->assertEquals('((MonthNameEnum,string),(MonthNumberEnum,int))[]', $mapper->getType($value, [
1265
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum',
1266
+ 'multitypetest\model\MonthNumberEnum::checkValue MonthNumberEnum'
1267
+ ]));
1268
+ $this->assertTrue(is_array($value));
1269
+ $this->assertEquals(12, $value[0]);
1270
+ $this->assertEquals("January", $value[1]);
1271
+
1272
+ // a type that require factory methods, can be mapped by both factory methods
1273
+ // mapped by first one
1274
+ $value = new \DateTime("2022-06-10");
1275
+ $this->assertEquals('DateTime', $mapper->getType($value, [
1276
+ 'multitypetest\model\DateTimeHelper::toSimpleDate DateTime',
1277
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1278
+ ]));
1279
+ $this->assertTrue(is_string($value));
1280
+ $this->assertEquals("2022-06-10", $value);
1281
+
1282
+ // a type that require factory methods, can be mapped by both factory methods
1283
+ // mapped by first one
1284
+ $value = new \DateTime("2022-06-10");
1285
+ $this->assertEquals('DateTime', $mapper->getType($value, [
1286
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1287
+ 'multitypetest\model\DateTimeHelper::toSimpleDate DateTime'
1288
+ ]));
1289
+ $this->assertTrue(is_string($value));
1290
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value);
1291
+
1292
+ // a datetime array, whose inner items can be mapped by both factory methods, mapped by first one
1293
+ $value = [new \DateTime("2022-06-10"), new \DateTime("2022-06-10")];
1294
+ $this->assertEquals('DateTime[]', $mapper->getType($value, [
1295
+ 'multitypetest\model\DateTimeHelper::toSimpleDate DateTime',
1296
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1297
+ ]));
1298
+ $this->assertTrue(is_array($value));
1299
+ $this->assertTrue(is_string($value[0]));
1300
+ $this->assertEquals("2022-06-10", $value[0]);
1301
+
1302
+ // a datetime array, can be mapped by both factory methods
1303
+ $value = [new \DateTime("2022-06-10"), new \DateTime("2022-06-10")];
1304
+ $this->assertEquals('DateTime[]', $mapper->getType($value, [
1305
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTimeArray DateTime[]',
1306
+ 'multitypetest\model\DateTimeHelper::toSimpleDateArray DateTime[]'
1307
+ ]));
1308
+ $this->assertTrue(is_array($value));
1309
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[0]);
1310
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[1]);
1311
+
1312
+ // a datetime array, inner item can be mapped by 1st factory method, while
1313
+ // outer array will be mapped by 2nd factory method
1314
+ $value = [new \DateTime("2022-06-10"), new \DateTime("2022-06-10")];
1315
+ $this->assertEquals('DateTime[]', $mapper->getType($value, [
1316
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1317
+ 'multitypetest\model\DateTimeHelper::toSimpleDateArray DateTime[]'
1318
+ ]));
1319
+ $this->assertTrue(is_array($value));
1320
+ $this->assertEquals("2022-06-10", $value[0]);
1321
+ $this->assertEquals("2022-06-10", $value[1]);
1322
+
1323
+ // a datetime mixed array
1324
+ $value = [new \DateTime("2022-06-10"), ["key" => new \DateTime("2022-06-10")]];
1325
+ $this->assertEquals('((DateTime[],array<string,DateTime>),DateTime)[]', $mapper->getType($value, [
1326
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1327
+ 'multitypetest\model\DateTimeHelper::toSimpleDateArray DateTime[]'
1328
+ ]));
1329
+ $this->assertTrue(is_array($value));
1330
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[0]);
1331
+ $this->assertTrue(is_array($value[1]));
1332
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[1]["key"]);
1333
+
1334
+ // a datetime mixed array,
1335
+ $value = [new \DateTime("2022-06-10"), ["key" => new \DateTime("2022-06-10")]];
1336
+ $this->assertEquals('(DateTime,array<string,DateTime>)[]', $mapper->getType($value, [
1337
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1338
+ 'multitypetest\model\DateTimeHelper::toSimpleDateArray array<string,DateTime>'
1339
+ ]));
1340
+ $this->assertTrue(is_array($value));
1341
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[0]);
1342
+ $this->assertTrue(is_array($value[1]));
1343
+ $this->assertEquals("2022-06-10", $value[1]["key"]);
1344
+
1345
+ // a datetime and enum array
1346
+ $value = [new \DateTime("2022-06-10"), "December"];
1347
+ $this->assertEquals('((MonthNameEnum,string),DateTime)[]', $mapper->getType($value, [
1348
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1349
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum'
1350
+ ]));
1351
+ $this->assertTrue(is_array($value));
1352
+ $this->assertEquals("Fri, 10 Jun 2022 00:00:00 GMT", $value[0]);
1353
+ $this->assertEquals("December", $value[1]);
1354
+
1355
+ // a datetime and enum null value
1356
+ $value = null;
1357
+ $this->assertEquals('(DateTime,MonthNameEnum,null)', $mapper->getType($value, [
1358
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1359
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum'
1360
+ ]));
1361
+ $this->assertTrue(is_null($value));
1362
+
1363
+ // a datetime null values array
1364
+ $value = [null,null];
1365
+ $this->assertEquals('((DateTime,null))[]', $mapper->getType($value, [
1366
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime'
1367
+ ]));
1368
+ $this->assertTrue(is_array($value));
1369
+ $this->assertTrue(is_null($value[0]));
1370
+ $this->assertTrue(is_null($value[1]));
1371
+
1372
+ // a datetime and enum null mix array
1373
+ $value = [null,"some string"];
1374
+ $this->assertEquals('((DateTime,MonthNameEnum,null),string)[]', $mapper->getType($value, [
1375
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTime DateTime',
1376
+ 'multitypetest\model\MonthNameEnum::checkValue MonthNameEnum'
1377
+ ]));
1378
+ $this->assertTrue(is_array($value));
1379
+ $this->assertTrue(is_null($value[0]));
1380
+ $this->assertEquals('some string', $value[1]);
1381
+ }
1382
+
1383
+ /**
1384
+ * This is a test for protected method JsonMapper->checkForType
1385
+ */
1386
+ public function testGetTypeFailure()
1387
+ {
1388
+ $this->expectException(JsonMapperException::class);
1389
+ $this->expectExceptionMessage("Provided factory methods are not callable with the value of Type: DateTime\nmultitypetest\model\DateTimeHelper::toRfc1123DateTimeArray: ");
1390
+ $mapper = new MultiTypeJsonMapper();
1391
+ $value = new \DateTime();
1392
+ $mapper->getType($value, [
1393
+ 'multitypetest\model\DateTimeHelper::toRfc1123DateTimeArray DateTime',
1394
+ ]);
1395
+ }
1396
+
1397
+ /**
1398
+ * This is a test for protected method JsonMapper->checkForType
1399
+ */
1400
+ public function testCheckForSimpleTypes()
1401
+ {
1402
+ $mapper = new MultiTypeJsonMapper();
1403
+ $this->assertTrue($mapper->checkForType('oneof(string,int)', 'string'));
1404
+ $this->assertTrue($mapper->checkForType('oneof(string, anyof(bool, int))', 'int'));
1405
+ $this->assertTrue($mapper->checkForType('oneof(string,int)[]', 'int[]'));
1406
+ $this->assertFalse($mapper->checkForType('oneof(string,int)[]', 'array<string,int>'));
1407
+ $this->assertTrue($mapper->checkForType('array<string,oneof(string,int,bool)>', 'array<string,int>'));
1408
+ $this->assertTrue($mapper->checkForType('array<string,oneof(string,int,bool)>', 'array<string,(bool,int)>'));
1409
+ $this->assertTrue($mapper->checkForType('oneof(string,int,bool)[]', '(bool,int)[]'));
1410
+ $this->assertTrue($mapper->checkForType('oneof(string,anyof(int,bool))[]', '(bool,int)[]'));
1411
+ $this->assertTrue($mapper->checkForType('oneof(string,anyof(int,bool)[])', '(bool,int)[]'));
1412
+ $this->assertFalse($mapper->checkForType('oneof(string,anyof(int,bool[]))', '(bool,int)[]'));
1413
+ $this->assertTrue($mapper->checkForType('oneof(string,anyof(int,bool[]))', 'bool[]'));
1414
+
1415
+ $this->assertTrue($mapper->checkForType('oneof(anyof(a,oneof(a[],b)[]),anyof(a,b,c)[])', '(a,b)[]'));
1416
+ $this->assertTrue($mapper->checkForType('oneof(anyof(a,oneof(a[],b)),anyof(a,b,c)[])', '((a,b)[],c[])'));
1417
+ $this->assertTrue($mapper->checkForType('oneof(anyof(a,oneof(a[],b)),anyof(a,b,c)[])', '(c,c[])'));
1418
+ $this->assertTrue($mapper->checkForType('oneof(anyof(a,b),anyof(a,b,c)[])', '(b,c)'));
1419
+ $this->assertFalse($mapper->checkForType('oneof(anyof(a,b),anyof(a,b,c)[])[]', '(b,c)'));
1420
+ $this->assertFalse($mapper->checkForType('oneof(anyof(a,b),anyof(a,b,c)[])[]', '(b,c)[]'));
1421
+
1422
+ }
1423
+
1424
+ /**
1425
+ * This is a test for protected method JsonMapper->checkForType
1426
+ */
1427
+ public function testCheckForComplexTypes()
1428
+ {
1429
+ $mapper = new MultiTypeJsonMapper();
1430
+
1431
+ $this->assertTrue($mapper->checkForType('oneof(Car,anyof(Atom,null)[])', 'Atom[]'));
1432
+ $this->assertTrue($mapper->checkForType('oneof(Car,anyof(Atom,null)[])', 'Car'));
1433
+
1434
+ $this->assertTrue($mapper->checkForType('oneof(Car,anyof(Atom,null))[]', '(Atom,Car,null)[]'));
1435
+ $this->assertTrue($mapper->checkForType('oneof(Car,anyof(Atom,null))[]', '(Atom,null)[]'));
1436
+ $this->assertFalse($mapper->checkForType('oneof(Car[],anyof(Atom,null))[]', '(Atom,Car,null)[]'));
1437
+ $this->assertFalse($mapper->checkForType('oneof(Car,oneof(Atom,Orbit)[])[]', '(Atom,null)[]'));
1438
+ $this->assertTrue($mapper->checkForType('oneof(Car,oneof(Atom,Orbit,null)[])', '(Atom,null)[]'));
1439
+ $this->assertTrue($mapper->checkForType('oneof(oneof(Atom,Orbit)[],oneof(Atom,Orbit,null)[])', '(Atom,null)[]'));
1440
+
1441
+ $this->assertTrue($mapper->checkForType('array<string,oneof(Car,anyof(Atom,null))>', 'array<string,(Atom,Car,null)>'));
1442
+ $this->assertTrue($mapper->checkForType('array<string,oneof(Car,anyof(Atom,null))>', 'array<string,(Atom,null)>'));
1443
+ $this->assertFalse($mapper->checkForType('array<string,oneof(Car[],anyof(Atom,null))>', 'array<string,(Atom,Car,null)>'));
1444
+ $this->assertFalse($mapper->checkForType('array<string,oneof(Car,oneof(Atom,Orbit)[])>', 'array<string,(Atom,null)>'));
1445
+ $this->assertTrue($mapper->checkForType('oneof(Car,array<string,oneof(Atom,Orbit,null)>)', 'array<string,(Atom,null)>'));
1446
+ $this->assertTrue($mapper->checkForType('oneof(array<string,oneof(Atom,Orbit)>,array<string,oneof(Atom,Orbit,null)>)', 'array<string,(Atom,null)>'));
1447
+ $this->assertTrue($mapper->checkForType('array<string,anyOf(Postman,Person,float,null)[]>', 'array<string,(Person,float)[]>'));
1448
+ }
1449
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Atom.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class Atom implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var int
14
+ */
15
+ private $numberOfElectrons;
16
+
17
+ /**
18
+ * @var int
19
+ */
20
+ private $numberOfProtons;
21
+
22
+ /**
23
+ * @param int $numberOfElectrons
24
+ */
25
+ public function __construct($numberOfElectrons)
26
+ {
27
+ $this->numberOfElectrons = $numberOfElectrons;
28
+ }
29
+
30
+ /**
31
+ * Returns NumberOfElectrons.
32
+ * @return int
33
+ */
34
+ public function getNumberOfElectrons()
35
+ {
36
+ return $this->numberOfElectrons;
37
+ }
38
+
39
+ /**
40
+ * Sets Value.
41
+ * @param int
42
+ *
43
+ * @required
44
+ * @maps $numberOfElectrons
45
+ */
46
+ public function setNumberOfElectrons($numberOfElectrons)
47
+ {
48
+ $this->numberOfElectrons = $numberOfElectrons;
49
+ }
50
+
51
+ /**
52
+ * Returns NumberOfProtons.
53
+ * @return int
54
+ */
55
+ public function getNumberOfProtons()
56
+ {
57
+ return $this->numberOfProtons;
58
+ }
59
+
60
+ /**
61
+ * Sets Value.
62
+ * @param int
63
+ *
64
+ * @required
65
+ * @maps $numberOfProtons
66
+ */
67
+ public function setNumberOfProtons($numberOfProtons)
68
+ {
69
+ $this->numberOfProtons = $numberOfProtons;
70
+ }
71
+
72
+ /**
73
+ * Encode this object to JSON
74
+ *
75
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
76
+ * are set. (default: false)
77
+ *
78
+ * @return array|stdClass
79
+ */
80
+ #[\ReturnTypeWillChange]
81
+ public function jsonSerialize($asArrayWhenEmpty = false)
82
+ {
83
+ $json = [];
84
+ $json['numberOfElectrons'] = $this->numberOfElectrons;
85
+ $json['numberOfProtons'] = $this->numberOfProtons;
86
+
87
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
88
+ }
89
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Car.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class Car extends Vehicle implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var bool
14
+ */
15
+ private $haveTrunk;
16
+
17
+ /**
18
+ * @param string $numberOfTyres
19
+ * @param bool $haveTrunk
20
+ */
21
+ public function __construct($numberOfTyres, $haveTrunk)
22
+ {
23
+ parent::__construct($numberOfTyres);
24
+ $this->haveTrunk = $haveTrunk;
25
+ }
26
+
27
+ /**
28
+ * Returns HaveTrunk.
29
+ * @return bool
30
+ */
31
+ public function getHaveTrunk()
32
+ {
33
+ return $this->haveTrunk;
34
+ }
35
+
36
+ /**
37
+ * Sets HaveTrunk.
38
+ * @param bool $haveTrunk
39
+ *
40
+ * @maps haveTrunk
41
+ */
42
+ public function setHaveTrunk($haveTrunk)
43
+ {
44
+ $this->haveTrunk = $haveTrunk;
45
+ }
46
+
47
+ /**
48
+ * Encode this object to JSON
49
+ *
50
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
51
+ * are set. (default: false)
52
+ *
53
+ * @return array|stdClass
54
+ */
55
+ #[\ReturnTypeWillChange]
56
+ public function jsonSerialize($asArrayWhenEmpty = false)
57
+ {
58
+ $json = [];
59
+ $json['haveTrunk'] = $this->haveTrunk;
60
+ $json = array_merge($json, parent::jsonSerialize(true));
61
+
62
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
63
+ }
64
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/ComplexCaseA.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+ require_once __DIR__ . '/DateTimeHelper.php';
5
+
6
+ use stdClass;
7
+
8
+ /**
9
+ * This class contains simple case of oneOf.
10
+ */
11
+ class ComplexCaseA implements \JsonSerializable
12
+ {
13
+ /**
14
+ * @var \DateTime[]|\DateTime|string|ComplexCaseA
15
+ */
16
+ private $value;
17
+
18
+ /**
19
+ * @var ComplexCaseA|ComplexCaseB|SimpleCaseA
20
+ */
21
+ private $optional;
22
+
23
+ /**
24
+ * @param \DateTime[]|\DateTime|string|ComplexCaseA $value
25
+ */
26
+ public function __construct($value)
27
+ {
28
+ $this->value = $value;
29
+ }
30
+
31
+ /**
32
+ * Returns Value.
33
+ *
34
+ * @return \DateTime[]|\DateTime|string|ComplexCaseA
35
+ */
36
+ public function getValue()
37
+ {
38
+ return $this->value;
39
+ }
40
+
41
+ /**
42
+ * Sets Value.
43
+ *
44
+ * @param \DateTime[]|\DateTime|string|ComplexCaseA $value
45
+ * @required
46
+ * @maps value
47
+ * @mapsBy oneOf(DateTime[],anyOf(DateTime,string),ComplexCaseA)
48
+ * @factory multitypetest\model\DateTimeHelper::fromSimpleDate DateTime
49
+ * @factory multitypetest\model\DateTimeHelper::fromSimpleDateArray DateTime[]
50
+ */
51
+ public function setValue($value)
52
+ {
53
+ $this->value = $value;
54
+ }
55
+
56
+ /**
57
+ * Returns Optional.
58
+ *
59
+ * @return ComplexCaseA|ComplexCaseB|SimpleCaseA
60
+ */
61
+ public function getOptional()
62
+ {
63
+ return $this->optional;
64
+ }
65
+
66
+ /**
67
+ * Sets Value.
68
+ *
69
+ * @param ComplexCaseA|ComplexCaseB|SimpleCaseA $optional
70
+ * @required
71
+ * @maps optional
72
+ * @mapsBy oneOf(ComplexCaseA,ComplexCaseB,SimpleCaseA)
73
+ */
74
+ public function setOptional($optional)
75
+ {
76
+ $this->optional = $optional;
77
+ }
78
+
79
+ /**
80
+ * Encode this object to JSON
81
+ *
82
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
83
+ * are set. (default: false)
84
+ *
85
+ * @return array|stdClass
86
+ */
87
+ #[\ReturnTypeWillChange]
88
+ public function jsonSerialize($asArrayWhenEmpty = false)
89
+ {
90
+ $json = [];
91
+ $json['value'] = $this->value;
92
+
93
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
94
+ }
95
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/ComplexCaseB.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains inner array case of oneOf.
9
+ */
10
+ class ComplexCaseB implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var Evening[]|Morning[]|Postman|Person[]|Vehicle|Car|string
14
+ */
15
+ private $value;
16
+
17
+ /**
18
+ * @var ComplexCaseA|SimpleCaseB[]|array
19
+ */
20
+ private $optional;
21
+
22
+ /**
23
+ * @param Evening[]|Morning[]|Postman|Person[]|Vehicle|Car|string $value
24
+ */
25
+ public function __construct($value)
26
+ {
27
+ $this->value = $value;
28
+ }
29
+
30
+ /**
31
+ * Returns Value.
32
+ * @return array
33
+ */
34
+ public function getValue()
35
+ {
36
+ return $this->value;
37
+ }
38
+
39
+ /**
40
+ * Sets Value.
41
+ *
42
+ * @param Evening[]|Morning[]|Postman|Person[]|Vehicle|Car|string $value
43
+ * @required
44
+ * @maps value
45
+ * @mapsBy anyOf(Evening[],Morning[],Employee,Person[],oneOf(Vehicle,Car),string)
46
+ */
47
+ public function setValue($value)
48
+ {
49
+ $this->value = $value;
50
+ }
51
+
52
+ /**
53
+ * Returns Optional.
54
+ *
55
+ * @return ComplexCaseA|SimpleCaseB[]|array
56
+ */
57
+ public function getOptional()
58
+ {
59
+ return $this->optional;
60
+ }
61
+
62
+ /**
63
+ * Sets Value.
64
+ *
65
+ * @param ComplexCaseA|SimpleCaseB[]|array $optional
66
+ * @required
67
+ * @maps optional
68
+ * @mapsBy anyOf(ComplexCaseA,SimpleCaseB[],array)
69
+ */
70
+ public function setOptional($optional)
71
+ {
72
+ $this->optional = $optional;
73
+ }
74
+
75
+ /**
76
+ * Encode this object to JSON
77
+ *
78
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
79
+ * are set. (default: false)
80
+ *
81
+ * @return mixed
82
+ */
83
+ #[\ReturnTypeWillChange]
84
+ public function jsonSerialize($asArrayWhenEmpty = false)
85
+ {
86
+ $json = [];
87
+ $json['value'] = $this->value;
88
+
89
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
90
+ }
91
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/DateTimeHelper.php ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * TesterLib
5
+ *
6
+ * This file was automatically generated for Stamplay by APIMATIC v3.0 ( https://www.apimatic.io ).
7
+ */
8
+
9
+ namespace multitypetest\model;
10
+
11
+ use DateTime;
12
+ use DateTimeZone;
13
+ use Exception;
14
+ use stdClass;
15
+
16
+ class DateTimeHelper
17
+ {
18
+ /**
19
+ * Match the pattern for a datetime string in simeple date format
20
+ */
21
+ const SIMPLE_DATE = 'Y-m-d';
22
+
23
+ /**
24
+ * Match the pattern for a datetime string in Rfc1123 format
25
+ */
26
+ const RFC1123 = 'D, d M Y H:i:s T';
27
+
28
+ /**
29
+ * Match the pattern for a datetime string in RFC3339 format
30
+ */
31
+ const RFC3339 = 'Y-m-d\TH:i:sP';
32
+
33
+ /**
34
+ * Convert a DateTime object to a string in simple date format
35
+ *
36
+ * @param DateTime|null $date The DateTime object to convert
37
+ *
38
+ * @return string|null The datetime as a string in simple date format
39
+ * @throws Exception
40
+ */
41
+ public static function toSimpleDate($date)
42
+ {
43
+ if (is_null($date)) {
44
+ return null;
45
+ } elseif ($date instanceof DateTime) {
46
+ return $date->format(static::SIMPLE_DATE);
47
+ }
48
+ throw new Exception('Not a valid DateTime object.');
49
+ }
50
+
51
+ /**
52
+ * Convert an array of DateTime objects to an array of strings in simple date format
53
+ *
54
+ * @param array|null $dates The array of DateTime objects to convert
55
+ *
56
+ * @return array|null The array of datetime strings in simple date format
57
+ */
58
+ public static function toSimpleDateArray($dates)
59
+ {
60
+ if (is_null($dates)) {
61
+ return null;
62
+ }
63
+ return array_map('static::toSimpleDate', $dates);
64
+ }
65
+
66
+ /**
67
+ * Parse a datetime string in simple date format to a DateTime object
68
+ *
69
+ * @param string|null $date A datetime string in simple date format
70
+ *
71
+ * @return DateTime|null The parsed DateTime object
72
+ * @throws Exception
73
+ */
74
+ public static function fromSimpleDate($date)
75
+ {
76
+ if (is_null($date)) {
77
+ return null;
78
+ }
79
+ $x = DateTime::createFromFormat(static::SIMPLE_DATE, $date);
80
+ if ($x instanceof DateTime) {
81
+ return $x;
82
+ }
83
+ throw new Exception('Incorrect format.');
84
+ }
85
+
86
+ /**
87
+ * Parse an array of datetime strings in simple date format to an array of DateTime objects
88
+ *
89
+ * @param array|null $dates An array of datetime strings in simple date format
90
+ *
91
+ * @return array|null An array of parsed DateTime objects
92
+ */
93
+ public static function fromSimpleDateArray($dates)
94
+ {
95
+ if (is_null($dates)) {
96
+ return null;
97
+ }
98
+ return array_map('static::fromSimpleDate', $dates);
99
+ }
100
+
101
+ /**
102
+ * Parse a class of datetime strings in simple date format to an array of DateTime objects
103
+ *
104
+ * @param stdClass|null $datetimes A class of datetime strings in simple date format
105
+ *
106
+ * @return array|null An array of parsed DateTime objects
107
+ */
108
+ public static function fromSimpleDateMap($datetimes)
109
+ {
110
+ if (is_null($datetimes)) {
111
+ return null;
112
+ }
113
+ $array = json_decode(json_encode($datetimes), true);
114
+ return array_map('static::fromSimpleDate', $array);
115
+ }
116
+
117
+ /**
118
+ * Convert a DateTime object to a string in Rfc1123 format
119
+ *
120
+ * @param DateTime|null $datetime The DateTime object to convert
121
+ *
122
+ * @return string|null The datetime as a string in Rfc1123 format
123
+ * @throws Exception
124
+ */
125
+ public static function toRfc1123DateTime($datetime)
126
+ {
127
+ if (is_null($datetime)) {
128
+ return null;
129
+ } elseif ($datetime instanceof DateTime) {
130
+ return $datetime->setTimeZone(new DateTimeZone('GMT'))->format(static::RFC1123);
131
+ }
132
+ throw new Exception('Not a valid DateTime object.');
133
+ }
134
+
135
+ /**
136
+ * Convert an array of DateTime objects to an array of strings in Rfc1123 format
137
+ *
138
+ * @param array|null $datetimes The array of DateTime objects to convert
139
+ *
140
+ * @return array|null The array of datetime strings in Rfc1123 format
141
+ */
142
+ public static function toRfc1123DateTimeArray($datetimes)
143
+ {
144
+ if (is_null($datetimes)) {
145
+ return null;
146
+ }
147
+ return array_map('static::toRfc1123DateTime', $datetimes);
148
+ }
149
+
150
+ /**
151
+ * Parse a datetime string in Rfc1123 format to a DateTime object
152
+ *
153
+ * @param string|null $datetime A datetime string in Rfc1123 format
154
+ *
155
+ * @return DateTime|null The parsed DateTime object
156
+ * @throws Exception
157
+ */
158
+ public static function fromRfc1123DateTime($datetime)
159
+ {
160
+ if (is_null($datetime)) {
161
+ return null;
162
+ }
163
+ $x = DateTime::createFromFormat(static::RFC1123, $datetime);
164
+ if ($x instanceof DateTime) {
165
+ return $x->setTimeZone(new DateTimeZone('GMT'));
166
+ }
167
+ throw new Exception('Incorrect format.');
168
+ }
169
+
170
+ /**
171
+ * Parse an array of datetime strings in Rfc1123 format to an array of DateTime objects
172
+ *
173
+ * @param array|null $datetimes An array of datetime strings in Rfc1123 format
174
+ *
175
+ * @return array|null An array of parsed DateTime objects
176
+ */
177
+ public static function fromRfc1123DateTimeArray($datetimes)
178
+ {
179
+ if (is_null($datetimes)) {
180
+ return null;
181
+ }
182
+ return array_map('static::fromRfc1123DateTime', $datetimes);
183
+ }
184
+
185
+ /**
186
+ * Parse a class of datetime strings in Rfc1123 format to an array of DateTime objects
187
+ *
188
+ * @param stdClass|null $datetimes A class of datetime strings in Rfc1123 format
189
+ *
190
+ * @return array|null An array of parsed DateTime objects
191
+ */
192
+ public static function fromRfc1123DateTimeMap($datetimes)
193
+ {
194
+ if (is_null($datetimes)) {
195
+ return null;
196
+ }
197
+ $array = json_decode(json_encode($datetimes), true);
198
+ return array_map('static::fromRfc1123DateTime', $array);
199
+ }
200
+
201
+ /**
202
+ * Convert a DateTime object to a string in Rfc3339 format
203
+ *
204
+ * @param DateTime|null $datetime The DateTime object to convert
205
+ *
206
+ * @return string|null The datetime as a string in Rfc3339 format
207
+ * @throws Exception
208
+ */
209
+ public static function toRfc3339DateTime($datetime)
210
+ {
211
+ if (is_null($datetime)) {
212
+ return null;
213
+ } elseif ($datetime instanceof DateTime) {
214
+ return $datetime->setTimeZone(new DateTimeZone('UTC'))->format(static::RFC3339);
215
+ }
216
+ throw new Exception('Not a valid DateTime object.');
217
+ }
218
+
219
+ /**
220
+ * Convert an array of DateTime objects to an array of strings in Rfc3339 format
221
+ *
222
+ * @param array|null $datetimes The array of DateTime objects to convert
223
+ *
224
+ * @return array|null The array of datetime strings in Rfc3339 format
225
+ */
226
+ public static function toRfc3339DateTimeArray($datetimes)
227
+ {
228
+ if (is_null($datetimes)) {
229
+ return null;
230
+ }
231
+ return array_map('static::toRfc3339DateTime', $datetimes);
232
+ }
233
+
234
+ /**
235
+ * Parse a datetime string in Rfc3339 format to a DateTime object
236
+ *
237
+ * @param string|null $datetime A datetime string in Rfc3339 format
238
+ *
239
+ * @return DateTime|null The parsed DateTime object
240
+ * @throws Exception
241
+ */
242
+ public static function fromRfc3339DateTime($datetime)
243
+ {
244
+ if (is_null($datetime)) {
245
+ return null;
246
+ }
247
+ // Check for timezone information and append it if missing
248
+ if (!(substr($datetime, strlen($datetime) - 1) == 'Z' || strpos($datetime, '+') !== false)) {
249
+ $datetime .= 'Z';
250
+ }
251
+
252
+ $x = DateTime::createFromFormat(static::RFC3339, $datetime);
253
+ if ($x instanceof DateTime) {
254
+ return $x->setTimeZone(new DateTimeZone('UTC'));
255
+ }
256
+ $x = DateTime::createFromFormat("Y-m-d\TH:i:s.uP", $datetime); // parse with up to 6 microseconds
257
+ if ($x instanceof DateTime) {
258
+ return $x->setTimeZone(new DateTimeZone('UTC'));
259
+ }
260
+ $x = DateTime::createFromFormat("Y-m-d\TH:i:s.uuP", $datetime); // parse with up to 12 microseconds
261
+ if ($x instanceof DateTime) {
262
+ return $x->setTimeZone(new DateTimeZone('UTC'));
263
+ }
264
+ throw new Exception('Incorrect format.');
265
+ }
266
+
267
+ /**
268
+ * Parse an array of datetime strings in Rfc3339 format to an array of DateTime objects
269
+ *
270
+ * @param array|null $datetimes An array of datetime strings in Rfc3339 format
271
+ *
272
+ * @return array|null An array of parsed DateTime objects
273
+ */
274
+ public static function fromRfc3339DateTimeArray($datetimes)
275
+ {
276
+ if (is_null($datetimes)) {
277
+ return null;
278
+ }
279
+ return array_map('static::fromRfc3339DateTime', $datetimes);
280
+ }
281
+
282
+ /**
283
+ * Parse a class of datetime strings in Rfc3339 format to an array of DateTime objects
284
+ *
285
+ * @param stdClass|null $datetimes A class of datetime strings in Rfc3339 format
286
+ *
287
+ * @return array|null An array of parsed DateTime objects
288
+ */
289
+ public static function fromRfc3339DateTimeMap($datetimes)
290
+ {
291
+ if (is_null($datetimes)) {
292
+ return null;
293
+ }
294
+ $array = json_decode(json_encode($datetimes), true);
295
+ return array_map('static::fromRfc3339DateTime', $array);
296
+ }
297
+
298
+ /**
299
+ * Convert a DateTime object to a Unix Timestamp
300
+ *
301
+ * @param DateTime|null $datetime The DateTime object to convert
302
+ *
303
+ * @return int|null The converted Unix Timestamp
304
+ * @throws Exception
305
+ */
306
+ public static function toUnixTimestamp($datetime)
307
+ {
308
+ if (is_null($datetime)) {
309
+ return null;
310
+ } elseif ($datetime instanceof DateTime) {
311
+ return $datetime->getTimestamp();
312
+ }
313
+ throw new Exception('Not a valid DateTime object.');
314
+ }
315
+
316
+ /**
317
+ * Convert an array of DateTime objects to an array of Unix timestamps
318
+ *
319
+ * @param array|null $datetimes The array of DateTime objects to convert
320
+ *
321
+ * @return array|null The array of integers representing date-time in Unix timestamp
322
+ */
323
+ public static function toUnixTimestampArray($datetimes)
324
+ {
325
+ if (is_null($datetimes)) {
326
+ return null;
327
+ }
328
+ return array_map('static::toUnixTimestamp', $datetimes);
329
+ }
330
+
331
+ /**
332
+ * Parse a Unix Timestamp to a DateTime object
333
+ *
334
+ * @param string|null $datetime The Unix Timestamp
335
+ *
336
+ * @return DateTime|null The parsed DateTime object
337
+ * @throws Exception
338
+ */
339
+ public static function fromUnixTimestamp($datetime)
340
+ {
341
+ if (is_null($datetime)) {
342
+ return null;
343
+ }
344
+ $x = DateTime::createFromFormat("U", $datetime);
345
+ if ($x instanceof DateTime) {
346
+ return $x;
347
+ }
348
+ throw new Exception('Incorrect format.');
349
+ }
350
+
351
+ /**
352
+ * Parse an array of Unix Timestamps to an array of DateTime objects
353
+ *
354
+ * @param array|null $datetimes An array of Unix Timestamps
355
+ *
356
+ * @return array|null An array of parsed DateTime objects
357
+ */
358
+ public static function fromUnixTimestampArray($datetimes)
359
+ {
360
+ if (is_null($datetimes)) {
361
+ return null;
362
+ }
363
+ return array_map('static::fromUnixTimestamp', array_map('strval', $datetimes));
364
+ }
365
+
366
+ /**
367
+ * Parse a class of Unix Timestamps to an array of DateTime objects
368
+ *
369
+ * @param stdClass|null $datetimes A class of Unix Timestamps
370
+ *
371
+ * @return array|null An array of parsed DateTime objects
372
+ */
373
+ public static function fromUnixTimestampMap($datetimes)
374
+ {
375
+ if (is_null($datetimes)) {
376
+ return null;
377
+ }
378
+ $array = json_decode(json_encode($datetimes), true);
379
+ return array_map('static::fromUnixTimestamp', array_map('strval', $array));
380
+ }
381
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/DaysEnum.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use Exception;
6
+ use stdClass;
7
+
8
+ /**
9
+ * A string enum representing days of the week
10
+ */
11
+ class DaysEnum
12
+ {
13
+ const SUNDAY = 'Sunday';
14
+
15
+ const MONDAY = 'Monday';
16
+
17
+ const TUESDAY = 'Tuesday';
18
+
19
+ const WEDNESDAY_ = 'Wednesday';
20
+
21
+ const THURSDAY = 'Thursday';
22
+
23
+ const FRI_DAY = 'Friday';
24
+
25
+ const SATURDAY = 'Saturday';
26
+
27
+ const DECEMBER = 'December';
28
+
29
+ const _ALL_VALUES = [
30
+ self::SUNDAY,
31
+ self::MONDAY,
32
+ self::TUESDAY,
33
+ self::WEDNESDAY_,
34
+ self::THURSDAY,
35
+ self::FRI_DAY,
36
+ self::SATURDAY,
37
+ self::DECEMBER,
38
+ ];
39
+
40
+ /**
41
+ * Ensures that all the given values are present in this Enum.
42
+ *
43
+ * @param array|stdClass|null|string $value Value or a list/map of values
44
+ *
45
+ * @return array|null|string Input value(s), if all are a part of this Enum
46
+ *
47
+ * @throws Exception Throws exception if any given value is not in this Enum
48
+ */
49
+ public static function checkValue($value)
50
+ {
51
+ $value = json_decode(json_encode($value), true);
52
+ if (is_null($value)) {
53
+ return null;
54
+ }
55
+ if (is_array($value)) {
56
+ foreach ($value as $v) {
57
+ self::checkValue($v);
58
+ }
59
+ return $value;
60
+ }
61
+ if (!in_array($value, self::_ALL_VALUES, true)) {
62
+ throw new Exception("$value is invalid for " . self::class);
63
+ }
64
+ return $value;
65
+ }
66
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Employee.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * @discriminator personType
9
+ * @discriminatorType Empl
10
+ */
11
+ class Employee extends Person implements \JsonSerializable
12
+ {
13
+ /**
14
+ * @var string
15
+ */
16
+ private $department;
17
+
18
+ /**
19
+ * @var Person[]
20
+ */
21
+ private $dependents;
22
+
23
+ /**
24
+ * @var \DateTime
25
+ */
26
+ private $hiredAt;
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ private $joiningDay;
32
+
33
+ /**
34
+ * @var int
35
+ */
36
+ private $salary;
37
+
38
+ /**
39
+ * @var string[]
40
+ */
41
+ private $workingDays;
42
+
43
+ /**
44
+ * @var Person|null
45
+ */
46
+ private $boss;
47
+
48
+ /**
49
+ * @param string $address
50
+ * @param int $age
51
+ * @param string $name
52
+ * @param string $uid
53
+ */
54
+ public function __construct($address, $age, $name, $uid )
55
+ {
56
+ parent::__construct($address, $age, $name, $uid);
57
+ }
58
+
59
+ /**
60
+ * Returns Department.
61
+ */
62
+ public function getDepartment()
63
+ {
64
+ return $this->department;
65
+ }
66
+
67
+ /**
68
+ * Sets Department.
69
+ *
70
+ * @required
71
+ * @maps department
72
+ */
73
+ public function setDepartment($department)
74
+ {
75
+ $this->department = $department;
76
+ }
77
+
78
+ /**
79
+ * Returns Dependents.
80
+ *
81
+ * @return Person[]
82
+ */
83
+ public function getDependents()
84
+ {
85
+ return $this->dependents;
86
+ }
87
+
88
+ /**
89
+ * Sets Dependents.
90
+ *
91
+ * @required
92
+ * @maps dependents
93
+ *
94
+ * @param Person[] $dependents
95
+ */
96
+ public function setDependents($dependents)
97
+ {
98
+ $this->dependents = $dependents;
99
+ }
100
+
101
+ /**
102
+ * Returns Hired At.
103
+ */
104
+ public function getHiredAt()
105
+ {
106
+ return $this->hiredAt;
107
+ }
108
+
109
+ /**
110
+ * Sets Hired At.
111
+ *
112
+ * @required
113
+ * @maps hiredAt
114
+ * @factory multitypetest\model\DateTimeHelper::fromRfc1123DateTime
115
+ */
116
+ public function setHiredAt($hiredAt)
117
+ {
118
+ $this->hiredAt = $hiredAt;
119
+ }
120
+
121
+ /**
122
+ * Returns Joining Day.
123
+ */
124
+ public function getJoiningDay()
125
+ {
126
+ return $this->joiningDay;
127
+ }
128
+
129
+ /**
130
+ * Sets Joining Day.
131
+ *
132
+ * @required
133
+ * @maps joiningDay
134
+ */
135
+ public function setJoiningDay($joiningDay)
136
+ {
137
+ $this->joiningDay = $joiningDay;
138
+ }
139
+
140
+ /**
141
+ * Returns Salary.
142
+ */
143
+ public function getSalary()
144
+ {
145
+ return $this->salary;
146
+ }
147
+
148
+ /**
149
+ * Sets Salary.
150
+ *
151
+ * @required
152
+ * @maps salary
153
+ */
154
+ public function setSalary($salary)
155
+ {
156
+ $this->salary = $salary;
157
+ }
158
+
159
+ /**
160
+ * Returns Working Days.
161
+ *
162
+ * @return string[]
163
+ */
164
+ public function getWorkingDays()
165
+ {
166
+ return $this->workingDays;
167
+ }
168
+
169
+ /**
170
+ * Sets Working Days.
171
+ *
172
+ * @required
173
+ * @maps workingDays
174
+ *
175
+ * @param string[] $workingDays
176
+ */
177
+ public function setWorkingDays($workingDays)
178
+ {
179
+ $this->workingDays = $workingDays;
180
+ }
181
+
182
+ /**
183
+ * Returns Boss.
184
+ */
185
+ public function getBoss()
186
+ {
187
+ return $this->boss;
188
+ }
189
+
190
+ /**
191
+ * Sets Boss.
192
+ *
193
+ * @maps boss
194
+ */
195
+ public function setBoss($boss)
196
+ {
197
+ $this->boss = $boss;
198
+ }
199
+
200
+ private $additionalProperties = [];
201
+
202
+ /**
203
+ * Add an additional property to this model.
204
+ *
205
+ * @param string $name Name of property
206
+ * @param mixed $value Value of property
207
+ */
208
+ public function addAdditionalProperty($name, $value)
209
+ {
210
+ $this->additionalProperties[$name] = $value;
211
+ }
212
+
213
+ /**
214
+ * Encode this object to JSON
215
+ *
216
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
217
+ * are set. (default: false)
218
+ *
219
+ * @return mixed
220
+ */
221
+ #[\ReturnTypeWillChange]
222
+ public function jsonSerialize($asArrayWhenEmpty = false)
223
+ {
224
+ $json = [];
225
+ $json['department'] = $this->department;
226
+ $json['dependents'] = $this->dependents;
227
+ $json['hiredAt'] = DateTimeHelper::toRfc1123DateTime($this->hiredAt);
228
+ $json['joiningDay'] = $this->joiningDay;
229
+ $json['salary'] = $this->salary;
230
+ $json['workingDays'] = $this->workingDays;
231
+ $json['boss'] = $this->boss;
232
+ $json = array_merge($json, parent::jsonSerialize(true), $this->additionalProperties);
233
+
234
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
235
+ }
236
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Evening.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * Course evening session
9
+ *
10
+ * @discriminator sessionType
11
+ * @discriminatorType Evening
12
+ */
13
+ class Evening implements \JsonSerializable
14
+ {
15
+ /**
16
+ * @var string
17
+ */
18
+ private $startsAt;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ private $endsAt;
24
+
25
+ /**
26
+ * @var string|null
27
+ */
28
+ private $sessionType;
29
+
30
+ /**
31
+ * @param string $startsAt
32
+ * @param string $endsAt
33
+ */
34
+ public function __construct($startsAt, $endsAt)
35
+ {
36
+ $this->startsAt = $startsAt;
37
+ $this->endsAt = $endsAt;
38
+ }
39
+
40
+ /**
41
+ * Returns Starts At.
42
+ *
43
+ * Session start time
44
+ */
45
+ public function getStartsAt()
46
+ {
47
+ return $this->startsAt;
48
+ }
49
+
50
+ /**
51
+ * Sets Starts At.
52
+ *
53
+ * Session start time
54
+ *
55
+ * @required
56
+ * @maps startsAt
57
+ */
58
+ public function setStartsAt($startsAt)
59
+ {
60
+ $this->startsAt = $startsAt;
61
+ }
62
+
63
+ /**
64
+ * Returns Ends At.
65
+ *
66
+ * Session end time
67
+ */
68
+ public function getEndsAt()
69
+ {
70
+ return $this->endsAt;
71
+ }
72
+
73
+ /**
74
+ * Sets Ends At.
75
+ *
76
+ * Session end time
77
+ *
78
+ * @required
79
+ * @maps endsAt
80
+ */
81
+ public function setEndsAt($endsAt)
82
+ {
83
+ $this->endsAt = $endsAt;
84
+ }
85
+
86
+ /**
87
+ * Returns Session Type.
88
+ */
89
+ public function getSessionType()
90
+ {
91
+ return $this->sessionType;
92
+ }
93
+
94
+ /**
95
+ * Sets Session Type.
96
+ *
97
+ * @maps sessionType
98
+ */
99
+ public function setSessionType($sessionType)
100
+ {
101
+ $this->sessionType = $sessionType;
102
+ }
103
+
104
+ /**
105
+ * Encode this object to JSON
106
+ *
107
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
108
+ * are set. (default: false)
109
+ *
110
+ * @return mixed
111
+ */
112
+ #[\ReturnTypeWillChange]
113
+ public function jsonSerialize($asArrayWhenEmpty = false)
114
+ {
115
+ $json = [];
116
+ $json['startsAt'] = $this->startsAt;
117
+ $json['endsAt'] = $this->endsAt;
118
+ $json['sessionType'] = $this->sessionType;
119
+
120
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
121
+ }
122
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/MonthNameEnum.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use Exception;
6
+ use stdClass;
7
+
8
+ /**
9
+ * A string enum representing days of the week
10
+ */
11
+ class MonthNameEnum
12
+ {
13
+ const JANUARY = 'January';
14
+
15
+ const FEBRUARY = 'February';
16
+
17
+ const MARCH = 'March';
18
+
19
+ const APRIL = 'April';
20
+
21
+ const MAY = 'May';
22
+
23
+ const JUNE = 'June';
24
+
25
+ const JULY = 'July';
26
+
27
+ const AUGUST = 'August';
28
+
29
+ const SEPTEMBER = 'September';
30
+
31
+ const OCTOBER = 'October';
32
+
33
+ const NOVEMBER = 'November';
34
+
35
+ const DECEMBER = 'December';
36
+
37
+ const _ALL_VALUES = [
38
+ self::JANUARY,
39
+ self::FEBRUARY,
40
+ self::MARCH,
41
+ self::APRIL,
42
+ self::MAY,
43
+ self::JUNE,
44
+ self::JULY,
45
+ self::AUGUST,
46
+ self::SEPTEMBER,
47
+ self::OCTOBER,
48
+ self::NOVEMBER,
49
+ self::DECEMBER,
50
+ ];
51
+
52
+ /**
53
+ * Ensures that all the given values are present in this Enum.
54
+ *
55
+ * @param array|stdClass|null|string $value Value or a list/map of values
56
+ *
57
+ * @return array|null|string Input value(s), if all are a part of this Enum
58
+ *
59
+ * @throws Exception Throws exception if any given value is not in this Enum
60
+ */
61
+ public static function checkValue($value)
62
+ {
63
+ $value = json_decode(json_encode($value), true);
64
+ if (is_null($value)) {
65
+ return null;
66
+ }
67
+ if (is_array($value)) {
68
+ foreach ($value as $v) {
69
+ self::checkValue($v);
70
+ }
71
+ return $value;
72
+ }
73
+ if (!in_array($value, self::_ALL_VALUES, true)) {
74
+ throw new Exception("$value is invalid for " . self::class);
75
+ }
76
+ return $value;
77
+ }
78
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/MonthNumberEnum.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use Exception;
6
+ use stdClass;
7
+
8
+ /**
9
+ * A string enum representing days of the week
10
+ */
11
+ class MonthNumberEnum
12
+ {
13
+ const JANUARY = 1;
14
+
15
+ const FEBRUARY = 2;
16
+
17
+ const MARCH = 3;
18
+
19
+ const APRIL = 4;
20
+
21
+ const MAY = 5;
22
+
23
+ const JUNE = 6;
24
+
25
+ const JULY = 7;
26
+
27
+ const AUGUST = 8;
28
+
29
+ const SEPTEMBER = 9;
30
+
31
+ const OCTOBER = 10;
32
+
33
+ const NOVEMBER = 11;
34
+
35
+ const DECEMBER = 12;
36
+
37
+ const _ALL_VALUES = [
38
+ self::JANUARY,
39
+ self::FEBRUARY,
40
+ self::MARCH,
41
+ self::APRIL,
42
+ self::MAY,
43
+ self::JUNE,
44
+ self::JULY,
45
+ self::AUGUST,
46
+ self::SEPTEMBER,
47
+ self::OCTOBER,
48
+ self::NOVEMBER,
49
+ self::DECEMBER,
50
+ ];
51
+
52
+ /**
53
+ * Ensures that all the given values are present in this Enum.
54
+ *
55
+ * @param array|stdClass|null|int $value Value or a list/map of values
56
+ *
57
+ * @return array|null|int Input value(s), if all are a part of this Enum
58
+ *
59
+ * @throws Exception Throws exception if any given value is not in this Enum
60
+ */
61
+ public static function checkValue($value)
62
+ {
63
+ $value = json_decode(json_encode($value), true);
64
+ if (is_null($value)) {
65
+ return null;
66
+ }
67
+ if (is_array($value)) {
68
+ foreach ($value as $v) {
69
+ self::checkValue($v);
70
+ }
71
+ return $value;
72
+ }
73
+ if (!in_array($value, self::_ALL_VALUES, true)) {
74
+ throw new Exception("$value is invalid for " . self::class);
75
+ }
76
+ return $value;
77
+ }
78
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Morning.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * Course morning session
9
+ *
10
+ * @discriminator sessionType
11
+ * @discriminatorType Morning
12
+ */
13
+ class Morning implements \JsonSerializable
14
+ {
15
+ /**
16
+ * @var string
17
+ */
18
+ private $startsAt;
19
+
20
+ /**
21
+ * @var string
22
+ */
23
+ private $endsAt;
24
+
25
+ /**
26
+ * @var string|null
27
+ */
28
+ private $sessionType;
29
+
30
+ /**
31
+ * @param string $startsAt
32
+ * @param string $endsAt
33
+ */
34
+ public function __construct($startsAt, $endsAt)
35
+ {
36
+ $this->startsAt = $startsAt;
37
+ $this->endsAt = $endsAt;
38
+ }
39
+
40
+ /**
41
+ * Returns Starts At.
42
+ *
43
+ * Session start time
44
+ */
45
+ public function getStartsAt()
46
+ {
47
+ return $this->startsAt;
48
+ }
49
+
50
+ /**
51
+ * Sets Starts At.
52
+ *
53
+ * Session start time
54
+ *
55
+ * @required
56
+ * @maps startsAt
57
+ */
58
+ public function setStartsAt($startsAt)
59
+ {
60
+ $this->startsAt = $startsAt;
61
+ }
62
+
63
+ /**
64
+ * Returns Ends At.
65
+ *
66
+ * Session end time
67
+ */
68
+ public function getEndsAt()
69
+ {
70
+ return $this->endsAt;
71
+ }
72
+
73
+ /**
74
+ * Sets Ends At.
75
+ *
76
+ * Session end time
77
+ *
78
+ * @required
79
+ * @maps endsAt
80
+ */
81
+ public function setEndsAt($endsAt)
82
+ {
83
+ $this->endsAt = $endsAt;
84
+ }
85
+
86
+ /**
87
+ * Returns Session Type.
88
+ */
89
+ public function getSessionType()
90
+ {
91
+ return $this->sessionType;
92
+ }
93
+
94
+ /**
95
+ * Sets Session Type.
96
+ *
97
+ * @maps sessionType
98
+ */
99
+ public function setSessionType($sessionType)
100
+ {
101
+ $this->sessionType = $sessionType;
102
+ }
103
+
104
+ /**
105
+ * Encode this object to JSON
106
+ *
107
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
108
+ * are set. (default: false)
109
+ *
110
+ * @return mixed
111
+ */
112
+ #[\ReturnTypeWillChange]
113
+ public function jsonSerialize($asArrayWhenEmpty = false)
114
+ {
115
+ $json = [];
116
+ $json['startsAt'] = $this->startsAt;
117
+ $json['endsAt'] = $this->endsAt;
118
+ $json['sessionType'] = $this->sessionType;
119
+
120
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
121
+ }
122
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Orbit.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class Orbit implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var int
14
+ */
15
+ private $numberOfElectrons;
16
+
17
+ /**
18
+ * @param int $numberOfElectrons
19
+ */
20
+ public function __construct($numberOfElectrons)
21
+ {
22
+ $this->numberOfElectrons = $numberOfElectrons;
23
+ }
24
+
25
+ /**
26
+ * Returns NumberOfElectrons.
27
+ * @return int
28
+ */
29
+ public function getNumberOfElectrons()
30
+ {
31
+ return $this->numberOfElectrons;
32
+ }
33
+
34
+ /**
35
+ * Sets Value.
36
+ * @param int
37
+ *
38
+ * @required
39
+ * @maps $numberOfElectrons
40
+ */
41
+ public function setNumberOfElectrons($numberOfElectrons)
42
+ {
43
+ $this->numberOfElectrons = $numberOfElectrons;
44
+ }
45
+
46
+ /**
47
+ * Encode this object to JSON
48
+ *
49
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
50
+ * are set. (default: false)
51
+ *
52
+ * @return array|stdClass
53
+ */
54
+ #[\ReturnTypeWillChange]
55
+ public function jsonSerialize($asArrayWhenEmpty = false)
56
+ {
57
+ $json = [];
58
+ $json['numberOfElectrons'] = $this->numberOfElectrons;
59
+
60
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
61
+ }
62
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/OuterArrayCase.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains inner array case of oneOf.
9
+ */
10
+ class OuterArrayCase implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var bool[]|int[][]|array
14
+ */
15
+ private $value;
16
+
17
+ /**
18
+ * @param bool[]|int[][]|array $value
19
+ */
20
+ public function __construct($value)
21
+ {
22
+ $this->value = $value;
23
+ }
24
+
25
+ /**
26
+ * Returns Value.
27
+ * @return bool[]|int[][]|array
28
+ */
29
+ public function getValue()
30
+ {
31
+ return $this->value;
32
+ }
33
+
34
+ /**
35
+ * Sets Value.
36
+ *
37
+ * @param bool[]|int[][]|array $value
38
+ * @required
39
+ * @maps value
40
+ * @mapsBy anyOf(bool,int[],oneOf(int,string))[]
41
+ */
42
+ public function setValue($value)
43
+ {
44
+ $this->value = $value;
45
+ }
46
+
47
+ /**
48
+ * Encode this object to JSON
49
+ *
50
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
51
+ * are set. (default: false)
52
+ *
53
+ * @return mixed
54
+ */
55
+ #[\ReturnTypeWillChange]
56
+ public function jsonSerialize($asArrayWhenEmpty = false)
57
+ {
58
+ $json = [];
59
+ $json['value'] = $this->value;
60
+
61
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
62
+ }
63
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Person.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * @discriminator personType
9
+ * @discriminatorType Per
10
+ */
11
+ class Person implements \JsonSerializable
12
+ {
13
+ /**
14
+ * @var string
15
+ */
16
+ private $address;
17
+
18
+ /**
19
+ * @var int
20
+ */
21
+ private $age;
22
+
23
+ /**
24
+ * @var \DateTime
25
+ */
26
+ private $birthday;
27
+
28
+ /**
29
+ * @var \DateTime
30
+ */
31
+ private $birthtime;
32
+
33
+ /**
34
+ * @var string
35
+ */
36
+ private $name;
37
+
38
+ /**
39
+ * @var string
40
+ */
41
+ private $uid;
42
+
43
+ /**
44
+ * @var string|null
45
+ */
46
+ private $personType;
47
+
48
+ /**
49
+ * @param string $address
50
+ * @param int $age
51
+ * @param string $name
52
+ * @param string $uid
53
+ */
54
+ public function __construct($address, $age, $name, $uid)
55
+ {
56
+ $this->address = $address;
57
+ $this->age = $age;
58
+ $this->name = $name;
59
+ $this->uid = $uid;
60
+ }
61
+
62
+ /**
63
+ * Returns Address.
64
+ */
65
+ public function getAddress()
66
+ {
67
+ return $this->address;
68
+ }
69
+
70
+ /**
71
+ * Sets Address.
72
+ *
73
+ * @required
74
+ * @maps address
75
+ */
76
+ public function setAddress($address)
77
+ {
78
+ $this->address = $address;
79
+ }
80
+
81
+ /**
82
+ * Returns Age.
83
+ */
84
+ public function getAge()
85
+ {
86
+ return $this->age;
87
+ }
88
+
89
+ /**
90
+ * Sets Age.
91
+ *
92
+ * @required
93
+ * @maps age
94
+ */
95
+ public function setAge($age)
96
+ {
97
+ $this->age = $age;
98
+ }
99
+
100
+ /**
101
+ * Returns Birthday.
102
+ */
103
+ public function getBirthday()
104
+ {
105
+ return $this->birthday;
106
+ }
107
+
108
+ /**
109
+ * Sets Birthday.
110
+ *
111
+ * @required
112
+ * @maps birthday
113
+ * @factory multitypetest\model\DateTimeHelper::fromSimpleDate
114
+ */
115
+ public function setBirthday($birthday)
116
+ {
117
+ $this->birthday = $birthday;
118
+ }
119
+
120
+ /**
121
+ * Returns Birthtime.
122
+ */
123
+ public function getBirthtime()
124
+ {
125
+ return $this->birthtime;
126
+ }
127
+
128
+ /**
129
+ * Sets Birthtime.
130
+ *
131
+ * @required
132
+ * @maps birthtime
133
+ * @factory multitypetest\model\DateTimeHelper::fromRfc3339DateTime
134
+ */
135
+ public function setBirthtime($birthtime)
136
+ {
137
+ $this->birthtime = $birthtime;
138
+ }
139
+
140
+ /**
141
+ * Returns Name.
142
+ */
143
+ public function getName()
144
+ {
145
+ return $this->name;
146
+ }
147
+
148
+ /**
149
+ * Sets Name.
150
+ *
151
+ * @required
152
+ * @maps name
153
+ */
154
+ public function setName($name)
155
+ {
156
+ $this->name = $name;
157
+ }
158
+
159
+ /**
160
+ * Returns Uid.
161
+ */
162
+ public function getUid()
163
+ {
164
+ return $this->uid;
165
+ }
166
+
167
+ /**
168
+ * Sets Uid.
169
+ *
170
+ * @required
171
+ * @maps uid
172
+ */
173
+ public function setUid($uid)
174
+ {
175
+ $this->uid = $uid;
176
+ }
177
+
178
+ /**
179
+ * Returns Person Type.
180
+ */
181
+ public function getPersonType()
182
+ {
183
+ return $this->personType;
184
+ }
185
+
186
+ /**
187
+ * Sets Person Type.
188
+ *
189
+ * @maps personType
190
+ */
191
+ public function setPersonType($personType)
192
+ {
193
+ $this->personType = $personType;
194
+ }
195
+
196
+ private $additionalProperties = [];
197
+
198
+ /**
199
+ * Add an additional property to this model.
200
+ *
201
+ * @param string $name Name of property
202
+ * @param mixed $value Value of property
203
+ */
204
+ public function addAdditionalProperty($name, $value)
205
+ {
206
+ $this->additionalProperties[$name] = $value;
207
+ }
208
+
209
+ /**
210
+ * Encode this object to JSON
211
+ *
212
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
213
+ * are set. (default: false)
214
+ *
215
+ * @return mixed
216
+ */
217
+ #[\ReturnTypeWillChange]
218
+ public function jsonSerialize($asArrayWhenEmpty = false)
219
+ {
220
+ $json = [];
221
+ $json['address'] = $this->address;
222
+ $json['age'] = $this->age;
223
+ $json['birthday'] = DateTimeHelper::toSimpleDate($this->birthday);
224
+ $json['birthtime'] = DateTimeHelper::toRfc3339DateTime($this->birthtime);
225
+ $json['name'] = $this->name;
226
+ $json['uid'] = $this->uid;
227
+ $json['personType'] = $this->personType;
228
+ $json = array_merge($json, $this->additionalProperties);
229
+
230
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
231
+ }
232
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Postman.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * @discriminator personType
9
+ * @discriminatorType Post
10
+ */
11
+ class Postman extends Person implements \JsonSerializable
12
+ {
13
+ /**
14
+ * @var string
15
+ */
16
+ private $department;
17
+
18
+ /**
19
+ * @var Person[]
20
+ */
21
+ private $dependents;
22
+
23
+ /**
24
+ * @var \DateTime
25
+ */
26
+ private $hiredAt;
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ private $joiningDay;
32
+
33
+ /**
34
+ * @var int
35
+ */
36
+ private $salary;
37
+
38
+ /**
39
+ * @var string[]
40
+ */
41
+ private $workingDays;
42
+
43
+ /**
44
+ * @param string $address
45
+ * @param int $age
46
+ * @param string $name
47
+ * @param string $uid
48
+ */
49
+ public function __construct($address, $age, $name, $uid)
50
+ {
51
+ parent::__construct($address, $age, $name, $uid);
52
+ }
53
+
54
+ /**
55
+ * Returns Department.
56
+ */
57
+ public function getDepartment()
58
+ {
59
+ return $this->department;
60
+ }
61
+
62
+ /**
63
+ * Sets Department.
64
+ *
65
+ * @required
66
+ * @maps department
67
+ */
68
+ public function setDepartment($department)
69
+ {
70
+ $this->department = $department;
71
+ }
72
+
73
+ /**
74
+ * Returns Dependents.
75
+ *
76
+ * @return Person[]
77
+ */
78
+ public function getDependents()
79
+ {
80
+ return $this->dependents;
81
+ }
82
+
83
+ /**
84
+ * Sets Dependents.
85
+ *
86
+ * @required
87
+ * @maps dependents
88
+ *
89
+ * @param Person[] $dependents
90
+ */
91
+ public function setDependents($dependents)
92
+ {
93
+ $this->dependents = $dependents;
94
+ }
95
+
96
+ /**
97
+ * Returns Hired At.
98
+ */
99
+ public function getHiredAt()
100
+ {
101
+ return $this->hiredAt;
102
+ }
103
+
104
+ /**
105
+ * Sets Hired At.
106
+ *
107
+ * @required
108
+ * @maps hiredAt
109
+ * @factory multitypetest\model\DateTimeHelper::fromRfc1123DateTime
110
+ */
111
+ public function setHiredAt($hiredAt)
112
+ {
113
+ $this->hiredAt = $hiredAt;
114
+ }
115
+
116
+ /**
117
+ * Returns Joining Day.
118
+ */
119
+ public function getJoiningDay()
120
+ {
121
+ return $this->joiningDay;
122
+ }
123
+
124
+ /**
125
+ * Sets Joining Day.
126
+ *
127
+ * @required
128
+ * @maps joiningDay
129
+ */
130
+ public function setJoiningDay($joiningDay)
131
+ {
132
+ $this->joiningDay = $joiningDay;
133
+ }
134
+
135
+ /**
136
+ * Returns Salary.
137
+ */
138
+ public function getSalary()
139
+ {
140
+ return $this->salary;
141
+ }
142
+
143
+ /**
144
+ * Sets Salary.
145
+ *
146
+ * @required
147
+ * @maps salary
148
+ */
149
+ public function setSalary($salary)
150
+ {
151
+ $this->salary = $salary;
152
+ }
153
+
154
+ /**
155
+ * Returns Working Days.
156
+ *
157
+ * @return string[]
158
+ */
159
+ public function getWorkingDays()
160
+ {
161
+ return $this->workingDays;
162
+ }
163
+
164
+ /**
165
+ * Sets Working Days.
166
+ *
167
+ * @required
168
+ * @maps workingDays
169
+ *
170
+ * @param string[] $workingDays
171
+ */
172
+ public function setWorkingDays($workingDays)
173
+ {
174
+ $this->workingDays = $workingDays;
175
+ }
176
+
177
+ private $additionalProperties = [];
178
+
179
+ /**
180
+ * Add an additional property to this model.
181
+ *
182
+ * @param string $name Name of property
183
+ * @param mixed $value Value of property
184
+ */
185
+ public function addAdditionalProperty($name, $value)
186
+ {
187
+ $this->additionalProperties[$name] = $value;
188
+ }
189
+
190
+ /**
191
+ * Encode this object to JSON
192
+ *
193
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
194
+ * are set. (default: false)
195
+ *
196
+ * @return mixed
197
+ */
198
+ #[\ReturnTypeWillChange]
199
+ public function jsonSerialize($asArrayWhenEmpty = false)
200
+ {
201
+ $json = [];
202
+ $json['department'] = $this->department;
203
+ $json['dependents'] = $this->dependents;
204
+ $json['hiredAt'] = DateTimeHelper::toRfc1123DateTime($this->hiredAt);
205
+ $json['joiningDay'] = $this->joiningDay;
206
+ $json['salary'] = $this->salary;
207
+ $json['workingDays'] = $this->workingDays;
208
+ $json = array_merge($json, parent::jsonSerialize(true), $this->additionalProperties);
209
+
210
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
211
+ }
212
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCase.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class SimpleCase implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var string[]
14
+ */
15
+ private $value;
16
+
17
+ /**
18
+ * @param string[] $value
19
+ */
20
+ public function __construct($value)
21
+ {
22
+ $this->value = $value;
23
+ }
24
+
25
+ /**
26
+ * Returns Value.
27
+ *
28
+ * @return string[]
29
+ */
30
+ public function getValue()
31
+ {
32
+ return $this->value;
33
+ }
34
+
35
+ /**
36
+ * Sets Value.
37
+ *
38
+ * @param string[] $value
39
+ * @required
40
+ * @maps value
41
+ */
42
+ public function setValue($value)
43
+ {
44
+ $this->value = $value;
45
+ }
46
+
47
+ /**
48
+ * Encode this object to JSON
49
+ *
50
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
51
+ * are set. (default: false)
52
+ *
53
+ * @return array|stdClass
54
+ */
55
+ #[\ReturnTypeWillChange]
56
+ public function jsonSerialize($asArrayWhenEmpty = false)
57
+ {
58
+ $json = [];
59
+ $json['value'] = $this->value;
60
+
61
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
62
+ }
63
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCaseA.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class SimpleCaseA implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var int[]|float[]|bool
14
+ */
15
+ private $value;
16
+
17
+ /**
18
+ * @param int[]|float[]|bool $value
19
+ */
20
+ public function __construct($value)
21
+ {
22
+ $this->value = $value;
23
+ }
24
+
25
+ /**
26
+ * Returns Value.
27
+ *
28
+ * @return int[]|float[]|bool
29
+ */
30
+ public function getValue()
31
+ {
32
+ return $this->value;
33
+ }
34
+
35
+ /**
36
+ * Sets Value.
37
+ *
38
+ * @param int[]|float[]|bool $value
39
+ * @required
40
+ * @maps value
41
+ * @mapsBy anyOf(int[],float[],bool)
42
+ */
43
+ public function setValue($value)
44
+ {
45
+ $this->value = $value;
46
+ }
47
+
48
+ /**
49
+ * Encode this object to JSON
50
+ *
51
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
52
+ * are set. (default: false)
53
+ *
54
+ * @return array|stdClass
55
+ */
56
+ #[\ReturnTypeWillChange]
57
+ public function jsonSerialize($asArrayWhenEmpty = false)
58
+ {
59
+ $json = [];
60
+ $json['value'] = $this->value;
61
+
62
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
63
+ }
64
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/SimpleCaseB.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains inner array case of oneOf.
9
+ */
10
+ class SimpleCaseB implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var bool|int[]|array
14
+ */
15
+ private $value;
16
+
17
+ /**
18
+ * @param bool|int[]|array $value
19
+ */
20
+ public function __construct($value)
21
+ {
22
+ $this->value = $value;
23
+ }
24
+
25
+ /**
26
+ * Returns Value.
27
+ * @return bool|int[]|array
28
+ */
29
+ public function getValue()
30
+ {
31
+ return $this->value;
32
+ }
33
+
34
+ /**
35
+ * Sets Value.
36
+ *
37
+ * @param bool|int[]|array $value
38
+ * @required
39
+ * @maps value
40
+ * @mapsBy oneOf(bool,int[],array)
41
+ */
42
+ public function setValue($value)
43
+ {
44
+ $this->value = $value;
45
+ }
46
+
47
+ /**
48
+ * Encode this object to JSON
49
+ *
50
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
51
+ * are set. (default: false)
52
+ *
53
+ * @return mixed
54
+ */
55
+ #[\ReturnTypeWillChange]
56
+ public function jsonSerialize($asArrayWhenEmpty = false)
57
+ {
58
+ $json = [];
59
+ $json['value'] = $this->value;
60
+
61
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
62
+ }
63
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Vehicle.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class Vehicle implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var string
14
+ */
15
+ private $numberOfTyres;
16
+
17
+ /**
18
+ * @param string $numberOfTyres
19
+ */
20
+ public function __construct($numberOfTyres)
21
+ {
22
+ $this->numberOfTyres = $numberOfTyres;
23
+ }
24
+
25
+ /**
26
+ * Returns NumberOfTyres.
27
+ * @return string
28
+ */
29
+ public function getNumberOfTyres()
30
+ {
31
+ return $this->numberOfTyres;
32
+ }
33
+
34
+ /**
35
+ * Sets Value.
36
+ * @param string
37
+ *
38
+ * @required
39
+ * @maps numberOfTyres
40
+ */
41
+ public function setNumberOfTyres($numberOfTyres)
42
+ {
43
+ $this->numberOfTyres = $numberOfTyres;
44
+ }
45
+
46
+ /**
47
+ * Encode this object to JSON
48
+ *
49
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
50
+ * are set. (default: false)
51
+ *
52
+ * @return array|stdClass
53
+ */
54
+ #[\ReturnTypeWillChange]
55
+ public function jsonSerialize($asArrayWhenEmpty = false)
56
+ {
57
+ $json = [];
58
+ $json['numberOfTyres'] = $this->numberOfTyres;
59
+
60
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
61
+ }
62
+ }
vendor/apimatic/jsonmapper/tests/multitypetest/model/Vehicle2.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace multitypetest\model;
4
+
5
+ use stdClass;
6
+
7
+ /**
8
+ * This class contains simple case of oneOf.
9
+ */
10
+ class Vehicle2 implements \JsonSerializable
11
+ {
12
+ /**
13
+ * @var int
14
+ */
15
+ private $numberOfTyres;
16
+
17
+ /**
18
+ * @param int $numberOfTyres
19
+ */
20
+ public function __construct($numberOfTyres)
21
+ {
22
+ $this->numberOfTyres = $numberOfTyres;
23
+ }
24
+
25
+ /**
26
+ * Returns NumberOfTyres.
27
+ * @return int
28
+ */
29
+ public function getNumberOfTyres()
30
+ {
31
+ return $this->numberOfTyres;
32
+ }
33
+
34
+ /**
35
+ * Sets Value.
36
+ * @param int
37
+ *
38
+ * @required
39
+ * @maps numberOfTyres
40
+ */
41
+ public function setNumberOfTyres($numberOfTyres)
42
+ {
43
+ $this->numberOfTyres = $numberOfTyres;
44
+ }
45
+
46
+ /**
47
+ * Encode this object to JSON
48
+ *
49
+ * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
50
+ * are set. (default: false)
51
+ *
52
+ * @return array|stdClass
53
+ */
54
+ #[\ReturnTypeWillChange]
55
+ public function jsonSerialize($asArrayWhenEmpty = false)
56
+ {
57
+ $json = [];
58
+ $json['numberOfTyres'] = $this->numberOfTyres;
59
+
60
+ return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
61
+ }
62
+ }
vendor/apimatic/jsonmapper/tests/namespacetest/NamespaceTest.php CHANGED
@@ -7,7 +7,13 @@ require_once __DIR__ . '/model/UserList.php';
7
  require_once __DIR__ . '/../othernamespace/Foo.php';
8
 
9
  use apimatic\jsonmapper\JsonMapper;
 
10
 
 
 
 
 
 
11
  class NamespaceTest extends \PHPUnit\Framework\TestCase
12
  {
13
  public function testMapArrayNamespace()
@@ -66,12 +72,10 @@ class NamespaceTest extends \PHPUnit\Framework\TestCase
66
  $this->assertInstanceOf('\namespacetest\model\User', $res->user);
67
  }
68
 
69
- /**
70
- * @expectedException apimatic\jsonmapper\JsonMapperException
71
- * @expectedExceptionMessage Empty type at property "namespacetest\UnitData::$empty"
72
- */
73
  public function testMapEmpty()
74
  {
 
 
75
  $mapper = new JsonMapper();
76
  $json = '{"empty":{}}';
77
  /* @var \namespacetest\UnitData $res */
7
  require_once __DIR__ . '/../othernamespace/Foo.php';
8
 
9
  use apimatic\jsonmapper\JsonMapper;
10
+ use apimatic\jsonmapper\JsonMapperException;
11
 
12
+ /**
13
+ * @covers \apimatic\jsonmapper\JsonMapper
14
+ * @covers \apimatic\jsonmapper\TypeCombination
15
+ * @covers \apimatic\jsonmapper\JsonMapperException
16
+ */
17
  class NamespaceTest extends \PHPUnit\Framework\TestCase
18
  {
19
  public function testMapArrayNamespace()
72
  $this->assertInstanceOf('\namespacetest\model\User', $res->user);
73
  }
74
 
 
 
 
 
75
  public function testMapEmpty()
76
  {
77
+ $this->expectException(JsonMapperException::class);
78
+ $this->expectExceptionMessage("Empty type at property 'namespacetest\UnitData::\$empty'");
79
  $mapper = new JsonMapper();
80
  $json = '{"empty":{}}';
81
  /* @var \namespacetest\UnitData $res */
vendor/apimatic/unirest-php/.github/workflows/php.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Tests
2
+ on:
3
+ push:
4
+ branches: [ v2-master ]
5
+ pull_request:
6
+ branches: [ v2-master ]
7
+ jobs:
8
+ test:
9
+ name: PHP ${{ matrix.php }}
10
+ runs-on: ubuntu-latest
11
+ if: "! contains(toJSON(github.event.head_commit.message), 'skip ci')"
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ experimental: [false]
17
+ php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v2
21
+ - name: Set up PHP
22
+ uses: shivammathur/setup-php@v2
23
+ with:
24
+ php-version: ${{ matrix.php }}
25
+ - name: Cache Composer dependencies
26
+ uses: actions/cache@v2
27
+ with:
28
+ path: ~/.composer/cache/files
29
+ key: php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
30
+ restore-keys: php-${{ matrix.php }}-composer-
31
+ - name: Install dependencies
32
+ run: composer install --prefer-source
33
+ - name: Run tests
34
+ run: ./vendor/bin/phpunit --coverage-text
vendor/apimatic/unirest-php/.gitignore CHANGED
@@ -5,3 +5,4 @@ composer*.lock
5
  composer.phar
6
  coverage
7
  vendor*
 
5
  composer.phar
6
  coverage
7
  vendor*
8
+ .phpunit.result.cache
vendor/apimatic/unirest-php/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: php
2
- dist: xenial
3
- os: linux
4
- php:
5
- - 5.6
6
- - 7.0
7
- - 7.1
8
- - 7.2
9
- - 7.3
10
- - 7.4
11
-
12
- before_script:
13
- - composer install --no-interaction --prefer-source --dev
14
- - phpenv rehash
15
- script:
16
- - ./vendor/bin/phpunit --coverage-text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/apimatic/unirest-php/README.md CHANGED
@@ -2,7 +2,7 @@
2
 
3
  [![version][packagist-version]][packagist-url]
4
  [![Downloads][packagist-downloads]][packagist-url]
5
- [![Build Status][travis-image]][travis-url]
6
  [![License][packagist-license]][license-url]
7
 
8
  Unirest is a set of lightweight HTTP libraries available in [multiple languages](http://unirest.io).
@@ -31,7 +31,7 @@ To install `apimatic/unirest-php` with Composer, just add the following to your
31
  ```json
32
  {
33
  "require": {
34
- "apimatic/unirest-php": "^2.0"
35
  }
36
  }
37
  ```
2
 
3
  [![version][packagist-version]][packagist-url]
4
  [![Downloads][packagist-downloads]][packagist-url]
5
+ [![Tests](https://github.com/apimatic/unirest-php/actions/workflows/php.yml/badge.svg)](https://github.com/apimatic/unirest-php/actions/workflows/php.yml)
6
  [![License][packagist-license]][license-url]
7
 
8
  Unirest is a set of lightweight HTTP libraries available in [multiple languages](http://unirest.io).
31
  ```json
32
  {
33
  "require": {
34
+ "apimatic/unirest-php": "^2.2.2"
35
  }
36
  }
37
  ```
vendor/apimatic/unirest-php/composer.json CHANGED
@@ -33,7 +33,7 @@
33
  "ext-json": "Allows using JSON Bodies for sending and parsing requests"
34
  },
35
  "require-dev": {
36
- "phpunit/phpunit": "^5 || ^6 || ^7"
37
  },
38
  "autoload": {
39
  "psr-0": {
33
  "ext-json": "Allows using JSON Bodies for sending and parsing requests"
34
  },
35
  "require-dev": {
36
+ "phpunit/phpunit": "^5 || ^6 || ^7 || ^8 || ^9"
37
  },
38
  "autoload": {
39
  "psr-0": {
vendor/apimatic/unirest-php/src/Unirest/OverrideRetry.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Unirest;
4
+
5
+ interface OverrideRetry
6
+ {
7
+ /**
8
+ * To retry request, ignoring httpMethods whitelist.
9
+ */
10
+ const ENABLE_RETRY = "enableRetries";
11
+
12
+ /**
13
+ * To disable retries, ignoring httpMethods whitelist.
14
+ */
15
+ const DISABLE_RETRY = "disableRetries";
16
+
17
+ /**
18
+ * To use global httpMethods whitelist to determine if request needs retrying.
19
+ */
20
+ const USE_GLOBAL_SETTINGS = "useGlobalSettings";
21
+ }
vendor/apimatic/unirest-php/src/Unirest/Request.php CHANGED
@@ -7,12 +7,21 @@ class Request
7
  private static $cookie = null;
8
  private static $cookieFile = null;
9
  private static $curlOpts = array();
10
- private static $defaultHeaders = array();
11
  private static $handle = null;
12
  private static $jsonOpts = array();
13
  private static $socketTimeout = null;
 
 
 
 
 
 
 
 
 
14
  private static $verifyPeer = true;
15
  private static $verifyHost = true;
 
16
 
17
  private static $auth = array (
18
  'user' => '',
@@ -32,6 +41,8 @@ class Request
32
  )
33
  );
34
 
 
 
35
  /**
36
  * Set JSON decode mode
37
  *
@@ -78,6 +89,105 @@ class Request
78
  return self::$socketTimeout = $seconds;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Set default headers to send on every request
83
  *
@@ -133,7 +243,7 @@ class Request
133
  }
134
 
135
  /**
136
- * Clear all the default headers
137
  */
138
  public static function clearCurlOpts()
139
  {
@@ -380,6 +490,12 @@ class Request
380
  return $result;
381
  }
382
 
 
 
 
 
 
 
383
  /**
384
  * Send a cURL request
385
  * @param \Unirest\Method|string $method HTTP method to use
@@ -393,17 +509,21 @@ class Request
393
  */
394
  public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
395
  {
396
- self::$handle = curl_init();
 
 
 
 
397
 
398
  if ($method !== Method::GET) {
399
- if ($method === Method::POST) {
400
- curl_setopt(self::$handle, CURLOPT_POST, true);
401
- } else {
402
- if ($method === Method::HEAD) {
403
  curl_setopt(self::$handle, CURLOPT_NOBODY, true);
404
- }
405
- curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
406
- }
407
 
408
  curl_setopt(self::$handle, CURLOPT_POSTFIELDS, $body);
409
  } elseif (is_array($body)) {
@@ -417,7 +537,7 @@ class Request
417
  }
418
 
419
  $curl_base_options = [
420
- CURLOPT_URL => self::encodeUrl($url),
421
  CURLOPT_RETURNTRANSFER => true,
422
  CURLOPT_FOLLOWLOCATION => true,
423
  CURLOPT_MAXREDIRS => 10,
@@ -471,21 +591,186 @@ class Request
471
  ));
472
  }
473
 
474
- $response = curl_exec(self::$handle);
475
- $error = curl_error(self::$handle);
476
- $info = self::getInfo();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
 
478
  if ($error) {
479
  throw new Exception($error);
480
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
 
482
- // Split the full response in its headers and body
483
- $header_size = $info['header_size'];
484
- $header = substr($response, 0, $header_size);
485
- $body = substr($response, $header_size);
486
- $httpCode = $info['http_code'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
 
488
- return new Response($httpCode, $body, $header, self::$jsonOpts);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  }
490
 
491
  public static function getInfo($opt = false)
@@ -525,47 +810,32 @@ class Request
525
  return $formattedHeaders;
526
  }
527
 
528
- private static function getArrayFromQuerystring($query)
529
- {
530
- $query = preg_replace_callback('/(?:^|(?<=&))[^=[]+/', function ($match) {
531
- return bin2hex(urldecode($match[0]));
532
- }, $query);
533
-
534
- parse_str($query, $values);
535
-
536
- return array_combine(array_map('hex2bin', array_keys($values)), $values);
537
- }
538
-
539
  /**
540
- * Ensure that a URL is encoded and safe to use with cURL
541
- * @param string $url URL to encode
542
- * @return string
 
543
  */
544
- private static function encodeUrl($url)
545
  {
546
- $url_parsed = parse_url($url);
547
-
548
- $scheme = $url_parsed['scheme'] . '://';
549
- $host = $url_parsed['host'];
550
- $port = (isset($url_parsed['port']) ? $url_parsed['port'] : null);
551
- $path = (isset($url_parsed['path']) ? $url_parsed['path'] : null);
552
- $query = (isset($url_parsed['query']) ? $url_parsed['query'] : null);
553
-
554
- if ($query !== null) {
555
- $query = '?' . http_build_query(self::getArrayFromQuerystring($query));
556
  }
557
-
558
- if (null !== $port) {
559
- if (!is_string($port)) {
560
- $port = strval($port);
561
- }
562
- if ($port[0] !== ':') {
563
- $port = ':' . $port;
564
- }
565
  }
 
 
566
 
567
- $result = $scheme . $host . $port . $path . $query;
568
- return $result;
 
 
 
 
569
  }
570
 
571
  private static function getHeaderString($key, $val)
7
  private static $cookie = null;
8
  private static $cookieFile = null;
9
  private static $curlOpts = array();
 
10
  private static $handle = null;
11
  private static $jsonOpts = array();
12
  private static $socketTimeout = null;
13
+ private static $enableRetries = false; // should we enable retries feature
14
+ private static $maxNumberOfRetries = 3; // total number of allowed retries
15
+ private static $retryOnTimeout = false; // Should we retry on timeout?
16
+ private static $retryInterval = 1.0; // Initial retry interval in seconds, to be increased by backoffFactor
17
+ private static $maximumRetryWaitTime = 120; // maximum retry wait time (commutative)
18
+ private static $backoffFactor = 2.0; // backoff factor to be used to increase retry interval
19
+ private static $httpStatusCodesToRetry = array(408, 413, 429, 500, 502, 503, 504, 521, 522, 524);
20
+ private static $httpMethodsToRetry = array("GET", "PUT");
21
+ private static $overrideRetryForNextRequest = OverrideRetry::USE_GLOBAL_SETTINGS;
22
  private static $verifyPeer = true;
23
  private static $verifyHost = true;
24
+ private static $defaultHeaders = array();
25
 
26
  private static $auth = array (
27
  'user' => '',
41
  )
42
  );
43
 
44
+ protected static $totalNumberOfConnections = 0;
45
+
46
  /**
47
  * Set JSON decode mode
48
  *
89
  return self::$socketTimeout = $seconds;
90
  }
91
 
92
+ /**
93
+ * Should we enable retries feature
94
+ *
95
+ * @param bool $enableRetries
96
+ * @return bool
97
+ */
98
+ public static function enableRetries($enableRetries)
99
+ {
100
+ return self::$enableRetries = $enableRetries;
101
+ }
102
+
103
+ /**
104
+ * Total number of allowed retries
105
+ *
106
+ * @param integer $maxNumberOfRetries
107
+ * @return integer
108
+ */
109
+ public static function maxNumberOfRetries($maxNumberOfRetries)
110
+ {
111
+ return self::$maxNumberOfRetries = $maxNumberOfRetries;
112
+ }
113
+
114
+ /**
115
+ * Should we retry on timeout
116
+ *
117
+ * @param bool $retryOnTimeout
118
+ * @return bool
119
+ */
120
+ public static function retryOnTimeout($retryOnTimeout)
121
+ {
122
+ return self::$retryOnTimeout = $retryOnTimeout;
123
+ }
124
+
125
+ /**
126
+ * Initial retry interval in seconds, to be increased by backoffFactor
127
+ *
128
+ * @param float $retryInterval
129
+ * @return float
130
+ */
131
+ public static function retryInterval($retryInterval)
132
+ {
133
+ return self::$retryInterval = $retryInterval;
134
+ }
135
+
136
+ /**
137
+ * Maximum retry wait time
138
+ *
139
+ * @param integer $maximumRetryWaitTime
140
+ * @return integer
141
+ */
142
+ public static function maximumRetryWaitTime($maximumRetryWaitTime)
143
+ {
144
+ return self::$maximumRetryWaitTime = $maximumRetryWaitTime;
145
+ }
146
+
147
+ /**
148
+ * Backoff factor to be used to increase retry interval
149
+ *
150
+ * @param float $backoffFactor
151
+ * @return float
152
+ */
153
+ public static function backoffFactor($backoffFactor)
154
+ {
155
+ return self::$backoffFactor = $backoffFactor;
156
+ }
157
+
158
+ /**
159
+ * Http status codes to retry against
160
+ *
161
+ * @param integer[] $httpStatusCodesToRetry
162
+ * @return integer[]
163
+ */
164
+ public static function httpStatusCodesToRetry($httpStatusCodesToRetry)
165
+ {
166
+ return self::$httpStatusCodesToRetry = $httpStatusCodesToRetry;
167
+ }
168
+
169
+ /**
170
+ * Http methods to retry against
171
+ *
172
+ * @param string[] $httpMethodsToRetry
173
+ * @return string[]
174
+ */
175
+ public static function httpMethodsToRetry($httpMethodsToRetry)
176
+ {
177
+ return self::$httpMethodsToRetry = $httpMethodsToRetry;
178
+ }
179
+
180
+ /**
181
+ * Enable or disable retries for next request, ignoring httpMethods whitelist.
182
+ *
183
+ * @param string $overrideRetryForNextRequest
184
+ * @return string
185
+ */
186
+ public static function overrideRetryForNextRequest($overrideRetryForNextRequest)
187
+ {
188
+ return self::$overrideRetryForNextRequest = $overrideRetryForNextRequest;
189
+ }
190
+
191
  /**
192
  * Set default headers to send on every request
193
  *
243
  }
244
 
245
  /**
246
+ * Clear all curl opts
247
  */
248
  public static function clearCurlOpts()
249
  {
490
  return $result;
491
  }
492
 
493
+ protected static function initializeHandle()
494
+ {
495
+ self::$handle = curl_init();
496
+ self::$totalNumberOfConnections = 0;
497
+ }
498
+
499
  /**
500
  * Send a cURL request
501
  * @param \Unirest\Method|string $method HTTP method to use
509
  */
510
  public static function send($method, $url, $body = null, $headers = array(), $username = null, $password = null)
511
  {
512
+ if (self::$handle == null) {
513
+ self::initializeHandle();
514
+ } else {
515
+ curl_reset(self::$handle);
516
+ }
517
 
518
  if ($method !== Method::GET) {
519
+ if ($method === Method::POST) {
520
+ curl_setopt(self::$handle, CURLOPT_POST, true);
521
+ } else {
522
+ if ($method === Method::HEAD) {
523
  curl_setopt(self::$handle, CURLOPT_NOBODY, true);
524
+ }
525
+ curl_setopt(self::$handle, CURLOPT_CUSTOMREQUEST, $method);
526
+ }
527
 
528
  curl_setopt(self::$handle, CURLOPT_POSTFIELDS, $body);
529
  } elseif (is_array($body)) {
537
  }
538
 
539
  $curl_base_options = [
540
+ CURLOPT_URL => self::validateUrl($url),
541
  CURLOPT_RETURNTRANSFER => true,
542
  CURLOPT_FOLLOWLOCATION => true,
543
  CURLOPT_MAXREDIRS => 10,
591
  ));
592
  }
593
 
594
+ $retryCount = 0; // current retry count
595
+ $waitTime = 0.0; // wait time in secs before current api call
596
+ $allowedWaitTime = self::$maximumRetryWaitTime; // remaining allowed wait time in seconds
597
+ $httpCode = null;
598
+ $headers = array();
599
+ do {
600
+ // If Retrying i.e. retryCount >= 1
601
+ if ($retryCount > 0) {
602
+ self::sleep($waitTime);
603
+ // calculate remaining allowed wait Time
604
+ $allowedWaitTime -= $waitTime;
605
+ }
606
+
607
+ // Execution of api call
608
+ $response = curl_exec(self::$handle);
609
+ $error = curl_error(self::$handle);
610
+ $info = self::getInfo();
611
+ if (!$error) {
612
+ $header_size = $info['header_size'];
613
+ $httpCode = $info['http_code'];
614
+ $headers = self::parseHeaders(substr($response, 0, $header_size));
615
+ }
616
+
617
+ if (self::shouldRetryRequest($method)) {
618
+ // calculate wait time for retry, and should not retry when wait time becomes 0
619
+ $waitTime = self::getRetryWaitTime($httpCode, $headers, $error, $allowedWaitTime, $retryCount);
620
+ $retryCount++;
621
+ }
622
+ } while ($waitTime > 0.0);
623
+
624
+ // reset request level retries check
625
+ self::$overrideRetryForNextRequest = OverrideRetry::USE_GLOBAL_SETTINGS;
626
 
627
  if ($error) {
628
  throw new Exception($error);
629
  }
630
+ // get response body
631
+ $body = substr($response, $header_size);
632
+
633
+ self::$totalNumberOfConnections += curl_getinfo(self::$handle, CURLINFO_NUM_CONNECTS);
634
+
635
+ return new Response($httpCode, $body, $headers, self::$jsonOpts);
636
+ }
637
+
638
+ /**
639
+ * Halts program flow for given number of seconds, and microseconds
640
+ *
641
+ * @param $seconds float seconds with upto 6 decimal places, here decimal part will be converted into microseconds
642
+ */
643
+ private static function sleep($seconds)
644
+ {
645
+ $secs = (int) $seconds;
646
+ // the fraction part of the $seconds will always be less than 1 sec, extracting micro seconds
647
+ $microSecs = (int) (($seconds - $secs) * 1000000);
648
+ sleep($secs);
649
+ usleep($microSecs);
650
+ }
651
 
652
+ /**
653
+ * Check if retries are enabled at global and request level,
654
+ * also check whitelisted httpMethods, if retries are only enabled globally.
655
+ *
656
+ * @param $method string|Method HttpMethod of request
657
+ * @return bool
658
+ */
659
+ private static function shouldRetryRequest($method)
660
+ {
661
+ switch (self::$overrideRetryForNextRequest) {
662
+ case OverrideRetry::ENABLE_RETRY:
663
+ return self::$enableRetries;
664
+ case OverrideRetry::USE_GLOBAL_SETTINGS:
665
+ return self::$enableRetries && in_array($method, self::$httpMethodsToRetry);
666
+ case OverrideRetry::DISABLE_RETRY:
667
+ return false;
668
+ }
669
+ return false;
670
+ }
671
 
672
+ /**
673
+ * Generate calculated wait time, and 0.0 if api should not be retried
674
+ *
675
+ * @param $httpCode int Http status code in response
676
+ * @param $headers array Response headers
677
+ * @param $error string Error returned by server
678
+ * @param $allowedWaitTime int Remaining allowed wait time
679
+ * @param $retryCount int Attempt number
680
+ * @return float Wait time before sending the next apiCall
681
+ */
682
+ private static function getRetryWaitTime($httpCode, $headers, $error, $allowedWaitTime, $retryCount)
683
+ {
684
+ $retryWaitTime = 0.0;
685
+ $retry_after = 0;
686
+ if ($error) {
687
+ $retry = self::$retryOnTimeout && curl_errno(self::$handle) == CURLE_OPERATION_TIMEDOUT;
688
+ } else {
689
+ // Successful apiCall with some status code or with Retry-After header
690
+ $headers_lower_keys = array_change_key_case($headers);
691
+ $retry_after_val = key_exists('retry-after', $headers_lower_keys) ?
692
+ $headers_lower_keys['retry-after'] : null;
693
+ $retry_after = self::getRetryAfterInSeconds($retry_after_val);
694
+ $retry = isset($retry_after_val) || in_array($httpCode, self::$httpStatusCodesToRetry);
695
+ }
696
+ // Calculate wait time only if max number of retries are not already attempted
697
+ if ($retry && $retryCount < self::$maxNumberOfRetries) {
698
+ // noise between 0 and 0.1 secs upto 6 decimal places
699
+ $noise = rand(0, 100000) / 1000000;
700
+ // calculate wait time with exponential backoff and noise in seconds
701
+ $waitTime = (self::$retryInterval * pow(self::$backoffFactor, $retryCount)) + $noise;
702
+ // select maximum of waitTime and retry_after
703
+ $waitTime = floatval(max($waitTime, $retry_after));
704
+ if ($waitTime <= $allowedWaitTime) {
705
+ // set retry wait time for next api call, only if its under allowed time
706
+ $retryWaitTime = $waitTime;
707
+ }
708
+ }
709
+ return $retryWaitTime;
710
+ }
711
+
712
+ /**
713
+ * Returns the number of seconds by extracting them from $retry-after header
714
+ *
715
+ * @param $retry_after mixed could be some numeric value in seconds, or it could be RFC1123
716
+ * formatted datetime string
717
+ * @return int Number of seconds specified by retry-after param
718
+ */
719
+ private static function getRetryAfterInSeconds($retry_after)
720
+ {
721
+ if (isset($retry_after)) {
722
+ if (is_numeric($retry_after)) {
723
+ return (int)$retry_after; // if value is already in seconds
724
+ } else {
725
+ // if value is a date time string in format RFC1123
726
+ $retry_after_date = \DateTime::createFromFormat('D, d M Y H:i:s O', $retry_after);
727
+ // retry_after_date could either be undefined, or false, or a DateTime object (if valid format string)
728
+ return $retry_after_date == false ? 0 : $retry_after_date->getTimestamp() - time();
729
+ }
730
+ }
731
+ return 0;
732
+ }
733
+
734
+ /**
735
+ * if PECL_HTTP is not available use a fall back function
736
+ *
737
+ * thanks to ricardovermeltfoort@gmail.com
738
+ * http://php.net/manual/en/function.http-parse-headers.php#112986
739
+ * @param string $raw_headers raw headers
740
+ * @return array
741
+ */
742
+ private static function parseHeaders($raw_headers)
743
+ {
744
+ if (function_exists('http_parse_headers')) {
745
+ return http_parse_headers($raw_headers);
746
+ } else {
747
+ $key = '';
748
+ $headers = array();
749
+
750
+ foreach (explode("\n", $raw_headers) as $i => $h) {
751
+ $h = explode(':', $h, 2);
752
+
753
+ if (isset($h[1])) {
754
+ if (!isset($headers[$h[0]])) {
755
+ $headers[$h[0]] = trim($h[1]);
756
+ } elseif (is_array($headers[$h[0]])) {
757
+ $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
758
+ } else {
759
+ $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
760
+ }
761
+
762
+ $key = $h[0];
763
+ } else {
764
+ if (substr($h[0], 0, 1) == "\t") {
765
+ $headers[$key] .= "\r\n\t".trim($h[0]);
766
+ } elseif (!$key) {
767
+ $headers[0] = trim($h[0]);
768
+ }
769
+ }
770
+ }
771
+
772
+ return $headers;
773
+ }
774
  }
775
 
776
  public static function getInfo($opt = false)
810
  return $formattedHeaders;
811
  }
812
 
 
 
 
 
 
 
 
 
 
 
 
813
  /**
814
+ * Validates and processes the given Url to ensure safe usage with cURL.
815
+ * @param string $url The given Url to process
816
+ * @return string Pre-processed Url as string
817
+ * @throws Exception
818
  */
819
+ public static function validateUrl($url)
820
  {
821
+ //perform parameter validation
822
+ if (!is_string($url)) {
823
+ throw new Exception('Invalid Url.');
 
 
 
 
 
 
 
824
  }
825
+ //ensure that the urls are absolute
826
+ $matchCount = preg_match("#^(https?://[^/]+)#", $url, $matches);
827
+ if ($matchCount == 0) {
828
+ throw new Exception('Invalid Url format.');
 
 
 
 
829
  }
830
+ //get the http protocol match
831
+ $protocol = $matches[1];
832
 
833
+ //remove redundant forward slashes
834
+ $query = substr($url, strlen($protocol));
835
+ $query = preg_replace("#//+#", "/", $query);
836
+
837
+ //return process url
838
+ return $protocol . $query;
839
  }
840
 
841
  private static function getHeaderString($key, $val)
vendor/apimatic/unirest-php/src/Unirest/Response.php CHANGED
@@ -10,15 +10,15 @@ class Response
10
  public $headers;
11
 
12
  /**
13
- * @param int $code response code of the cURL request
14
- * @param string $raw_body the raw body of the cURL response
15
- * @param string $headers raw header string from cURL response
16
- * @param array $json_args arguments to pass to json_decode function
17
  */
18
  public function __construct($code, $raw_body, $headers, $json_args = array())
19
  {
20
  $this->code = $code;
21
- $this->headers = $this->parseHeaders($headers);
22
  $this->raw_body = $raw_body;
23
  $this->body = $raw_body;
24
 
@@ -33,46 +33,4 @@ class Response
33
  }
34
  }
35
  }
36
-
37
- /**
38
- * if PECL_HTTP is not available use a fall back function
39
- *
40
- * thanks to ricardovermeltfoort@gmail.com
41
- * http://php.net/manual/en/function.http-parse-headers.php#112986
42
- * @param string $raw_headers raw headers
43
- * @return array
44
- */
45
- private function parseHeaders($raw_headers)
46
- {
47
- if (function_exists('http_parse_headers')) {
48
- return http_parse_headers($raw_headers);
49
- } else {
50
- $key = '';
51
- $headers = array();
52
-
53
- foreach (explode("\n", $raw_headers) as $i => $h) {
54
- $h = explode(':', $h, 2);
55
-
56
- if (isset($h[1])) {
57
- if (!isset($headers[$h[0]])) {
58
- $headers[$h[0]] = trim($h[1]);
59
- } elseif (is_array($headers[$h[0]])) {
60
- $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
61
- } else {
62
- $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
63
- }
64
-
65
- $key = $h[0];
66
- } else {
67
- if (substr($h[0], 0, 1) == "\t") {
68
- $headers[$key] .= "\r\n\t".trim($h[0]);
69
- } elseif (!$key) {
70
- $headers[0] = trim($h[0]);
71
- }
72
- }
73
- }
74
-
75
- return $headers;
76
- }
77
- }
78
  }
10
  public $headers;
11
 
12
  /**
13
+ * @param int $code response code of the cURL request
14
+ * @param string $raw_body the raw body of the cURL response
15
+ * @param array $headers parsed headers array from cURL response
16
+ * @param array $json_args arguments to pass to json_decode function
17
  */
18
  public function __construct($code, $raw_body, $headers, $json_args = array())
19
  {
20
  $this->code = $code;
21
+ $this->headers = $headers;
22
  $this->raw_body = $raw_body;
23
  $this->body = $raw_body;
24
 
33
  }
34
  }
35
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
vendor/apimatic/unirest-php/tests/Unirest/RequestChild.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Unirest;
4
+
5
+ class RequestChild extends Request
6
+ {
7
+ public static function getTotalNumberOfConnections()
8
+ {
9
+ return parent::$totalNumberOfConnections;
10
+ }
11
+
12
+ public static function resetHandle()
13
+ {
14
+ parent::initializeHandle();
15
+ }
16
+ }
vendor/apimatic/unirest-php/tests/Unirest/RequestTest.php CHANGED
@@ -3,8 +3,11 @@
3
  namespace Unirest\Request\Test;
4
 
5
  use Unirest\Request as Request;
 
 
6
 
7
  require __DIR__ . '/../../src/Unirest.php';
 
8
 
9
  class UnirestRequestTest extends \PHPUnit\Framework\TestCase
10
  {
@@ -20,16 +23,17 @@ class UnirestRequestTest extends \PHPUnit\Framework\TestCase
20
  Request::clearCurlOpts();
21
  }
22
 
23
- /**
24
- * @expectedException \Unirest\Exception
25
- */
26
  public function testTimeoutFail()
27
  {
28
  Request::timeout(1);
29
-
30
- Request::get('http://mockbin.com/delay/1000');
31
-
 
 
 
32
  Request::timeout(null); // Cleaning timeout for the other tests
 
33
  }
34
 
35
  public function testDefaultHeaders()
@@ -81,6 +85,60 @@ class UnirestRequestTest extends \PHPUnit\Framework\TestCase
81
  $this->assertFalse(property_exists($response->body->headers, 'hello'));
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  public function testSetMashapeKey()
85
  {
86
  Request::setMashapeKey('abcd');
@@ -108,7 +166,7 @@ class UnirestRequestTest extends \PHPUnit\Framework\TestCase
108
 
109
  public function testGzip()
110
  {
111
- $response = Request::get('http://mockbin.com/gzip/request');
112
 
113
  $this->assertEquals('gzip', $response->headers['Content-Encoding']);
114
  }
3
  namespace Unirest\Request\Test;
4
 
5
  use Unirest\Request as Request;
6
+ use Unirest\Exception as Exception;
7
+ use Unirest\RequestChild;
8
 
9
  require __DIR__ . '/../../src/Unirest.php';
10
+ require __DIR__ . '/RequestChild.php';
11
 
12
  class UnirestRequestTest extends \PHPUnit\Framework\TestCase
13
  {
23
  Request::clearCurlOpts();
24
  }
25
 
 
 
 
26
  public function testTimeoutFail()
27
  {
28
  Request::timeout(1);
29
+ $message = "Timeout exception not thrown";
30
+ try {
31
+ Request::get('http://mockbin.com/delay/2000');
32
+ } catch (Exception $e) {
33
+ $message = substr($e->getMessage(), 0, 19);
34
+ }
35
  Request::timeout(null); // Cleaning timeout for the other tests
36
+ $this->assertEquals('Operation timed out', $message);
37
  }
38
 
39
  public function testDefaultHeaders()
85
  $this->assertFalse(property_exists($response->body->headers, 'hello'));
86
  }
87
 
88
+ public function testConnectionReuse()
89
+ {
90
+ RequestChild::resetHandle();
91
+ $url = "http://httpbin.org/get";
92
+
93
+ // test client sending keep-alive automatically
94
+ $res = Request::get($url);
95
+ $this->assertEquals("keep-alive", $res->headers['Connection']);
96
+ $this->assertEquals(1, RequestChild::getTotalNumberOfConnections());
97
+
98
+ // test closing connection after response is received
99
+ $res = Request::get($url, [ 'Connection' => 'close' ]);
100
+ $this->assertEquals("close", $res->headers['Connection']);
101
+ $this->assertEquals(1, RequestChild::getTotalNumberOfConnections());
102
+
103
+ // test creating a new connection after closing previous one
104
+ $res = Request::get($url);
105
+ $this->assertEquals("keep-alive", $res->headers['Connection']);
106
+ $this->assertEquals(2, RequestChild::getTotalNumberOfConnections());
107
+
108
+ // test persisting the new connection
109
+ $res = Request::get($url);
110
+ $this->assertEquals("keep-alive", $res->headers['Connection']);
111
+ $this->assertEquals(2, RequestChild::getTotalNumberOfConnections());
112
+ }
113
+
114
+ public function testConnectionReuseForMultipleDomains()
115
+ {
116
+ RequestChild::resetHandle();
117
+ $url1 = "http://httpbin.org/get";
118
+ $url2 = "http://ptsv2.com/t/cedqp-1655183385";
119
+ $url3 = "http://en2hoq5smpha9.x.pipedream.net";
120
+ $url4 = "http://mockbin.com/request";
121
+
122
+ Request::get($url1);
123
+ Request::get($url2);
124
+ Request::get($url3);
125
+ // test creating 3 connections by calling 3 domains
126
+ $this->assertEquals(3, RequestChild::getTotalNumberOfConnections());
127
+
128
+ Request::get($url1);
129
+ Request::get($url2);
130
+ Request::get($url3);
131
+ // test persisting previous 3 connections
132
+ $this->assertEquals(3, RequestChild::getTotalNumberOfConnections());
133
+
134
+ Request::get($url1);
135
+ Request::get($url2);
136
+ Request::get($url3);
137
+ Request::get($url4);
138
+ // test adding a new connection by persisting previous ones using a call to another domain
139
+ $this->assertEquals(4, RequestChild::getTotalNumberOfConnections());
140
+ }
141
+
142
  public function testSetMashapeKey()
143
  {
144
  Request::setMashapeKey('abcd');
166
 
167
  public function testGzip()
168
  {
169
+ $response = Request::post('http://mockbin.com/gzip');
170
 
171
  $this->assertEquals('gzip', $response->headers['Content-Encoding']);
172
  }
vendor/autoload.php CHANGED
@@ -3,23 +3,10 @@
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
- if (!headers_sent()) {
7
- header('HTTP/1.1 500 Internal Server Error');
8
- }
9
- $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
10
- if (!ini_get('display_errors')) {
11
- if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
12
- fwrite(STDERR, $err);
13
- } elseif (!headers_sent()) {
14
- echo $err;
15
- }
16
- }
17
- trigger_error(
18
- $err,
19
- E_USER_ERROR
20
- );
21
  }
22
 
23
  require_once __DIR__ . '/composer/autoload_real.php';
24
 
25
- return ComposerAutoloaderInit7c14f19059e2f8ed732f587baee6be06::getLoader();
3
  // autoload.php @generated by Composer
4
 
5
  if (PHP_VERSION_ID < 50600) {
6
+ echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
7
+ exit(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
  require_once __DIR__ . '/composer/autoload_real.php';
11
 
12
+ return ComposerAutoloaderInitaf825c40dabb0d3b127c697a618cc035::getLoader();
vendor/composer/InstalledVersions.php CHANGED
@@ -28,7 +28,7 @@ class InstalledVersions
28
  {
29
  /**
30
  * @var mixed[]|null
31
- * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
32
  */
33
  private static $installed;
34
 
@@ -39,7 +39,7 @@ class InstalledVersions
39
 
40
  /**
41
  * @var array[]
42
- * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
@@ -243,7 +243,7 @@ class InstalledVersions
243
 
244
  /**
245
  * @return array
246
- * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
247
  */
248
  public static function getRootPackage()
249
  {
@@ -257,7 +257,7 @@ class InstalledVersions
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
- * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
261
  */
262
  public static function getRawData()
263
  {
@@ -280,7 +280,7 @@ class InstalledVersions
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
- * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
284
  */
285
  public static function getAllRawData()
286
  {
@@ -303,7 +303,7 @@ class InstalledVersions
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
- * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
307
  */
308
  public static function reload($data)
309
  {
@@ -313,7 +313,7 @@ class InstalledVersions
313
 
314
  /**
315
  * @return array[]
316
- * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
317
  */
318
  private static function getInstalled()
319
  {
28
  {
29
  /**
30
  * @var mixed[]|null
31
+ * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
32
  */
33
  private static $installed;
34
 
39
 
40
  /**
41
  * @var array[]
42
+ * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
43
  */
44
  private static $installedByVendor = array();
45
 
243
 
244
  /**
245
  * @return array
246
+ * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
247
  */
248
  public static function getRootPackage()
249
  {
257
  *
258
  * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
259
  * @return array[]
260
+ * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
261
  */
262
  public static function getRawData()
263
  {
280
  * Returns the raw data of all installed.php which are currently loaded for custom implementations
281
  *
282
  * @return array[]
283
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
284
  */
285
  public static function getAllRawData()
286
  {
303
  * @param array[] $data A vendor/composer/installed.php data set
304
  * @return void
305
  *
306
+ * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
307
  */
308
  public static function reload($data)
309
  {
313
 
314
  /**
315
  * @return array[]
316
+ * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
317
  */
318
  private static function getInstalled()
319
  {
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit7c14f19059e2f8ed732f587baee6be06
6
  {
7
  private static $loader;
8
 
@@ -24,12 +24,12 @@ class ComposerAutoloaderInit7c14f19059e2f8ed732f587baee6be06
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInit7c14f19059e2f8ed732f587baee6be06', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit7c14f19059e2f8ed732f587baee6be06', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
- call_user_func(\Composer\Autoload\ComposerStaticInit7c14f19059e2f8ed732f587baee6be06::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitaf825c40dabb0d3b127c697a618cc035
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInitaf825c40dabb0d3b127c697a618cc035', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInitaf825c40dabb0d3b127c697a618cc035', 'loadClassLoader'));
30
 
31
  require __DIR__ . '/autoload_static.php';
32
+ call_user_func(\Composer\Autoload\ComposerStaticInitaf825c40dabb0d3b127c697a618cc035::getInitializer($loader));
33
 
34
  $loader->register(true);
35
 
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit7c14f19059e2f8ed732f587baee6be06
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
@@ -45,10 +45,10 @@ class ComposerStaticInit7c14f19059e2f8ed732f587baee6be06
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
- $loader->prefixLengthsPsr4 = ComposerStaticInit7c14f19059e2f8ed732f587baee6be06::$prefixLengthsPsr4;
49
- $loader->prefixDirsPsr4 = ComposerStaticInit7c14f19059e2f8ed732f587baee6be06::$prefixDirsPsr4;
50
- $loader->prefixesPsr0 = ComposerStaticInit7c14f19059e2f8ed732f587baee6be06::$prefixesPsr0;
51
- $loader->classMap = ComposerStaticInit7c14f19059e2f8ed732f587baee6be06::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitaf825c40dabb0d3b127c697a618cc035
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'a' =>
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
+ $loader->prefixLengthsPsr4 = ComposerStaticInitaf825c40dabb0d3b127c697a618cc035::$prefixLengthsPsr4;
49
+ $loader->prefixDirsPsr4 = ComposerStaticInitaf825c40dabb0d3b127c697a618cc035::$prefixDirsPsr4;
50
+ $loader->prefixesPsr0 = ComposerStaticInitaf825c40dabb0d3b127c697a618cc035::$prefixesPsr0;
51
+ $loader->classMap = ComposerStaticInitaf825c40dabb0d3b127c697a618cc035::$classMap;
52
 
53
  }, null, ClassLoader::class);
54
  }
vendor/composer/installed.json CHANGED
@@ -2,24 +2,27 @@
2
  "packages": [
3
  {
4
  "name": "apimatic/jsonmapper",
5
- "version": "v2.0.3",
6
- "version_normalized": "2.0.3.0",
7
  "source": {
8
  "type": "git",
9
  "url": "https://github.com/apimatic/jsonmapper.git",
10
- "reference": "f7588f1ab692c402a9118e65cb9fd42b74e5e0db"
11
  },
12
  "dist": {
13
  "type": "zip",
14
- "url": "https://api.github.com/repos/apimatic/jsonmapper/zipball/f7588f1ab692c402a9118e65cb9fd42b74e5e0db",
15
- "reference": "f7588f1ab692c402a9118e65cb9fd42b74e5e0db",
16
  "shasum": ""
17
  },
 
 
 
18
  "require-dev": {
19
- "phpunit/phpunit": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
20
  "squizlabs/php_codesniffer": "^3.0.0"
21
  },
22
- "time": "2021-07-16T09:02:23+00:00",
23
  "type": "library",
24
  "installation-source": "dist",
25
  "autoload": {
@@ -49,23 +52,23 @@
49
  "support": {
50
  "email": "mehdi.jaffery@apimatic.io",
51
  "issues": "https://github.com/apimatic/jsonmapper/issues",
52
- "source": "https://github.com/apimatic/jsonmapper/tree/v2.0.3"
53
  },
54
  "install-path": "../apimatic/jsonmapper"
55
  },
56
  {
57
  "name": "apimatic/unirest-php",
58
- "version": "2.0.0",
59
- "version_normalized": "2.0.0.0",
60
  "source": {
61
  "type": "git",
62
  "url": "https://github.com/apimatic/unirest-php.git",
63
- "reference": "b4e399a8970c3a5c611f734282f306381f9d1eee"
64
  },
65
  "dist": {
66
  "type": "zip",
67
- "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/b4e399a8970c3a5c611f734282f306381f9d1eee",
68
- "reference": "b4e399a8970c3a5c611f734282f306381f9d1eee",
69
  "shasum": ""
70
  },
71
  "require": {
@@ -73,12 +76,12 @@
73
  "php": ">=5.6.0"
74
  },
75
  "require-dev": {
76
- "phpunit/phpunit": "^5 || ^6 || ^7"
77
  },
78
  "suggest": {
79
  "ext-json": "Allows using JSON Bodies for sending and parsing requests"
80
  },
81
- "time": "2020-04-07T17:16:29+00:00",
82
  "type": "library",
83
  "installation-source": "dist",
84
  "autoload": {
@@ -116,39 +119,39 @@
116
  "support": {
117
  "email": "opensource@apimatic.io",
118
  "issues": "https://github.com/apimatic/unirest-php/issues",
119
- "source": "https://github.com/apimatic/unirest-php/tree/2.0.0"
120
  },
121
  "install-path": "../apimatic/unirest-php"
122
  },
123
  {
124
  "name": "square/square",
125
- "version": "15.0.0.20211020",
126
- "version_normalized": "15.0.0.20211020",
127
  "source": {
128
  "type": "git",
129
  "url": "https://github.com/square/square-php-sdk.git",
130
- "reference": "a31e7fbb6cd458095b2f09543d799a06c35fd2a7"
131
  },
132
  "dist": {
133
  "type": "zip",
134
- "url": "https://api.github.com/repos/square/square-php-sdk/zipball/a31e7fbb6cd458095b2f09543d799a06c35fd2a7",
135
- "reference": "a31e7fbb6cd458095b2f09543d799a06c35fd2a7",
136
  "shasum": ""
137
  },
138
  "require": {
139
- "apimatic/jsonmapper": "^2.0.2",
140
- "apimatic/unirest-php": "^2.0",
141
  "ext-curl": "*",
142
  "ext-json": "*",
143
  "ext-mbstring": "*",
144
- "php": ">=7.2"
145
  },
146
  "require-dev": {
147
- "phan/phan": "^3.0",
148
  "phpunit/phpunit": "^7.5 || ^8.5",
149
  "squizlabs/php_codesniffer": "^3.5"
150
  },
151
- "time": "2021-10-20T15:45:12+00:00",
152
  "type": "library",
153
  "installation-source": "dist",
154
  "autoload": {
@@ -176,7 +179,7 @@
176
  ],
177
  "support": {
178
  "issues": "https://github.com/square/square-php-sdk/issues",
179
- "source": "https://github.com/square/square-php-sdk/tree/15.0.0.20211020"
180
  },
181
  "install-path": "../square/square"
182
  },
2
  "packages": [
3
  {
4
  "name": "apimatic/jsonmapper",
5
+ "version": "v3.0.4",
6
+ "version_normalized": "3.0.4.0",
7
  "source": {
8
  "type": "git",
9
  "url": "https://github.com/apimatic/jsonmapper.git",
10
+ "reference": "99fc5372d69e773a623bec78b91061857d0b6832"
11
  },
12
  "dist": {
13
  "type": "zip",
14
+ "url": "https://api.github.com/repos/apimatic/jsonmapper/zipball/99fc5372d69e773a623bec78b91061857d0b6832",
15
+ "reference": "99fc5372d69e773a623bec78b91061857d0b6832",
16
  "shasum": ""
17
  },
18
+ "require": {
19
+ "ext-json": "*"
20
+ },
21
  "require-dev": {
22
+ "phpunit/phpunit": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
23
  "squizlabs/php_codesniffer": "^3.0.0"
24
  },
25
+ "time": "2022-06-13T08:54:54+00:00",
26
  "type": "library",
27
  "installation-source": "dist",
28
  "autoload": {
52
  "support": {
53
  "email": "mehdi.jaffery@apimatic.io",
54
  "issues": "https://github.com/apimatic/jsonmapper/issues",
55
+ "source": "https://github.com/apimatic/jsonmapper/tree/v3.0.4"
56
  },
57
  "install-path": "../apimatic/jsonmapper"
58
  },
59
  {
60
  "name": "apimatic/unirest-php",
61
+ "version": "2.3.0",
62
+ "version_normalized": "2.3.0.0",
63
  "source": {
64
  "type": "git",
65
  "url": "https://github.com/apimatic/unirest-php.git",
66
+ "reference": "52e226fb3b7081dc9ef64aee876142a240a5f0f9"
67
  },
68
  "dist": {
69
  "type": "zip",
70
+ "url": "https://api.github.com/repos/apimatic/unirest-php/zipball/52e226fb3b7081dc9ef64aee876142a240a5f0f9",
71
+ "reference": "52e226fb3b7081dc9ef64aee876142a240a5f0f9",
72
  "shasum": ""
73
  },
74
  "require": {
76
  "php": ">=5.6.0"
77
  },
78
  "require-dev": {
79
+ "phpunit/phpunit": "^5 || ^6 || ^7 || ^8 || ^9"
80
  },
81
  "suggest": {
82
  "ext-json": "Allows using JSON Bodies for sending and parsing requests"
83
  },
84
+ "time": "2022-06-15T08:29:49+00:00",
85
  "type": "library",
86
  "installation-source": "dist",
87
  "autoload": {
119
  "support": {
120
  "email": "opensource@apimatic.io",
121
  "issues": "https://github.com/apimatic/unirest-php/issues",
122
+ "source": "https://github.com/apimatic/unirest-php/tree/2.3.0"
123
  },
124
  "install-path": "../apimatic/unirest-php"
125
  },
126
  {
127
  "name": "square/square",
128
+ "version": "19.0.1.20220512",
129
+ "version_normalized": "19.0.1.20220512",
130
  "source": {
131
  "type": "git",
132
  "url": "https://github.com/square/square-php-sdk.git",
133
+ "reference": "7852d8a09f818b1bdd929a6366afaa1dbc6bf5e9"
134
  },
135
  "dist": {
136
  "type": "zip",
137
+ "url": "https://api.github.com/repos/square/square-php-sdk/zipball/7852d8a09f818b1bdd929a6366afaa1dbc6bf5e9",
138
+ "reference": "7852d8a09f818b1bdd929a6366afaa1dbc6bf5e9",
139
  "shasum": ""
140
  },
141
  "require": {
142
+ "apimatic/jsonmapper": "^3.0.1",
143
+ "apimatic/unirest-php": "^2.2.2",
144
  "ext-curl": "*",
145
  "ext-json": "*",
146
  "ext-mbstring": "*",
147
+ "php": ">=7.2 <8.2"
148
  },
149
  "require-dev": {
150
+ "phan/phan": "5.3.1",
151
  "phpunit/phpunit": "^7.5 || ^8.5",
152
  "squizlabs/php_codesniffer": "^3.5"
153
  },
154
+ "time": "2022-05-25T17:40:58+00:00",
155
  "type": "library",
156
  "installation-source": "dist",
157
  "autoload": {
179
  ],
180
  "support": {
181
  "issues": "https://github.com/square/square-php-sdk/issues",
182
+ "source": "https://github.com/square/square-php-sdk/tree/19.0.1.20220512"
183
  },
184
  "install-path": "../square/square"
185
  },
vendor/composer/installed.php CHANGED
@@ -1,58 +1,58 @@
1
  <?php return array(
2
  'root' => array(
3
- 'name' => 'woocommerce/woocommerce-square',
4
  'pretty_version' => 'dev-trunk',
5
  'version' => 'dev-trunk',
6
- 'reference' => '0fa0bbaf537fc5f02c8665fd95c544458f9b6fe2',
7
  'type' => 'library',
8
  'install_path' => __DIR__ . '/../../',
9
  'aliases' => array(),
 
 
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'apimatic/jsonmapper' => array(
14
- 'pretty_version' => 'v2.0.3',
15
- 'version' => '2.0.3.0',
16
- 'reference' => 'f7588f1ab692c402a9118e65cb9fd42b74e5e0db',
17
  'type' => 'library',
18
  'install_path' => __DIR__ . '/../apimatic/jsonmapper',
19
  'aliases' => array(),
 
20
  'dev_requirement' => false,
21
  ),
22
  'apimatic/unirest-php' => array(
23
- 'pretty_version' => '2.0.0',
24
- 'version' => '2.0.0.0',
25
- 'reference' => 'b4e399a8970c3a5c611f734282f306381f9d1eee',
26
  'type' => 'library',
27
  'install_path' => __DIR__ . '/../apimatic/unirest-php',
28
  'aliases' => array(),
 
29
  'dev_requirement' => false,
30
  ),
31
  'square/square' => array(
32
- 'pretty_version' => '15.0.0.20211020',
33
- 'version' => '15.0.0.20211020',
34
- 'reference' => 'a31e7fbb6cd458095b2f09543d799a06c35fd2a7',
35
  'type' => 'library',
36
  'install_path' => __DIR__ . '/../square/square',
37
  'aliases' => array(),
 
38
  'dev_requirement' => false,
39
  ),
40
  'woocommerce/action-scheduler' => array(
41
  'pretty_version' => '3.4.0',
42
  'version' => '3.4.0.0',
43
- 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
44
  'type' => 'wordpress-plugin',
45
  'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
46
  'aliases' => array(),
 
47
  'dev_requirement' => false,
48
  ),
49
  'woocommerce/woocommerce-square' => array(
50
  'pretty_version' => 'dev-trunk',
51
  'version' => 'dev-trunk',
52
- 'reference' => '0fa0bbaf537fc5f02c8665fd95c544458f9b6fe2',
53
  'type' => 'library',
54
  'install_path' => __DIR__ . '/../../',
55
  'aliases' => array(),
 
56
  'dev_requirement' => false,
57
  ),
58
  ),
1
  <?php return array(
2
  'root' => array(
 
3
  'pretty_version' => 'dev-trunk',
4
  'version' => 'dev-trunk',
 
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '116c02bc5d7978bcf045aed83bf048b140dca263',
9
+ 'name' => 'woocommerce/woocommerce-square',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'apimatic/jsonmapper' => array(
14
+ 'pretty_version' => 'v3.0.4',
15
+ 'version' => '3.0.4.0',
 
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../apimatic/jsonmapper',
18
  'aliases' => array(),
19
+ 'reference' => '99fc5372d69e773a623bec78b91061857d0b6832',
20
  'dev_requirement' => false,
21
  ),
22
  'apimatic/unirest-php' => array(
23
+ 'pretty_version' => '2.3.0',
24
+ 'version' => '2.3.0.0',
 
25
  'type' => 'library',
26
  'install_path' => __DIR__ . '/../apimatic/unirest-php',
27
  'aliases' => array(),
28
+ 'reference' => '52e226fb3b7081dc9ef64aee876142a240a5f0f9',
29
  'dev_requirement' => false,
30
  ),
31
  'square/square' => array(
32
+ 'pretty_version' => '19.0.1.20220512',
33
+ 'version' => '19.0.1.20220512',
 
34
  'type' => 'library',
35
  'install_path' => __DIR__ . '/../square/square',
36
  'aliases' => array(),
37
+ 'reference' => '7852d8a09f818b1bdd929a6366afaa1dbc6bf5e9',
38
  'dev_requirement' => false,
39
  ),
40
  'woocommerce/action-scheduler' => array(
41
  'pretty_version' => '3.4.0',
42
  'version' => '3.4.0.0',
 
43
  'type' => 'wordpress-plugin',
44
  'install_path' => __DIR__ . '/../woocommerce/action-scheduler',
45
  'aliases' => array(),
46
+ 'reference' => '3218a33ff14b968f8cb05de9656c2efa1eeb1330',
47
  'dev_requirement' => false,
48
  ),
49
  'woocommerce/woocommerce-square' => array(
50
  'pretty_version' => 'dev-trunk',
51
  'version' => 'dev-trunk',
 
52
  'type' => 'library',
53
  'install_path' => __DIR__ . '/../../',
54
  'aliases' => array(),
55
+ 'reference' => '116c02bc5d7978bcf045aed83bf048b140dca263',
56
  'dev_requirement' => false,
57
  ),
58
  ),
vendor/square/square/.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve Square SDKs
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **Expected behavior**
14
+ A clear and concise description of what you expected to happen.
15
+
16
+ **To Reproduce**
17
+ Steps to reproduce the bug:
18
+ 1. (step 1)
19
+ 2. (step 2)
20
+ 3. (step 3)
21
+ 4. ...
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain the bug.
25
+
26
+ **Square SDK version**
27
+ For example: 17.2.x
28
+
29
+ **Additional context**
30
+ Add any other context about the problem here.
vendor/square/square/.github/workflows/automerge.yml DELETED
@@ -1,33 +0,0 @@
1
- # This workflow will trigger an automerge
2
- # Checks PR title, author, and branch name.
3
- # If the properties match a generated SDK PR,
4
- # corresponding labels are applied with labeler
5
- # and triggers automerge.
6
-
7
- name: Automerge
8
- on:
9
- pull_request:
10
- branches: [ master, main ]
11
- pull_request_review:
12
- types:
13
- - submitted
14
- check_suite:
15
- types:
16
- - completed
17
- status: {}
18
- jobs:
19
- labeler:
20
- runs-on: ubuntu-latest
21
- steps:
22
- - name: automerge-labeler
23
- uses: fuxingloh/multi-labeler@v1
24
-
25
- automerge:
26
- needs: labeler
27
- runs-on: ubuntu-latest
28
- steps:
29
- - name: automerge
30
- uses: "pascalgn/automerge-action@v0.14.2"
31
- env:
32
- GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
33
- MERGE_LABELS: "automerge,automerge-branch,automerge-author"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/square/square/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
  # Change Log
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## Version 15.0.0.20211020 (2021-10-20)
4
  ## API updates
5
  * **Transactions API.** Three previously deprecated endpoints (`ListRefunds`, `Charge`, and `CreateRefund`) in the [Transactions API](https://developer.squareup.com/reference/square_2021-10-20/transactions-api) are removed from Square API version 2021-10-20 and later. These endpoints will work if you are using Square API versions prior to 2021-10-20. However, these endpoints will eventually be retired from all Square versions.
1
  # Change Log
2
 
3
+ For general API and SDK changelogs, see [Square APIs and SDKs Release Notes](https://developer.squareup.com/docs/changelog/connect).
4
+
5
+ ## Version 17.3.0.20220316 (2022-03-16)
6
+ ### Added
7
+
8
+ * Now supports PHP 8.1
9
+
10
+
11
+ ## Version 17.0.0.20211215 (2021-12-15)
12
+ ### API updates
13
+
14
+ * **Invoices API:**
15
+ * The Invoices API now supports seller accounts in France. For more information, see [International availability and considerations.](https://developer.squareup.com/docs/invoices-api/overview#international-availability-invoices)
16
+ * France only: [`Invoice`](https://developer.squareup.com/reference/square_2021-12-15/objects/Invoice) object. Added a new `payment_conditions` field, which contains payment terms and conditions that are displayed on the invoice. This field is available only for sellers in France. For more information, see [Payment conditions.](https://developer.squareup.com/docs/invoices-api/overview#payment-conditions)
17
+
18
+ Square version 2021-12-15 or higher is required to set this field, but it is returned in `ListInvoices` and `RetrieveInvoice` requests for all Square versions.
19
+
20
+ * **Cards API**
21
+ * Added the `CARD_DECLINED_VERIFICATION_REQUIRED` error code to the list of error codes returned by [CreateCard](https://developer.squareup.com/reference/square_2021-12-15/cards-api/CreateCard).
22
+ * **Catalog API:**
23
+ * [CreateCatalogImage](https://developer.squareup.com/reference/square_2021-12-15/catalog-api/create-catalog-image) endpoint
24
+ * Updated to support attaching multiple images to a [Catalogbject](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogObject) instance.
25
+ * Added `is_primary` option to let the caller choose to attach an image as the primary image on the object for display with the Square Point of Sale and other first-party Square applications. For more information, see [Upload and Attach Images.](https://developer.squareup.com/docs/catalog-api/upload-and-attach-images)
26
+ * [CatalogObject](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogObject) object
27
+ * Retired the `image_id` field, used to hold a single image object attached to an image-supporting object of the `ITEM`, `ITEM_VARIATION`, `CATEGORY`, or `MODIFIER_LIST` type, in Square API version 2021-12-15 and later, which supports attachment of multiple images. The `image_id` field is still supported in Square API version prior to 2021-12-15. For more information, see [Work with Images: Overview.](https://developer.squareup.com/docs/catalog-api/cookbook/create-catalog-image#overview)
28
+ * [CatalogItem](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogItem), [CatalogItemVariation](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogItemVariation), [CatalogCategory](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogCategory) or [CatalogModifierList](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogModifierList) object
29
+ * Added `image_ids` list to hold attached image objects. The first element of `image_ids` list refers to the primary image attached to the catalog object. For more information, see [Work with Images: Overview.](https://developer.squareup.com/docs/catalog-api/cookbook/create-catalog-image#overview)
30
+ * [UpdateCatalogImage](https://developer.squareup.com/reference/square_2021-12-15/catalog-api/update-catalog-image) endpoint
31
+ * Added to support replacing the image file encapsulated by an existing [CatalogImage](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogImage) object. For more information, see [Replace image file on a CatalogImage object.](https://developer.squareup.com/docs/catalog-api/manage-images#replace-the-image-file-of-a-catalogimage-object)
32
+
33
+ * [CatalogPricingRule](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogPricingRule) object
34
+ * Added [minimum_order_subtotal_money](https://developer.squareup.com/reference/square_2021-12-15/objects/CatalogPricingRule#definition__property-minimum_order_subtotal_money) field to require that the minimum order subtotal be reached before the pricing rule may be applied.
35
+
36
+ ### Documentation updates
37
+ * Added a new top-level node for Developer Tools. This node includes such features as Sandbox, API Logs, and Webhooks.
38
+ * Added [Webhook Event Logs (beta)](https://developer.squareup.com/docs/devtools/webhook-logs) documentation to the Developer Tools node.
39
+
40
+
41
+ ## Version 16.0.0.20211117 (2021-11-17)
42
+ ## API updates
43
+
44
+ * **Cards API.** The [Card](https://developer.squareup.com/reference/square_2021-11-17/objects/card) object and webhook response body for all webhooks are updated updated with fields.
45
+ * Added the [Card.merchant_id](https://developer.squareup.com/reference/square_2021-11-17/objects/Card#definition__property-merchant_id) field to identify the Square seller that stored the payment card on file.
46
+ * Added a [Card](https://developer.squareup.com/reference/square_2021-11-17/objects/Card) object to the response bodies of all [Cards API webhooks](https://developer.squareup.com/docs/webhooks/v2webhook-events-tech-ref#cards-api). The `Card` is added as a child of the `data.object` field in all webhook responses.
47
+
48
+ * **Bookings API.** The new [ListBookings](https://developer.squareup.com/reference/square_2021-11-17/bookings-api/list-bookings) endpoint supports browsing a collection of bookings of a seller. For more information, see [Use the Bookings API: list bookings.](https://developer.squareup.com/docs/bookings-api/use-the-api#list-bookings)
49
+
50
+ * **Subscriptions API.** Introduced the new [actions framework](https://developer.squareup.com/docs/subscriptions-api/overview#subscriptions-actions-overview) representing scheduled, future changes to subscriptions.
51
+ * The new [PauseSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/pause-subscription) endpoint supports temporarily pausing a subscription. Calling this endpoint schedules a new `PAUSE` action.
52
+ * The new [SwapPlan](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/swap-plan) endpoint supports changing the subscription plan associated with a single customer. Calling this endpoint schedules a new `SWAP_PLAN` action.
53
+ * The new [DeleteSubscriptionAction](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/delete-subscription-action) endpoint supports deleting a scheduled action.
54
+ * The [ResumeSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/resume-subscription) endpoint has been updated to support resuming a paused subscription. Calling this endpoint schedules a new `RESUME` action.
55
+ * The [CancelSubscription](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/cancel-subscription) endpoint now schedules a new `CANCEL` action.
56
+ * Added an optional `include` body parameter to the [SearchSubscriptions](https://developer.squareup.com/reference/square_2021-11-17/subscriptions-api/search-subscriptions) endpoint. Include `actions` in the request to return all [actions](https://developer.squareup.com/docs/subscriptions-api/overview#subscriptions-actions-overview) associated with the subscriptions.
57
+
58
+ ## Documentation Update
59
+
60
+ * **Migration Guides.**
61
+ * [Migrate from the Connect V1 Refunds API.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-refunds) The topic is updated to include information to migrate from the v1 ListRefunds endpoint to the appropriate Square API counterparts.
62
+ * [Migrate from the Connect V1 Payments API.](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-payments) The topic provides developers information to migrate from the Connect V1 Payments API to the appropriate Square API counterparts.
63
+
64
+ Code that relies on these V1 API endpoints must be updated to avoid breaking when these APIs reach retirement.
65
+
66
+
67
  ## Version 15.0.0.20211020 (2021-10-20)
68
  ## API updates
69
  * **Transactions API.** Three previously deprecated endpoints (`ListRefunds`, `Charge`, and `CreateRefund`) in the [Transactions API](https://developer.squareup.com/reference/square_2021-10-20/transactions-api) are removed from Square API version 2021-10-20 and later. These endpoints will work if you are using Square API versions prior to 2021-10-20. However, these endpoints will eventually be retired from all Square versions.
vendor/square/square/CONTRIBUTING.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to Square SDKs
2
+
3
+ Thank you for your willingness to help improve the Square SDKs. Your feedback and expertise ultimately benefits everyone who builds with Square.
4
+
5
+ If you encounter a bug while using Square SDKs, please [let us know](#bug-reporting). We'll investigate the issue and fix it as soon as possible.
6
+
7
+ We also accept feedback in the form of a pull request (PR), and will follow up with you if we need more information. However, any code changes required will be perfomed by Square engineering, and we'll close the PR.
8
+
9
+ ## Bug report
10
+
11
+ To report a bug:
12
+ * Go to the **[Issues](../../issues)** page.
13
+ * Click **New issue**.
14
+ * Click **Get started**.
15
+
16
+ ## Other support
17
+
18
+ For all other support, including new feature requests, see:
19
+
20
+ * Square developer forums: [https://developer.squareup.com/forums](https://developer.squareup.com/forums)
21
+ * Square support center: [https://squareup.com/help/us/en](https://squareup.com/help/us/en)
vendor/square/square/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 Square, Inc.
2
  Licensed under the Apache License, Version 2.0 (the "License");
3
  you may not use this file except in compliance with the License.
4
  You may obtain a copy of the License at
1
+ Copyright 2022 Square, Inc.
2
  Licensed under the Apache License, Version 2.0 (the "License");
3
  you may not use this file except in compliance with the License.
4
  You may obtain a copy of the License at
vendor/square/square/README.md CHANGED
@@ -8,26 +8,61 @@ Use this library to integrate Square payments into your app and grow your busine
8
 
9
  ## Requirements
10
 
11
- PHP 7.1+:
12
 
13
- Installing
14
- -----
15
- ### Composer
16
- The PHP SDK is available on Packagist. The reccomended way to install is via [Composer](https://getcomposer.org/), simply run:
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ```
19
- $ composer require square/square
 
 
 
 
 
 
 
 
 
 
 
 
20
  ```
21
- ### Manual Installation
22
- If you prefer not to use Composer, you can manually install the following packages by cloning them into your root PHP directory.
23
 
24
- * [`square/square-php-sdk`](https://github.com/square/square-php-sdk) - this package includes Square's PHP SDK
25
- * [`apimatic/jsonmapper`](https://github.com/apimatic/jsonmapper) - the Square PHP SDK uses JSON Mapper to convert JSON responses into PHP classes dynamically. This package bundles a custom version of JSON Mapper that works with the Square API.
26
- * [`apimatic/unirest-php`](https://github.com/apimatic/unirest-php) - the Square PHP SDK wraps Unirest, an REST API HTTP client. This package bundles a custom version of Unirest that works with the Square API.
27
 
28
- After downloading the SDK and its dependencies you'll need to write a custom `autoload.php` file. Once written you can then require your `autoload.php` and have access to the SDK and its dependencies. An example `autoload.php` can be found [here](example-autoload.php).
 
 
29
 
30
- ## API documentation
 
 
 
 
 
 
 
 
 
 
31
 
32
  ### Payments
33
  * [Payments]
@@ -36,6 +71,7 @@ After downloading the SDK and its dependencies you'll need to write a custom `au
36
  * [Checkout]
37
  * [Apple Pay]
38
  * [Cards]
 
39
 
40
  ### Terminal
41
  * [Terminal]
@@ -55,6 +91,7 @@ After downloading the SDK and its dependencies you'll need to write a custom `au
55
 
56
  ### Customers
57
  * [Customers]
 
58
  * [Customer Groups]
59
  * [Customer Segments]
60
 
@@ -73,6 +110,7 @@ After downloading the SDK and its dependencies you'll need to write a custom `au
73
  * [Locations]
74
  * [Devices]
75
  * [Cash Drawers]
 
76
 
77
  ### Team
78
  * [Team]
@@ -96,300 +134,6 @@ After downloading the SDK and its dependencies you'll need to write a custom `au
96
  * [V1 Items]
97
  * [Transactions]
98
 
99
- ## Usage
100
-
101
-
102
- First time using Square? Here’s how to get started:
103
-
104
- 1. **Create a Square account.** If you don’t have one already, [sign up for a developer account].
105
- 1. **Create an application.** Go to your [Developer Dashboard] and create your first application. All you need to do is give it a name. When you’re doing this for your production application, enter the name as you would want a customer to see it.
106
- 1. **Make your first API call.** Almost all Square API calls require a location ID. You’ll make your first call to #list_locations, which happens to be one of the API calls that don’t require a location ID. For more information about locations, see the [Locations] API documentation.
107
-
108
- Now let’s call your first Square API. Open your favorite text editor, create a new file called `index.php`, and copy the following code into that file:
109
-
110
-
111
-
112
- ```php
113
- <?php
114
-
115
- require 'vendor/autoload.php';
116
-
117
- use Square\SquareClient;
118
- use Square\LocationsApi;
119
- use Square\Exceptions\ApiException;
120
- use Square\Http\ApiResponse;
121
- use Square\Models\ListLocationsResponse;
122
- use Square\Environment;
123
-
124
-
125
- $client = new SquareClient([
126
- 'accessToken' => 'YOUR SANDBOX ACCESS TOKEN HERE',
127
- 'environment' => Environment::SANDBOX,
128
- ]);
129
-
130
- try {
131
- $locationsApi = $client->getLocationsApi();
132
- $apiResponse = $locationsApi->listLocations();
133
-
134
- if ($apiResponse->isSuccess()) {
135
- $listLocationsResponse = $apiResponse->getResult();
136
- $locationsList = $listLocationsResponse->getLocations();
137
- foreach ($locationsList as $location) {
138
- print_r($location);
139
- }
140
- } else {
141
- print_r($apiResponse->getErrors());
142
- }
143
- } catch (ApiException $e) {
144
- print_r("Recieved error while calling Square: " . $e->getMessage());
145
- }
146
- ```
147
-
148
- Next, get an access token and reference it in your code. Go back to your application in the Developer Dashboard, in the Sandbox section click Show in the Sandbox Access Token box, copy that access token, and replace `'YOUR SANDBOX ACCESS TOKEN HERE'` with that token.
149
-
150
- **Important** When you eventually switch from trying things out on sandbox to actually working with your real production resources, you should not embed the access token in your code. Make sure you store and access your production access tokens securely.
151
-
152
- Now save `index.php` and run it:
153
-
154
- ```sh
155
- php -S localhost:8000
156
- ```
157
-
158
-
159
- If your call is successful, you’ll get a response that looks like this:
160
-
161
- ```
162
- stdClass Object
163
- (
164
- [id] => KXKXSFEKT2587
165
- [name] => My Location
166
- [address] => stdClass Object
167
- (
168
- [address_line_1] => 1455 Market Street
169
- [locality] => San Francisco
170
- [administrative_district_level_1] => CA
171
- [postal_code] => 94103
172
- [country] => US
173
- )
174
- # ...
175
- ```
176
-
177
- Yay! You successfully made your first call. If you didn’t, you would see an error message that looks something like this:
178
-
179
- ```
180
- Array
181
- (
182
- [0] => Square\Models\Error Object
183
- (
184
- [category:Square\Models\Error:private] => AUTHENTICATION_ERROR
185
- [code:Square\Models\Error:private] => UNAUTHORIZED
186
- [detail:Square\Models\Error:private] => This request could not be authorized.
187
- [field:Square\Models\Error:private] =>
188
- )
189
-
190
- )
191
- ```
192
-
193
- This error was returned when an invalid token was used to call the API.
194
-
195
- After you’ve tried out the Square APIs and tested your application using sandbox, you will want to switch to your production credentials so that you can manage real Square resources. Don't forget to switch your access token from sandbox to production for real data.
196
-
197
- ## SDK patterns
198
- If you know a few patterns, you’ll be able to call any API in the SDK. Here are some important ones:
199
-
200
- ### Get an access token
201
-
202
- To use the Square API to manage the resources (such as payments, orders, customers, etc.) of a Square account, you need to create an application (or use an existing one) in the Developer Dashboard and get an access token.
203
-
204
- When you call a Square API, you call it using an access key. An access key has specific permissions to resources in a specific Square account that can be accessed by a specific application in a specific developer account.
205
- Use an access token that is appropriate for your use case. There are two options:
206
-
207
- - To manage the resources for your own Square account, use the Personal Access Token for the application created in your Square account.
208
- - To manage resources for other Square accounts, use OAuth to ask owners of the accounts you want to manage so that you can work on their behalf. When you implement OAuth, you ask the Square account holder for permission to manage resources in their account (you can define the specific resources to access) and get an OAuth access token and refresh token for their account.
209
-
210
- **Important** For both use cases, make sure you store and access the tokens securely.
211
-
212
- ### Import and Instantiate the Client Class
213
-
214
- To use the Square API, you import the Client class, instantiate a Client object, and initialize it with the appropriate access token. Here’s how:
215
-
216
- - Instantiate a `SquareClient` object with the access token for the Square account whose resources you want to manage. To access sandbox resources, initialize the `SquareClient` with environment set to sandbox:
217
-
218
- ```php
219
- use Square\SquareClient;
220
- use Square\Environment;
221
-
222
- $client = new SquareClient([
223
- 'accessToken' => 'YOUR SANDBOX ACCESS TOKEN HERE',
224
- 'environment' => Environment::SANDBOX
225
- ]);
226
- ```
227
-
228
- - To access production resources, set environment to production:
229
-
230
- ```php
231
- use Square\SquareClient;
232
- use Square\Environment;
233
-
234
- $client = new SquareClient([
235
- 'accessToken' => 'YOUR PRODUCTION ACCESS TOKEN HERE',
236
- 'environment' => Environment::PRODUCTION
237
- ]);
238
- ```
239
-
240
- - To set a custom environment provide a `customUrl`, and set the environment to `Environment::CUSTOM`:
241
-
242
- ```php
243
- use Square\SquareClient;
244
- use Square\Environment;
245
-
246
- $client = new SquareClient([
247
- 'accessToken' => 'YOUR ACCESS TOKEN HERE',
248
- 'environment' => Environment::CUSTOM,
249
- 'customUrl' => 'https://your.customdomain.com'
250
- ]);
251
- ```
252
-
253
- ### Get an Instance of an API object and call its methods
254
-
255
- Each API is implemented as a class. The Client object instantiates every API class and exposes them as properties so you can easily start using any Square API. You work with an API by calling methods on an instance of an API class. Here’s how:
256
-
257
- - Work with an API by calling the methods on the API object. For example, you would call listCustomers to get a list of all customers in the Square account:
258
-
259
- ```php
260
- try {
261
- $result = $client->getCustomersApi()->listCustomers();
262
- } catch (ApiException $e) {
263
- print_r("Recieved error while calling Square: " . $e->getMessage());
264
- }
265
- ```
266
-
267
- See the SDK documentation for the list of methods for each API class.
268
-
269
- Pass complex parameters (such as create, update, search, etc.) as a Request object. For example, you would pass a `CreateCustomerRequest` containing the values used to create a new customer using create_customer:
270
-
271
- ```php
272
- use Square\SquareClient;
273
- use Square\Exceptions\ApiException;
274
- use Square\Models\CreateCustomerRequest;
275
- use Square\Environment;
276
-
277
- $client = new SquareClient([
278
- "accessToken" => "SQUARE_SANDBOX_ACCESS_TOKEN",
279
- "environment" => Environment::SANDBOX
280
- ]);
281
-
282
- $customersApi = $client->getCustomersApi();
283
-
284
- // Create customer
285
- $request = new CreateCustomerRequest;
286
- $request->setGivenName('Amelia');
287
- $request->setFamilyName('Earhart');
288
- $request->setPhoneNumber("1-252-555-4240");
289
- $request->setNote('A customer');
290
-
291
- try {
292
- $result = $customersApi->createCustomer($request);
293
-
294
- if ($result->isSuccess()) {
295
- print_r($result->getResult()->getCustomer());
296
- } else {
297
- print_r($result->getErrors());
298
- }
299
- } catch (ApiException $e) {
300
- print_r("Recieved error while calling Square: " . $e->getMessage());
301
- }
302
- ```
303
-
304
- If your call succeeds, you’ll see a response that looks like this:
305
- ```
306
- Square\Models\Customer Object
307
- (
308
- [id:Square\Models\Customer:private] => 2CN457HSFGR11CKQGHDECEZCDC
309
- [createdAt:Square\Models\Customer:private] => 2020-06-05T00:42:54.499Z
310
- [updatedAt:Square\Models\Customer:private] => 2020-06-05T00:42:54Z
311
- [cards:Square\Models\Customer:private] =>
312
- [givenName:Square\Models\Customer:private] => Amelia
313
- [familyName:Square\Models\Customer:private] => Earhart
314
- [nickname:Square\Models\Customer:private] =>
315
- [companyName:Square\Models\Customer:private] =>
316
- [emailAddress:Square\Models\Customer:private] =>
317
- [address:Square\Models\Customer:private] =>
318
- [phoneNumber:Square\Models\Customer:private] => 1-252-555-4240
319
- [birthday:Square\Models\Customer:private] =>
320
- [referenceId:Square\Models\Customer:private] =>
321
- [note:Square\Models\Customer:private] => a customer
322
- [preferences:Square\Models\Customer:private] => Square\Models\CustomerPreferences Object
323
- (
324
- [emailUnsubscribed:Square\Models\CustomerPreferences:private] =>
325
- )
326
-
327
- [groups:Square\Models\Customer:private] =>
328
- [creationSource:Square\Models\Customer:private] => THIRD_PARTY
329
- [groupIds:Square\Models\Customer:private] =>
330
- [segmentIds:Square\Models\Customer:private] =>
331
- )
332
- ```
333
-
334
- - Use idempotency for create, update, or other calls that you want to avoid calling twice. To make an idempotent API call, you add the idempotency_key with a unique value in the API call’s request.
335
- - Specify a location ID for APIs such as Transactions, Orders, and Checkout that deal with payments. When a payment or order is created in Square, it is always associated with a location.
336
-
337
- ### Handle the response
338
-
339
- API calls return a response object that contains properties that describe both the request (headers and request) and the response (status_code, reason_phrase, text, errors, body, and cursor). The response also has `isSuccess()` and `isError()` helper methods so you can easily determine the success or failure of a call:
340
-
341
- ```php
342
- if ($apiResponse->isSuccess()) {
343
- $listLocationsResponse = $apiResponse->getResult();
344
- } else {
345
- print_r($apiResponse->getErrors());
346
- }
347
- ```
348
-
349
- - Read the response payload. The response payload is returned as an array from the `getResult` method. For retrieve calls, an object containing a single item is returned with a key name that is the name of the object (for example, customer). For list calls, an object containing a Array of objects is returned with a key name that is the plural of the object name (for example, customers).
350
- - Make sure you get all items returned in a list call by checking the cursor value returned in the API response. When you call a list API the first time, set the cursor to an empty String or omit it from the API request. If the API response contains a cursor with a value, you call the API again to get the next page of items and continue to call that API again until the cursor is an empty String.
351
-
352
- ## Tests
353
-
354
- First, clone the repo locally and `cd` into the directory.
355
-
356
- ```sh
357
- git clone https://github.com/square/square-php-sdk.git
358
- cd square-php-sdk
359
- ```
360
-
361
- Next, make sure you've downloaded Composer, following the instructions [here](https://getcomposer.org/download/)
362
- and then run the following command from the directory containing `composer.json`:
363
-
364
- ```
365
- composer install
366
- ```
367
-
368
-
369
- Before running the tests, find a sandbox token in your [Developer Dashboard] and set a `SQUARE_ACCESS_TOKEN` environment variable.
370
-
371
- ```sh
372
- $dotenv = Dotenv::create(__DIR__);
373
- $dotenv->load();
374
- $timeout = getenv('SQUARE_TIMEOUT');
375
- $accessToken = getenv('SQUARE_ACCESS_TOKEN');
376
- $environment = getenv('SQUARE_ENVIRONMENT');
377
- $baseUrl = getenv('SQUARE_BASE_URL');
378
- ```
379
-
380
- And run the tests.
381
-
382
- ```sh
383
- php composer.phar run test
384
- ```
385
-
386
- ## Learn more
387
-
388
- The Square Platform is built on the [Square API]. Square has a number of other SDKs that enable you to securely handle credit card information on both mobile and web so that you can process payments via the Square API.
389
-
390
- You can also use the Square API to create applications or services that work with payments, orders, inventory, etc. that have been created and managed in Square’s in-person hardware products (Square Point of Sale and Square Register).
391
-
392
-
393
  [//]: # "Link anchor definitions"
394
  [Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg
395
  [Developer Dashboard]: https://developer.squareup.com/apps
@@ -400,7 +144,9 @@ You can also use the Square API to create applications or services that work wit
400
  [Disputes]: doc/apis/disputes.md
401
  [Terminal]: doc/apis/terminal.md
402
  [Cash Drawers]: doc/apis/cash-drawers.md
 
403
  [Customer Groups]: doc/apis/customer-groups.md
 
404
  [Customer Segments]: doc/apis/customer-segments.md
405
  [Bank Accounts]: doc/apis/bank-accounts.md
406
  [Payments]: doc/apis/payments.md
@@ -429,5 +175,6 @@ You can also use the Square API to create applications or services that work wit
429
  [Sites]: doc/apis/sites.md
430
  [Snippets]: doc/apis/snippets.md
431
  [Cards]: doc/api/cards.md
 
432
  [Gift Cards]: doc/api/gift-cards.md
433
  [Gift Card Activities]: doc/api/gift-card-activities.md
8
 
9
  ## Requirements
10
 
11
+ Use of the Square PHP SDK requires:
12
 
13
+ * PHP 7.4 through PHP 8.1
 
 
 
14
 
15
+ ## Installation
16
+
17
+ For more information, see [Set Up Your Square SDK for a PHP Project](https://developer.squareup.com/docs/sdks/php/setup-project).
18
+
19
+ ## Quickstart
20
+
21
+ For more information, see [Square PHP SDK Quickstart](https://developer.squareup.com/docs/sdks/php/quick-start).
22
+
23
+ ## Usage
24
+ For more information, see [Using the Square PHP SDK](https://developer.squareup.com/docs/sdks/php/using-php-sdk).
25
+
26
+ ## Tests
27
+
28
+ First, clone the repo locally and `cd` into the directory.
29
+
30
+ ```sh
31
+ git clone https://github.com/square/square-php-sdk.git
32
+ cd square-php-sdk
33
  ```
34
+
35
+ Next, make sure you've downloaded Composer, following the instructions [here](https://getcomposer.org/download/)
36
+ and then run the following command from the root of the repository:
37
+
38
+ ```sh
39
+ composer install
40
+ ```
41
+
42
+ Before running the tests, find a sandbox token in your [Developer Dashboard] and set environment variables:
43
+
44
+ ```sh
45
+ export SQUARE_ACCESS_TOKEN=mytoken
46
+ export SQUARE_ENVIRONMENT=sandbox
47
  ```
 
 
48
 
49
+ Run the tests:
 
 
50
 
51
+ ```sh
52
+ composer run test
53
+ ```
54
 
55
+ All environment variables:
56
+ * `SQUARE_TIMEOUT` - number
57
+ * `SQUARE_NUMBER_OF_RETRIES` - number
58
+ * `SQUARE_MAXIMUM_RETRY_WAIT_TIME` - number
59
+ * `SQUARE_SQUARE_VERSION` - string
60
+ * `SQUARE_USER_AGENT_DETAIL` - string
61
+ * `SQUARE_CUSTOM_URL` - string
62
+ * `SQUARE_ACCESS_TOKEN` - string
63
+ * `SQUARE_ENVIRONMENT` - string - one of production, sandbox, custom
64
+
65
+ ## SDK Reference
66
 
67
  ### Payments
68
  * [Payments]
71
  * [Checkout]
72
  * [Apple Pay]
73
  * [Cards]
74
+ * [Payouts]
75
 
76
  ### Terminal
77
  * [Terminal]
91
 
92
  ### Customers
93
  * [Customers]
94
+ * [Customer Custom Attributes]
95
  * [Customer Groups]
96
  * [Customer Segments]
97
 
110
  * [Locations]
111
  * [Devices]
112
  * [Cash Drawers]
113
+ * [Vendors]
114
 
115
  ### Team
116
  * [Team]
134
  * [V1 Items]
135
  * [Transactions]
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  [//]: # "Link anchor definitions"
138
  [Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg
139
  [Developer Dashboard]: https://developer.squareup.com/apps
144
  [Disputes]: doc/apis/disputes.md
145
  [Terminal]: doc/apis/terminal.md
146
  [Cash Drawers]: doc/apis/cash-drawers.md
147
+ [Vendors]: doc/apis/vendors.md
148
  [Customer Groups]: doc/apis/customer-groups.md
149
+ [Customer Custom Attributes]: doc/apis/customer-custom-attributes.md
150
  [Customer Segments]: doc/apis/customer-segments.md
151
  [Bank Accounts]: doc/apis/bank-accounts.md
152
  [Payments]: doc/apis/payments.md
175
  [Sites]: doc/apis/sites.md
176
  [Snippets]: doc/apis/snippets.md
177
  [Cards]: doc/api/cards.md
178
+ [Payouts]: doc/api/payouts.md
179
  [Gift Cards]: doc/api/gift-cards.md
180
  [Gift Card Activities]: doc/api/gift-card-activities.md
vendor/square/square/composer.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "square/square",
3
  "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.",
4
- "version": "15.0.0.20211020",
5
  "type": "library",
6
  "keywords": [
7
  "Square",
@@ -18,16 +18,16 @@
18
  }
19
  ],
20
  "require": {
21
- "php": ">=7.2",
22
  "ext-curl": "*",
23
  "ext-json": "*",
24
  "ext-mbstring": "*",
25
- "apimatic/unirest-php": "^2.0",
26
- "apimatic/jsonmapper": "^2.0.2"
27
  },
28
  "require-dev": {
29
  "squizlabs/php_codesniffer": "^3.5",
30
- "phan/phan": "^3.0",
31
  "phpunit/phpunit": "^7.5 || ^8.5"
32
  },
33
  "autoload": {
1
  {
2
  "name": "square/square",
3
  "description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.",
4
+ "version": "19.0.1.20220512",
5
  "type": "library",
6
  "keywords": [
7
  "Square",
18
  }
19
  ],
20
  "require": {
21
+ "php": ">=7.2 <8.2",
22
  "ext-curl": "*",
23
  "ext-json": "*",
24
  "ext-mbstring": "*",
25
+ "apimatic/unirest-php": "^2.2.2",
26
+ "apimatic/jsonmapper": "^3.0.1"
27
  },
28
  "require-dev": {
29
  "squizlabs/php_codesniffer": "^3.5",
30
+ "phan/phan": "5.3.1",
31
  "phpunit/phpunit": "^7.5 || ^8.5"
32
  },
33
  "autoload": {
vendor/square/square/doc/apis/apple-pay.md CHANGED
@@ -29,11 +29,11 @@ function registerDomain(RegisterDomainRequest $body): ApiResponse
29
 
30
  | Parameter | Type | Tags | Description |
31
  | --- | --- | --- | --- |
32
- | `body` | [`RegisterDomainRequest`](/doc/models/register-domain-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
33
 
34
  ## Response Type
35
 
36
- [`RegisterDomainResponse`](/doc/models/register-domain-response.md)
37
 
38
  ## Example Usage
39
 
29
 
30
  | Parameter | Type | Tags | Description |
31
  | --- | --- | --- | --- |
32
+ | `body` | [`RegisterDomainRequest`](../../doc/models/register-domain-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
33
 
34
  ## Response Type
35
 
36
+ [`RegisterDomainResponse`](../../doc/models/register-domain-response.md)
37
 
38
  ## Example Usage
39
 
vendor/square/square/doc/apis/bank-accounts.md CHANGED
@@ -10,14 +10,14 @@ $bankAccountsApi = $client->getBankAccountsApi();
10
 
11
  ## Methods
12
 
13
- * [List Bank Accounts](/doc/apis/bank-accounts.md#list-bank-accounts)
14
- * [Get Bank Account by V1 Id](/doc/apis/bank-accounts.md#get-bank-account-by-v1-id)
15
- * [Get Bank Account](/doc/apis/bank-accounts.md#get-bank-account)
16
 
17
 
18
  # List Bank Accounts
19
 
20
- Returns a list of [BankAccount](/doc/models/bank-account.md) objects linked to a Square account.
21
 
22
  ```php
23
  function listBankAccounts(?string $cursor = null, ?int $limit = null, ?string $locationId = null): ApiResponse
@@ -33,16 +33,12 @@ function listBankAccounts(?string $cursor = null, ?int $limit = null, ?string $l
33
 
34
  ## Response Type
35
 
36
- [`ListBankAccountsResponse`](/doc/models/list-bank-accounts-response.md)
37
 
38
  ## Example Usage
39
 
40
  ```php
41
- $cursor = 'cursor6';
42
- $limit = 172;
43
- $locationId = 'location_id4';
44
-
45
- $apiResponse = $bankAccountsApi->listBankAccounts($cursor, $limit, $locationId);
46
 
47
  if ($apiResponse->isSuccess()) {
48
  $listBankAccountsResponse = $apiResponse->getResult();
@@ -58,7 +54,7 @@ if ($apiResponse->isSuccess()) {
58
 
59
  # Get Bank Account by V1 Id
60
 
61
- Returns details of a [BankAccount](/doc/models/bank-account.md) identified by V1 bank account ID.
62
 
63
  ```php
64
  function getBankAccountByV1Id(string $v1BankAccountId): ApiResponse
@@ -72,7 +68,7 @@ function getBankAccountByV1Id(string $v1BankAccountId): ApiResponse
72
 
73
  ## Response Type
74
 
75
- [`GetBankAccountByV1IdResponse`](/doc/models/get-bank-account-by-v1-id-response.md)
76
 
77
  ## Example Usage
78
 
@@ -95,7 +91,7 @@ if ($apiResponse->isSuccess()) {
95
 
96
  # Get Bank Account
97
 
98
- Returns details of a [BankAccount](/doc/models/bank-account.md)
99
  linked to a Square account.
100
 
101
  ```php
@@ -110,7 +106,7 @@ function getBankAccount(string $bankAccountId): ApiResponse
110
 
111
  ## Response Type
112
 
113
- [`GetBankAccountResponse`](/doc/models/get-bank-account-response.md)
114
 
115
  ## Example Usage
116
 
10
 
11
  ## Methods
12
 
13
+ * [List Bank Accounts](../../doc/apis/bank-accounts.md#list-bank-accounts)
14
+ * [Get Bank Account by V1 Id](../../doc/apis/bank-accounts.md#get-bank-account-by-v1-id)
15
+ * [Get Bank Account](../../doc/apis/bank-accounts.md#get-bank-account)
16
 
17
 
18
  # List Bank Accounts
19
 
20
+ Returns a list of [BankAccount](../../doc/models/bank-account.md) objects linked to a Square account.
21
 
22
  ```php
23
  function listBankAccounts(?string $cursor = null, ?int $limit = null, ?string $locationId = null): ApiResponse
33
 
34
  ## Response Type
35
 
36
+ [`ListBankAccountsResponse`](../../doc/models/list-bank-accounts-response.md)
37
 
38
  ## Example Usage
39
 
40
  ```php
41
+ $apiResponse = $bankAccountsApi->listBankAccounts();
 
 
 
 
42
 
43
  if ($apiResponse->isSuccess()) {
44
  $listBankAccountsResponse = $apiResponse->getResult();
54
 
55
  # Get Bank Account by V1 Id
56
 
57
+ Returns details of a [BankAccount](../../doc/models/bank-account.md) identified by V1 bank account ID.
58
 
59
  ```php
60
  function getBankAccountByV1Id(string $v1BankAccountId): ApiResponse
68
 
69
  ## Response Type
70
 
71
+ [`GetBankAccountByV1IdResponse`](../../doc/models/get-bank-account-by-v1-id-response.md)
72
 
73
  ## Example Usage
74
 
91
 
92
  # Get Bank Account
93
 
94
+ Returns details of a [BankAccount](../../doc/models/bank-account.md)
95
  linked to a Square account.
96
 
97
  ```php
106
 
107
  ## Response Type
108
 
109
+ [`GetBankAccountResponse`](../../doc/models/get-bank-account-response.md)
110
 
111
  ## Example Usage
112
 
vendor/square/square/doc/apis/bookings.md CHANGED
@@ -10,20 +10,77 @@ $bookingsApi = $client->getBookingsApi();
10
 
11
  ## Methods
12
 
13
- * [Create Booking](/doc/apis/bookings.md#create-booking)
14
- * [Search Availability](/doc/apis/bookings.md#search-availability)
15
- * [Retrieve Business Booking Profile](/doc/apis/bookings.md#retrieve-business-booking-profile)
16
- * [List Team Member Booking Profiles](/doc/apis/bookings.md#list-team-member-booking-profiles)
17
- * [Retrieve Team Member Booking Profile](/doc/apis/bookings.md#retrieve-team-member-booking-profile)
18
- * [Retrieve Booking](/doc/apis/bookings.md#retrieve-booking)
19
- * [Update Booking](/doc/apis/bookings.md#update-booking)
20
- * [Cancel Booking](/doc/apis/bookings.md#cancel-booking)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  # Create Booking
24
 
25
  Creates a booking.
26
 
 
 
 
 
 
 
27
  ```php
28
  function createBooking(CreateBookingRequest $body): ApiResponse
29
  ```
@@ -32,25 +89,19 @@ function createBooking(CreateBookingRequest $body): ApiResponse
32
 
33
  | Parameter | Type | Tags | Description |
34
  | --- | --- | --- | --- |
35
- | `body` | [`CreateBookingRequest`](/doc/models/create-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
36
 
37
  ## Response Type
38
 
39
- [`CreateBookingResponse`](/doc/models/create-booking-response.md)
40
 
41
  ## Example Usage
42
 
43
  ```php
44
  $body_booking = new Models\Booking;
45
- $body_booking->setId('id8');
46
- $body_booking->setVersion(148);
47
- $body_booking->setStatus(Models\BookingStatus::ACCEPTED);
48
- $body_booking->setCreatedAt('created_at6');
49
- $body_booking->setUpdatedAt('updated_at4');
50
  $body = new Models\CreateBookingRequest(
51
  $body_booking
52
  );
53
- $body->setIdempotencyKey('idempotency_key2');
54
 
55
  $apiResponse = $bookingsApi->createBooking($body);
56
 
@@ -70,6 +121,9 @@ if ($apiResponse->isSuccess()) {
70
 
71
  Searches for availabilities for booking.
72
 
 
 
 
73
  ```php
74
  function searchAvailability(SearchAvailabilityRequest $body): ApiResponse
75
  ```
@@ -78,44 +132,19 @@ function searchAvailability(SearchAvailabilityRequest $body): ApiResponse
78
 
79
  | Parameter | Type | Tags | Description |
80
  | --- | --- | --- | --- |
81
- | `body` | [`SearchAvailabilityRequest`](/doc/models/search-availability-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
82
 
83
  ## Response Type
84
 
85
- [`SearchAvailabilityResponse`](/doc/models/search-availability-response.md)
86
 
87
  ## Example Usage
88
 
89
  ```php
90
  $body_query_filter_startAtRange = new Models\TimeRange;
91
- $body_query_filter_startAtRange->setStartAt('start_at8');
92
- $body_query_filter_startAtRange->setEndAt('end_at4');
93
  $body_query_filter = new Models\SearchAvailabilityFilter(
94
  $body_query_filter_startAtRange
95
  );
96
- $body_query_filter->setLocationId('location_id6');
97
- $body_query_filter_segmentFilters = [];
98
-
99
- $body_query_filter_segmentFilters_0_serviceVariationId = 'service_variation_id8';
100
- $body_query_filter_segmentFilters[0] = new Models\SegmentFilter(
101
- $body_query_filter_segmentFilters_0_serviceVariationId
102
- );
103
- $body_query_filter_segmentFilters[0]->setTeamMemberIdFilter(new Models\FilterValue);
104
- $body_query_filter_segmentFilters[0]->getTeamMemberIdFilter()->setAll(['all7']);
105
- $body_query_filter_segmentFilters[0]->getTeamMemberIdFilter()->setAny(['any0', 'any1']);
106
- $body_query_filter_segmentFilters[0]->getTeamMemberIdFilter()->setNone(['none5']);
107
-
108
- $body_query_filter_segmentFilters_1_serviceVariationId = 'service_variation_id7';
109
- $body_query_filter_segmentFilters[1] = new Models\SegmentFilter(
110
- $body_query_filter_segmentFilters_1_serviceVariationId
111
- );
112
- $body_query_filter_segmentFilters[1]->setTeamMemberIdFilter(new Models\FilterValue);
113
- $body_query_filter_segmentFilters[1]->getTeamMemberIdFilter()->setAll(['all6', 'all7', 'all8']);
114
- $body_query_filter_segmentFilters[1]->getTeamMemberIdFilter()->setAny(['any1', 'any2', 'any3']);
115
- $body_query_filter_segmentFilters[1]->getTeamMemberIdFilter()->setNone(['none6', 'none7']);
116
- $body_query_filter->setSegmentFilters($body_query_filter_segmentFilters);
117
-
118
- $body_query_filter->setBookingId('booking_id6');
119
  $body_query = new Models\SearchAvailabilityQuery(
120
  $body_query_filter
121
  );
@@ -147,7 +176,7 @@ function retrieveBusinessBookingProfile(): ApiResponse
147
 
148
  ## Response Type
149
 
150
- [`RetrieveBusinessBookingProfileResponse`](/doc/models/retrieve-business-booking-profile-response.md)
151
 
152
  ## Example Usage
153
 
@@ -184,23 +213,20 @@ function listTeamMemberBookingProfiles(
184
  | Parameter | Type | Tags | Description |
185
  | --- | --- | --- | --- |
186
  | `bookableOnly` | `?bool` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`).<br>**Default**: `false` |
187
- | `limit` | `?int` | Query, Optional | The maximum number of results to return. |
188
- | `cursor` | `?string` | Query, Optional | The cursor for paginating through the results. |
189
  | `locationId` | `?string` | Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
190
 
191
  ## Response Type
192
 
193
- [`ListTeamMemberBookingProfilesResponse`](/doc/models/list-team-member-booking-profiles-response.md)
194
 
195
  ## Example Usage
196
 
197
  ```php
198
  $bookableOnly = false;
199
- $limit = 172;
200
- $cursor = 'cursor6';
201
- $locationId = 'location_id4';
202
 
203
- $apiResponse = $bookingsApi->listTeamMemberBookingProfiles($bookableOnly, $limit, $cursor, $locationId);
204
 
205
  if ($apiResponse->isSuccess()) {
206
  $listTeamMemberBookingProfilesResponse = $apiResponse->getResult();
@@ -230,7 +256,7 @@ function retrieveTeamMemberBookingProfile(string $teamMemberId): ApiResponse
230
 
231
  ## Response Type
232
 
233
- [`RetrieveTeamMemberBookingProfileResponse`](/doc/models/retrieve-team-member-booking-profile-response.md)
234
 
235
  ## Example Usage
236
 
@@ -255,6 +281,9 @@ if ($apiResponse->isSuccess()) {
255
 
256
  Retrieves a booking.
257
 
 
 
 
258
  ```php
259
  function retrieveBooking(string $bookingId): ApiResponse
260
  ```
@@ -263,11 +292,11 @@ function retrieveBooking(string $bookingId): ApiResponse
263
 
264
  | Parameter | Type | Tags | Description |
265
  | --- | --- | --- | --- |
266
- | `bookingId` | `string` | Template, Required | The ID of the [Booking](/doc/models/booking.md) object representing the to-be-retrieved booking. |
267
 
268
  ## Response Type
269
 
270
- [`RetrieveBookingResponse`](/doc/models/retrieve-booking-response.md)
271
 
272
  ## Example Usage
273
 
@@ -292,6 +321,12 @@ if ($apiResponse->isSuccess()) {
292
 
293
  Updates a booking.
294
 
 
 
 
 
 
 
295
  ```php
296
  function updateBooking(string $bookingId, UpdateBookingRequest $body): ApiResponse
297
  ```
@@ -300,27 +335,21 @@ function updateBooking(string $bookingId, UpdateBookingRequest $body): ApiRespon
300
 
301
  | Parameter | Type | Tags | Description |
302
  | --- | --- | --- | --- |
303
- | `bookingId` | `string` | Template, Required | The ID of the [Booking](/doc/models/booking.md) object representing the to-be-updated booking. |
304
- | `body` | [`UpdateBookingRequest`](/doc/models/update-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
305
 
306
  ## Response Type
307
 
308
- [`UpdateBookingResponse`](/doc/models/update-booking-response.md)
309
 
310
  ## Example Usage
311
 
312
  ```php
313
  $bookingId = 'booking_id4';
314
  $body_booking = new Models\Booking;
315
- $body_booking->setId('id8');
316
- $body_booking->setVersion(148);
317
- $body_booking->setStatus(Models\BookingStatus::ACCEPTED);
318
- $body_booking->setCreatedAt('created_at6');
319
- $body_booking->setUpdatedAt('updated_at4');
320
  $body = new Models\UpdateBookingRequest(
321
  $body_booking
322
  );
323
- $body->setIdempotencyKey('idempotency_key2');
324
 
325
  $apiResponse = $bookingsApi->updateBooking($bookingId, $body);
326
 
@@ -340,6 +369,12 @@ if ($apiResponse->isSuccess()) {
340
 
341
  Cancels an existing booking.
342
 
 
 
 
 
 
 
343
  ```php
344
  function cancelBooking(string $bookingId, CancelBookingRequest $body): ApiResponse
345
  ```
@@ -348,20 +383,18 @@ function cancelBooking(string $bookingId, CancelBookingRequest $body): ApiRespon
348
 
349
  | Parameter | Type | Tags | Description |
350
  | --- | --- | --- | --- |
351
- | `bookingId` | `string` | Template, Required | The ID of the [Booking](/doc/models/booking.md) object representing the to-be-cancelled booking. |
352
- | `body` | [`CancelBookingRequest`](/doc/models/cancel-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
353
 
354
  ## Response Type
355
 
356
- [`CancelBookingResponse`](/doc/models/cancel-booking-response.md)
357
 
358
  ## Example Usage
359
 
360
  ```php
361
  $bookingId = 'booking_id4';
362
  $body = new Models\CancelBookingRequest;
363
- $body->setIdempotencyKey('idempotency_key2');
364
- $body->setBookingVersion(8);
365
 
366
  $apiResponse = $bookingsApi->cancelBooking($bookingId, $body);
367
 
10
 
11
  ## Methods
12
 
13
+ * [List Bookings](../../doc/apis/bookings.md#list-bookings)
14
+ * [Create Booking](../../doc/apis/bookings.md#create-booking)
15
+ * [Search Availability](../../doc/apis/bookings.md#search-availability)
16
+ * [Retrieve Business Booking Profile](../../doc/apis/bookings.md#retrieve-business-booking-profile)
17
+ * [List Team Member Booking Profiles](../../doc/apis/bookings.md#list-team-member-booking-profiles)
18
+ * [Retrieve Team Member Booking Profile](../../doc/apis/bookings.md#retrieve-team-member-booking-profile)
19
+ * [Retrieve Booking](../../doc/apis/bookings.md#retrieve-booking)
20
+ * [Update Booking](../../doc/apis/bookings.md#update-booking)
21
+ * [Cancel Booking](../../doc/apis/bookings.md#cancel-booking)
22
+
23
+
24
+ # List Bookings
25
+
26
+ Retrieve a collection of bookings.
27
+
28
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
29
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
30
+
31
+ ```php
32
+ function listBookings(
33
+ ?int $limit = null,
34
+ ?string $cursor = null,
35
+ ?string $teamMemberId = null,
36
+ ?string $locationId = null,
37
+ ?string $startAtMin = null,
38
+ ?string $startAtMax = null
39
+ ): ApiResponse
40
+ ```
41
+
42
+ ## Parameters
43
+
44
+ | Parameter | Type | Tags | Description |
45
+ | --- | --- | --- | --- |
46
+ | `limit` | `?int` | Query, Optional | The maximum number of results per page to return in a paged response. |
47
+ | `cursor` | `?string` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
48
+ | `teamMemberId` | `?string` | Query, Optional | The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. |
49
+ | `locationId` | `?string` | Query, Optional | The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. |
50
+ | `startAtMin` | `?string` | Query, Optional | The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. |
51
+ | `startAtMax` | `?string` | Query, Optional | The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after `start_at_min` is used. |
52
+
53
+ ## Response Type
54
+
55
+ [`ListBookingsResponse`](../../doc/models/list-bookings-response.md)
56
+
57
+ ## Example Usage
58
+
59
+ ```php
60
+ $apiResponse = $bookingsApi->listBookings();
61
+
62
+ if ($apiResponse->isSuccess()) {
63
+ $listBookingsResponse = $apiResponse->getResult();
64
+ } else {
65
+ $errors = $apiResponse->getErrors();
66
+ }
67
+
68
+ // Get more response info...
69
+ // $statusCode = $apiResponse->getStatusCode();
70
+ // $headers = $apiResponse->getHeaders();
71
+ ```
72
 
73
 
74
  # Create Booking
75
 
76
  Creates a booking.
77
 
78
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
79
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
80
+
81
+ For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus*
82
+ or *Appointments Premium*.
83
+
84
  ```php
85
  function createBooking(CreateBookingRequest $body): ApiResponse
86
  ```
89
 
90
  | Parameter | Type | Tags | Description |
91
  | --- | --- | --- | --- |
92
+ | `body` | [`CreateBookingRequest`](../../doc/models/create-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
93
 
94
  ## Response Type
95
 
96
+ [`CreateBookingResponse`](../../doc/models/create-booking-response.md)
97
 
98
  ## Example Usage
99
 
100
  ```php
101
  $body_booking = new Models\Booking;
 
 
 
 
 
102
  $body = new Models\CreateBookingRequest(
103
  $body_booking
104
  );
 
105
 
106
  $apiResponse = $bookingsApi->createBooking($body);
107
 
121
 
122
  Searches for availabilities for booking.
123
 
124
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
125
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
126
+
127
  ```php
128
  function searchAvailability(SearchAvailabilityRequest $body): ApiResponse
129
  ```
132
 
133
  | Parameter | Type | Tags | Description |
134
  | --- | --- | --- | --- |
135
+ | `body` | [`SearchAvailabilityRequest`](../../doc/models/search-availability-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
136
 
137
  ## Response Type
138
 
139
+ [`SearchAvailabilityResponse`](../../doc/models/search-availability-response.md)
140
 
141
  ## Example Usage
142
 
143
  ```php
144
  $body_query_filter_startAtRange = new Models\TimeRange;
 
 
145
  $body_query_filter = new Models\SearchAvailabilityFilter(
146
  $body_query_filter_startAtRange
147
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  $body_query = new Models\SearchAvailabilityQuery(
149
  $body_query_filter
150
  );
176
 
177
  ## Response Type
178
 
179
+ [`RetrieveBusinessBookingProfileResponse`](../../doc/models/retrieve-business-booking-profile-response.md)
180
 
181
  ## Example Usage
182
 
213
  | Parameter | Type | Tags | Description |
214
  | --- | --- | --- | --- |
215
  | `bookableOnly` | `?bool` | Query, Optional | Indicates whether to include only bookable team members in the returned result (`true`) or not (`false`).<br>**Default**: `false` |
216
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a paged response. |
217
+ | `cursor` | `?string` | Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
218
  | `locationId` | `?string` | Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
219
 
220
  ## Response Type
221
 
222
+ [`ListTeamMemberBookingProfilesResponse`](../../doc/models/list-team-member-booking-profiles-response.md)
223
 
224
  ## Example Usage
225
 
226
  ```php
227
  $bookableOnly = false;
 
 
 
228
 
229
+ $apiResponse = $bookingsApi->listTeamMemberBookingProfiles($bookableOnly);
230
 
231
  if ($apiResponse->isSuccess()) {
232
  $listTeamMemberBookingProfilesResponse = $apiResponse->getResult();
256
 
257
  ## Response Type
258
 
259
+ [`RetrieveTeamMemberBookingProfileResponse`](../../doc/models/retrieve-team-member-booking-profile-response.md)
260
 
261
  ## Example Usage
262
 
281
 
282
  Retrieves a booking.
283
 
284
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope.
285
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope.
286
+
287
  ```php
288
  function retrieveBooking(string $bookingId): ApiResponse
289
  ```
292
 
293
  | Parameter | Type | Tags | Description |
294
  | --- | --- | --- | --- |
295
+ | `bookingId` | `string` | Template, Required | The ID of the [Booking](../../doc/models/booking.md) object representing the to-be-retrieved booking. |
296
 
297
  ## Response Type
298
 
299
+ [`RetrieveBookingResponse`](../../doc/models/retrieve-booking-response.md)
300
 
301
  ## Example Usage
302
 
321
 
322
  Updates a booking.
323
 
324
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
325
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
326
+
327
+ For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus*
328
+ or *Appointments Premium*.
329
+
330
  ```php
331
  function updateBooking(string $bookingId, UpdateBookingRequest $body): ApiResponse
332
  ```
335
 
336
  | Parameter | Type | Tags | Description |
337
  | --- | --- | --- | --- |
338
+ | `bookingId` | `string` | Template, Required | The ID of the [Booking](../../doc/models/booking.md) object representing the to-be-updated booking. |
339
+ | `body` | [`UpdateBookingRequest`](../../doc/models/update-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
340
 
341
  ## Response Type
342
 
343
+ [`UpdateBookingResponse`](../../doc/models/update-booking-response.md)
344
 
345
  ## Example Usage
346
 
347
  ```php
348
  $bookingId = 'booking_id4';
349
  $body_booking = new Models\Booking;
 
 
 
 
 
350
  $body = new Models\UpdateBookingRequest(
351
  $body_booking
352
  );
 
353
 
354
  $apiResponse = $bookingsApi->updateBooking($bookingId, $body);
355
 
369
 
370
  Cancels an existing booking.
371
 
372
+ To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope.
373
+ To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope.
374
+
375
+ For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus*
376
+ or *Appointments Premium*.
377
+
378
  ```php
379
  function cancelBooking(string $bookingId, CancelBookingRequest $body): ApiResponse
380
  ```
383
 
384
  | Parameter | Type | Tags | Description |
385
  | --- | --- | --- | --- |
386
+ | `bookingId` | `string` | Template, Required | The ID of the [Booking](../../doc/models/booking.md) object representing the to-be-cancelled booking. |
387
+ | `body` | [`CancelBookingRequest`](../../doc/models/cancel-booking-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
388
 
389
  ## Response Type
390
 
391
+ [`CancelBookingResponse`](../../doc/models/cancel-booking-response.md)
392
 
393
  ## Example Usage
394
 
395
  ```php
396
  $bookingId = 'booking_id4';
397
  $body = new Models\CancelBookingRequest;
 
 
398
 
399
  $apiResponse = $bookingsApi->cancelBooking($bookingId, $body);
400
 
vendor/square/square/doc/apis/cards.md CHANGED
@@ -10,10 +10,10 @@ $cardsApi = $client->getCardsApi();
10
 
11
  ## Methods
12
 
13
- * [List Cards](/doc/apis/cards.md#list-cards)
14
- * [Create Card](/doc/apis/cards.md#create-card)
15
- * [Retrieve Card](/doc/apis/cards.md#retrieve-card)
16
- * [Disable Card](/doc/apis/cards.md#disable-card)
17
 
18
 
19
  # List Cards
@@ -39,22 +39,18 @@ function listCards(
39
  | `customerId` | `?string` | Query, Optional | Limit results to cards associated with the customer supplied.<br>By default, all cards owned by the merchant are returned. |
40
  | `includeDisabled` | `?bool` | Query, Optional | Includes disabled cards.<br>By default, all enabled cards owned by the merchant are returned.<br>**Default**: `false` |
41
  | `referenceId` | `?string` | Query, Optional | Limit results to cards associated with the reference_id supplied. |
42
- | `sortOrder` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.<br>This field defaults to ASC. |
43
 
44
  ## Response Type
45
 
46
- [`ListCardsResponse`](/doc/models/list-cards-response.md)
47
 
48
  ## Example Usage
49
 
50
  ```php
51
- $cursor = 'cursor6';
52
- $customerId = 'customer_id8';
53
  $includeDisabled = false;
54
- $referenceId = 'reference_id2';
55
- $sortOrder = Models\SortOrder::DESC;
56
 
57
- $apiResponse = $cardsApi->listCards($cursor, $customerId, $includeDisabled, $referenceId, $sortOrder);
58
 
59
  if ($apiResponse->isSuccess()) {
60
  $listCardsResponse = $apiResponse->getResult();
@@ -80,11 +76,11 @@ function createCard(CreateCardRequest $body): ApiResponse
80
 
81
  | Parameter | Type | Tags | Description |
82
  | --- | --- | --- | --- |
83
- | `body` | [`CreateCardRequest`](/doc/models/create-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
84
 
85
  ## Response Type
86
 
87
- [`CreateCardResponse`](/doc/models/create-card-response.md)
88
 
89
  ## Example Usage
90
 
@@ -92,18 +88,11 @@ function createCard(CreateCardRequest $body): ApiResponse
92
  $body_idempotencyKey = '4935a656-a929-4792-b97c-8848be85c27c';
93
  $body_sourceId = 'cnon:uIbfJXhXETSP197M3GB';
94
  $body_card = new Models\Card;
95
- $body_card->setId('id0');
96
- $body_card->setCardBrand(Models\CardBrand::INTERAC);
97
- $body_card->setLast4('last_42');
98
- $body_card->setExpMonth(236);
99
- $body_card->setExpYear(60);
100
  $body_card->setCardholderName('Amelia Earhart');
101
  $body_card->setBillingAddress(new Models\Address);
102
  $body_card->getBillingAddress()->setAddressLine1('500 Electric Ave');
103
  $body_card->getBillingAddress()->setAddressLine2('Suite 600');
104
- $body_card->getBillingAddress()->setAddressLine3('address_line_34');
105
  $body_card->getBillingAddress()->setLocality('New York');
106
- $body_card->getBillingAddress()->setSublocality('sublocality8');
107
  $body_card->getBillingAddress()->setAdministrativeDistrictLevel1('NY');
108
  $body_card->getBillingAddress()->setPostalCode('10003');
109
  $body_card->getBillingAddress()->setCountry(Models\Country::US);
@@ -114,7 +103,6 @@ $body = new Models\CreateCardRequest(
114
  $body_sourceId,
115
  $body_card
116
  );
117
- $body->setVerificationToken('verification_token0');
118
 
119
  $apiResponse = $cardsApi->createCard($body);
120
 
@@ -146,7 +134,7 @@ function retrieveCard(string $cardId): ApiResponse
146
 
147
  ## Response Type
148
 
149
- [`RetrieveCardResponse`](/doc/models/retrieve-card-response.md)
150
 
151
  ## Example Usage
152
 
@@ -184,7 +172,7 @@ function disableCard(string $cardId): ApiResponse
184
 
185
  ## Response Type
186
 
187
- [`DisableCardResponse`](/doc/models/disable-card-response.md)
188
 
189
  ## Example Usage
190
 
10
 
11
  ## Methods
12
 
13
+ * [List Cards](../../doc/apis/cards.md#list-cards)
14
+ * [Create Card](../../doc/apis/cards.md#create-card)
15
+ * [Retrieve Card](../../doc/apis/cards.md#retrieve-card)
16
+ * [Disable Card](../../doc/apis/cards.md#disable-card)
17
 
18
 
19
  # List Cards
39
  | `customerId` | `?string` | Query, Optional | Limit results to cards associated with the customer supplied.<br>By default, all cards owned by the merchant are returned. |
40
  | `includeDisabled` | `?bool` | Query, Optional | Includes disabled cards.<br>By default, all enabled cards owned by the merchant are returned.<br>**Default**: `false` |
41
  | `referenceId` | `?string` | Query, Optional | Limit results to cards associated with the reference_id supplied. |
42
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | Sorts the returned list by when the card was created with the specified order.<br>This field defaults to ASC. |
43
 
44
  ## Response Type
45
 
46
+ [`ListCardsResponse`](../../doc/models/list-cards-response.md)
47
 
48
  ## Example Usage
49
 
50
  ```php
 
 
51
  $includeDisabled = false;
 
 
52
 
53
+ $apiResponse = $cardsApi->listCards(null, null, $includeDisabled);
54
 
55
  if ($apiResponse->isSuccess()) {
56
  $listCardsResponse = $apiResponse->getResult();
76
 
77
  | Parameter | Type | Tags | Description |
78
  | --- | --- | --- | --- |
79
+ | `body` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
80
 
81
  ## Response Type
82
 
83
+ [`CreateCardResponse`](../../doc/models/create-card-response.md)
84
 
85
  ## Example Usage
86
 
88
  $body_idempotencyKey = '4935a656-a929-4792-b97c-8848be85c27c';
89
  $body_sourceId = 'cnon:uIbfJXhXETSP197M3GB';
90
  $body_card = new Models\Card;
 
 
 
 
 
91
  $body_card->setCardholderName('Amelia Earhart');
92
  $body_card->setBillingAddress(new Models\Address);
93
  $body_card->getBillingAddress()->setAddressLine1('500 Electric Ave');
94
  $body_card->getBillingAddress()->setAddressLine2('Suite 600');
 
95
  $body_card->getBillingAddress()->setLocality('New York');
 
96
  $body_card->getBillingAddress()->setAdministrativeDistrictLevel1('NY');
97
  $body_card->getBillingAddress()->setPostalCode('10003');
98
  $body_card->getBillingAddress()->setCountry(Models\Country::US);
103
  $body_sourceId,
104
  $body_card
105
  );
 
106
 
107
  $apiResponse = $cardsApi->createCard($body);
108
 
134
 
135
  ## Response Type
136
 
137
+ [`RetrieveCardResponse`](../../doc/models/retrieve-card-response.md)
138
 
139
  ## Example Usage
140
 
172
 
173
  ## Response Type
174
 
175
+ [`DisableCardResponse`](../../doc/models/disable-card-response.md)
176
 
177
  ## Example Usage
178
 
vendor/square/square/doc/apis/cash-drawers.md CHANGED
@@ -10,9 +10,9 @@ $cashDrawersApi = $client->getCashDrawersApi();
10
 
11
  ## Methods
12
 
13
- * [List Cash Drawer Shifts](/doc/apis/cash-drawers.md#list-cash-drawer-shifts)
14
- * [Retrieve Cash Drawer Shift](/doc/apis/cash-drawers.md#retrieve-cash-drawer-shift)
15
- * [List Cash Drawer Shift Events](/doc/apis/cash-drawers.md#list-cash-drawer-shift-events)
16
 
17
 
18
  # List Cash Drawer Shifts
@@ -36,7 +36,7 @@ function listCashDrawerShifts(
36
  | Parameter | Type | Tags | Description |
37
  | --- | --- | --- | --- |
38
  | `locationId` | `string` | Query, Required | The ID of the location to query for a list of cash drawer shifts. |
39
- | `sortOrder` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which cash drawer shifts are listed in the response,<br>based on their opened_at field. Default value: ASC |
40
  | `beginTime` | `?string` | Query, Optional | The inclusive start time of the query on opened_at, in ISO 8601 format. |
41
  | `endTime` | `?string` | Query, Optional | The exclusive end date of the query on opened_at, in ISO 8601 format. |
42
  | `limit` | `?int` | Query, Optional | Number of cash drawer shift events in a page of results (200 by<br>default, 1000 max). |
@@ -44,19 +44,14 @@ function listCashDrawerShifts(
44
 
45
  ## Response Type
46
 
47
- [`ListCashDrawerShiftsResponse`](/doc/models/list-cash-drawer-shifts-response.md)
48
 
49
  ## Example Usage
50
 
51
  ```php
52
  $locationId = 'location_id4';
53
- $sortOrder = Models\SortOrder::DESC;
54
- $beginTime = 'begin_time2';
55
- $endTime = 'end_time2';
56
- $limit = 172;
57
- $cursor = 'cursor6';
58
 
59
- $apiResponse = $cashDrawersApi->listCashDrawerShifts($locationId, $sortOrder, $beginTime, $endTime, $limit, $cursor);
60
 
61
  if ($apiResponse->isSuccess()) {
62
  $listCashDrawerShiftsResponse = $apiResponse->getResult();
@@ -73,7 +68,7 @@ if ($apiResponse->isSuccess()) {
73
  # Retrieve Cash Drawer Shift
74
 
75
  Provides the summary details for a single cash drawer shift. See
76
- [ListCashDrawerShiftEvents](/doc/apis/cash-drawers.md#list-cash-drawer-shift-events) for a list of cash drawer shift events.
77
 
78
  ```php
79
  function retrieveCashDrawerShift(string $locationId, string $shiftId): ApiResponse
@@ -88,7 +83,7 @@ function retrieveCashDrawerShift(string $locationId, string $shiftId): ApiRespon
88
 
89
  ## Response Type
90
 
91
- [`RetrieveCashDrawerShiftResponse`](/doc/models/retrieve-cash-drawer-shift-response.md)
92
 
93
  ## Example Usage
94
 
@@ -134,17 +129,15 @@ function listCashDrawerShiftEvents(
134
 
135
  ## Response Type
136
 
137
- [`ListCashDrawerShiftEventsResponse`](/doc/models/list-cash-drawer-shift-events-response.md)
138
 
139
  ## Example Usage
140
 
141
  ```php
142
  $locationId = 'location_id4';
143
  $shiftId = 'shift_id0';
144
- $limit = 172;
145
- $cursor = 'cursor6';
146
 
147
- $apiResponse = $cashDrawersApi->listCashDrawerShiftEvents($locationId, $shiftId, $limit, $cursor);
148
 
149
  if ($apiResponse->isSuccess()) {
150
  $listCashDrawerShiftEventsResponse = $apiResponse->getResult();
10
 
11
  ## Methods
12
 
13
+ * [List Cash Drawer Shifts](../../doc/apis/cash-drawers.md#list-cash-drawer-shifts)
14
+ * [Retrieve Cash Drawer Shift](../../doc/apis/cash-drawers.md#retrieve-cash-drawer-shift)
15
+ * [List Cash Drawer Shift Events](../../doc/apis/cash-drawers.md#list-cash-drawer-shift-events)
16
 
17
 
18
  # List Cash Drawer Shifts
36
  | Parameter | Type | Tags | Description |
37
  | --- | --- | --- | --- |
38
  | `locationId` | `string` | Query, Required | The ID of the location to query for a list of cash drawer shifts. |
39
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which cash drawer shifts are listed in the response,<br>based on their opened_at field. Default value: ASC |
40
  | `beginTime` | `?string` | Query, Optional | The inclusive start time of the query on opened_at, in ISO 8601 format. |
41
  | `endTime` | `?string` | Query, Optional | The exclusive end date of the query on opened_at, in ISO 8601 format. |
42
  | `limit` | `?int` | Query, Optional | Number of cash drawer shift events in a page of results (200 by<br>default, 1000 max). |
44
 
45
  ## Response Type
46
 
47
+ [`ListCashDrawerShiftsResponse`](../../doc/models/list-cash-drawer-shifts-response.md)
48
 
49
  ## Example Usage
50
 
51
  ```php
52
  $locationId = 'location_id4';
 
 
 
 
 
53
 
54
+ $apiResponse = $cashDrawersApi->listCashDrawerShifts($locationId);
55
 
56
  if ($apiResponse->isSuccess()) {
57
  $listCashDrawerShiftsResponse = $apiResponse->getResult();
68
  # Retrieve Cash Drawer Shift
69
 
70
  Provides the summary details for a single cash drawer shift. See
71
+ [ListCashDrawerShiftEvents](../../doc/apis/cash-drawers.md#list-cash-drawer-shift-events) for a list of cash drawer shift events.
72
 
73
  ```php
74
  function retrieveCashDrawerShift(string $locationId, string $shiftId): ApiResponse
83
 
84
  ## Response Type
85
 
86
+ [`RetrieveCashDrawerShiftResponse`](../../doc/models/retrieve-cash-drawer-shift-response.md)
87
 
88
  ## Example Usage
89
 
129
 
130
  ## Response Type
131
 
132
+ [`ListCashDrawerShiftEventsResponse`](../../doc/models/list-cash-drawer-shift-events-response.md)
133
 
134
  ## Example Usage
135
 
136
  ```php
137
  $locationId = 'location_id4';
138
  $shiftId = 'shift_id0';
 
 
139
 
140
+ $apiResponse = $cashDrawersApi->listCashDrawerShiftEvents($locationId, $shiftId);
141
 
142
  if ($apiResponse->isSuccess()) {
143
  $listCashDrawerShiftEventsResponse = $apiResponse->getResult();
vendor/square/square/doc/apis/catalog.md CHANGED
@@ -10,28 +10,29 @@ $catalogApi = $client->getCatalogApi();
10
 
11
  ## Methods
12
 
13
- * [Batch Delete Catalog Objects](/doc/apis/catalog.md#batch-delete-catalog-objects)
14
- * [Batch Retrieve Catalog Objects](/doc/apis/catalog.md#batch-retrieve-catalog-objects)
15
- * [Batch Upsert Catalog Objects](/doc/apis/catalog.md#batch-upsert-catalog-objects)
16
- * [Create Catalog Image](/doc/apis/catalog.md#create-catalog-image)
17
- * [Catalog Info](/doc/apis/catalog.md#catalog-info)
18
- * [List Catalog](/doc/apis/catalog.md#list-catalog)
19
- * [Upsert Catalog Object](/doc/apis/catalog.md#upsert-catalog-object)
20
- * [Delete Catalog Object](/doc/apis/catalog.md#delete-catalog-object)
21
- * [Retrieve Catalog Object](/doc/apis/catalog.md#retrieve-catalog-object)
22
- * [Search Catalog Objects](/doc/apis/catalog.md#search-catalog-objects)
23
- * [Search Catalog Items](/doc/apis/catalog.md#search-catalog-items)
24
- * [Update Item Modifier Lists](/doc/apis/catalog.md#update-item-modifier-lists)
25
- * [Update Item Taxes](/doc/apis/catalog.md#update-item-taxes)
 
26
 
27
 
28
  # Batch Delete Catalog Objects
29
 
30
- Deletes a set of [CatalogItem](/doc/models/catalog-item.md)s based on the
31
  provided list of target IDs and returns a set of successfully deleted IDs in
32
  the response. Deletion is a cascading event such that all children of the
33
  targeted object are also deleted. For example, deleting a CatalogItem will
34
- also delete all of its [CatalogItemVariation](/doc/models/catalog-item-variation.md)
35
  children.
36
 
37
  `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted
@@ -46,11 +47,11 @@ function batchDeleteCatalogObjects(BatchDeleteCatalogObjectsRequest $body): ApiR
46
 
47
  | Parameter | Type | Tags | Description |
48
  | --- | --- | --- | --- |
49
- | `body` | [`BatchDeleteCatalogObjectsRequest`](/doc/models/batch-delete-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
50
 
51
  ## Response Type
52
 
53
- [`BatchDeleteCatalogObjectsResponse`](/doc/models/batch-delete-catalog-objects-response.md)
54
 
55
  ## Example Usage
56
 
@@ -75,11 +76,11 @@ if ($apiResponse->isSuccess()) {
75
  # Batch Retrieve Catalog Objects
76
 
77
  Returns a set of objects based on the provided ID.
78
- Each [CatalogItem](/doc/models/catalog-item.md) returned in the set includes all of its
79
  child information including: all of its
80
- [CatalogItemVariation](/doc/models/catalog-item-variation.md) objects, references to
81
- its [CatalogModifierList](/doc/models/catalog-modifier-list.md) objects, and the ids of
82
- any [CatalogTax](/doc/models/catalog-tax.md) objects that apply to it.
83
 
84
  ```php
85
  function batchRetrieveCatalogObjects(BatchRetrieveCatalogObjectsRequest $body): ApiResponse
@@ -89,11 +90,11 @@ function batchRetrieveCatalogObjects(BatchRetrieveCatalogObjectsRequest $body):
89
 
90
  | Parameter | Type | Tags | Description |
91
  | --- | --- | --- | --- |
92
- | `body` | [`BatchRetrieveCatalogObjectsRequest`](/doc/models/batch-retrieve-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
93
 
94
  ## Response Type
95
 
96
- [`BatchRetrieveCatalogObjectsResponse`](/doc/models/batch-retrieve-catalog-objects-response.md)
97
 
98
  ## Example Usage
99
 
@@ -103,7 +104,6 @@ $body = new Models\BatchRetrieveCatalogObjectsRequest(
103
  $body_objectIds
104
  );
105
  $body->setIncludeRelatedObjects(true);
106
- $body->setCatalogVersion(118);
107
 
108
  $apiResponse = $catalogApi->batchRetrieveCatalogObjects($body);
109
 
@@ -139,11 +139,11 @@ function batchUpsertCatalogObjects(BatchUpsertCatalogObjectsRequest $body): ApiR
139
 
140
  | Parameter | Type | Tags | Description |
141
  | --- | --- | --- | --- |
142
- | `body` | [`BatchUpsertCatalogObjectsRequest`](/doc/models/batch-upsert-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
143
 
144
  ## Response Type
145
 
146
- [`BatchUpsertCatalogObjectsResponse`](/doc/models/batch-upsert-catalog-objects-response.md)
147
 
148
  ## Example Usage
149
 
@@ -159,40 +159,10 @@ $body_batches_0_objects[0] = new Models\CatalogObject(
159
  $body_batches_0_objects_0_type,
160
  $body_batches_0_objects_0_id
161
  );
162
- $body_batches_0_objects[0]->setUpdatedAt('updated_at6');
163
- $body_batches_0_objects[0]->setVersion(252);
164
- $body_batches_0_objects[0]->setIsDeleted(false);
165
- $body_batches_0_objects_0_customAttributeValues = [];
166
-
167
- $body_batches_0_objects_0_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
168
- $body_batches_0_objects_0_customAttributeValues['key0']->setName('name1');
169
- $body_batches_0_objects_0_customAttributeValues['key0']->setStringValue('string_value5');
170
- $body_batches_0_objects_0_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id1');
171
- $body_batches_0_objects_0_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::SELECTION);
172
- $body_batches_0_objects_0_customAttributeValues['key0']->setNumberValue('number_value1');
173
-
174
- $body_batches_0_objects_0_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
175
- $body_batches_0_objects_0_customAttributeValues['key1']->setName('name0');
176
- $body_batches_0_objects_0_customAttributeValues['key1']->setStringValue('string_value4');
177
- $body_batches_0_objects_0_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id2');
178
- $body_batches_0_objects_0_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::STRING);
179
- $body_batches_0_objects_0_customAttributeValues['key1']->setNumberValue('number_value0');
180
- $body_batches_0_objects[0]->setCustomAttributeValues($body_batches_0_objects_0_customAttributeValues);
181
-
182
- $body_batches_0_objects_0_catalogV1Ids = [];
183
-
184
- $body_batches_0_objects_0_catalogV1Ids[0] = new Models\CatalogV1Id;
185
- $body_batches_0_objects_0_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id4');
186
- $body_batches_0_objects_0_catalogV1Ids[0]->setLocationId('location_id4');
187
- $body_batches_0_objects[0]->setCatalogV1Ids($body_batches_0_objects_0_catalogV1Ids);
188
-
189
  $body_batches_0_objects[0]->setPresentAtAllLocations(true);
190
  $body_batches_0_objects[0]->setItemData(new Models\CatalogItem);
191
  $body_batches_0_objects[0]->getItemData()->setName('Tea');
192
  $body_batches_0_objects[0]->getItemData()->setDescription('Hot Leaf Juice');
193
- $body_batches_0_objects[0]->getItemData()->setAbbreviation('abbreviation0');
194
- $body_batches_0_objects[0]->getItemData()->setLabelColor('label_color0');
195
- $body_batches_0_objects[0]->getItemData()->setAvailableOnline(false);
196
  $body_batches_0_objects[0]->getItemData()->setCategoryId('#Beverages');
197
  $body_batches_0_objects[0]->getItemData()->setTaxIds(['#SalesTax']);
198
  $body_batches_0_objects_0_itemData_variations = [];
@@ -203,33 +173,6 @@ $body_batches_0_objects_0_itemData_variations[0] = new Models\CatalogObject(
203
  $body_batches_0_objects_0_itemData_variations_0_type,
204
  $body_batches_0_objects_0_itemData_variations_0_id
205
  );
206
- $body_batches_0_objects_0_itemData_variations[0]->setUpdatedAt('updated_at5');
207
- $body_batches_0_objects_0_itemData_variations[0]->setVersion(99);
208
- $body_batches_0_objects_0_itemData_variations[0]->setIsDeleted(true);
209
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues = [];
210
-
211
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
212
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0']->setName('name0');
213
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0']->setStringValue('string_value4');
214
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id2');
215
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::STRING);
216
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key0']->setNumberValue('number_value0');
217
-
218
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
219
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1']->setName('name1');
220
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1']->setStringValue('string_value5');
221
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id1');
222
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::SELECTION);
223
- $body_batches_0_objects_0_itemData_variations_0_customAttributeValues['key1']->setNumberValue('number_value1');
224
- $body_batches_0_objects_0_itemData_variations[0]->setCustomAttributeValues($body_batches_0_objects_0_itemData_variations_0_customAttributeValues);
225
-
226
- $body_batches_0_objects_0_itemData_variations_0_catalogV1Ids = [];
227
-
228
- $body_batches_0_objects_0_itemData_variations_0_catalogV1Ids[0] = new Models\CatalogV1Id;
229
- $body_batches_0_objects_0_itemData_variations_0_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id3');
230
- $body_batches_0_objects_0_itemData_variations_0_catalogV1Ids[0]->setLocationId('location_id3');
231
- $body_batches_0_objects_0_itemData_variations[0]->setCatalogV1Ids($body_batches_0_objects_0_itemData_variations_0_catalogV1Ids);
232
-
233
  $body_batches_0_objects_0_itemData_variations[0]->setPresentAtAllLocations(true);
234
  $body_batches_0_objects[0]->getItemData()->setVariations($body_batches_0_objects_0_itemData_variations);
235
 
@@ -240,37 +183,10 @@ $body_batches_0_objects[1] = new Models\CatalogObject(
240
  $body_batches_0_objects_1_type,
241
  $body_batches_0_objects_1_id
242
  );
243
- $body_batches_0_objects[1]->setUpdatedAt('updated_at7');
244
- $body_batches_0_objects[1]->setVersion(253);
245
- $body_batches_0_objects[1]->setIsDeleted(true);
246
- $body_batches_0_objects_1_customAttributeValues = [];
247
-
248
- $body_batches_0_objects_1_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
249
- $body_batches_0_objects_1_customAttributeValues['key0']->setName('name2');
250
- $body_batches_0_objects_1_customAttributeValues['key0']->setStringValue('string_value6');
251
- $body_batches_0_objects_1_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id0');
252
- $body_batches_0_objects_1_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::NUMBER);
253
- $body_batches_0_objects_1_customAttributeValues['key0']->setNumberValue('number_value2');
254
- $body_batches_0_objects[1]->setCustomAttributeValues($body_batches_0_objects_1_customAttributeValues);
255
-
256
- $body_batches_0_objects_1_catalogV1Ids = [];
257
-
258
- $body_batches_0_objects_1_catalogV1Ids[0] = new Models\CatalogV1Id;
259
- $body_batches_0_objects_1_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id5');
260
- $body_batches_0_objects_1_catalogV1Ids[0]->setLocationId('location_id5');
261
-
262
- $body_batches_0_objects_1_catalogV1Ids[1] = new Models\CatalogV1Id;
263
- $body_batches_0_objects_1_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id6');
264
- $body_batches_0_objects_1_catalogV1Ids[1]->setLocationId('location_id6');
265
- $body_batches_0_objects[1]->setCatalogV1Ids($body_batches_0_objects_1_catalogV1Ids);
266
-
267
  $body_batches_0_objects[1]->setPresentAtAllLocations(true);
268
  $body_batches_0_objects[1]->setItemData(new Models\CatalogItem);
269
  $body_batches_0_objects[1]->getItemData()->setName('Coffee');
270
  $body_batches_0_objects[1]->getItemData()->setDescription('Hot Bean Juice');
271
- $body_batches_0_objects[1]->getItemData()->setAbbreviation('abbreviation9');
272
- $body_batches_0_objects[1]->getItemData()->setLabelColor('label_color9');
273
- $body_batches_0_objects[1]->getItemData()->setAvailableOnline(true);
274
  $body_batches_0_objects[1]->getItemData()->setCategoryId('#Beverages');
275
  $body_batches_0_objects[1]->getItemData()->setTaxIds(['#SalesTax']);
276
  $body_batches_0_objects_1_itemData_variations = [];
@@ -281,30 +197,6 @@ $body_batches_0_objects_1_itemData_variations[0] = new Models\CatalogObject(
281
  $body_batches_0_objects_1_itemData_variations_0_type,
282
  $body_batches_0_objects_1_itemData_variations_0_id
283
  );
284
- $body_batches_0_objects_1_itemData_variations[0]->setUpdatedAt('updated_at4');
285
- $body_batches_0_objects_1_itemData_variations[0]->setVersion(100);
286
- $body_batches_0_objects_1_itemData_variations[0]->setIsDeleted(false);
287
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues = [];
288
-
289
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
290
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0']->setName('name9');
291
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0']->setStringValue('string_value3');
292
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id3');
293
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
294
- $body_batches_0_objects_1_itemData_variations_0_customAttributeValues['key0']->setNumberValue('number_value9');
295
- $body_batches_0_objects_1_itemData_variations[0]->setCustomAttributeValues($body_batches_0_objects_1_itemData_variations_0_customAttributeValues);
296
-
297
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids = [];
298
-
299
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[0] = new Models\CatalogV1Id;
300
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id4');
301
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[0]->setLocationId('location_id4');
302
-
303
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[1] = new Models\CatalogV1Id;
304
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id5');
305
- $body_batches_0_objects_1_itemData_variations_0_catalogV1Ids[1]->setLocationId('location_id5');
306
- $body_batches_0_objects_1_itemData_variations[0]->setCatalogV1Ids($body_batches_0_objects_1_itemData_variations_0_catalogV1Ids);
307
-
308
  $body_batches_0_objects_1_itemData_variations[0]->setPresentAtAllLocations(true);
309
 
310
  $body_batches_0_objects_1_itemData_variations_1_type = Models\CatalogObjectType::ITEM_VARIATION;
@@ -313,48 +205,6 @@ $body_batches_0_objects_1_itemData_variations[1] = new Models\CatalogObject(
313
  $body_batches_0_objects_1_itemData_variations_1_type,
314
  $body_batches_0_objects_1_itemData_variations_1_id
315
  );
316
- $body_batches_0_objects_1_itemData_variations[1]->setUpdatedAt('updated_at3');
317
- $body_batches_0_objects_1_itemData_variations[1]->setVersion(101);
318
- $body_batches_0_objects_1_itemData_variations[1]->setIsDeleted(true);
319
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues = [];
320
-
321
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
322
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0']->setName('name8');
323
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0']->setStringValue('string_value2');
324
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id4');
325
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::NUMBER);
326
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key0']->setNumberValue('number_value8');
327
-
328
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
329
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1']->setName('name9');
330
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1']->setStringValue('string_value3');
331
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id3');
332
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
333
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key1']->setNumberValue('number_value9');
334
-
335
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2'] = new Models\CatalogCustomAttributeValue;
336
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2']->setName('name0');
337
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2']->setStringValue('string_value4');
338
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2']->setCustomAttributeDefinitionId('custom_attribute_definition_id2');
339
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2']->setType(Models\CatalogCustomAttributeDefinitionType::STRING);
340
- $body_batches_0_objects_1_itemData_variations_1_customAttributeValues['key2']->setNumberValue('number_value0');
341
- $body_batches_0_objects_1_itemData_variations[1]->setCustomAttributeValues($body_batches_0_objects_1_itemData_variations_1_customAttributeValues);
342
-
343
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids = [];
344
-
345
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[0] = new Models\CatalogV1Id;
346
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id5');
347
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[0]->setLocationId('location_id5');
348
-
349
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[1] = new Models\CatalogV1Id;
350
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id6');
351
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[1]->setLocationId('location_id6');
352
-
353
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[2] = new Models\CatalogV1Id;
354
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[2]->setCatalogV1Id('catalog_v1_id7');
355
- $body_batches_0_objects_1_itemData_variations_1_catalogV1Ids[2]->setLocationId('location_id7');
356
- $body_batches_0_objects_1_itemData_variations[1]->setCatalogV1Ids($body_batches_0_objects_1_itemData_variations_1_catalogV1Ids);
357
-
358
  $body_batches_0_objects_1_itemData_variations[1]->setPresentAtAllLocations(true);
359
  $body_batches_0_objects[1]->getItemData()->setVariations($body_batches_0_objects_1_itemData_variations);
360
 
@@ -365,48 +215,6 @@ $body_batches_0_objects[2] = new Models\CatalogObject(
365
  $body_batches_0_objects_2_type,
366
  $body_batches_0_objects_2_id
367
  );
368
- $body_batches_0_objects[2]->setUpdatedAt('updated_at8');
369
- $body_batches_0_objects[2]->setVersion(254);
370
- $body_batches_0_objects[2]->setIsDeleted(false);
371
- $body_batches_0_objects_2_customAttributeValues = [];
372
-
373
- $body_batches_0_objects_2_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
374
- $body_batches_0_objects_2_customAttributeValues['key0']->setName('name3');
375
- $body_batches_0_objects_2_customAttributeValues['key0']->setStringValue('string_value7');
376
- $body_batches_0_objects_2_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id9');
377
- $body_batches_0_objects_2_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
378
- $body_batches_0_objects_2_customAttributeValues['key0']->setNumberValue('number_value3');
379
-
380
- $body_batches_0_objects_2_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
381
- $body_batches_0_objects_2_customAttributeValues['key1']->setName('name2');
382
- $body_batches_0_objects_2_customAttributeValues['key1']->setStringValue('string_value6');
383
- $body_batches_0_objects_2_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id0');
384
- $body_batches_0_objects_2_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::NUMBER);
385
- $body_batches_0_objects_2_customAttributeValues['key1']->setNumberValue('number_value2');
386
-
387
- $body_batches_0_objects_2_customAttributeValues['key2'] = new Models\CatalogCustomAttributeValue;
388
- $body_batches_0_objects_2_customAttributeValues['key2']->setName('name1');
389
- $body_batches_0_objects_2_customAttributeValues['key2']->setStringValue('string_value5');
390
- $body_batches_0_objects_2_customAttributeValues['key2']->setCustomAttributeDefinitionId('custom_attribute_definition_id1');
391
- $body_batches_0_objects_2_customAttributeValues['key2']->setType(Models\CatalogCustomAttributeDefinitionType::SELECTION);
392
- $body_batches_0_objects_2_customAttributeValues['key2']->setNumberValue('number_value1');
393
- $body_batches_0_objects[2]->setCustomAttributeValues($body_batches_0_objects_2_customAttributeValues);
394
-
395
- $body_batches_0_objects_2_catalogV1Ids = [];
396
-
397
- $body_batches_0_objects_2_catalogV1Ids[0] = new Models\CatalogV1Id;
398
- $body_batches_0_objects_2_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id6');
399
- $body_batches_0_objects_2_catalogV1Ids[0]->setLocationId('location_id6');
400
-
401
- $body_batches_0_objects_2_catalogV1Ids[1] = new Models\CatalogV1Id;
402
- $body_batches_0_objects_2_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id7');
403
- $body_batches_0_objects_2_catalogV1Ids[1]->setLocationId('location_id7');
404
-
405
- $body_batches_0_objects_2_catalogV1Ids[2] = new Models\CatalogV1Id;
406
- $body_batches_0_objects_2_catalogV1Ids[2]->setCatalogV1Id('catalog_v1_id8');
407
- $body_batches_0_objects_2_catalogV1Ids[2]->setLocationId('location_id8');
408
- $body_batches_0_objects[2]->setCatalogV1Ids($body_batches_0_objects_2_catalogV1Ids);
409
-
410
  $body_batches_0_objects[2]->setPresentAtAllLocations(true);
411
 
412
  $body_batches_0_objects_3_type = Models\CatalogObjectType::TAX;
@@ -415,33 +223,6 @@ $body_batches_0_objects[3] = new Models\CatalogObject(
415
  $body_batches_0_objects_3_type,
416
  $body_batches_0_objects_3_id
417
  );
418
- $body_batches_0_objects[3]->setUpdatedAt('updated_at9');
419
- $body_batches_0_objects[3]->setVersion(255);
420
- $body_batches_0_objects[3]->setIsDeleted(true);
421
- $body_batches_0_objects_3_customAttributeValues = [];
422
-
423
- $body_batches_0_objects_3_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
424
- $body_batches_0_objects_3_customAttributeValues['key0']->setName('name4');
425
- $body_batches_0_objects_3_customAttributeValues['key0']->setStringValue('string_value8');
426
- $body_batches_0_objects_3_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id8');
427
- $body_batches_0_objects_3_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::STRING);
428
- $body_batches_0_objects_3_customAttributeValues['key0']->setNumberValue('number_value4');
429
-
430
- $body_batches_0_objects_3_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
431
- $body_batches_0_objects_3_customAttributeValues['key1']->setName('name3');
432
- $body_batches_0_objects_3_customAttributeValues['key1']->setStringValue('string_value7');
433
- $body_batches_0_objects_3_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id9');
434
- $body_batches_0_objects_3_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
435
- $body_batches_0_objects_3_customAttributeValues['key1']->setNumberValue('number_value3');
436
- $body_batches_0_objects[3]->setCustomAttributeValues($body_batches_0_objects_3_customAttributeValues);
437
-
438
- $body_batches_0_objects_3_catalogV1Ids = [];
439
-
440
- $body_batches_0_objects_3_catalogV1Ids[0] = new Models\CatalogV1Id;
441
- $body_batches_0_objects_3_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id7');
442
- $body_batches_0_objects_3_catalogV1Ids[0]->setLocationId('location_id7');
443
- $body_batches_0_objects[3]->setCatalogV1Ids($body_batches_0_objects_3_catalogV1Ids);
444
-
445
  $body_batches_0_objects[3]->setPresentAtAllLocations(true);
446
 
447
  $body_batches[0] = new Models\CatalogObjectBatch(
@@ -469,9 +250,9 @@ if ($apiResponse->isSuccess()) {
469
 
470
  # Create Catalog Image
471
 
472
- Uploads an image file to be represented by a [CatalogImage](/doc/models/catalog-image.md) object linked to an existing
473
- [CatalogObject](/doc/models/catalog-object.md) instance. A call to this endpoint can upload an image, link an image to
474
- a catalog object, or do both.
475
 
476
  This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in
477
  JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
@@ -479,7 +260,7 @@ JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
479
  ```php
480
  function createCatalogImage(
481
  ?CreateCatalogImageRequest $request = null,
482
- ?\Square\Utils\FileWrapper $imageFile = null
483
  ): ApiResponse
484
  ```
485
 
@@ -487,12 +268,12 @@ function createCatalogImage(
487
 
488
  | Parameter | Type | Tags | Description |
489
  | --- | --- | --- | --- |
490
- | `request` | [`?CreateCatalogImageRequest`](/doc/models/create-catalog-image-request.md) | Form, Optional | - |
491
- | `imageFile` | `?\Square\Utils\FileWrapper` | Form, Optional | - |
492
 
493
  ## Response Type
494
 
495
- [`CreateCatalogImageResponse`](/doc/models/create-catalog-image-response.md)
496
 
497
  ## Example Usage
498
 
@@ -504,31 +285,13 @@ $request_image = new Models\CatalogObject(
504
  $request_image_type,
505
  $request_image_id
506
  );
507
- $request_image->setUpdatedAt('updated_at4');
508
- $request_image->setVersion(68);
509
- $request_image->setIsDeleted(false);
510
- $request_image_customAttributeValues = [];
511
-
512
- $request_image_customAttributeValues[''] = new Models\CatalogCustomAttributeValue;
513
-
514
- $request_image_customAttributeValues[''] = new Models\CatalogCustomAttributeValue;
515
- $request_image->setCustomAttributeValues($request_image_customAttributeValues);
516
-
517
- $request_image_catalogV1Ids = [];
518
-
519
- $request_image_catalogV1Ids[0] = new Models\CatalogV1Id;
520
- $request_image_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id4');
521
- $request_image_catalogV1Ids[0]->setLocationId('location_id4');
522
- $request_image->setCatalogV1Ids($request_image_catalogV1Ids);
523
-
524
  $request = new Models\CreateCatalogImageRequest(
525
  $request_idempotencyKey,
526
  $request_image
527
  );
528
  $request->setObjectId('ND6EA5AAJEO5WL3JNNIAQA32');
529
- $imageFile = 'dummy_file';
530
 
531
- $apiResponse = $catalogApi->createCatalogImage($request, $imageFile);
532
 
533
  if ($apiResponse->isSuccess()) {
534
  $createCatalogImageResponse = $apiResponse->getResult();
@@ -542,6 +305,56 @@ if ($apiResponse->isSuccess()) {
542
  ```
543
 
544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  # Catalog Info
546
 
547
  Retrieves information about the Square Catalog API, such as batch size
@@ -553,7 +366,7 @@ function catalogInfo(): ApiResponse
553
 
554
  ## Response Type
555
 
556
- [`CatalogInfoResponse`](/doc/models/catalog-info-response.md)
557
 
558
  ## Example Usage
559
 
@@ -574,14 +387,13 @@ if ($apiResponse->isSuccess()) {
574
 
575
  # List Catalog
576
 
577
- Returns a list of [CatalogObject](/doc/models/catalog-object.md)s that includes
578
- all objects of a set of desired types (for example, all [CatalogItem](/doc/models/catalog-item.md)
579
- and [CatalogTax](/doc/models/catalog-tax.md) objects) in the catalog. The `types` parameter
580
- is specified as a comma-separated list of valid [CatalogObject](/doc/models/catalog-object.md) types:
581
- `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`.
582
 
583
  __Important:__ ListCatalog does not return deleted catalog items. To retrieve
584
- deleted catalog items, use [SearchCatalogObjects](/doc/apis/catalog.md#search-catalog-objects)
585
  and set the `include_deleted_objects` attribute value to `true`.
586
 
587
  ```php
@@ -593,21 +405,17 @@ function listCatalog(?string $cursor = null, ?string $types = null, ?int $catalo
593
  | Parameter | Type | Tags | Description |
594
  | --- | --- | --- | --- |
595
  | `cursor` | `?string` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.<br>The page size is currently set to be 100.<br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
596
- | `types` | `?string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve.<br><br>The valid values are defined in the [CatalogObjectType](/doc/models/catalog-object-type.md) enum, including<br>`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, or `IMAGE`.<br><br>If this is unspecified, the operation returns objects of all the types at the version of the Square API used to make the request. |
597
- | `catalogVersion` | `?int` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](/doc/models/catalog-object.md)s' `version` attribute. |
598
 
599
  ## Response Type
600
 
601
- [`ListCatalogResponse`](/doc/models/list-catalog-response.md)
602
 
603
  ## Example Usage
604
 
605
  ```php
606
- $cursor = 'cursor6';
607
- $types = 'types6';
608
- $catalogVersion = 126;
609
-
610
- $apiResponse = $catalogApi->listCatalog($cursor, $types, $catalogVersion);
611
 
612
  if ($apiResponse->isSuccess()) {
613
  $listCatalogResponse = $apiResponse->getResult();
@@ -623,7 +431,7 @@ if ($apiResponse->isSuccess()) {
623
 
624
  # Upsert Catalog Object
625
 
626
- Creates or updates the target [CatalogObject](/doc/models/catalog-object.md).
627
 
628
  ```php
629
  function upsertCatalogObject(UpsertCatalogObjectRequest $body): ApiResponse
@@ -633,11 +441,11 @@ function upsertCatalogObject(UpsertCatalogObjectRequest $body): ApiResponse
633
 
634
  | Parameter | Type | Tags | Description |
635
  | --- | --- | --- | --- |
636
- | `body` | [`UpsertCatalogObjectRequest`](/doc/models/upsert-catalog-object-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
637
 
638
  ## Response Type
639
 
640
- [`UpsertCatalogObjectResponse`](/doc/models/upsert-catalog-object-response.md)
641
 
642
  ## Example Usage
643
 
@@ -649,39 +457,10 @@ $body_object = new Models\CatalogObject(
649
  $body_object_type,
650
  $body_object_id
651
  );
652
- $body_object->setUpdatedAt('updated_at8');
653
- $body_object->setVersion(252);
654
- $body_object->setIsDeleted(false);
655
- $body_object_customAttributeValues = [];
656
-
657
- $body_object_customAttributeValues[''] = new Models\CatalogCustomAttributeValue;
658
-
659
- $body_object_customAttributeValues[''] = new Models\CatalogCustomAttributeValue;
660
-
661
- $body_object_customAttributeValues[''] = new Models\CatalogCustomAttributeValue;
662
- $body_object->setCustomAttributeValues($body_object_customAttributeValues);
663
-
664
- $body_object_catalogV1Ids = [];
665
-
666
- $body_object_catalogV1Ids[0] = new Models\CatalogV1Id;
667
- $body_object_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id0');
668
- $body_object_catalogV1Ids[0]->setLocationId('location_id0');
669
-
670
- $body_object_catalogV1Ids[1] = new Models\CatalogV1Id;
671
- $body_object_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id1');
672
- $body_object_catalogV1Ids[1]->setLocationId('location_id1');
673
-
674
- $body_object_catalogV1Ids[2] = new Models\CatalogV1Id;
675
- $body_object_catalogV1Ids[2]->setCatalogV1Id('catalog_v1_id2');
676
- $body_object_catalogV1Ids[2]->setLocationId('location_id2');
677
- $body_object->setCatalogV1Ids($body_object_catalogV1Ids);
678
-
679
  $body_object->setItemData(new Models\CatalogItem);
680
  $body_object->getItemData()->setName('Cocoa');
681
  $body_object->getItemData()->setDescription('Hot Chocolate');
682
  $body_object->getItemData()->setAbbreviation('Ch');
683
- $body_object->getItemData()->setLabelColor('label_color4');
684
- $body_object->getItemData()->setAvailableOnline(false);
685
  $body_object_itemData_variations = [];
686
 
687
  $body_object_itemData_variations_0_type = Models\CatalogObjectType::ITEM_VARIATION;
@@ -690,33 +469,6 @@ $body_object_itemData_variations[0] = new Models\CatalogObject(
690
  $body_object_itemData_variations_0_type,
691
  $body_object_itemData_variations_0_id
692
  );
693
- $body_object_itemData_variations[0]->setUpdatedAt('updated_at9');
694
- $body_object_itemData_variations[0]->setVersion(69);
695
- $body_object_itemData_variations[0]->setIsDeleted(true);
696
- $body_object_itemData_variations_0_customAttributeValues = [];
697
-
698
- $body_object_itemData_variations_0_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
699
- $body_object_itemData_variations_0_customAttributeValues['key0']->setName('name4');
700
- $body_object_itemData_variations_0_customAttributeValues['key0']->setStringValue('string_value8');
701
- $body_object_itemData_variations_0_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id8');
702
- $body_object_itemData_variations_0_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::NUMBER);
703
- $body_object_itemData_variations_0_customAttributeValues['key0']->setNumberValue('number_value4');
704
-
705
- $body_object_itemData_variations_0_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
706
- $body_object_itemData_variations_0_customAttributeValues['key1']->setName('name5');
707
- $body_object_itemData_variations_0_customAttributeValues['key1']->setStringValue('string_value9');
708
- $body_object_itemData_variations_0_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id7');
709
- $body_object_itemData_variations_0_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
710
- $body_object_itemData_variations_0_customAttributeValues['key1']->setNumberValue('number_value5');
711
- $body_object_itemData_variations[0]->setCustomAttributeValues($body_object_itemData_variations_0_customAttributeValues);
712
-
713
- $body_object_itemData_variations_0_catalogV1Ids = [];
714
-
715
- $body_object_itemData_variations_0_catalogV1Ids[0] = new Models\CatalogV1Id;
716
- $body_object_itemData_variations_0_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id9');
717
- $body_object_itemData_variations_0_catalogV1Ids[0]->setLocationId('location_id9');
718
- $body_object_itemData_variations[0]->setCatalogV1Ids($body_object_itemData_variations_0_catalogV1Ids);
719
-
720
 
721
  $body_object_itemData_variations_1_type = Models\CatalogObjectType::ITEM_VARIATION;
722
  $body_object_itemData_variations_1_id = '#Large';
@@ -724,48 +476,6 @@ $body_object_itemData_variations[1] = new Models\CatalogObject(
724
  $body_object_itemData_variations_1_type,
725
  $body_object_itemData_variations_1_id
726
  );
727
- $body_object_itemData_variations[1]->setUpdatedAt('updated_at0');
728
- $body_object_itemData_variations[1]->setVersion(68);
729
- $body_object_itemData_variations[1]->setIsDeleted(false);
730
- $body_object_itemData_variations_1_customAttributeValues = [];
731
-
732
- $body_object_itemData_variations_1_customAttributeValues['key0'] = new Models\CatalogCustomAttributeValue;
733
- $body_object_itemData_variations_1_customAttributeValues['key0']->setName('name5');
734
- $body_object_itemData_variations_1_customAttributeValues['key0']->setStringValue('string_value9');
735
- $body_object_itemData_variations_1_customAttributeValues['key0']->setCustomAttributeDefinitionId('custom_attribute_definition_id7');
736
- $body_object_itemData_variations_1_customAttributeValues['key0']->setType(Models\CatalogCustomAttributeDefinitionType::BOOLEAN);
737
- $body_object_itemData_variations_1_customAttributeValues['key0']->setNumberValue('number_value5');
738
-
739
- $body_object_itemData_variations_1_customAttributeValues['key1'] = new Models\CatalogCustomAttributeValue;
740
- $body_object_itemData_variations_1_customAttributeValues['key1']->setName('name6');
741
- $body_object_itemData_variations_1_customAttributeValues['key1']->setStringValue('string_value0');
742
- $body_object_itemData_variations_1_customAttributeValues['key1']->setCustomAttributeDefinitionId('custom_attribute_definition_id6');
743
- $body_object_itemData_variations_1_customAttributeValues['key1']->setType(Models\CatalogCustomAttributeDefinitionType::STRING);
744
- $body_object_itemData_variations_1_customAttributeValues['key1']->setNumberValue('number_value6');
745
-
746
- $body_object_itemData_variations_1_customAttributeValues['key2'] = new Models\CatalogCustomAttributeValue;
747
- $body_object_itemData_variations_1_customAttributeValues['key2']->setName('name7');
748
- $body_object_itemData_variations_1_customAttributeValues['key2']->setStringValue('string_value1');
749
- $body_object_itemData_variations_1_customAttributeValues['key2']->setCustomAttributeDefinitionId('custom_attribute_definition_id5');
750
- $body_object_itemData_variations_1_customAttributeValues['key2']->setType(Models\CatalogCustomAttributeDefinitionType::SELECTION);
751
- $body_object_itemData_variations_1_customAttributeValues['key2']->setNumberValue('number_value7');
752
- $body_object_itemData_variations[1]->setCustomAttributeValues($body_object_itemData_variations_1_customAttributeValues);
753
-
754
- $body_object_itemData_variations_1_catalogV1Ids = [];
755
-
756
- $body_object_itemData_variations_1_catalogV1Ids[0] = new Models\CatalogV1Id;
757
- $body_object_itemData_variations_1_catalogV1Ids[0]->setCatalogV1Id('catalog_v1_id8');
758
- $body_object_itemData_variations_1_catalogV1Ids[0]->setLocationId('location_id8');
759
-
760
- $body_object_itemData_variations_1_catalogV1Ids[1] = new Models\CatalogV1Id;
761
- $body_object_itemData_variations_1_catalogV1Ids[1]->setCatalogV1Id('catalog_v1_id9');
762
- $body_object_itemData_variations_1_catalogV1Ids[1]->setLocationId('location_id9');
763
-
764
- $body_object_itemData_variations_1_catalogV1Ids[2] = new Models\CatalogV1Id;
765
- $body_object_itemData_variations_1_catalogV1Ids[2]->setCatalogV1Id('catalog_v1_id0');
766
- $body_object_itemData_variations_1_catalogV1Ids[2]->setLocationId('location_id0');
767
- $body_object_itemData_variations[1]->setCatalogV1Ids($body_object_itemData_variations_1_catalogV1Ids);
768
-
769
  $body_object->getItemData()->setVariations($body_object_itemData_variations);
770
 
771
  $body = new Models\UpsertCatalogObjectRequest(
@@ -789,12 +499,12 @@ if ($apiResponse->isSuccess()) {
789
 
790
  # Delete Catalog Object
791
 
792
- Deletes a single [CatalogObject](/doc/models/catalog-object.md) based on the
793
  provided ID and returns the set of successfully deleted IDs in the response.
794
  Deletion is a cascading event such that all children of the targeted object
795
- are also deleted. For example, deleting a [CatalogItem](/doc/models/catalog-item.md)
796
  will also delete all of its
797
- [CatalogItemVariation](/doc/models/catalog-item-variation.md) children.
798
 
799
  ```php
800
  function deleteCatalogObject(string $objectId): ApiResponse
@@ -808,7 +518,7 @@ function deleteCatalogObject(string $objectId): ApiResponse
808
 
809
  ## Response Type
810
 
811
- [`DeleteCatalogObjectResponse`](/doc/models/delete-catalog-object-response.md)
812
 
813
  ## Example Usage
814
 
@@ -831,13 +541,13 @@ if ($apiResponse->isSuccess()) {
831
 
832
  # Retrieve Catalog Object
833
 
834
- Returns a single [CatalogItem](/doc/models/catalog-item.md) as a
835
- [CatalogObject](/doc/models/catalog-object.md) based on the provided ID. The returned
836
- object includes all of the relevant [CatalogItem](/doc/models/catalog-item.md)
837
- information including: [CatalogItemVariation](/doc/models/catalog-item-variation.md)
838
  children, references to its
839
- [CatalogModifierList](/doc/models/catalog-modifier-list.md) objects, and the ids of
840
- any [CatalogTax](/doc/models/catalog-tax.md) objects that apply to it.
841
 
842
  ```php
843
  function retrieveCatalogObject(
@@ -852,21 +562,20 @@ function retrieveCatalogObject(
852
  | Parameter | Type | Tags | Description |
853
  | --- | --- | --- | --- |
854
  | `objectId` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. |
855
- | `includeRelatedObjects` | `?bool` | Query, Optional | If `true`, the response will include additional objects that are related to the<br>requested object, as follows:<br><br>If the `object` field of the response contains a `CatalogItem`, its associated<br>`CatalogCategory`, `CatalogTax`, `CatalogImage` and `CatalogModifierList` objects will<br>be returned in the `related_objects` field of the response. If the `object` field of<br>the response contains a `CatalogItemVariation`, its parent `CatalogItem` will be returned<br>in the `related_objects` field of the response.<br><br>Default value: `false`<br>**Default**: `false` |
856
- | `catalogVersion` | `?int` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](/doc/models/catalog-object.md)s. |
857
 
858
  ## Response Type
859
 
860
- [`RetrieveCatalogObjectResponse`](/doc/models/retrieve-catalog-object-response.md)
861
 
862
  ## Example Usage
863
 
864
  ```php
865
  $objectId = 'object_id8';
866
  $includeRelatedObjects = false;
867
- $catalogVersion = 126;
868
 
869
- $apiResponse = $catalogApi->retrieveCatalogObject($objectId, $includeRelatedObjects, $catalogVersion);
870
 
871
  if ($apiResponse->isSuccess()) {
872
  $retrieveCatalogObjectResponse = $apiResponse->getResult();
@@ -882,10 +591,10 @@ if ($apiResponse->isSuccess()) {
882
 
883
  # Search Catalog Objects
884
 
885
- Searches for [CatalogObject](/doc/models/catalog-object.md) of any type by matching supported search attribute values,
886
  excluding custom attribute values on items or item variations, against one or more of the specified query filters.
887
 
888
- This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](/doc/apis/catalog.md#search-catalog-items)
889
  endpoint in the following aspects:
890
 
891
  - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects.
@@ -901,52 +610,24 @@ function searchCatalogObjects(SearchCatalogObjectsRequest $body): ApiResponse
901
 
902
  | Parameter | Type | Tags | Description |
903
  | --- | --- | --- | --- |
904
- | `body` | [`SearchCatalogObjectsRequest`](/doc/models/search-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
905
 
906
  ## Response Type
907
 
908
- [`SearchCatalogObjectsResponse`](/doc/models/search-catalog-objects-response.md)
909
 
910
  ## Example Usage
911
 
912
  ```php
913
  $body = new Models\SearchCatalogObjectsRequest;
914
- $body->setCursor('cursor0');
915
  $body->setObjectTypes([Models\CatalogObjectType::ITEM]);
916
- $body->setIncludeDeletedObjects(false);
917
- $body->setIncludeRelatedObjects(false);
918
- $body->setBeginTime('begin_time4');
919
  $body->setQuery(new Models\CatalogQuery);
920
- $body_query_sortedAttributeQuery_attributeName = 'attribute_name6';
921
- $body->getQuery()->setSortedAttributeQuery(new Models\CatalogQuerySortedAttribute(
922
- $body_query_sortedAttributeQuery_attributeName
923
- ));
924
- $body->getQuery()->getSortedAttributeQuery()->setInitialAttributeValue('initial_attribute_value4');
925
- $body->getQuery()->getSortedAttributeQuery()->setSortOrder(Models\SortOrder::DESC);
926
- $body_query_exactQuery_attributeName = 'attribute_name2';
927
- $body_query_exactQuery_attributeValue = 'attribute_value2';
928
- $body->getQuery()->setExactQuery(new Models\CatalogQueryExact(
929
- $body_query_exactQuery_attributeName,
930
- $body_query_exactQuery_attributeValue
931
- ));
932
- $body_query_setQuery_attributeName = 'attribute_name8';
933
- $body_query_setQuery_attributeValues = ['attribute_values0'];
934
- $body->getQuery()->setSetQuery(new Models\CatalogQuerySet(
935
- $body_query_setQuery_attributeName,
936
- $body_query_setQuery_attributeValues
937
- ));
938
  $body_query_prefixQuery_attributeName = 'name';
939
  $body_query_prefixQuery_attributePrefix = 'tea';
940
  $body->getQuery()->setPrefixQuery(new Models\CatalogQueryPrefix(
941
  $body_query_prefixQuery_attributeName,
942
  $body_query_prefixQuery_attributePrefix
943
  ));
944
- $body_query_rangeQuery_attributeName = 'attribute_name6';
945
- $body->getQuery()->setRangeQuery(new Models\CatalogQueryRange(
946
- $body_query_rangeQuery_attributeName
947
- ));
948
- $body->getQuery()->getRangeQuery()->setAttributeMinValue(14);
949
- $body->getQuery()->getRangeQuery()->setAttributeMaxValue(180);
950
  $body->setLimit(100);
951
 
952
  $apiResponse = $catalogApi->searchCatalogObjects($body);
@@ -968,7 +649,7 @@ if ($apiResponse->isSuccess()) {
968
  Searches for catalog items or item variations by matching supported search attribute values, including
969
  custom attribute values, against one or more of the specified query filters.
970
 
971
- This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](/doc/apis/catalog.md#search-catalog-objects)
972
  endpoint in the following aspects:
973
 
974
  - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects.
@@ -984,11 +665,11 @@ function searchCatalogItems(SearchCatalogItemsRequest $body): ApiResponse
984
 
985
  | Parameter | Type | Tags | Description |
986
  | --- | --- | --- | --- |
987
- | `body` | [`SearchCatalogItemsRequest`](/doc/models/search-catalog-items-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
988
 
989
  ## Response Type
990
 
991
- [`SearchCatalogItemsResponse`](/doc/models/search-catalog-items-response.md)
992
 
993
  ## Example Usage
994
 
@@ -998,7 +679,6 @@ $body->setTextFilter('red');
998
  $body->setCategoryIds(['WINE_CATEGORY_ID']);
999
  $body->setStockLevels([Models\SearchCatalogItemsRequestStockLevel::OUT, Models\SearchCatalogItemsRequestStockLevel::LOW]);
1000
  $body->setEnabledLocationIds(['ATL_LOCATION_ID']);
1001
- $body->setCursor('cursor0');
1002
  $body->setLimit(100);
1003
  $body->setSortOrder(Models\SortOrder::ASC);
1004
  $body->setProductTypes([Models\CatalogItemProductType::REGULAR]);
@@ -1006,40 +686,20 @@ $body_customAttributeFilters = [];
1006
 
1007
  $body_customAttributeFilters[0] = new Models\CustomAttributeFilter;
1008
  $body_customAttributeFilters[0]->setCustomAttributeDefinitionId('VEGAN_DEFINITION_ID');
1009
- $body_customAttributeFilters[0]->setKey('key2');
1010
- $body_customAttributeFilters[0]->setStringFilter('string_filter4');
1011
- $body_customAttributeFilters[0]->setNumberFilter(new Models\Range);
1012
- $body_customAttributeFilters[0]->getNumberFilter()->setMin('min0');
1013
- $body_customAttributeFilters[0]->getNumberFilter()->setMax('max2');
1014
- $body_customAttributeFilters[0]->setSelectionUidsFilter(['selection_uids_filter2', 'selection_uids_filter3']);
1015
  $body_customAttributeFilters[0]->setBoolFilter(true);
1016
 
1017
  $body_customAttributeFilters[1] = new Models\CustomAttributeFilter;
1018
  $body_customAttributeFilters[1]->setCustomAttributeDefinitionId('BRAND_DEFINITION_ID');
1019
- $body_customAttributeFilters[1]->setKey('key3');
1020
  $body_customAttributeFilters[1]->setStringFilter('Dark Horse');
1021
- $body_customAttributeFilters[1]->setNumberFilter(new Models\Range);
1022
- $body_customAttributeFilters[1]->getNumberFilter()->setMin('min1');
1023
- $body_customAttributeFilters[1]->getNumberFilter()->setMax('max1');
1024
- $body_customAttributeFilters[1]->setSelectionUidsFilter(['selection_uids_filter1']);
1025
 
1026
  $body_customAttributeFilters[2] = new Models\CustomAttributeFilter;
1027
- $body_customAttributeFilters[2]->setCustomAttributeDefinitionId('custom_attribute_definition_id8');
1028
  $body_customAttributeFilters[2]->setKey('VINTAGE');
1029
- $body_customAttributeFilters[2]->setStringFilter('string_filter6');
1030
  $body_customAttributeFilters[2]->setNumberFilter(new Models\Range);
1031
  $body_customAttributeFilters[2]->getNumberFilter()->setMin('2017');
1032
  $body_customAttributeFilters[2]->getNumberFilter()->setMax('2018');
1033
- $body_customAttributeFilters[2]->setSelectionUidsFilter(['selection_uids_filter0', 'selection_uids_filter1', 'selection_uids_filter2']);
1034
 
1035
  $body_customAttributeFilters[3] = new Models\CustomAttributeFilter;
1036
  $body_customAttributeFilters[3]->setCustomAttributeDefinitionId('VARIETAL_DEFINITION_ID');
1037
- $body_customAttributeFilters[3]->setKey('key5');
1038
- $body_customAttributeFilters[3]->setStringFilter('string_filter7');
1039
- $body_customAttributeFilters[3]->setNumberFilter(new Models\Range);
1040
- $body_customAttributeFilters[3]->getNumberFilter()->setMin('min3');
1041
- $body_customAttributeFilters[3]->getNumberFilter()->setMax('max9');
1042
- $body_customAttributeFilters[3]->setSelectionUidsFilter(['selection_uids_filter9', 'selection_uids_filter0']);
1043
  $body->setCustomAttributeFilters($body_customAttributeFilters);
1044
 
1045
 
@@ -1059,8 +719,8 @@ if ($apiResponse->isSuccess()) {
1059
 
1060
  # Update Item Modifier Lists
1061
 
1062
- Updates the [CatalogModifierList](/doc/models/catalog-modifier-list.md) objects
1063
- that apply to the targeted [CatalogItem](/doc/models/catalog-item.md) without having
1064
  to perform an upsert on the entire item.
1065
 
1066
  ```php
@@ -1071,11 +731,11 @@ function updateItemModifierLists(UpdateItemModifierListsRequest $body): ApiRespo
1071
 
1072
  | Parameter | Type | Tags | Description |
1073
  | --- | --- | --- | --- |
1074
- | `body` | [`UpdateItemModifierListsRequest`](/doc/models/update-item-modifier-lists-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
1075
 
1076
  ## Response Type
1077
 
1078
- [`UpdateItemModifierListsResponse`](/doc/models/update-item-modifier-lists-response.md)
1079
 
1080
  ## Example Usage
1081
 
@@ -1103,8 +763,8 @@ if ($apiResponse->isSuccess()) {
1103
 
1104
  # Update Item Taxes
1105
 
1106
- Updates the [CatalogTax](/doc/models/catalog-tax.md) objects that apply to the
1107
- targeted [CatalogItem](/doc/models/catalog-item.md) without having to perform an
1108
  upsert on the entire item.
1109
 
1110
  ```php
@@ -1115,11 +775,11 @@ function updateItemTaxes(UpdateItemTaxesRequest $body): ApiResponse
1115
 
1116
  | Parameter | Type | Tags | Description |
1117
  | --- | --- | --- | --- |
1118
- | `body` | [`UpdateItemTaxesRequest`](/doc/models/update-item-taxes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
1119
 
1120
  ## Response Type
1121
 
1122
- [`UpdateItemTaxesResponse`](/doc/models/update-item-taxes-response.md)
1123
 
1124
  ## Example Usage
1125
 
10
 
11
  ## Methods
12
 
13
+ * [Batch Delete Catalog Objects](../../doc/apis/catalog.md#batch-delete-catalog-objects)
14
+ * [Batch Retrieve Catalog Objects](../../doc/apis/catalog.md#batch-retrieve-catalog-objects)
15
+ * [Batch Upsert Catalog Objects](../../doc/apis/catalog.md#batch-upsert-catalog-objects)
16
+ * [Create Catalog Image](../../doc/apis/catalog.md#create-catalog-image)
17
+ * [Update Catalog Image](../../doc/apis/catalog.md#update-catalog-image)
18
+ * [Catalog Info](../../doc/apis/catalog.md#catalog-info)
19
+ * [List Catalog](../../doc/apis/catalog.md#list-catalog)
20
+ * [Upsert Catalog Object](../../doc/apis/catalog.md#upsert-catalog-object)
21
+ * [Delete Catalog Object](../../doc/apis/catalog.md#delete-catalog-object)
22
+ * [Retrieve Catalog Object](../../doc/apis/catalog.md#retrieve-catalog-object)
23
+ * [Search Catalog Objects](../../doc/apis/catalog.md#search-catalog-objects)
24
+ * [Search Catalog Items](../../doc/apis/catalog.md#search-catalog-items)
25
+ * [Update Item Modifier Lists](../../doc/apis/catalog.md#update-item-modifier-lists)
26
+ * [Update Item Taxes](../../doc/apis/catalog.md#update-item-taxes)
27
 
28
 
29
  # Batch Delete Catalog Objects
30
 
31
+ Deletes a set of [CatalogItem](../../doc/models/catalog-item.md)s based on the
32
  provided list of target IDs and returns a set of successfully deleted IDs in
33
  the response. Deletion is a cascading event such that all children of the
34
  targeted object are also deleted. For example, deleting a CatalogItem will
35
+ also delete all of its [CatalogItemVariation](../../doc/models/catalog-item-variation.md)
36
  children.
37
 
38
  `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted
47
 
48
  | Parameter | Type | Tags | Description |
49
  | --- | --- | --- | --- |
50
+ | `body` | [`BatchDeleteCatalogObjectsRequest`](../../doc/models/batch-delete-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
51
 
52
  ## Response Type
53
 
54
+ [`BatchDeleteCatalogObjectsResponse`](../../doc/models/batch-delete-catalog-objects-response.md)
55
 
56
  ## Example Usage
57
 
76
  # Batch Retrieve Catalog Objects
77
 
78
  Returns a set of objects based on the provided ID.
79
+ Each [CatalogItem](../../doc/models/catalog-item.md) returned in the set includes all of its
80
  child information including: all of its
81
+ [CatalogItemVariation](../../doc/models/catalog-item-variation.md) objects, references to
82
+ its [CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects, and the ids of
83
+ any [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to it.
84
 
85
  ```php
86
  function batchRetrieveCatalogObjects(BatchRetrieveCatalogObjectsRequest $body): ApiResponse
90
 
91
  | Parameter | Type | Tags | Description |
92
  | --- | --- | --- | --- |
93
+ | `body` | [`BatchRetrieveCatalogObjectsRequest`](../../doc/models/batch-retrieve-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
94
 
95
  ## Response Type
96
 
97
+ [`BatchRetrieveCatalogObjectsResponse`](../../doc/models/batch-retrieve-catalog-objects-response.md)
98
 
99
  ## Example Usage
100
 
104
  $body_objectIds
105
  );
106
  $body->setIncludeRelatedObjects(true);
 
107
 
108
  $apiResponse = $catalogApi->batchRetrieveCatalogObjects($body);
109
 
139
 
140
  | Parameter | Type | Tags | Description |
141
  | --- | --- | --- | --- |
142
+ | `body` | [`BatchUpsertCatalogObjectsRequest`](../../doc/models/batch-upsert-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
143
 
144
  ## Response Type
145
 
146
+ [`BatchUpsertCatalogObjectsResponse`](../../doc/models/batch-upsert-catalog-objects-response.md)
147
 
148
  ## Example Usage
149
 
159
  $body_batches_0_objects_0_type,
160
  $body_batches_0_objects_0_id
161
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  $body_batches_0_objects[0]->setPresentAtAllLocations(true);
163
  $body_batches_0_objects[0]->setItemData(new Models\CatalogItem);
164
  $body_batches_0_objects[0]->getItemData()->setName('Tea');
165
  $body_batches_0_objects[0]->getItemData()->setDescription('Hot Leaf Juice');
 
 
 
166
  $body_batches_0_objects[0]->getItemData()->setCategoryId('#Beverages');
167
  $body_batches_0_objects[0]->getItemData()->setTaxIds(['#SalesTax']);
168
  $body_batches_0_objects_0_itemData_variations = [];
173
  $body_batches_0_objects_0_itemData_variations_0_type,
174
  $body_batches_0_objects_0_itemData_variations_0_id
175
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  $body_batches_0_objects_0_itemData_variations[0]->setPresentAtAllLocations(true);
177
  $body_batches_0_objects[0]->getItemData()->setVariations($body_batches_0_objects_0_itemData_variations);
178
 
183
  $body_batches_0_objects_1_type,
184
  $body_batches_0_objects_1_id
185
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  $body_batches_0_objects[1]->setPresentAtAllLocations(true);
187
  $body_batches_0_objects[1]->setItemData(new Models\CatalogItem);
188
  $body_batches_0_objects[1]->getItemData()->setName('Coffee');
189
  $body_batches_0_objects[1]->getItemData()->setDescription('Hot Bean Juice');
 
 
 
190
  $body_batches_0_objects[1]->getItemData()->setCategoryId('#Beverages');
191
  $body_batches_0_objects[1]->getItemData()->setTaxIds(['#SalesTax']);
192
  $body_batches_0_objects_1_itemData_variations = [];
197
  $body_batches_0_objects_1_itemData_variations_0_type,
198
  $body_batches_0_objects_1_itemData_variations_0_id
199
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  $body_batches_0_objects_1_itemData_variations[0]->setPresentAtAllLocations(true);
201
 
202
  $body_batches_0_objects_1_itemData_variations_1_type = Models\CatalogObjectType::ITEM_VARIATION;
205
  $body_batches_0_objects_1_itemData_variations_1_type,
206
  $body_batches_0_objects_1_itemData_variations_1_id
207
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  $body_batches_0_objects_1_itemData_variations[1]->setPresentAtAllLocations(true);
209
  $body_batches_0_objects[1]->getItemData()->setVariations($body_batches_0_objects_1_itemData_variations);
210
 
215
  $body_batches_0_objects_2_type,
216
  $body_batches_0_objects_2_id
217
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  $body_batches_0_objects[2]->setPresentAtAllLocations(true);
219
 
220
  $body_batches_0_objects_3_type = Models\CatalogObjectType::TAX;
223
  $body_batches_0_objects_3_type,
224
  $body_batches_0_objects_3_id
225
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  $body_batches_0_objects[3]->setPresentAtAllLocations(true);
227
 
228
  $body_batches[0] = new Models\CatalogObjectBatch(
250
 
251
  # Create Catalog Image
252
 
253
+ Uploads an image file to be represented by a [CatalogImage](../../doc/models/catalog-image.md) object that can be linked to an existing
254
+ [CatalogObject](../../doc/models/catalog-object.md) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id`
255
+ is not specified.
256
 
257
  This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in
258
  JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
260
  ```php
261
  function createCatalogImage(
262
  ?CreateCatalogImageRequest $request = null,
263
+ ?FileWrapper $imageFile = null
264
  ): ApiResponse
265
  ```
266
 
268
 
269
  | Parameter | Type | Tags | Description |
270
  | --- | --- | --- | --- |
271
+ | `request` | [`?CreateCatalogImageRequest`](../../doc/models/create-catalog-image-request.md) | Form, Optional | - |
272
+ | `imageFile` | `?FileWrapper` | Form, Optional | - |
273
 
274
  ## Response Type
275
 
276
+ [`CreateCatalogImageResponse`](../../doc/models/create-catalog-image-response.md)
277
 
278
  ## Example Usage
279
 
285
  $request_image_type,
286
  $request_image_id
287
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  $request = new Models\CreateCatalogImageRequest(
289
  $request_idempotencyKey,
290
  $request_image
291
  );
292
  $request->setObjectId('ND6EA5AAJEO5WL3JNNIAQA32');
 
293
 
294
+ $apiResponse = $catalogApi->createCatalogImage($request);
295
 
296
  if ($apiResponse->isSuccess()) {
297
  $createCatalogImageResponse = $apiResponse->getResult();
305
  ```
306
 
307
 
308
+ # Update Catalog Image
309
+
310
+ Uploads a new image file to replace the existing one in the specified [CatalogImage](../../doc/models/catalog-image.md) object.
311
+
312
+ This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in
313
+ JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
314
+
315
+ ```php
316
+ function updateCatalogImage(
317
+ string $imageId,
318
+ ?UpdateCatalogImageRequest $request = null,
319
+ ?FileWrapper $imageFile = null
320
+ ): ApiResponse
321
+ ```
322
+
323
+ ## Parameters
324
+
325
+ | Parameter | Type | Tags | Description |
326
+ | --- | --- | --- | --- |
327
+ | `imageId` | `string` | Template, Required | The ID of the `CatalogImage` object to update the encapsulated image file. |
328
+ | `request` | [`?UpdateCatalogImageRequest`](../../doc/models/update-catalog-image-request.md) | Form, Optional | - |
329
+ | `imageFile` | `?FileWrapper` | Form, Optional | - |
330
+
331
+ ## Response Type
332
+
333
+ [`UpdateCatalogImageResponse`](../../doc/models/update-catalog-image-response.md)
334
+
335
+ ## Example Usage
336
+
337
+ ```php
338
+ $imageId = 'image_id4';
339
+ $request_idempotencyKey = '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86';
340
+ $request = new Models\UpdateCatalogImageRequest(
341
+ $request_idempotencyKey
342
+ );
343
+
344
+ $apiResponse = $catalogApi->updateCatalogImage($imageId, $request);
345
+
346
+ if ($apiResponse->isSuccess()) {
347
+ $updateCatalogImageResponse = $apiResponse->getResult();
348
+ } else {
349
+ $errors = $apiResponse->getErrors();
350
+ }
351
+
352
+ // Get more response info...
353
+ // $statusCode = $apiResponse->getStatusCode();
354
+ // $headers = $apiResponse->getHeaders();
355
+ ```
356
+
357
+
358
  # Catalog Info
359
 
360
  Retrieves information about the Square Catalog API, such as batch size
366
 
367
  ## Response Type
368
 
369
+ [`CatalogInfoResponse`](../../doc/models/catalog-info-response.md)
370
 
371
  ## Example Usage
372
 
387
 
388
  # List Catalog
389
 
390
+ Returns a list of all [CatalogObject](../../doc/models/catalog-object.md)s of the specified types in the catalog.
391
+
392
+ The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](../../doc/models/catalog-object-type.md) values,
393
+ for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
 
394
 
395
  __Important:__ ListCatalog does not return deleted catalog items. To retrieve
396
+ deleted catalog items, use [SearchCatalogObjects](../../doc/apis/catalog.md#search-catalog-objects)
397
  and set the `include_deleted_objects` attribute value to `true`.
398
 
399
  ```php
405
  | Parameter | Type | Tags | Description |
406
  | --- | --- | --- | --- |
407
  | `cursor` | `?string` | Query, Optional | The pagination cursor returned in the previous response. Leave unset for an initial request.<br>The page size is currently set to be 100.<br>See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. |
408
+ | `types` | `?string` | Query, Optional | An optional case-insensitive, comma-separated list of object types to retrieve.<br><br>The valid values are defined in the [CatalogObjectType](../../doc/models/catalog-object-type.md) enum, for example,<br>`ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,<br>`MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc.<br><br>If this is unspecified, the operation returns objects of all the top level types at the version<br>of the Square API used to make the request. Object types that are nested onto other object types<br>are not included in the defaults.<br><br>At the current API version the default object types are:<br>ITEM, CATEGORY, TAX, DISCOUNT, MODIFIER_LIST, DINING_OPTION, TAX_EXEMPTION,<br>SERVICE_CHARGE, PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,<br>SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTINGS. |
409
+ | `catalogVersion` | `?int` | Query, Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical<br>versions of objects. The specified version value is matched against<br>the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will<br>be from the current version of the catalog. |
410
 
411
  ## Response Type
412
 
413
+ [`ListCatalogResponse`](../../doc/models/list-catalog-response.md)
414
 
415
  ## Example Usage
416
 
417
  ```php
418
+ $apiResponse = $catalogApi->listCatalog();
 
 
 
 
419
 
420
  if ($apiResponse->isSuccess()) {
421
  $listCatalogResponse = $apiResponse->getResult();
431
 
432
  # Upsert Catalog Object
433
 
434
+ Creates or updates the target [CatalogObject](../../doc/models/catalog-object.md).
435
 
436
  ```php
437
  function upsertCatalogObject(UpsertCatalogObjectRequest $body): ApiResponse
441
 
442
  | Parameter | Type | Tags | Description |
443
  | --- | --- | --- | --- |
444
+ | `body` | [`UpsertCatalogObjectRequest`](../../doc/models/upsert-catalog-object-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
445
 
446
  ## Response Type
447
 
448
+ [`UpsertCatalogObjectResponse`](../../doc/models/upsert-catalog-object-response.md)
449
 
450
  ## Example Usage
451
 
457
  $body_object_type,
458
  $body_object_id
459
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
  $body_object->setItemData(new Models\CatalogItem);
461
  $body_object->getItemData()->setName('Cocoa');
462
  $body_object->getItemData()->setDescription('Hot Chocolate');
463
  $body_object->getItemData()->setAbbreviation('Ch');
 
 
464
  $body_object_itemData_variations = [];
465
 
466
  $body_object_itemData_variations_0_type = Models\CatalogObjectType::ITEM_VARIATION;
469
  $body_object_itemData_variations_0_type,
470
  $body_object_itemData_variations_0_id
471
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
 
473
  $body_object_itemData_variations_1_type = Models\CatalogObjectType::ITEM_VARIATION;
474
  $body_object_itemData_variations_1_id = '#Large';
476
  $body_object_itemData_variations_1_type,
477
  $body_object_itemData_variations_1_id
478
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  $body_object->getItemData()->setVariations($body_object_itemData_variations);
480
 
481
  $body = new Models\UpsertCatalogObjectRequest(
499
 
500
  # Delete Catalog Object
501
 
502
+ Deletes a single [CatalogObject](../../doc/models/catalog-object.md) based on the
503
  provided ID and returns the set of successfully deleted IDs in the response.
504
  Deletion is a cascading event such that all children of the targeted object
505
+ are also deleted. For example, deleting a [CatalogItem](../../doc/models/catalog-item.md)
506
  will also delete all of its
507
+ [CatalogItemVariation](../../doc/models/catalog-item-variation.md) children.
508
 
509
  ```php
510
  function deleteCatalogObject(string $objectId): ApiResponse
518
 
519
  ## Response Type
520
 
521
+ [`DeleteCatalogObjectResponse`](../../doc/models/delete-catalog-object-response.md)
522
 
523
  ## Example Usage
524
 
541
 
542
  # Retrieve Catalog Object
543
 
544
+ Returns a single [CatalogItem](../../doc/models/catalog-item.md) as a
545
+ [CatalogObject](../../doc/models/catalog-object.md) based on the provided ID. The returned
546
+ object includes all of the relevant [CatalogItem](../../doc/models/catalog-item.md)
547
+ information including: [CatalogItemVariation](../../doc/models/catalog-item-variation.md)
548
  children, references to its
549
+ [CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects, and the ids of
550
+ any [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to it.
551
 
552
  ```php
553
  function retrieveCatalogObject(
562
  | Parameter | Type | Tags | Description |
563
  | --- | --- | --- | --- |
564
  | `objectId` | `string` | Template, Required | The object ID of any type of catalog objects to be retrieved. |
565
+ | `includeRelatedObjects` | `?bool` | Query, Optional | If `true`, the response will include additional objects that are related to the<br>requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field<br>of the response. These objects are put in the `related_objects` field. Setting this to `true` is<br>helpful when the objects are needed for immediate display to a user.<br>This process only goes one level deep. Objects referenced by the related objects will not be included. For example,<br><br>if the `objects` field of the response contains a CatalogItem, its associated<br>CatalogCategory objects, CatalogTax objects, CatalogImage objects and<br>CatalogModifierLists will be returned in the `related_objects` field of the<br>response. If the `objects` field of the response contains a CatalogItemVariation,<br>its parent CatalogItem will be returned in the `related_objects` field of<br>the response.<br><br>Default value: `false`<br>**Default**: `false` |
566
+ | `catalogVersion` | `?int` | Query, Optional | Requests objects as of a specific version of the catalog. This allows you to retrieve historical<br>versions of objects. The value to retrieve a specific version of an object can be found<br>in the version field of [CatalogObject](../../doc/models/catalog-object.md)s. If not included, results will<br>be from the current version of the catalog. |
567
 
568
  ## Response Type
569
 
570
+ [`RetrieveCatalogObjectResponse`](../../doc/models/retrieve-catalog-object-response.md)
571
 
572
  ## Example Usage
573
 
574
  ```php
575
  $objectId = 'object_id8';
576
  $includeRelatedObjects = false;
 
577
 
578
+ $apiResponse = $catalogApi->retrieveCatalogObject($objectId, $includeRelatedObjects);
579
 
580
  if ($apiResponse->isSuccess()) {
581
  $retrieveCatalogObjectResponse = $apiResponse->getResult();
591
 
592
  # Search Catalog Objects
593
 
594
+ Searches for [CatalogObject](../../doc/models/catalog-object.md) of any type by matching supported search attribute values,
595
  excluding custom attribute values on items or item variations, against one or more of the specified query filters.
596
 
597
+ This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](../../doc/apis/catalog.md#search-catalog-items)
598
  endpoint in the following aspects:
599
 
600
  - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects.
610
 
611
  | Parameter | Type | Tags | Description |
612
  | --- | --- | --- | --- |
613
+ | `body` | [`SearchCatalogObjectsRequest`](../../doc/models/search-catalog-objects-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
614
 
615
  ## Response Type
616
 
617
+ [`SearchCatalogObjectsResponse`](../../doc/models/search-catalog-objects-response.md)
618
 
619
  ## Example Usage
620
 
621
  ```php
622
  $body = new Models\SearchCatalogObjectsRequest;
 
623
  $body->setObjectTypes([Models\CatalogObjectType::ITEM]);
 
 
 
624
  $body->setQuery(new Models\CatalogQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  $body_query_prefixQuery_attributeName = 'name';
626
  $body_query_prefixQuery_attributePrefix = 'tea';
627
  $body->getQuery()->setPrefixQuery(new Models\CatalogQueryPrefix(
628
  $body_query_prefixQuery_attributeName,
629
  $body_query_prefixQuery_attributePrefix
630
  ));
 
 
 
 
 
 
631
  $body->setLimit(100);
632
 
633
  $apiResponse = $catalogApi->searchCatalogObjects($body);
649
  Searches for catalog items or item variations by matching supported search attribute values, including
650
  custom attribute values, against one or more of the specified query filters.
651
 
652
+ This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](../../doc/apis/catalog.md#search-catalog-objects)
653
  endpoint in the following aspects:
654
 
655
  - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects.
665
 
666
  | Parameter | Type | Tags | Description |
667
  | --- | --- | --- | --- |
668
+ | `body` | [`SearchCatalogItemsRequest`](../../doc/models/search-catalog-items-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
669
 
670
  ## Response Type
671
 
672
+ [`SearchCatalogItemsResponse`](../../doc/models/search-catalog-items-response.md)
673
 
674
  ## Example Usage
675
 
679
  $body->setCategoryIds(['WINE_CATEGORY_ID']);
680
  $body->setStockLevels([Models\SearchCatalogItemsRequestStockLevel::OUT, Models\SearchCatalogItemsRequestStockLevel::LOW]);
681
  $body->setEnabledLocationIds(['ATL_LOCATION_ID']);
 
682
  $body->setLimit(100);
683
  $body->setSortOrder(Models\SortOrder::ASC);
684
  $body->setProductTypes([Models\CatalogItemProductType::REGULAR]);
686
 
687
  $body_customAttributeFilters[0] = new Models\CustomAttributeFilter;
688
  $body_customAttributeFilters[0]->setCustomAttributeDefinitionId('VEGAN_DEFINITION_ID');
 
 
 
 
 
 
689
  $body_customAttributeFilters[0]->setBoolFilter(true);
690
 
691
  $body_customAttributeFilters[1] = new Models\CustomAttributeFilter;
692
  $body_customAttributeFilters[1]->setCustomAttributeDefinitionId('BRAND_DEFINITION_ID');
 
693
  $body_customAttributeFilters[1]->setStringFilter('Dark Horse');
 
 
 
 
694
 
695
  $body_customAttributeFilters[2] = new Models\CustomAttributeFilter;
 
696
  $body_customAttributeFilters[2]->setKey('VINTAGE');
 
697
  $body_customAttributeFilters[2]->setNumberFilter(new Models\Range);
698
  $body_customAttributeFilters[2]->getNumberFilter()->setMin('2017');
699
  $body_customAttributeFilters[2]->getNumberFilter()->setMax('2018');
 
700
 
701
  $body_customAttributeFilters[3] = new Models\CustomAttributeFilter;
702
  $body_customAttributeFilters[3]->setCustomAttributeDefinitionId('VARIETAL_DEFINITION_ID');
 
 
 
 
 
 
703
  $body->setCustomAttributeFilters($body_customAttributeFilters);
704
 
705
 
719
 
720
  # Update Item Modifier Lists
721
 
722
+ Updates the [CatalogModifierList](../../doc/models/catalog-modifier-list.md) objects
723
+ that apply to the targeted [CatalogItem](../../doc/models/catalog-item.md) without having
724
  to perform an upsert on the entire item.
725
 
726
  ```php
731
 
732
  | Parameter | Type | Tags | Description |
733
  | --- | --- | --- | --- |
734
+ | `body` | [`UpdateItemModifierListsRequest`](../../doc/models/update-item-modifier-lists-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
735
 
736
  ## Response Type
737
 
738
+ [`UpdateItemModifierListsResponse`](../../doc/models/update-item-modifier-lists-response.md)
739
 
740
  ## Example Usage
741
 
763
 
764
  # Update Item Taxes
765
 
766
+ Updates the [CatalogTax](../../doc/models/catalog-tax.md) objects that apply to the
767
+ targeted [CatalogItem](../../doc/models/catalog-item.md) without having to perform an
768
  upsert on the entire item.
769
 
770
  ```php
775
 
776
  | Parameter | Type | Tags | Description |
777
  | --- | --- | --- | --- |
778
+ | `body` | [`UpdateItemTaxesRequest`](../../doc/models/update-item-taxes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
779
 
780
  ## Response Type
781
 
782
+ [`UpdateItemTaxesResponse`](../../doc/models/update-item-taxes-response.md)
783
 
784
  ## Example Usage
785
 
vendor/square/square/doc/apis/checkout.md CHANGED
@@ -8,6 +8,15 @@ $checkoutApi = $client->getCheckoutApi();
8
 
9
  `CheckoutApi`
10
 
 
 
 
 
 
 
 
 
 
11
 
12
  # Create Checkout
13
 
@@ -15,6 +24,11 @@ Links a `checkoutId` to a `checkout_page_url` that customers are
15
  directed to in order to provide their payment information using a
16
  payment processing workflow hosted on connect.squareup.com.
17
 
 
 
 
 
 
18
  ```php
19
  function createCheckout(string $locationId, CreateCheckoutRequest $body): ApiResponse
20
  ```
@@ -24,11 +38,11 @@ function createCheckout(string $locationId, CreateCheckoutRequest $body): ApiRes
24
  | Parameter | Type | Tags | Description |
25
  | --- | --- | --- | --- |
26
  | `locationId` | `string` | Template, Required | The ID of the business location to associate the checkout with. |
27
- | `body` | [`CreateCheckoutRequest`](/doc/models/create-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
28
 
29
  ## Response Type
30
 
31
- [`CreateCheckoutResponse`](/doc/models/create-checkout-response.md)
32
 
33
  ## Example Usage
34
 
@@ -40,10 +54,7 @@ $body_order_order_locationId = 'location_id';
40
  $body_order->setOrder(new Models\Order(
41
  $body_order_order_locationId
42
  ));
43
- $body_order->getOrder()->setId('id6');
44
  $body_order->getOrder()->setReferenceId('reference_id');
45
- $body_order->getOrder()->setSource(new Models\OrderSource);
46
- $body_order->getOrder()->getSource()->setName('name8');
47
  $body_order->getOrder()->setCustomerId('customer_id');
48
  $body_order_order_lineItems = [];
49
 
@@ -51,35 +62,13 @@ $body_order_order_lineItems_0_quantity = '2';
51
  $body_order_order_lineItems[0] = new Models\OrderLineItem(
52
  $body_order_order_lineItems_0_quantity
53
  );
54
- $body_order_order_lineItems[0]->setUid('uid3');
55
  $body_order_order_lineItems[0]->setName('Printed T Shirt');
56
- $body_order_order_lineItems[0]->setQuantityUnit(new Models\OrderQuantityUnit);
57
- $body_order_order_lineItems[0]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
58
- $body_order_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name = 'name1';
59
- $body_order_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation3';
60
- $body_order_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
61
- $body_order_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name,
62
- $body_order_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation
63
- ));
64
- $body_order_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_YARD);
65
- $body_order_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_CENTIMETER);
66
- $body_order_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_SHOT);
67
- $body_order_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_MILLIGRAM);
68
- $body_order_order_lineItems[0]->getQuantityUnit()->setPrecision(191);
69
- $body_order_order_lineItems[0]->getQuantityUnit()->setCatalogObjectId('catalog_object_id7');
70
- $body_order_order_lineItems[0]->getQuantityUnit()->setCatalogVersion(131);
71
- $body_order_order_lineItems[0]->setNote('note1');
72
- $body_order_order_lineItems[0]->setCatalogObjectId('catalog_object_id3');
73
  $body_order_order_lineItems_0_appliedTaxes = [];
74
 
75
  $body_order_order_lineItems_0_appliedTaxes_0_taxUid = '38ze1696-z1e3-5628-af6d-f1e04d947fg3';
76
  $body_order_order_lineItems_0_appliedTaxes[0] = new Models\OrderLineItemAppliedTax(
77
  $body_order_order_lineItems_0_appliedTaxes_0_taxUid
78
  );
79
- $body_order_order_lineItems_0_appliedTaxes[0]->setUid('uid3');
80
- $body_order_order_lineItems_0_appliedTaxes[0]->setAppliedMoney(new Models\Money);
81
- $body_order_order_lineItems_0_appliedTaxes[0]->getAppliedMoney()->setAmount(53);
82
- $body_order_order_lineItems_0_appliedTaxes[0]->getAppliedMoney()->setCurrency(Models\Currency::GBP);
83
  $body_order_order_lineItems[0]->setAppliedTaxes($body_order_order_lineItems_0_appliedTaxes);
84
 
85
  $body_order_order_lineItems_0_appliedDiscounts = [];
@@ -88,10 +77,6 @@ $body_order_order_lineItems_0_appliedDiscounts_0_discountUid = '56ae1696-z1e3-93
88
  $body_order_order_lineItems_0_appliedDiscounts[0] = new Models\OrderLineItemAppliedDiscount(
89
  $body_order_order_lineItems_0_appliedDiscounts_0_discountUid
90
  );
91
- $body_order_order_lineItems_0_appliedDiscounts[0]->setUid('uid7');
92
- $body_order_order_lineItems_0_appliedDiscounts[0]->setAppliedMoney(new Models\Money);
93
- $body_order_order_lineItems_0_appliedDiscounts[0]->getAppliedMoney()->setAmount(161);
94
- $body_order_order_lineItems_0_appliedDiscounts[0]->getAppliedMoney()->setCurrency(Models\Currency::LSL);
95
  $body_order_order_lineItems[0]->setAppliedDiscounts($body_order_order_lineItems_0_appliedDiscounts);
96
 
97
  $body_order_order_lineItems[0]->setBasePriceMoney(new Models\Money);
@@ -102,25 +87,7 @@ $body_order_order_lineItems_1_quantity = '1';
102
  $body_order_order_lineItems[1] = new Models\OrderLineItem(
103
  $body_order_order_lineItems_1_quantity
104
  );
105
- $body_order_order_lineItems[1]->setUid('uid4');
106
  $body_order_order_lineItems[1]->setName('Slim Jeans');
107
- $body_order_order_lineItems[1]->setQuantityUnit(new Models\OrderQuantityUnit);
108
- $body_order_order_lineItems[1]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
109
- $body_order_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name = 'name2';
110
- $body_order_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation4';
111
- $body_order_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
112
- $body_order_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name,
113
- $body_order_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation
114
- ));
115
- $body_order_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_MILE);
116
- $body_order_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_MILLIMETER);
117
- $body_order_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_CUP);
118
- $body_order_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::IMPERIAL_STONE);
119
- $body_order_order_lineItems[1]->getQuantityUnit()->setPrecision(192);
120
- $body_order_order_lineItems[1]->getQuantityUnit()->setCatalogObjectId('catalog_object_id6');
121
- $body_order_order_lineItems[1]->getQuantityUnit()->setCatalogVersion(130);
122
- $body_order_order_lineItems[1]->setNote('note0');
123
- $body_order_order_lineItems[1]->setCatalogObjectId('catalog_object_id2');
124
  $body_order_order_lineItems[1]->setBasePriceMoney(new Models\Money);
125
  $body_order_order_lineItems[1]->getBasePriceMoney()->setAmount(2500);
126
  $body_order_order_lineItems[1]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
@@ -129,25 +96,7 @@ $body_order_order_lineItems_2_quantity = '3';
129
  $body_order_order_lineItems[2] = new Models\OrderLineItem(
130
  $body_order_order_lineItems_2_quantity
131
  );
132
- $body_order_order_lineItems[2]->setUid('uid5');
133
  $body_order_order_lineItems[2]->setName('Woven Sweater');
134
- $body_order_order_lineItems[2]->setQuantityUnit(new Models\OrderQuantityUnit);
135
- $body_order_order_lineItems[2]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
136
- $body_order_order_lineItems_2_quantityUnit_measurementUnit_customUnit_name = 'name3';
137
- $body_order_order_lineItems_2_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation5';
138
- $body_order_order_lineItems[2]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
139
- $body_order_order_lineItems_2_quantityUnit_measurementUnit_customUnit_name,
140
- $body_order_order_lineItems_2_quantityUnit_measurementUnit_customUnit_abbreviation
141
- ));
142
- $body_order_order_lineItems[2]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::METRIC_SQUARE_CENTIMETER);
143
- $body_order_order_lineItems[2]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::IMPERIAL_MILE);
144
- $body_order_order_lineItems[2]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_PINT);
145
- $body_order_order_lineItems[2]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::IMPERIAL_POUND);
146
- $body_order_order_lineItems[2]->getQuantityUnit()->setPrecision(193);
147
- $body_order_order_lineItems[2]->getQuantityUnit()->setCatalogObjectId('catalog_object_id5');
148
- $body_order_order_lineItems[2]->getQuantityUnit()->setCatalogVersion(129);
149
- $body_order_order_lineItems[2]->setNote('note9');
150
- $body_order_order_lineItems[2]->setCatalogObjectId('catalog_object_id1');
151
  $body_order_order_lineItems[2]->setBasePriceMoney(new Models\Money);
152
  $body_order_order_lineItems[2]->getBasePriceMoney()->setAmount(3500);
153
  $body_order_order_lineItems[2]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
@@ -157,9 +106,6 @@ $body_order_order_taxes = [];
157
 
158
  $body_order_order_taxes[0] = new Models\OrderLineItemTax;
159
  $body_order_order_taxes[0]->setUid('38ze1696-z1e3-5628-af6d-f1e04d947fg3');
160
- $body_order_order_taxes[0]->setCatalogObjectId('catalog_object_id7');
161
- $body_order_order_taxes[0]->setCatalogVersion(47);
162
- $body_order_order_taxes[0]->setName('name9');
163
  $body_order_order_taxes[0]->setType(Models\OrderLineItemTaxType::INCLUSIVE);
164
  $body_order_order_taxes[0]->setPercentage('7.75');
165
  $body_order_order_taxes[0]->setScope(Models\OrderLineItemTaxScope::LINE_ITEM);
@@ -169,9 +115,6 @@ $body_order_order_discounts = [];
169
 
170
  $body_order_order_discounts[0] = new Models\OrderLineItemDiscount;
171
  $body_order_order_discounts[0]->setUid('56ae1696-z1e3-9328-af6d-f1e04d947gd4');
172
- $body_order_order_discounts[0]->setCatalogObjectId('catalog_object_id1');
173
- $body_order_order_discounts[0]->setCatalogVersion(73);
174
- $body_order_order_discounts[0]->setName('name7');
175
  $body_order_order_discounts[0]->setType(Models\OrderLineItemDiscountType::FIXED_AMOUNT);
176
  $body_order_order_discounts[0]->setAmountMoney(new Models\Money);
177
  $body_order_order_discounts[0]->getAmountMoney()->setAmount(100);
@@ -190,14 +133,10 @@ $body->setPrePopulateBuyerEmail('example@email.com');
190
  $body->setPrePopulateShippingAddress(new Models\Address);
191
  $body->getPrePopulateShippingAddress()->setAddressLine1('1455 Market St.');
192
  $body->getPrePopulateShippingAddress()->setAddressLine2('Suite 600');
193
- $body->getPrePopulateShippingAddress()->setAddressLine3('address_line_36');
194
  $body->getPrePopulateShippingAddress()->setLocality('San Francisco');
195
- $body->getPrePopulateShippingAddress()->setSublocality('sublocality0');
196
  $body->getPrePopulateShippingAddress()->setAdministrativeDistrictLevel1('CA');
197
  $body->getPrePopulateShippingAddress()->setPostalCode('94103');
198
  $body->getPrePopulateShippingAddress()->setCountry(Models\Country::US);
199
- $body->getPrePopulateShippingAddress()->setFirstName('Jane');
200
- $body->getPrePopulateShippingAddress()->setLastName('Doe');
201
  $body->setRedirectUrl('https://merchant.website.com/order-confirm');
202
  $body_additionalRecipients = [];
203
 
@@ -224,3 +163,210 @@ if ($apiResponse->isSuccess()) {
224
  // $headers = $apiResponse->getHeaders();
225
  ```
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  `CheckoutApi`
10
 
11
+ ## Methods
12
+
13
+ * [Create Checkout](../../doc/apis/checkout.md#create-checkout)
14
+ * [List Payment Links](../../doc/apis/checkout.md#list-payment-links)
15
+ * [Create Payment Link](../../doc/apis/checkout.md#create-payment-link)
16
+ * [Delete Payment Link](../../doc/apis/checkout.md#delete-payment-link)
17
+ * [Retrieve Payment Link](../../doc/apis/checkout.md#retrieve-payment-link)
18
+ * [Update Payment Link](../../doc/apis/checkout.md#update-payment-link)
19
+
20
 
21
  # Create Checkout
22
 
24
  directed to in order to provide their payment information using a
25
  payment processing workflow hosted on connect.squareup.com.
26
 
27
+ NOTE: The Checkout API has been updated with new features.
28
+ For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights).
29
+ We recommend that you use the new [CreatePaymentLink](../../doc/apis/checkout.md#create-payment-link) 
30
+ endpoint in place of this previously released endpoint.
31
+
32
  ```php
33
  function createCheckout(string $locationId, CreateCheckoutRequest $body): ApiResponse
34
  ```
38
  | Parameter | Type | Tags | Description |
39
  | --- | --- | --- | --- |
40
  | `locationId` | `string` | Template, Required | The ID of the business location to associate the checkout with. |
41
+ | `body` | [`CreateCheckoutRequest`](../../doc/models/create-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
+ [`CreateCheckoutResponse`](../../doc/models/create-checkout-response.md)
46
 
47
  ## Example Usage
48
 
54
  $body_order->setOrder(new Models\Order(
55
  $body_order_order_locationId
56
  ));
 
57
  $body_order->getOrder()->setReferenceId('reference_id');
 
 
58
  $body_order->getOrder()->setCustomerId('customer_id');
59
  $body_order_order_lineItems = [];
60
 
62
  $body_order_order_lineItems[0] = new Models\OrderLineItem(
63
  $body_order_order_lineItems_0_quantity
64
  );
 
65
  $body_order_order_lineItems[0]->setName('Printed T Shirt');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  $body_order_order_lineItems_0_appliedTaxes = [];
67
 
68
  $body_order_order_lineItems_0_appliedTaxes_0_taxUid = '38ze1696-z1e3-5628-af6d-f1e04d947fg3';
69
  $body_order_order_lineItems_0_appliedTaxes[0] = new Models\OrderLineItemAppliedTax(
70
  $body_order_order_lineItems_0_appliedTaxes_0_taxUid
71
  );
 
 
 
 
72
  $body_order_order_lineItems[0]->setAppliedTaxes($body_order_order_lineItems_0_appliedTaxes);
73
 
74
  $body_order_order_lineItems_0_appliedDiscounts = [];
77
  $body_order_order_lineItems_0_appliedDiscounts[0] = new Models\OrderLineItemAppliedDiscount(
78
  $body_order_order_lineItems_0_appliedDiscounts_0_discountUid
79
  );
 
 
 
 
80
  $body_order_order_lineItems[0]->setAppliedDiscounts($body_order_order_lineItems_0_appliedDiscounts);
81
 
82
  $body_order_order_lineItems[0]->setBasePriceMoney(new Models\Money);
87
  $body_order_order_lineItems[1] = new Models\OrderLineItem(
88
  $body_order_order_lineItems_1_quantity
89
  );
 
90
  $body_order_order_lineItems[1]->setName('Slim Jeans');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  $body_order_order_lineItems[1]->setBasePriceMoney(new Models\Money);
92
  $body_order_order_lineItems[1]->getBasePriceMoney()->setAmount(2500);
93
  $body_order_order_lineItems[1]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
96
  $body_order_order_lineItems[2] = new Models\OrderLineItem(
97
  $body_order_order_lineItems_2_quantity
98
  );
 
99
  $body_order_order_lineItems[2]->setName('Woven Sweater');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  $body_order_order_lineItems[2]->setBasePriceMoney(new Models\Money);
101
  $body_order_order_lineItems[2]->getBasePriceMoney()->setAmount(3500);
102
  $body_order_order_lineItems[2]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
106
 
107
  $body_order_order_taxes[0] = new Models\OrderLineItemTax;
108
  $body_order_order_taxes[0]->setUid('38ze1696-z1e3-5628-af6d-f1e04d947fg3');
 
 
 
109
  $body_order_order_taxes[0]->setType(Models\OrderLineItemTaxType::INCLUSIVE);
110
  $body_order_order_taxes[0]->setPercentage('7.75');
111
  $body_order_order_taxes[0]->setScope(Models\OrderLineItemTaxScope::LINE_ITEM);
115
 
116
  $body_order_order_discounts[0] = new Models\OrderLineItemDiscount;
117
  $body_order_order_discounts[0]->setUid('56ae1696-z1e3-9328-af6d-f1e04d947gd4');
 
 
 
118
  $body_order_order_discounts[0]->setType(Models\OrderLineItemDiscountType::FIXED_AMOUNT);
119
  $body_order_order_discounts[0]->setAmountMoney(new Models\Money);
120
  $body_order_order_discounts[0]->getAmountMoney()->setAmount(100);
133
  $body->setPrePopulateShippingAddress(new Models\Address);
134
  $body->getPrePopulateShippingAddress()->setAddressLine1('1455 Market St.');
135
  $body->getPrePopulateShippingAddress()->setAddressLine2('Suite 600');
 
136
  $body->getPrePopulateShippingAddress()->setLocality('San Francisco');
 
137
  $body->getPrePopulateShippingAddress()->setAdministrativeDistrictLevel1('CA');
138
  $body->getPrePopulateShippingAddress()->setPostalCode('94103');
139
  $body->getPrePopulateShippingAddress()->setCountry(Models\Country::US);
 
 
140
  $body->setRedirectUrl('https://merchant.website.com/order-confirm');
141
  $body_additionalRecipients = [];
142
 
163
  // $headers = $apiResponse->getHeaders();
164
  ```
165
 
166
+
167
+ # List Payment Links
168
+
169
+ Lists all payment links.
170
+
171
+ ```php
172
+ function listPaymentLinks(?string $cursor = null, ?int $limit = null): ApiResponse
173
+ ```
174
+
175
+ ## Parameters
176
+
177
+ | Parameter | Type | Tags | Description |
178
+ | --- | --- | --- | --- |
179
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, the endpoint returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
180
+ | `limit` | `?int` | Query, Optional | A limit on the number of results to return per page. The limit is advisory and<br>the implementation might return more or less results. If the supplied limit is negative, zero, or<br>greater than the maximum limit of 1000, it is ignored.<br><br>Default value: `100` |
181
+
182
+ ## Response Type
183
+
184
+ [`ListPaymentLinksResponse`](../../doc/models/list-payment-links-response.md)
185
+
186
+ ## Example Usage
187
+
188
+ ```php
189
+ $apiResponse = $checkoutApi->listPaymentLinks();
190
+
191
+ if ($apiResponse->isSuccess()) {
192
+ $listPaymentLinksResponse = $apiResponse->getResult();
193
+ } else {
194
+ $errors = $apiResponse->getErrors();
195
+ }
196
+
197
+ // Get more response info...
198
+ // $statusCode = $apiResponse->getStatusCode();
199
+ // $headers = $apiResponse->getHeaders();
200
+ ```
201
+
202
+
203
+ # Create Payment Link
204
+
205
+ Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services.
206
+
207
+ ```php
208
+ function createPaymentLink(CreatePaymentLinkRequest $body): ApiResponse
209
+ ```
210
+
211
+ ## Parameters
212
+
213
+ | Parameter | Type | Tags | Description |
214
+ | --- | --- | --- | --- |
215
+ | `body` | [`CreatePaymentLinkRequest`](../../doc/models/create-payment-link-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
216
+
217
+ ## Response Type
218
+
219
+ [`CreatePaymentLinkResponse`](../../doc/models/create-payment-link-response.md)
220
+
221
+ ## Example Usage
222
+
223
+ ```php
224
+ $body = new Models\CreatePaymentLinkRequest;
225
+ $body->setIdempotencyKey('cd9e25dc-d9f2-4430-aedb-61605070e95f');
226
+ $body_quickPay_name = 'Auto Detailing';
227
+ $body_quickPay_priceMoney = new Models\Money;
228
+ $body_quickPay_priceMoney->setAmount(10000);
229
+ $body_quickPay_priceMoney->setCurrency(Models\Currency::USD);
230
+ $body_quickPay_locationId = 'A9Y43N9ABXZBP';
231
+ $body->setQuickPay(new Models\QuickPay(
232
+ $body_quickPay_name,
233
+ $body_quickPay_priceMoney,
234
+ $body_quickPay_locationId
235
+ ));
236
+
237
+ $apiResponse = $checkoutApi->createPaymentLink($body);
238
+
239
+ if ($apiResponse->isSuccess()) {
240
+ $createPaymentLinkResponse = $apiResponse->getResult();
241
+ } else {
242
+ $errors = $apiResponse->getErrors();
243
+ }
244
+
245
+ // Get more response info...
246
+ // $statusCode = $apiResponse->getStatusCode();
247
+ // $headers = $apiResponse->getHeaders();
248
+ ```
249
+
250
+
251
+ # Delete Payment Link
252
+
253
+ Deletes a payment link.
254
+
255
+ ```php
256
+ function deletePaymentLink(string $id): ApiResponse
257
+ ```
258
+
259
+ ## Parameters
260
+
261
+ | Parameter | Type | Tags | Description |
262
+ | --- | --- | --- | --- |
263
+ | `id` | `string` | Template, Required | The ID of the payment link to delete. |
264
+
265
+ ## Response Type
266
+
267
+ [`DeletePaymentLinkResponse`](../../doc/models/delete-payment-link-response.md)
268
+
269
+ ## Example Usage
270
+
271
+ ```php
272
+ $id = 'id0';
273
+
274
+ $apiResponse = $checkoutApi->deletePaymentLink($id);
275
+
276
+ if ($apiResponse->isSuccess()) {
277
+ $deletePaymentLinkResponse = $apiResponse->getResult();
278
+ } else {
279
+ $errors = $apiResponse->getErrors();
280
+ }
281
+
282
+ // Get more response info...
283
+ // $statusCode = $apiResponse->getStatusCode();
284
+ // $headers = $apiResponse->getHeaders();
285
+ ```
286
+
287
+
288
+ # Retrieve Payment Link
289
+
290
+ Retrieves a payment link.
291
+
292
+ ```php
293
+ function retrievePaymentLink(string $id): ApiResponse
294
+ ```
295
+
296
+ ## Parameters
297
+
298
+ | Parameter | Type | Tags | Description |
299
+ | --- | --- | --- | --- |
300
+ | `id` | `string` | Template, Required | The ID of link to retrieve. |
301
+
302
+ ## Response Type
303
+
304
+ [`RetrievePaymentLinkResponse`](../../doc/models/retrieve-payment-link-response.md)
305
+
306
+ ## Example Usage
307
+
308
+ ```php
309
+ $id = 'id0';
310
+
311
+ $apiResponse = $checkoutApi->retrievePaymentLink($id);
312
+
313
+ if ($apiResponse->isSuccess()) {
314
+ $retrievePaymentLinkResponse = $apiResponse->getResult();
315
+ } else {
316
+ $errors = $apiResponse->getErrors();
317
+ }
318
+
319
+ // Get more response info...
320
+ // $statusCode = $apiResponse->getStatusCode();
321
+ // $headers = $apiResponse->getHeaders();
322
+ ```
323
+
324
+
325
+ # Update Payment Link
326
+
327
+ Updates a payment link. You can update the `payment_link` fields such as
328
+ `description`, `checkout_options`, and `pre_populated_data`.
329
+ You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field.
330
+
331
+ ```php
332
+ function updatePaymentLink(string $id, UpdatePaymentLinkRequest $body): ApiResponse
333
+ ```
334
+
335
+ ## Parameters
336
+
337
+ | Parameter | Type | Tags | Description |
338
+ | --- | --- | --- | --- |
339
+ | `id` | `string` | Template, Required | The ID of the payment link to update. |
340
+ | `body` | [`UpdatePaymentLinkRequest`](../../doc/models/update-payment-link-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
341
+
342
+ ## Response Type
343
+
344
+ [`UpdatePaymentLinkResponse`](../../doc/models/update-payment-link-response.md)
345
+
346
+ ## Example Usage
347
+
348
+ ```php
349
+ $id = 'id0';
350
+ $body_paymentLink_version = 1;
351
+ $body_paymentLink = new Models\PaymentLink(
352
+ $body_paymentLink_version
353
+ );
354
+ $body_paymentLink->setCheckoutOptions(new Models\CheckoutOptions);
355
+ $body_paymentLink->getCheckoutOptions()->setAskForShippingAddress(true);
356
+ $body = new Models\UpdatePaymentLinkRequest(
357
+ $body_paymentLink
358
+ );
359
+
360
+ $apiResponse = $checkoutApi->updatePaymentLink($id, $body);
361
+
362
+ if ($apiResponse->isSuccess()) {
363
+ $updatePaymentLinkResponse = $apiResponse->getResult();
364
+ } else {
365
+ $errors = $apiResponse->getErrors();
366
+ }
367
+
368
+ // Get more response info...
369
+ // $statusCode = $apiResponse->getStatusCode();
370
+ // $headers = $apiResponse->getHeaders();
371
+ ```
372
+
vendor/square/square/doc/apis/customer-custom-attributes.md ADDED
@@ -0,0 +1,547 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Customer Custom Attributes
2
+
3
+ ```php
4
+ $customerCustomAttributesApi = $client->getCustomerCustomAttributesApi();
5
+ ```
6
+
7
+ ## Class Name
8
+
9
+ `CustomerCustomAttributesApi`
10
+
11
+ ## Methods
12
+
13
+ * [List Customer Custom Attribute Definitions](../../doc/apis/customer-custom-attributes.md#list-customer-custom-attribute-definitions)
14
+ * [Create Customer Custom Attribute Definition](../../doc/apis/customer-custom-attributes.md#create-customer-custom-attribute-definition)
15
+ * [Delete Customer Custom Attribute Definition](../../doc/apis/customer-custom-attributes.md#delete-customer-custom-attribute-definition)
16
+ * [Retrieve Customer Custom Attribute Definition](../../doc/apis/customer-custom-attributes.md#retrieve-customer-custom-attribute-definition)
17
+ * [Update Customer Custom Attribute Definition](../../doc/apis/customer-custom-attributes.md#update-customer-custom-attribute-definition)
18
+ * [Bulk Upsert Customer Custom Attributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes)
19
+ * [List Customer Custom Attributes](../../doc/apis/customer-custom-attributes.md#list-customer-custom-attributes)
20
+ * [Delete Customer Custom Attribute](../../doc/apis/customer-custom-attributes.md#delete-customer-custom-attribute)
21
+ * [Retrieve Customer Custom Attribute](../../doc/apis/customer-custom-attributes.md#retrieve-customer-custom-attribute)
22
+ * [Upsert Customer Custom Attribute](../../doc/apis/customer-custom-attributes.md#upsert-customer-custom-attribute)
23
+
24
+
25
+ # List Customer Custom Attribute Definitions
26
+
27
+ Lists the customer-related custom attribute definitions that belong to a Square seller account.
28
+
29
+ When all response pages are retrieved, the results include all custom attribute definitions
30
+ that are visible to the requesting application, including those that are created by other
31
+ applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
32
+
33
+ ```php
34
+ function listCustomerCustomAttributeDefinitions(?int $limit = null, ?string $cursor = null): ApiResponse
35
+ ```
36
+
37
+ ## Parameters
38
+
39
+ | Parameter | Type | Tags | Description |
40
+ | --- | --- | --- | --- |
41
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.<br>The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.<br>The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
42
+ | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.<br>Provide this cursor to retrieve the next page of results for your original request.<br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
43
+
44
+ ## Response Type
45
+
46
+ [`ListCustomerCustomAttributeDefinitionsResponse`](../../doc/models/list-customer-custom-attribute-definitions-response.md)
47
+
48
+ ## Example Usage
49
+
50
+ ```php
51
+ $apiResponse = $customerCustomAttributesApi->listCustomerCustomAttributeDefinitions();
52
+
53
+ if ($apiResponse->isSuccess()) {
54
+ $listCustomerCustomAttributeDefinitionsResponse = $apiResponse->getResult();
55
+ } else {
56
+ $errors = $apiResponse->getErrors();
57
+ }
58
+
59
+ // Get more response info...
60
+ // $statusCode = $apiResponse->getStatusCode();
61
+ // $headers = $apiResponse->getHeaders();
62
+ ```
63
+
64
+
65
+ # Create Customer Custom Attribute Definition
66
+
67
+ Creates a customer-related custom attribute definition for a Square seller account. Use this
68
+ endpoint to define a custom attribute that can be associated with customer profiles.
69
+
70
+ A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties
71
+ for a custom attribute. After the definition is created, you can call
72
+ [UpsertCustomerCustomAttribute](../../doc/apis/customer-custom-attributes.md#upsert-customer-custom-attribute) or
73
+ [BulkUpsertCustomerCustomAttributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes)
74
+ to set the custom attribute for customer profiles in the seller's Customer Directory.
75
+
76
+ Sellers can view all custom attributes in exported customer data, including those set to
77
+ `VISIBILITY_HIDDEN`.
78
+
79
+ ```php
80
+ function createCustomerCustomAttributeDefinition(
81
+ CreateCustomerCustomAttributeDefinitionRequest $body
82
+ ): ApiResponse
83
+ ```
84
+
85
+ ## Parameters
86
+
87
+ | Parameter | Type | Tags | Description |
88
+ | --- | --- | --- | --- |
89
+ | `body` | [`CreateCustomerCustomAttributeDefinitionRequest`](../../doc/models/create-customer-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
90
+
91
+ ## Response Type
92
+
93
+ [`CreateCustomerCustomAttributeDefinitionResponse`](../../doc/models/create-customer-custom-attribute-definition-response.md)
94
+
95
+ ## Example Usage
96
+
97
+ ```php
98
+ $body_customAttributeDefinition = new Models\CustomAttributeDefinition;
99
+ $body_customAttributeDefinition->setKey('favoritemovie');
100
+ $body_customAttributeDefinition->setName('Favorite Movie');
101
+ $body_customAttributeDefinition->setDescription('The favorite movie of the customer.');
102
+ $body_customAttributeDefinition->setVisibility(Models\CustomAttributeDefinitionVisibility::VISIBILITY_HIDDEN);
103
+ $body = new Models\CreateCustomerCustomAttributeDefinitionRequest(
104
+ $body_customAttributeDefinition
105
+ );
106
+
107
+ $apiResponse = $customerCustomAttributesApi->createCustomerCustomAttributeDefinition($body);
108
+
109
+ if ($apiResponse->isSuccess()) {
110
+ $createCustomerCustomAttributeDefinitionResponse = $apiResponse->getResult();
111
+ } else {
112
+ $errors = $apiResponse->getErrors();
113
+ }
114
+
115
+ // Get more response info...
116
+ // $statusCode = $apiResponse->getStatusCode();
117
+ // $headers = $apiResponse->getHeaders();
118
+ ```
119
+
120
+
121
+ # Delete Customer Custom Attribute Definition
122
+
123
+ Deletes a customer-related custom attribute definition from a Square seller account.
124
+
125
+ Deleting a custom attribute definition also deletes the corresponding custom attribute from
126
+ all customer profiles in the seller's Customer Directory.
127
+
128
+ Only the definition owner can delete a custom attribute definition.
129
+
130
+ ```php
131
+ function deleteCustomerCustomAttributeDefinition(string $key): ApiResponse
132
+ ```
133
+
134
+ ## Parameters
135
+
136
+ | Parameter | Type | Tags | Description |
137
+ | --- | --- | --- | --- |
138
+ | `key` | `string` | Template, Required | The key of the custom attribute definition to delete. |
139
+
140
+ ## Response Type
141
+
142
+ [`DeleteCustomerCustomAttributeDefinitionResponse`](../../doc/models/delete-customer-custom-attribute-definition-response.md)
143
+
144
+ ## Example Usage
145
+
146
+ ```php
147
+ $key = 'key0';
148
+
149
+ $apiResponse = $customerCustomAttributesApi->deleteCustomerCustomAttributeDefinition($key);
150
+
151
+ if ($apiResponse->isSuccess()) {
152
+ $deleteCustomerCustomAttributeDefinitionResponse = $apiResponse->getResult();
153
+ } else {
154
+ $errors = $apiResponse->getErrors();
155
+ }
156
+
157
+ // Get more response info...
158
+ // $statusCode = $apiResponse->getStatusCode();
159
+ // $headers = $apiResponse->getHeaders();
160
+ ```
161
+
162
+
163
+ # Retrieve Customer Custom Attribute Definition
164
+
165
+ Retrieves a customer-related custom attribute definition from a Square seller account.
166
+
167
+ To retrieve a custom attribute definition created by another application, the `visibility`
168
+ setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
169
+
170
+ ```php
171
+ function retrieveCustomerCustomAttributeDefinition(string $key, ?int $version = null): ApiResponse
172
+ ```
173
+
174
+ ## Parameters
175
+
176
+ | Parameter | Type | Tags | Description |
177
+ | --- | --- | --- | --- |
178
+ | `key` | `string` | Template, Required | The key of the custom attribute definition to retrieve. If the requesting application<br>is not the definition owner, you must use the qualified key. |
179
+ | `version` | `?int` | Query, Optional | The current version of the custom attribute definition, which is used for strongly consistent<br>reads to guarantee that you receive the most up-to-date data. When included in the request,<br>Square returns the specified version or a higher version if one exists. If the specified version<br>is higher than the current version, Square returns a `BAD_REQUEST` error. |
180
+
181
+ ## Response Type
182
+
183
+ [`RetrieveCustomerCustomAttributeDefinitionResponse`](../../doc/models/retrieve-customer-custom-attribute-definition-response.md)
184
+
185
+ ## Example Usage
186
+
187
+ ```php
188
+ $key = 'key0';
189
+
190
+ $apiResponse = $customerCustomAttributesApi->retrieveCustomerCustomAttributeDefinition($key);
191
+
192
+ if ($apiResponse->isSuccess()) {
193
+ $retrieveCustomerCustomAttributeDefinitionResponse = $apiResponse->getResult();
194
+ } else {
195
+ $errors = $apiResponse->getErrors();
196
+ }
197
+
198
+ // Get more response info...
199
+ // $statusCode = $apiResponse->getStatusCode();
200
+ // $headers = $apiResponse->getHeaders();
201
+ ```
202
+
203
+
204
+ # Update Customer Custom Attribute Definition
205
+
206
+ Updates a customer-related custom attribute definition for a Square seller account.
207
+
208
+ Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the
209
+ `schema` for a `Selection` data type.
210
+
211
+ Only the definition owner can update a custom attribute definition. Note that sellers can view
212
+ all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`.
213
+
214
+ ```php
215
+ function updateCustomerCustomAttributeDefinition(
216
+ string $key,
217
+ UpdateCustomerCustomAttributeDefinitionRequest $body
218
+ ): ApiResponse
219
+ ```
220
+
221
+ ## Parameters
222
+
223
+ | Parameter | Type | Tags | Description |
224
+ | --- | --- | --- | --- |
225
+ | `key` | `string` | Template, Required | The key of the custom attribute definition to update. |
226
+ | `body` | [`UpdateCustomerCustomAttributeDefinitionRequest`](../../doc/models/update-customer-custom-attribute-definition-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
227
+
228
+ ## Response Type
229
+
230
+ [`UpdateCustomerCustomAttributeDefinitionResponse`](../../doc/models/update-customer-custom-attribute-definition-response.md)
231
+
232
+ ## Example Usage
233
+
234
+ ```php
235
+ $key = 'key0';
236
+ $body_customAttributeDefinition = new Models\CustomAttributeDefinition;
237
+ $body_customAttributeDefinition->setDescription('Update the description as desired.');
238
+ $body_customAttributeDefinition->setVisibility(Models\CustomAttributeDefinitionVisibility::VISIBILITY_READ_ONLY);
239
+ $body = new Models\UpdateCustomerCustomAttributeDefinitionRequest(
240
+ $body_customAttributeDefinition
241
+ );
242
+
243
+ $apiResponse = $customerCustomAttributesApi->updateCustomerCustomAttributeDefinition($key, $body);
244
+
245
+ if ($apiResponse->isSuccess()) {
246
+ $updateCustomerCustomAttributeDefinitionResponse = $apiResponse->getResult();
247
+ } else {
248
+ $errors = $apiResponse->getErrors();
249
+ }
250
+
251
+ // Get more response info...
252
+ // $statusCode = $apiResponse->getStatusCode();
253
+ // $headers = $apiResponse->getHeaders();
254
+ ```
255
+
256
+
257
+ # Bulk Upsert Customer Custom Attributes
258
+
259
+ Creates or updates custom attributes for customer profiles as a bulk operation.
260
+
261
+ Use this endpoint to set the value of one or more custom attributes for one or more customer profiles.
262
+ A custom attribute is based on a custom attribute definition in a Square seller account, which is
263
+ created using the [CreateCustomerCustomAttributeDefinition](../../doc/apis/customer-custom-attributes.md#create-customer-custom-attribute-definition) endpoint.
264
+
265
+ This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert
266
+ requests and returns a map of individual upsert responses. Each upsert request has a unique ID
267
+ and provides a customer ID and custom attribute. Each upsert response is returned with the ID
268
+ of the corresponding request.
269
+
270
+ To create or update a custom attribute owned by another application, the `visibility` setting
271
+ must be `VISIBILITY_READ_WRITE_VALUES`.
272
+
273
+ ```php
274
+ function bulkUpsertCustomerCustomAttributes(BulkUpsertCustomerCustomAttributesRequest $body): ApiResponse
275
+ ```
276
+
277
+ ## Parameters
278
+
279
+ | Parameter | Type | Tags | Description |
280
+ | --- | --- | --- | --- |
281
+ | `body` | [`BulkUpsertCustomerCustomAttributesRequest`](../../doc/models/bulk-upsert-customer-custom-attributes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
282
+
283
+ ## Response Type
284
+
285
+ [`BulkUpsertCustomerCustomAttributesResponse`](../../doc/models/bulk-upsert-customer-custom-attributes-response.md)
286
+
287
+ ## Example Usage
288
+
289
+ ```php
290
+ $body_values = [];
291
+
292
+ $body_values__customerId = null;
293
+ $body_values__customAttribute = new Models\CustomAttribute;
294
+ $body_values[''] = new Models\BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(
295
+ $body_values__customerId,
296
+ $body_values__customAttribute
297
+ );
298
+
299
+ $body_values__customerId = null;
300
+ $body_values__customAttribute = new Models\CustomAttribute;
301
+ $body_values[''] = new Models\BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(
302
+ $body_values__customerId,
303
+ $body_values__customAttribute
304
+ );
305
+
306
+ $body_values__customerId = null;
307
+ $body_values__customAttribute = new Models\CustomAttribute;
308
+ $body_values[''] = new Models\BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(
309
+ $body_values__customerId,
310
+ $body_values__customAttribute
311
+ );
312
+
313
+ $body_values__customerId = null;
314
+ $body_values__customAttribute = new Models\CustomAttribute;
315
+ $body_values[''] = new Models\BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(
316
+ $body_values__customerId,
317
+ $body_values__customAttribute
318
+ );
319
+
320
+ $body_values__customerId = null;
321
+ $body_values__customAttribute = new Models\CustomAttribute;
322
+ $body_values[''] = new Models\BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest(
323
+ $body_values__customerId,
324
+ $body_values__customAttribute
325
+ );
326
+
327
+ $body = new Models\BulkUpsertCustomerCustomAttributesRequest(
328
+ $body_values
329
+ );
330
+
331
+ $apiResponse = $customerCustomAttributesApi->bulkUpsertCustomerCustomAttributes($body);
332
+
333
+ if ($apiResponse->isSuccess()) {
334
+ $bulkUpsertCustomerCustomAttributesResponse = $apiResponse->getResult();
335
+ } else {
336
+ $errors = $apiResponse->getErrors();
337
+ }
338
+
339
+ // Get more response info...
340
+ // $statusCode = $apiResponse->getStatusCode();
341
+ // $headers = $apiResponse->getHeaders();
342
+ ```
343
+
344
+
345
+ # List Customer Custom Attributes
346
+
347
+ Lists the custom attributes associated with a customer profile.
348
+
349
+ You can use the `with_definitions` query parameter to also retrieve custom attribute definitions
350
+ in the same call.
351
+
352
+ When all response pages are retrieved, the results include all custom attributes that are
353
+ visible to the requesting application, including those that are owned by other applications
354
+ and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
355
+
356
+ ```php
357
+ function listCustomerCustomAttributes(
358
+ string $customerId,
359
+ ?int $limit = null,
360
+ ?string $cursor = null,
361
+ ?bool $withDefinitions = false
362
+ ): ApiResponse
363
+ ```
364
+
365
+ ## Parameters
366
+
367
+ | Parameter | Type | Tags | Description |
368
+ | --- | --- | --- | --- |
369
+ | `customerId` | `string` | Template, Required | The ID of the target [customer profile](../../doc/models/customer.md). |
370
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single paged response. This limit is advisory.<br>The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100.<br>The default value is 20. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
371
+ | `cursor` | `?string` | Query, Optional | The cursor returned in the paged response from the previous call to this endpoint.<br>Provide this cursor to retrieve the next page of results for your original request. For more<br>information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
372
+ | `withDefinitions` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of each<br>custom attribute. Set this parameter to `true` to get the name and description of each custom<br>attribute, information about the data type, or other definition details. The default value is `false`.<br>**Default**: `false` |
373
+
374
+ ## Response Type
375
+
376
+ [`ListCustomerCustomAttributesResponse`](../../doc/models/list-customer-custom-attributes-response.md)
377
+
378
+ ## Example Usage
379
+
380
+ ```php
381
+ $customerId = 'customer_id8';
382
+ $withDefinitions = false;
383
+
384
+ $apiResponse = $customerCustomAttributesApi->listCustomerCustomAttributes($customerId, null, null, $withDefinitions);
385
+
386
+ if ($apiResponse->isSuccess()) {
387
+ $listCustomerCustomAttributesResponse = $apiResponse->getResult();
388
+ } else {
389
+ $errors = $apiResponse->getErrors();
390
+ }
391
+
392
+ // Get more response info...
393
+ // $statusCode = $apiResponse->getStatusCode();
394
+ // $headers = $apiResponse->getHeaders();
395
+ ```
396
+
397
+
398
+ # Delete Customer Custom Attribute
399
+
400
+ Deletes a custom attribute associated with a customer profile.
401
+
402
+ To delete a custom attribute owned by another application, the `visibility` setting must be
403
+ `VISIBILITY_READ_WRITE_VALUES`.
404
+
405
+ ```php
406
+ function deleteCustomerCustomAttribute(string $customerId, string $key): ApiResponse
407
+ ```
408
+
409
+ ## Parameters
410
+
411
+ | Parameter | Type | Tags | Description |
412
+ | --- | --- | --- | --- |
413
+ | `customerId` | `string` | Template, Required | The ID of the target [customer profile](../../doc/models/customer.md). |
414
+ | `key` | `string` | Template, Required | The key of the custom attribute to delete. This key must match the `key` of a custom<br>attribute definition in the Square seller account. If the requesting application is not the<br>definition owner, you must use the qualified key. |
415
+
416
+ ## Response Type
417
+
418
+ [`DeleteCustomerCustomAttributeResponse`](../../doc/models/delete-customer-custom-attribute-response.md)
419
+
420
+ ## Example Usage
421
+
422
+ ```php
423
+ $customerId = 'customer_id8';
424
+ $key = 'key0';
425
+
426
+ $apiResponse = $customerCustomAttributesApi->deleteCustomerCustomAttribute($customerId, $key);
427
+
428
+ if ($apiResponse->isSuccess()) {
429
+ $deleteCustomerCustomAttributeResponse = $apiResponse->getResult();
430
+ } else {
431
+ $errors = $apiResponse->getErrors();
432
+ }
433
+
434
+ // Get more response info...
435
+ // $statusCode = $apiResponse->getStatusCode();
436
+ // $headers = $apiResponse->getHeaders();
437
+ ```
438
+
439
+
440
+ # Retrieve Customer Custom Attribute
441
+
442
+ Retrieves a custom attribute associated with a customer profile.
443
+
444
+ You can use the `with_definition` query parameter to also retrieve the custom attribute definition
445
+ in the same call.
446
+
447
+ To retrieve a custom attribute owned by another application, the `visibility` setting must be
448
+ `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`.
449
+
450
+ ```php
451
+ function retrieveCustomerCustomAttribute(
452
+ string $customerId,
453
+ string $key,
454
+ ?bool $withDefinition = false,
455
+ ?int $version = null
456
+ ): ApiResponse
457
+ ```
458
+
459
+ ## Parameters
460
+
461
+ | Parameter | Type | Tags | Description |
462
+ | --- | --- | --- | --- |
463
+ | `customerId` | `string` | Template, Required | The ID of the target [customer profile](../../doc/models/customer.md). |
464
+ | `key` | `string` | Template, Required | The key of the custom attribute to retrieve. This key must match the `key` of a custom<br>attribute definition in the Square seller account. If the requesting application is not the<br>definition owner, you must use the qualified key. |
465
+ | `withDefinition` | `?bool` | Query, Optional | Indicates whether to return the [custom attribute definition](../../doc/models/custom-attribute-definition.md) in the `definition` field of<br>the custom attribute. Set this parameter to `true` to get the name and description of the custom<br>attribute, information about the data type, or other definition details. The default value is `false`.<br>**Default**: `false` |
466
+ | `version` | `?int` | Query, Optional | The current version of the custom attribute, which is used for strongly consistent reads to<br>guarantee that you receive the most up-to-date data. When included in the request, Square<br>returns the specified version or a higher version if one exists. If the specified version is<br>higher than the current version, Square returns a `BAD_REQUEST` error. |
467
+
468
+ ## Response Type
469
+
470
+ [`RetrieveCustomerCustomAttributeResponse`](../../doc/models/retrieve-customer-custom-attribute-response.md)
471
+
472
+ ## Example Usage
473
+
474
+ ```php
475
+ $customerId = 'customer_id8';
476
+ $key = 'key0';
477
+ $withDefinition = false;
478
+
479
+ $apiResponse = $customerCustomAttributesApi->retrieveCustomerCustomAttribute($customerId, $key, $withDefinition);
480
+
481
+ if ($apiResponse->isSuccess()) {
482
+ $retrieveCustomerCustomAttributeResponse = $apiResponse->getResult();
483
+ } else {
484
+ $errors = $apiResponse->getErrors();
485
+ }
486
+
487
+ // Get more response info...
488
+ // $statusCode = $apiResponse->getStatusCode();
489
+ // $headers = $apiResponse->getHeaders();
490
+ ```
491
+
492
+
493
+ # Upsert Customer Custom Attribute
494
+
495
+ Creates or updates a custom attribute for a customer profile.
496
+
497
+ Use this endpoint to set the value of a custom attribute for a specified customer profile.
498
+ A custom attribute is based on a custom attribute definition in a Square seller account, which
499
+ is created using the [CreateCustomerCustomAttributeDefinition](../../doc/apis/customer-custom-attributes.md#create-customer-custom-attribute-definition) endpoint.
500
+
501
+ To create or update a custom attribute owned by another application, the `visibility` setting
502
+ must be `VISIBILITY_READ_WRITE_VALUES`.
503
+
504
+ ```php
505
+ function upsertCustomerCustomAttribute(
506
+ string $customerId,
507
+ string $key,
508
+ UpsertCustomerCustomAttributeRequest $body
509
+ ): ApiResponse
510
+ ```
511
+
512
+ ## Parameters
513
+
514
+ | Parameter | Type | Tags | Description |
515
+ | --- | --- | --- | --- |
516
+ | `customerId` | `string` | Template, Required | The ID of the target [customer profile](../../doc/models/customer.md). |
517
+ | `key` | `string` | Template, Required | The key of the custom attribute to create or update. This key must match the `key` of a<br>custom attribute definition in the Square seller account. If the requesting application is not<br>the definition owner, you must use the qualified key. |
518
+ | `body` | [`UpsertCustomerCustomAttributeRequest`](../../doc/models/upsert-customer-custom-attribute-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
519
+
520
+ ## Response Type
521
+
522
+ [`UpsertCustomerCustomAttributeResponse`](../../doc/models/upsert-customer-custom-attribute-response.md)
523
+
524
+ ## Example Usage
525
+
526
+ ```php
527
+ $customerId = 'customer_id8';
528
+ $key = 'key0';
529
+ $body_customAttribute = new Models\CustomAttribute;
530
+ $body_customAttribute->setValue('"Dune"');
531
+ $body = new Models\UpsertCustomerCustomAttributeRequest(
532
+ $body_customAttribute
533
+ );
534
+
535
+ $apiResponse = $customerCustomAttributesApi->upsertCustomerCustomAttribute($customerId, $key, $body);
536
+
537
+ if ($apiResponse->isSuccess()) {
538
+ $upsertCustomerCustomAttributeResponse = $apiResponse->getResult();
539
+ } else {
540
+ $errors = $apiResponse->getErrors();
541
+ }
542
+
543
+ // Get more response info...
544
+ // $statusCode = $apiResponse->getStatusCode();
545
+ // $headers = $apiResponse->getHeaders();
546
+ ```
547
+
vendor/square/square/doc/apis/customer-groups.md CHANGED
@@ -10,11 +10,11 @@ $customerGroupsApi = $client->getCustomerGroupsApi();
10
 
11
  ## Methods
12
 
13
- * [List Customer Groups](/doc/apis/customer-groups.md#list-customer-groups)
14
- * [Create Customer Group](/doc/apis/customer-groups.md#create-customer-group)
15
- * [Delete Customer Group](/doc/apis/customer-groups.md#delete-customer-group)
16
- * [Retrieve Customer Group](/doc/apis/customer-groups.md#retrieve-customer-group)
17
- * [Update Customer Group](/doc/apis/customer-groups.md#update-customer-group)
18
 
19
 
20
  # List Customer Groups
@@ -29,20 +29,17 @@ function listCustomerGroups(?string $cursor = null, ?int $limit = null): ApiResp
29
 
30
  | Parameter | Type | Tags | Description |
31
  | --- | --- | --- | --- |
32
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for your original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
33
- | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>The limit is ignored if it is less than 1 or greater than 50. The default value is 50.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
34
 
35
  ## Response Type
36
 
37
- [`ListCustomerGroupsResponse`](/doc/models/list-customer-groups-response.md)
38
 
39
  ## Example Usage
40
 
41
  ```php
42
- $cursor = 'cursor6';
43
- $limit = 172;
44
-
45
- $apiResponse = $customerGroupsApi->listCustomerGroups($cursor, $limit);
46
 
47
  if ($apiResponse->isSuccess()) {
48
  $listCustomerGroupsResponse = $apiResponse->getResult();
@@ -70,11 +67,11 @@ function createCustomerGroup(CreateCustomerGroupRequest $body): ApiResponse
70
 
71
  | Parameter | Type | Tags | Description |
72
  | --- | --- | --- | --- |
73
- | `body` | [`CreateCustomerGroupRequest`](/doc/models/create-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
74
 
75
  ## Response Type
76
 
77
- [`CreateCustomerGroupResponse`](/doc/models/create-customer-group-response.md)
78
 
79
  ## Example Usage
80
 
@@ -83,13 +80,9 @@ $body_group_name = 'Loyal Customers';
83
  $body_group = new Models\CustomerGroup(
84
  $body_group_name
85
  );
86
- $body_group->setId('id4');
87
- $body_group->setCreatedAt('created_at2');
88
- $body_group->setUpdatedAt('updated_at0');
89
  $body = new Models\CreateCustomerGroupRequest(
90
  $body_group
91
  );
92
- $body->setIdempotencyKey('idempotency_key2');
93
 
94
  $apiResponse = $customerGroupsApi->createCustomerGroup($body);
95
 
@@ -121,7 +114,7 @@ function deleteCustomerGroup(string $groupId): ApiResponse
121
 
122
  ## Response Type
123
 
124
- [`DeleteCustomerGroupResponse`](/doc/models/delete-customer-group-response.md)
125
 
126
  ## Example Usage
127
 
@@ -158,7 +151,7 @@ function retrieveCustomerGroup(string $groupId): ApiResponse
158
 
159
  ## Response Type
160
 
161
- [`RetrieveCustomerGroupResponse`](/doc/models/retrieve-customer-group-response.md)
162
 
163
  ## Example Usage
164
 
@@ -192,11 +185,11 @@ function updateCustomerGroup(string $groupId, UpdateCustomerGroupRequest $body):
192
  | Parameter | Type | Tags | Description |
193
  | --- | --- | --- | --- |
194
  | `groupId` | `string` | Template, Required | The ID of the customer group to update. |
195
- | `body` | [`UpdateCustomerGroupRequest`](/doc/models/update-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
196
 
197
  ## Response Type
198
 
199
- [`UpdateCustomerGroupResponse`](/doc/models/update-customer-group-response.md)
200
 
201
  ## Example Usage
202
 
@@ -206,9 +199,6 @@ $body_group_name = 'Loyal Customers';
206
  $body_group = new Models\CustomerGroup(
207
  $body_group_name
208
  );
209
- $body_group->setId('id4');
210
- $body_group->setCreatedAt('created_at2');
211
- $body_group->setUpdatedAt('updated_at0');
212
  $body = new Models\UpdateCustomerGroupRequest(
213
  $body_group
214
  );
10
 
11
  ## Methods
12
 
13
+ * [List Customer Groups](../../doc/apis/customer-groups.md#list-customer-groups)
14
+ * [Create Customer Group](../../doc/apis/customer-groups.md#create-customer-group)
15
+ * [Delete Customer Group](../../doc/apis/customer-groups.md#delete-customer-group)
16
+ * [Retrieve Customer Group](../../doc/apis/customer-groups.md#retrieve-customer-group)
17
+ * [Update Customer Group](../../doc/apis/customer-groups.md#update-customer-group)
18
 
19
 
20
  # List Customer Groups
29
 
30
  | Parameter | Type | Tags | Description |
31
  | --- | --- | --- | --- |
32
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for your original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
33
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>If the limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
34
 
35
  ## Response Type
36
 
37
+ [`ListCustomerGroupsResponse`](../../doc/models/list-customer-groups-response.md)
38
 
39
  ## Example Usage
40
 
41
  ```php
42
+ $apiResponse = $customerGroupsApi->listCustomerGroups();
 
 
 
43
 
44
  if ($apiResponse->isSuccess()) {
45
  $listCustomerGroupsResponse = $apiResponse->getResult();
67
 
68
  | Parameter | Type | Tags | Description |
69
  | --- | --- | --- | --- |
70
+ | `body` | [`CreateCustomerGroupRequest`](../../doc/models/create-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
71
 
72
  ## Response Type
73
 
74
+ [`CreateCustomerGroupResponse`](../../doc/models/create-customer-group-response.md)
75
 
76
  ## Example Usage
77
 
80
  $body_group = new Models\CustomerGroup(
81
  $body_group_name
82
  );
 
 
 
83
  $body = new Models\CreateCustomerGroupRequest(
84
  $body_group
85
  );
 
86
 
87
  $apiResponse = $customerGroupsApi->createCustomerGroup($body);
88
 
114
 
115
  ## Response Type
116
 
117
+ [`DeleteCustomerGroupResponse`](../../doc/models/delete-customer-group-response.md)
118
 
119
  ## Example Usage
120
 
151
 
152
  ## Response Type
153
 
154
+ [`RetrieveCustomerGroupResponse`](../../doc/models/retrieve-customer-group-response.md)
155
 
156
  ## Example Usage
157
 
185
  | Parameter | Type | Tags | Description |
186
  | --- | --- | --- | --- |
187
  | `groupId` | `string` | Template, Required | The ID of the customer group to update. |
188
+ | `body` | [`UpdateCustomerGroupRequest`](../../doc/models/update-customer-group-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
189
 
190
  ## Response Type
191
 
192
+ [`UpdateCustomerGroupResponse`](../../doc/models/update-customer-group-response.md)
193
 
194
  ## Example Usage
195
 
199
  $body_group = new Models\CustomerGroup(
200
  $body_group_name
201
  );
 
 
 
202
  $body = new Models\UpdateCustomerGroupRequest(
203
  $body_group
204
  );
vendor/square/square/doc/apis/customer-segments.md CHANGED
@@ -10,8 +10,8 @@ $customerSegmentsApi = $client->getCustomerSegmentsApi();
10
 
11
  ## Methods
12
 
13
- * [List Customer Segments](/doc/apis/customer-segments.md#list-customer-segments)
14
- * [Retrieve Customer Segment](/doc/apis/customer-segments.md#retrieve-customer-segment)
15
 
16
 
17
  # List Customer Segments
@@ -26,20 +26,17 @@ function listCustomerSegments(?string $cursor = null, ?int $limit = null): ApiRe
26
 
27
  | Parameter | Type | Tags | Description |
28
  | --- | --- | --- | --- |
29
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by previous calls to `ListCustomerSegments`.<br>This cursor is used to retrieve the next set of query results.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
30
- | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>The limit is ignored if it is less than 1 or greater than 50. The default value is 50.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
31
 
32
  ## Response Type
33
 
34
- [`ListCustomerSegmentsResponse`](/doc/models/list-customer-segments-response.md)
35
 
36
  ## Example Usage
37
 
38
  ```php
39
- $cursor = 'cursor6';
40
- $limit = 172;
41
-
42
- $apiResponse = $customerSegmentsApi->listCustomerSegments($cursor, $limit);
43
 
44
  if ($apiResponse->isSuccess()) {
45
  $listCustomerSegmentsResponse = $apiResponse->getResult();
@@ -69,7 +66,7 @@ function retrieveCustomerSegment(string $segmentId): ApiResponse
69
 
70
  ## Response Type
71
 
72
- [`RetrieveCustomerSegmentResponse`](/doc/models/retrieve-customer-segment-response.md)
73
 
74
  ## Example Usage
75
 
10
 
11
  ## Methods
12
 
13
+ * [List Customer Segments](../../doc/apis/customer-segments.md#list-customer-segments)
14
+ * [Retrieve Customer Segment](../../doc/apis/customer-segments.md#retrieve-customer-segment)
15
 
16
 
17
  # List Customer Segments
26
 
27
  | Parameter | Type | Tags | Description |
28
  | --- | --- | --- | --- |
29
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by previous calls to `ListCustomerSegments`.<br>This cursor is used to retrieve the next set of query results.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
30
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>If the specified limit is less than 1 or greater than 50, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 50.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
31
 
32
  ## Response Type
33
 
34
+ [`ListCustomerSegmentsResponse`](../../doc/models/list-customer-segments-response.md)
35
 
36
  ## Example Usage
37
 
38
  ```php
39
+ $apiResponse = $customerSegmentsApi->listCustomerSegments();
 
 
 
40
 
41
  if ($apiResponse->isSuccess()) {
42
  $listCustomerSegmentsResponse = $apiResponse->getResult();
66
 
67
  ## Response Type
68
 
69
+ [`RetrieveCustomerSegmentResponse`](../../doc/models/retrieve-customer-segment-response.md)
70
 
71
  ## Example Usage
72
 
vendor/square/square/doc/apis/customers.md CHANGED
@@ -10,16 +10,16 @@ $customersApi = $client->getCustomersApi();
10
 
11
  ## Methods
12
 
13
- * [List Customers](/doc/apis/customers.md#list-customers)
14
- * [Create Customer](/doc/apis/customers.md#create-customer)
15
- * [Search Customers](/doc/apis/customers.md#search-customers)
16
- * [Delete Customer](/doc/apis/customers.md#delete-customer)
17
- * [Retrieve Customer](/doc/apis/customers.md#retrieve-customer)
18
- * [Update Customer](/doc/apis/customers.md#update-customer)
19
- * [Create Customer Card](/doc/apis/customers.md#create-customer-card)
20
- * [Delete Customer Card](/doc/apis/customers.md#delete-customer-card)
21
- * [Remove Group From Customer](/doc/apis/customers.md#remove-group-from-customer)
22
- * [Add Group to Customer](/doc/apis/customers.md#add-group-to-customer)
23
 
24
 
25
  # List Customers
@@ -43,24 +43,19 @@ function listCustomers(
43
 
44
  | Parameter | Type | Tags | Description |
45
  | --- | --- | --- | --- |
46
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for your original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
47
- | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>The limit is ignored if it is less than 1 or greater than 100. The default value is 100.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
48
- | `sortField` | [`?string (CustomerSortField)`](/doc/models/customer-sort-field.md) | Query, Optional | Indicates how customers should be sorted.<br><br>The default value is `DEFAULT`. |
49
- | `sortOrder` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | Indicates whether customers should be sorted in ascending (`ASC`) or<br>descending (`DESC`) order.<br><br>The default value is `ASC`. |
50
 
51
  ## Response Type
52
 
53
- [`ListCustomersResponse`](/doc/models/list-customers-response.md)
54
 
55
  ## Example Usage
56
 
57
  ```php
58
- $cursor = 'cursor6';
59
- $limit = 172;
60
- $sortField = Models\CustomerSortField::DEFAULT_;
61
- $sortOrder = Models\SortOrder::DESC;
62
-
63
- $apiResponse = $customersApi->listCustomers($cursor, $limit, $sortField, $sortOrder);
64
 
65
  if ($apiResponse->isSuccess()) {
66
  $listCustomersResponse = $apiResponse->getResult();
@@ -95,28 +90,23 @@ function createCustomer(CreateCustomerRequest $body): ApiResponse
95
 
96
  | Parameter | Type | Tags | Description |
97
  | --- | --- | --- | --- |
98
- | `body` | [`CreateCustomerRequest`](/doc/models/create-customer-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
99
 
100
  ## Response Type
101
 
102
- [`CreateCustomerResponse`](/doc/models/create-customer-response.md)
103
 
104
  ## Example Usage
105
 
106
  ```php
107
  $body = new Models\CreateCustomerRequest;
108
- $body->setIdempotencyKey('idempotency_key2');
109
  $body->setGivenName('Amelia');
110
  $body->setFamilyName('Earhart');
111
- $body->setCompanyName('company_name2');
112
- $body->setNickname('nickname2');
113
  $body->setEmailAddress('Amelia.Earhart@example.com');
114
  $body->setAddress(new Models\Address);
115
  $body->getAddress()->setAddressLine1('500 Electric Ave');
116
  $body->getAddress()->setAddressLine2('Suite 600');
117
- $body->getAddress()->setAddressLine3('address_line_38');
118
  $body->getAddress()->setLocality('New York');
119
- $body->getAddress()->setSublocality('sublocality2');
120
  $body->getAddress()->setAdministrativeDistrictLevel1('NY');
121
  $body->getAddress()->setPostalCode('10003');
122
  $body->getAddress()->setCountry(Models\Country::US);
@@ -158,17 +148,16 @@ function searchCustomers(SearchCustomersRequest $body): ApiResponse
158
 
159
  | Parameter | Type | Tags | Description |
160
  | --- | --- | --- | --- |
161
- | `body` | [`SearchCustomersRequest`](/doc/models/search-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
162
 
163
  ## Response Type
164
 
165
- [`SearchCustomersResponse`](/doc/models/search-customers-response.md)
166
 
167
  ## Example Usage
168
 
169
  ```php
170
  $body = new Models\SearchCustomersRequest;
171
- $body->setCursor('cursor0');
172
  $body->setLimit(2);
173
  $body->setQuery(new Models\CustomerQuery);
174
  $body->getQuery()->setFilter(new Models\CustomerFilter);
@@ -178,19 +167,10 @@ $body->getQuery()->getFilter()->getCreationSource()->setRule(Models\CustomerIncl
178
  $body->getQuery()->getFilter()->setCreatedAt(new Models\TimeRange);
179
  $body->getQuery()->getFilter()->getCreatedAt()->setStartAt('2018-01-01T00:00:00-00:00');
180
  $body->getQuery()->getFilter()->getCreatedAt()->setEndAt('2018-02-01T00:00:00-00:00');
181
- $body->getQuery()->getFilter()->setUpdatedAt(new Models\TimeRange);
182
- $body->getQuery()->getFilter()->getUpdatedAt()->setStartAt('start_at4');
183
- $body->getQuery()->getFilter()->getUpdatedAt()->setEndAt('end_at8');
184
  $body->getQuery()->getFilter()->setEmailAddress(new Models\CustomerTextFilter);
185
- $body->getQuery()->getFilter()->getEmailAddress()->setExact('exact0');
186
  $body->getQuery()->getFilter()->getEmailAddress()->setFuzzy('example.com');
187
- $body->getQuery()->getFilter()->setPhoneNumber(new Models\CustomerTextFilter);
188
- $body->getQuery()->getFilter()->getPhoneNumber()->setExact('exact0');
189
- $body->getQuery()->getFilter()->getPhoneNumber()->setFuzzy('fuzzy6');
190
  $body->getQuery()->getFilter()->setGroupIds(new Models\FilterValue);
191
  $body->getQuery()->getFilter()->getGroupIds()->setAll(['545AXB44B4XXWMVQ4W8SBT3HHF']);
192
- $body->getQuery()->getFilter()->getGroupIds()->setAny(['any0', 'any1', 'any2']);
193
- $body->getQuery()->getFilter()->getGroupIds()->setNone(['none5', 'none6']);
194
  $body->getQuery()->setSort(new Models\CustomerSort);
195
  $body->getQuery()->getSort()->setField(Models\CustomerSortField::CREATED_AT);
196
  $body->getQuery()->getSort()->setOrder(Models\SortOrder::ASC);
@@ -226,19 +206,18 @@ function deleteCustomer(string $customerId, ?int $version = null): ApiResponse
226
  | Parameter | Type | Tags | Description |
227
  | --- | --- | --- | --- |
228
  | `customerId` | `string` | Template, Required | The ID of the customer to delete. |
229
- | `version` | `?int` | Query, Optional | The current version of the customer profile.<br><br>As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/working-with-apis/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). |
230
 
231
  ## Response Type
232
 
233
- [`DeleteCustomerResponse`](/doc/models/delete-customer-response.md)
234
 
235
  ## Example Usage
236
 
237
  ```php
238
  $customerId = 'customer_id8';
239
- $version = 172;
240
 
241
- $apiResponse = $customersApi->deleteCustomer($customerId, $version);
242
 
243
  if ($apiResponse->isSuccess()) {
244
  $deleteCustomerResponse = $apiResponse->getResult();
@@ -268,7 +247,7 @@ function retrieveCustomer(string $customerId): ApiResponse
268
 
269
  ## Response Type
270
 
271
- [`RetrieveCustomerResponse`](/doc/models/retrieve-customer-response.md)
272
 
273
  ## Example Usage
274
 
@@ -297,7 +276,7 @@ As a best practice, you should include the `version` field in the request to ena
297
 
298
  To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
299
 
300
- You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](/doc/apis/cards.md) or [Gift Cards API](/doc/apis/gift-cards.md).
301
 
302
  ```php
303
  function updateCustomer(string $customerId, UpdateCustomerRequest $body): ApiResponse
@@ -308,21 +287,17 @@ function updateCustomer(string $customerId, UpdateCustomerRequest $body): ApiRes
308
  | Parameter | Type | Tags | Description |
309
  | --- | --- | --- | --- |
310
  | `customerId` | `string` | Template, Required | The ID of the customer to update. |
311
- | `body` | [`UpdateCustomerRequest`](/doc/models/update-customer-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
312
 
313
  ## Response Type
314
 
315
- [`UpdateCustomerResponse`](/doc/models/update-customer-response.md)
316
 
317
  ## Example Usage
318
 
319
  ```php
320
  $customerId = 'customer_id8';
321
  $body = new Models\UpdateCustomerRequest;
322
- $body->setGivenName('given_name8');
323
- $body->setFamilyName('family_name0');
324
- $body->setCompanyName('company_name2');
325
- $body->setNickname('nickname2');
326
  $body->setEmailAddress('New.Amelia.Earhart@example.com');
327
  $body->setPhoneNumber('');
328
  $body->setNote('updated customer note');
@@ -361,11 +336,11 @@ function createCustomerCard(string $customerId, CreateCustomerCardRequest $body)
361
  | Parameter | Type | Tags | Description |
362
  | --- | --- | --- | --- |
363
  | `customerId` | `string` | Template, Required | The Square ID of the customer profile the card is linked to. |
364
- | `body` | [`CreateCustomerCardRequest`](/doc/models/create-customer-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
365
 
366
  ## Response Type
367
 
368
- [`CreateCustomerCardResponse`](/doc/models/create-customer-card-response.md)
369
 
370
  ## Example Usage
371
 
@@ -378,14 +353,11 @@ $body = new Models\CreateCustomerCardRequest(
378
  $body->setBillingAddress(new Models\Address);
379
  $body->getBillingAddress()->setAddressLine1('500 Electric Ave');
380
  $body->getBillingAddress()->setAddressLine2('Suite 600');
381
- $body->getBillingAddress()->setAddressLine3('address_line_38');
382
  $body->getBillingAddress()->setLocality('New York');
383
- $body->getBillingAddress()->setSublocality('sublocality2');
384
  $body->getBillingAddress()->setAdministrativeDistrictLevel1('NY');
385
  $body->getBillingAddress()->setPostalCode('10003');
386
  $body->getBillingAddress()->setCountry(Models\Country::US);
387
  $body->setCardholderName('Amelia Earhart');
388
- $body->setVerificationToken('verification_token0');
389
 
390
  $apiResponse = $customersApi->createCustomerCard($customerId, $body);
391
 
@@ -420,7 +392,7 @@ function deleteCustomerCard(string $customerId, string $cardId): ApiResponse
420
 
421
  ## Response Type
422
 
423
- [`DeleteCustomerCardResponse`](/doc/models/delete-customer-card-response.md)
424
 
425
  ## Example Usage
426
 
@@ -462,7 +434,7 @@ function removeGroupFromCustomer(string $customerId, string $groupId): ApiRespon
462
 
463
  ## Response Type
464
 
465
- [`RemoveGroupFromCustomerResponse`](/doc/models/remove-group-from-customer-response.md)
466
 
467
  ## Example Usage
468
 
@@ -504,7 +476,7 @@ function addGroupToCustomer(string $customerId, string $groupId): ApiResponse
504
 
505
  ## Response Type
506
 
507
- [`AddGroupToCustomerResponse`](/doc/models/add-group-to-customer-response.md)
508
 
509
  ## Example Usage
510
 
10
 
11
  ## Methods
12
 
13
+ * [List Customers](../../doc/apis/customers.md#list-customers)
14
+ * [Create Customer](../../doc/apis/customers.md#create-customer)
15
+ * [Search Customers](../../doc/apis/customers.md#search-customers)
16
+ * [Delete Customer](../../doc/apis/customers.md#delete-customer)
17
+ * [Retrieve Customer](../../doc/apis/customers.md#retrieve-customer)
18
+ * [Update Customer](../../doc/apis/customers.md#update-customer)
19
+ * [Create Customer Card](../../doc/apis/customers.md#create-customer-card)
20
+ * [Delete Customer Card](../../doc/apis/customers.md#delete-customer-card)
21
+ * [Remove Group From Customer](../../doc/apis/customers.md#remove-group-from-customer)
22
+ * [Add Group to Customer](../../doc/apis/customers.md#add-group-to-customer)
23
 
24
 
25
  # List Customers
43
 
44
  | Parameter | Type | Tags | Description |
45
  | --- | --- | --- | --- |
46
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for your original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
47
+ | `limit` | `?int` | Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.<br>If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
48
+ | `sortField` | [`?string (CustomerSortField)`](../../doc/models/customer-sort-field.md) | Query, Optional | Indicates how customers should be sorted.<br><br>The default value is `DEFAULT`. |
49
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | Indicates whether customers should be sorted in ascending (`ASC`) or<br>descending (`DESC`) order.<br><br>The default value is `ASC`. |
50
 
51
  ## Response Type
52
 
53
+ [`ListCustomersResponse`](../../doc/models/list-customers-response.md)
54
 
55
  ## Example Usage
56
 
57
  ```php
58
+ $apiResponse = $customersApi->listCustomers();
 
 
 
 
 
59
 
60
  if ($apiResponse->isSuccess()) {
61
  $listCustomersResponse = $apiResponse->getResult();
90
 
91
  | Parameter | Type | Tags | Description |
92
  | --- | --- | --- | --- |
93
+ | `body` | [`CreateCustomerRequest`](../../doc/models/create-customer-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
94
 
95
  ## Response Type
96
 
97
+ [`CreateCustomerResponse`](../../doc/models/create-customer-response.md)
98
 
99
  ## Example Usage
100
 
101
  ```php
102
  $body = new Models\CreateCustomerRequest;
 
103
  $body->setGivenName('Amelia');
104
  $body->setFamilyName('Earhart');
 
 
105
  $body->setEmailAddress('Amelia.Earhart@example.com');
106
  $body->setAddress(new Models\Address);
107
  $body->getAddress()->setAddressLine1('500 Electric Ave');
108
  $body->getAddress()->setAddressLine2('Suite 600');
 
109
  $body->getAddress()->setLocality('New York');
 
110
  $body->getAddress()->setAdministrativeDistrictLevel1('NY');
111
  $body->getAddress()->setPostalCode('10003');
112
  $body->getAddress()->setCountry(Models\Country::US);
148
 
149
  | Parameter | Type | Tags | Description |
150
  | --- | --- | --- | --- |
151
+ | `body` | [`SearchCustomersRequest`](../../doc/models/search-customers-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
152
 
153
  ## Response Type
154
 
155
+ [`SearchCustomersResponse`](../../doc/models/search-customers-response.md)
156
 
157
  ## Example Usage
158
 
159
  ```php
160
  $body = new Models\SearchCustomersRequest;
 
161
  $body->setLimit(2);
162
  $body->setQuery(new Models\CustomerQuery);
163
  $body->getQuery()->setFilter(new Models\CustomerFilter);
167
  $body->getQuery()->getFilter()->setCreatedAt(new Models\TimeRange);
168
  $body->getQuery()->getFilter()->getCreatedAt()->setStartAt('2018-01-01T00:00:00-00:00');
169
  $body->getQuery()->getFilter()->getCreatedAt()->setEndAt('2018-02-01T00:00:00-00:00');
 
 
 
170
  $body->getQuery()->getFilter()->setEmailAddress(new Models\CustomerTextFilter);
 
171
  $body->getQuery()->getFilter()->getEmailAddress()->setFuzzy('example.com');
 
 
 
172
  $body->getQuery()->getFilter()->setGroupIds(new Models\FilterValue);
173
  $body->getQuery()->getFilter()->getGroupIds()->setAll(['545AXB44B4XXWMVQ4W8SBT3HHF']);
 
 
174
  $body->getQuery()->setSort(new Models\CustomerSort);
175
  $body->getQuery()->getSort()->setField(Models\CustomerSortField::CREATED_AT);
176
  $body->getQuery()->getSort()->setOrder(Models\SortOrder::ASC);
206
  | Parameter | Type | Tags | Description |
207
  | --- | --- | --- | --- |
208
  | `customerId` | `string` | Template, Required | The ID of the customer to delete. |
209
+ | `version` | `?int` | Query, Optional | The current version of the customer profile.<br><br>As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile). |
210
 
211
  ## Response Type
212
 
213
+ [`DeleteCustomerResponse`](../../doc/models/delete-customer-response.md)
214
 
215
  ## Example Usage
216
 
217
  ```php
218
  $customerId = 'customer_id8';
 
219
 
220
+ $apiResponse = $customersApi->deleteCustomer($customerId);
221
 
222
  if ($apiResponse->isSuccess()) {
223
  $deleteCustomerResponse = $apiResponse->getResult();
247
 
248
  ## Response Type
249
 
250
+ [`RetrieveCustomerResponse`](../../doc/models/retrieve-customer-response.md)
251
 
252
  ## Example Usage
253
 
276
 
277
  To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
278
 
279
+ You cannot use this endpoint to change cards on file. To make changes, use the [Cards API](../../doc/apis/cards.md) or [Gift Cards API](../../doc/apis/gift-cards.md).
280
 
281
  ```php
282
  function updateCustomer(string $customerId, UpdateCustomerRequest $body): ApiResponse
287
  | Parameter | Type | Tags | Description |
288
  | --- | --- | --- | --- |
289
  | `customerId` | `string` | Template, Required | The ID of the customer to update. |
290
+ | `body` | [`UpdateCustomerRequest`](../../doc/models/update-customer-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
291
 
292
  ## Response Type
293
 
294
+ [`UpdateCustomerResponse`](../../doc/models/update-customer-response.md)
295
 
296
  ## Example Usage
297
 
298
  ```php
299
  $customerId = 'customer_id8';
300
  $body = new Models\UpdateCustomerRequest;
 
 
 
 
301
  $body->setEmailAddress('New.Amelia.Earhart@example.com');
302
  $body->setPhoneNumber('');
303
  $body->setNote('updated customer note');
336
  | Parameter | Type | Tags | Description |
337
  | --- | --- | --- | --- |
338
  | `customerId` | `string` | Template, Required | The Square ID of the customer profile the card is linked to. |
339
+ | `body` | [`CreateCustomerCardRequest`](../../doc/models/create-customer-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
340
 
341
  ## Response Type
342
 
343
+ [`CreateCustomerCardResponse`](../../doc/models/create-customer-card-response.md)
344
 
345
  ## Example Usage
346
 
353
  $body->setBillingAddress(new Models\Address);
354
  $body->getBillingAddress()->setAddressLine1('500 Electric Ave');
355
  $body->getBillingAddress()->setAddressLine2('Suite 600');
 
356
  $body->getBillingAddress()->setLocality('New York');
 
357
  $body->getBillingAddress()->setAdministrativeDistrictLevel1('NY');
358
  $body->getBillingAddress()->setPostalCode('10003');
359
  $body->getBillingAddress()->setCountry(Models\Country::US);
360
  $body->setCardholderName('Amelia Earhart');
 
361
 
362
  $apiResponse = $customersApi->createCustomerCard($customerId, $body);
363
 
392
 
393
  ## Response Type
394
 
395
+ [`DeleteCustomerCardResponse`](../../doc/models/delete-customer-card-response.md)
396
 
397
  ## Example Usage
398
 
434
 
435
  ## Response Type
436
 
437
+ [`RemoveGroupFromCustomerResponse`](../../doc/models/remove-group-from-customer-response.md)
438
 
439
  ## Example Usage
440
 
476
 
477
  ## Response Type
478
 
479
+ [`AddGroupToCustomerResponse`](../../doc/models/add-group-to-customer-response.md)
480
 
481
  ## Example Usage
482
 
vendor/square/square/doc/apis/devices.md CHANGED
@@ -10,9 +10,9 @@ $devicesApi = $client->getDevicesApi();
10
 
11
  ## Methods
12
 
13
- * [List Device Codes](/doc/apis/devices.md#list-device-codes)
14
- * [Create Device Code](/doc/apis/devices.md#create-device-code)
15
- * [Get Device Code](/doc/apis/devices.md#get-device-code)
16
 
17
 
18
  # List Device Codes
@@ -34,22 +34,17 @@ function listDeviceCodes(
34
  | --- | --- | --- | --- |
35
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. |
36
  | `locationId` | `?string` | Query, Optional | If specified, only returns DeviceCodes of the specified location.<br>Returns DeviceCodes of all locations if empty. |
37
- | `productType` | [`?string (ProductType)`](/doc/models/product-type.md) | Query, Optional | If specified, only returns DeviceCodes targeting the specified product type.<br>Returns DeviceCodes of all product types if empty. |
38
- | `status` | [`?string (DeviceCodeStatus)`](/doc/models/device-code-status.md) | Query, Optional | If specified, returns DeviceCodes with the specified statuses.<br>Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. |
39
 
40
  ## Response Type
41
 
42
- [`ListDeviceCodesResponse`](/doc/models/list-device-codes-response.md)
43
 
44
  ## Example Usage
45
 
46
  ```php
47
- $cursor = 'cursor6';
48
- $locationId = 'location_id4';
49
- $productType = Models\ProductType::TERMINAL_API;
50
- $status = Models\DeviceCodeStatus::UNKNOWN;
51
-
52
- $apiResponse = $devicesApi->listDeviceCodes($cursor, $locationId, $productType, $status);
53
 
54
  if ($apiResponse->isSuccess()) {
55
  $listDeviceCodesResponse = $apiResponse->getResult();
@@ -76,21 +71,18 @@ function createDeviceCode(CreateDeviceCodeRequest $body): ApiResponse
76
 
77
  | Parameter | Type | Tags | Description |
78
  | --- | --- | --- | --- |
79
- | `body` | [`CreateDeviceCodeRequest`](/doc/models/create-device-code-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
80
 
81
  ## Response Type
82
 
83
- [`CreateDeviceCodeResponse`](/doc/models/create-device-code-response.md)
84
 
85
  ## Example Usage
86
 
87
  ```php
88
  $body_idempotencyKey = '01bb00a6-0c86-4770-94ed-f5fca973cd56';
89
  $body_deviceCode = new Models\DeviceCode;
90
- $body_deviceCode->setId('id0');
91
  $body_deviceCode->setName('Counter 1');
92
- $body_deviceCode->setCode('code8');
93
- $body_deviceCode->setDeviceId('device_id6');
94
  $body_deviceCode->setLocationId('B5E4484SHHNYH');
95
  $body = new Models\CreateDeviceCodeRequest(
96
  $body_idempotencyKey,
@@ -127,7 +119,7 @@ function getDeviceCode(string $id): ApiResponse
127
 
128
  ## Response Type
129
 
130
- [`GetDeviceCodeResponse`](/doc/models/get-device-code-response.md)
131
 
132
  ## Example Usage
133
 
10
 
11
  ## Methods
12
 
13
+ * [List Device Codes](../../doc/apis/devices.md#list-device-codes)
14
+ * [Create Device Code](../../doc/apis/devices.md#create-device-code)
15
+ * [Get Device Code](../../doc/apis/devices.md#get-device-code)
16
 
17
 
18
  # List Device Codes
34
  | --- | --- | --- | --- |
35
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. |
36
  | `locationId` | `?string` | Query, Optional | If specified, only returns DeviceCodes of the specified location.<br>Returns DeviceCodes of all locations if empty. |
37
+ | `productType` | [`?string (ProductType)`](../../doc/models/product-type.md) | Query, Optional | If specified, only returns DeviceCodes targeting the specified product type.<br>Returns DeviceCodes of all product types if empty. |
38
+ | `status` | [`?string (DeviceCodeStatus)`](../../doc/models/device-code-status.md) | Query, Optional | If specified, returns DeviceCodes with the specified statuses.<br>Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty. |
39
 
40
  ## Response Type
41
 
42
+ [`ListDeviceCodesResponse`](../../doc/models/list-device-codes-response.md)
43
 
44
  ## Example Usage
45
 
46
  ```php
47
+ $apiResponse = $devicesApi->listDeviceCodes();
 
 
 
 
 
48
 
49
  if ($apiResponse->isSuccess()) {
50
  $listDeviceCodesResponse = $apiResponse->getResult();
71
 
72
  | Parameter | Type | Tags | Description |
73
  | --- | --- | --- | --- |
74
+ | `body` | [`CreateDeviceCodeRequest`](../../doc/models/create-device-code-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
75
 
76
  ## Response Type
77
 
78
+ [`CreateDeviceCodeResponse`](../../doc/models/create-device-code-response.md)
79
 
80
  ## Example Usage
81
 
82
  ```php
83
  $body_idempotencyKey = '01bb00a6-0c86-4770-94ed-f5fca973cd56';
84
  $body_deviceCode = new Models\DeviceCode;
 
85
  $body_deviceCode->setName('Counter 1');
 
 
86
  $body_deviceCode->setLocationId('B5E4484SHHNYH');
87
  $body = new Models\CreateDeviceCodeRequest(
88
  $body_idempotencyKey,
119
 
120
  ## Response Type
121
 
122
+ [`GetDeviceCodeResponse`](../../doc/models/get-device-code-response.md)
123
 
124
  ## Example Usage
125
 
vendor/square/square/doc/apis/disputes.md CHANGED
@@ -10,15 +10,15 @@ $disputesApi = $client->getDisputesApi();
10
 
11
  ## Methods
12
 
13
- * [List Disputes](/doc/apis/disputes.md#list-disputes)
14
- * [Retrieve Dispute](/doc/apis/disputes.md#retrieve-dispute)
15
- * [Accept Dispute](/doc/apis/disputes.md#accept-dispute)
16
- * [List Dispute Evidence](/doc/apis/disputes.md#list-dispute-evidence)
17
- * [Create Dispute Evidence File](/doc/apis/disputes.md#create-dispute-evidence-file)
18
- * [Create Dispute Evidence Text](/doc/apis/disputes.md#create-dispute-evidence-text)
19
- * [Delete Dispute Evidence](/doc/apis/disputes.md#delete-dispute-evidence)
20
- * [Retrieve Dispute Evidence](/doc/apis/disputes.md#retrieve-dispute-evidence)
21
- * [Submit Evidence](/doc/apis/disputes.md#submit-evidence)
22
 
23
 
24
  # List Disputes
@@ -34,21 +34,17 @@ function listDisputes(?string $cursor = null, ?string $states = null, ?string $l
34
  | Parameter | Type | Tags | Description |
35
  | --- | --- | --- | --- |
36
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
37
- | `states` | [`?string (DisputeState)`](/doc/models/dispute-state.md) | Query, Optional | The dispute states to filter the result.<br>If not specified, the endpoint returns all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`,<br>or `LOST`). |
38
  | `locationId` | `?string` | Query, Optional | The ID of the location for which to return a list of disputes. If not specified, the endpoint returns<br>all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`) associated with all locations. |
39
 
40
  ## Response Type
41
 
42
- [`ListDisputesResponse`](/doc/models/list-disputes-response.md)
43
 
44
  ## Example Usage
45
 
46
  ```php
47
- $cursor = 'cursor6';
48
- $states = Models\DisputeState::EVIDENCE_REQUIRED;
49
- $locationId = 'location_id4';
50
-
51
- $apiResponse = $disputesApi->listDisputes($cursor, $states, $locationId);
52
 
53
  if ($apiResponse->isSuccess()) {
54
  $listDisputesResponse = $apiResponse->getResult();
@@ -78,7 +74,7 @@ function retrieveDispute(string $disputeId): ApiResponse
78
 
79
  ## Response Type
80
 
81
- [`RetrieveDisputeResponse`](/doc/models/retrieve-dispute-response.md)
82
 
83
  ## Example Usage
84
 
@@ -119,7 +115,7 @@ function acceptDispute(string $disputeId): ApiResponse
119
 
120
  ## Response Type
121
 
122
- [`AcceptDisputeResponse`](/doc/models/accept-dispute-response.md)
123
 
124
  ## Example Usage
125
 
@@ -157,15 +153,14 @@ function listDisputeEvidence(string $disputeId, ?string $cursor = null): ApiResp
157
 
158
  ## Response Type
159
 
160
- [`ListDisputeEvidenceResponse`](/doc/models/list-dispute-evidence-response.md)
161
 
162
  ## Example Usage
163
 
164
  ```php
165
  $disputeId = 'dispute_id2';
166
- $cursor = 'cursor6';
167
 
168
- $apiResponse = $disputesApi->listDisputeEvidence($disputeId, $cursor);
169
 
170
  if ($apiResponse->isSuccess()) {
171
  $listDisputeEvidenceResponse = $apiResponse->getResult();
@@ -188,7 +183,7 @@ multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats
188
  function createDisputeEvidenceFile(
189
  string $disputeId,
190
  ?CreateDisputeEvidenceFileRequest $request = null,
191
- ?\Square\Utils\FileWrapper $imageFile = null
192
  ): ApiResponse
193
  ```
194
 
@@ -197,26 +192,19 @@ function createDisputeEvidenceFile(
197
  | Parameter | Type | Tags | Description |
198
  | --- | --- | --- | --- |
199
  | `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. |
200
- | `request` | [`?CreateDisputeEvidenceFileRequest`](/doc/models/create-dispute-evidence-file-request.md) | Form, Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. |
201
- | `imageFile` | `?\Square\Utils\FileWrapper` | Form, Optional | - |
202
 
203
  ## Response Type
204
 
205
- [`CreateDisputeEvidenceFileResponse`](/doc/models/create-dispute-evidence-file-response.md)
206
 
207
  ## Example Usage
208
 
209
  ```php
210
  $disputeId = 'dispute_id2';
211
- $request_idempotencyKey = 'idempotency_key2';
212
- $request = new Models\CreateDisputeEvidenceFileRequest(
213
- $request_idempotencyKey
214
- );
215
- $request->setEvidenceType(Models\DisputeEvidenceType::REBUTTAL_EXPLANATION);
216
- $request->setContentType('content_type0');
217
- $imageFile = 'dummy_file';
218
 
219
- $apiResponse = $disputesApi->createDisputeEvidenceFile($disputeId, $request, $imageFile);
220
 
221
  if ($apiResponse->isSuccess()) {
222
  $createDisputeEvidenceFileResponse = $apiResponse->getResult();
@@ -243,11 +231,11 @@ function createDisputeEvidenceText(string $disputeId, CreateDisputeEvidenceTextR
243
  | Parameter | Type | Tags | Description |
244
  | --- | --- | --- | --- |
245
  | `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. |
246
- | `body` | [`CreateDisputeEvidenceTextRequest`](/doc/models/create-dispute-evidence-text-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
247
 
248
  ## Response Type
249
 
250
- [`CreateDisputeEvidenceTextResponse`](/doc/models/create-dispute-evidence-text-response.md)
251
 
252
  ## Example Usage
253
 
@@ -280,7 +268,7 @@ if ($apiResponse->isSuccess()) {
280
  Removes specified evidence from a dispute.
281
 
282
  Square does not send the bank any evidence that is removed. Also, you cannot remove evidence after
283
- submitting it to the bank using [SubmitEvidence](/doc/apis/disputes.md#submit-evidence).
284
 
285
  ```php
286
  function deleteDisputeEvidence(string $disputeId, string $evidenceId): ApiResponse
@@ -295,7 +283,7 @@ function deleteDisputeEvidence(string $disputeId, string $evidenceId): ApiRespon
295
 
296
  ## Response Type
297
 
298
- [`DeleteDisputeEvidenceResponse`](/doc/models/delete-dispute-evidence-response.md)
299
 
300
  ## Example Usage
301
 
@@ -337,7 +325,7 @@ function retrieveDisputeEvidence(string $disputeId, string $evidenceId): ApiResp
337
 
338
  ## Response Type
339
 
340
- [`RetrieveDisputeEvidenceResponse`](/doc/models/retrieve-dispute-evidence-response.md)
341
 
342
  ## Example Usage
343
 
@@ -364,8 +352,8 @@ if ($apiResponse->isSuccess()) {
364
  Submits evidence to the cardholder's bank.
365
 
366
  Before submitting evidence, Square compiles all available evidence. This includes evidence uploaded
367
- using the [CreateDisputeEvidenceFile](/doc/apis/disputes.md#create-dispute-evidence-file) and
368
- [CreateDisputeEvidenceText](/doc/apis/disputes.md#create-dispute-evidence-text) endpoints and
369
  evidence automatically provided by Square, when available.
370
 
371
  ```php
@@ -380,7 +368,7 @@ function submitEvidence(string $disputeId): ApiResponse
380
 
381
  ## Response Type
382
 
383
- [`SubmitEvidenceResponse`](/doc/models/submit-evidence-response.md)
384
 
385
  ## Example Usage
386
 
10
 
11
  ## Methods
12
 
13
+ * [List Disputes](../../doc/apis/disputes.md#list-disputes)
14
+ * [Retrieve Dispute](../../doc/apis/disputes.md#retrieve-dispute)
15
+ * [Accept Dispute](../../doc/apis/disputes.md#accept-dispute)
16
+ * [List Dispute Evidence](../../doc/apis/disputes.md#list-dispute-evidence)
17
+ * [Create Dispute Evidence File](../../doc/apis/disputes.md#create-dispute-evidence-file)
18
+ * [Create Dispute Evidence Text](../../doc/apis/disputes.md#create-dispute-evidence-text)
19
+ * [Delete Dispute Evidence](../../doc/apis/disputes.md#delete-dispute-evidence)
20
+ * [Retrieve Dispute Evidence](../../doc/apis/disputes.md#retrieve-dispute-evidence)
21
+ * [Submit Evidence](../../doc/apis/disputes.md#submit-evidence)
22
 
23
 
24
  # List Disputes
34
  | Parameter | Type | Tags | Description |
35
  | --- | --- | --- | --- |
36
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
37
+ | `states` | [`?string (DisputeState)`](../../doc/models/dispute-state.md) | Query, Optional | The dispute states to filter the result.<br>If not specified, the endpoint returns all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`,<br>or `LOST`). |
38
  | `locationId` | `?string` | Query, Optional | The ID of the location for which to return a list of disputes. If not specified, the endpoint returns<br>all open disputes (the dispute status is not `INQUIRY_CLOSED`, `WON`, or `LOST`) associated with all locations. |
39
 
40
  ## Response Type
41
 
42
+ [`ListDisputesResponse`](../../doc/models/list-disputes-response.md)
43
 
44
  ## Example Usage
45
 
46
  ```php
47
+ $apiResponse = $disputesApi->listDisputes();
 
 
 
 
48
 
49
  if ($apiResponse->isSuccess()) {
50
  $listDisputesResponse = $apiResponse->getResult();
74
 
75
  ## Response Type
76
 
77
+ [`RetrieveDisputeResponse`](../../doc/models/retrieve-dispute-response.md)
78
 
79
  ## Example Usage
80
 
115
 
116
  ## Response Type
117
 
118
+ [`AcceptDisputeResponse`](../../doc/models/accept-dispute-response.md)
119
 
120
  ## Example Usage
121
 
153
 
154
  ## Response Type
155
 
156
+ [`ListDisputeEvidenceResponse`](../../doc/models/list-dispute-evidence-response.md)
157
 
158
  ## Example Usage
159
 
160
  ```php
161
  $disputeId = 'dispute_id2';
 
162
 
163
+ $apiResponse = $disputesApi->listDisputeEvidence($disputeId);
164
 
165
  if ($apiResponse->isSuccess()) {
166
  $listDisputeEvidenceResponse = $apiResponse->getResult();
183
  function createDisputeEvidenceFile(
184
  string $disputeId,
185
  ?CreateDisputeEvidenceFileRequest $request = null,
186
+ ?FileWrapper $imageFile = null
187
  ): ApiResponse
188
  ```
189
 
192
  | Parameter | Type | Tags | Description |
193
  | --- | --- | --- | --- |
194
  | `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. |
195
+ | `request` | [`?CreateDisputeEvidenceFileRequest`](../../doc/models/create-dispute-evidence-file-request.md) | Form, Optional | Defines the parameters for a `CreateDisputeEvidenceFile` request. |
196
+ | `imageFile` | `?FileWrapper` | Form, Optional | - |
197
 
198
  ## Response Type
199
 
200
+ [`CreateDisputeEvidenceFileResponse`](../../doc/models/create-dispute-evidence-file-response.md)
201
 
202
  ## Example Usage
203
 
204
  ```php
205
  $disputeId = 'dispute_id2';
 
 
 
 
 
 
 
206
 
207
+ $apiResponse = $disputesApi->createDisputeEvidenceFile($disputeId);
208
 
209
  if ($apiResponse->isSuccess()) {
210
  $createDisputeEvidenceFileResponse = $apiResponse->getResult();
231
  | Parameter | Type | Tags | Description |
232
  | --- | --- | --- | --- |
233
  | `disputeId` | `string` | Template, Required | The ID of the dispute you want to upload evidence for. |
234
+ | `body` | [`CreateDisputeEvidenceTextRequest`](../../doc/models/create-dispute-evidence-text-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
235
 
236
  ## Response Type
237
 
238
+ [`CreateDisputeEvidenceTextResponse`](../../doc/models/create-dispute-evidence-text-response.md)
239
 
240
  ## Example Usage
241
 
268
  Removes specified evidence from a dispute.
269
 
270
  Square does not send the bank any evidence that is removed. Also, you cannot remove evidence after
271
+ submitting it to the bank using [SubmitEvidence](../../doc/apis/disputes.md#submit-evidence).
272
 
273
  ```php
274
  function deleteDisputeEvidence(string $disputeId, string $evidenceId): ApiResponse
283
 
284
  ## Response Type
285
 
286
+ [`DeleteDisputeEvidenceResponse`](../../doc/models/delete-dispute-evidence-response.md)
287
 
288
  ## Example Usage
289
 
325
 
326
  ## Response Type
327
 
328
+ [`RetrieveDisputeEvidenceResponse`](../../doc/models/retrieve-dispute-evidence-response.md)
329
 
330
  ## Example Usage
331
 
352
  Submits evidence to the cardholder's bank.
353
 
354
  Before submitting evidence, Square compiles all available evidence. This includes evidence uploaded
355
+ using the [CreateDisputeEvidenceFile](../../doc/apis/disputes.md#create-dispute-evidence-file) and
356
+ [CreateDisputeEvidenceText](../../doc/apis/disputes.md#create-dispute-evidence-text) endpoints and
357
  evidence automatically provided by Square, when available.
358
 
359
  ```php
368
 
369
  ## Response Type
370
 
371
+ [`SubmitEvidenceResponse`](../../doc/models/submit-evidence-response.md)
372
 
373
  ## Example Usage
374
 
vendor/square/square/doc/apis/employees.md CHANGED
@@ -10,8 +10,8 @@ $employeesApi = $client->getEmployeesApi();
10
 
11
  ## Methods
12
 
13
- * [List Employees](/doc/apis/employees.md#list-employees)
14
- * [Retrieve Employee](/doc/apis/employees.md#retrieve-employee)
15
 
16
 
17
  # List Employees
@@ -34,23 +34,18 @@ function listEmployees(
34
  | Parameter | Type | Tags | Description |
35
  | --- | --- | --- | --- |
36
  | `locationId` | `?string` | Query, Optional | - |
37
- | `status` | [`?string (EmployeeStatus)`](/doc/models/employee-status.md) | Query, Optional | Specifies the EmployeeStatus to filter the employee by. |
38
  | `limit` | `?int` | Query, Optional | The number of employees to be returned on each page. |
39
  | `cursor` | `?string` | Query, Optional | The token required to retrieve the specified page of results. |
40
 
41
  ## Response Type
42
 
43
- [`ListEmployeesResponse`](/doc/models/list-employees-response.md)
44
 
45
  ## Example Usage
46
 
47
  ```php
48
- $locationId = 'location_id4';
49
- $status = Models\EmployeeStatus::ACTIVE;
50
- $limit = 172;
51
- $cursor = 'cursor6';
52
-
53
- $apiResponse = $employeesApi->listEmployees($locationId, $status, $limit, $cursor);
54
 
55
  if ($apiResponse->isSuccess()) {
56
  $listEmployeesResponse = $apiResponse->getResult();
@@ -82,7 +77,7 @@ function retrieveEmployee(string $id): ApiResponse
82
 
83
  ## Response Type
84
 
85
- [`RetrieveEmployeeResponse`](/doc/models/retrieve-employee-response.md)
86
 
87
  ## Example Usage
88
 
10
 
11
  ## Methods
12
 
13
+ * [List Employees](../../doc/apis/employees.md#list-employees)
14
+ * [Retrieve Employee](../../doc/apis/employees.md#retrieve-employee)
15
 
16
 
17
  # List Employees
34
  | Parameter | Type | Tags | Description |
35
  | --- | --- | --- | --- |
36
  | `locationId` | `?string` | Query, Optional | - |
37
+ | `status` | [`?string (EmployeeStatus)`](../../doc/models/employee-status.md) | Query, Optional | Specifies the EmployeeStatus to filter the employee by. |
38
  | `limit` | `?int` | Query, Optional | The number of employees to be returned on each page. |
39
  | `cursor` | `?string` | Query, Optional | The token required to retrieve the specified page of results. |
40
 
41
  ## Response Type
42
 
43
+ [`ListEmployeesResponse`](../../doc/models/list-employees-response.md)
44
 
45
  ## Example Usage
46
 
47
  ```php
48
+ $apiResponse = $employeesApi->listEmployees();
 
 
 
 
 
49
 
50
  if ($apiResponse->isSuccess()) {
51
  $listEmployeesResponse = $apiResponse->getResult();
77
 
78
  ## Response Type
79
 
80
+ [`RetrieveEmployeeResponse`](../../doc/models/retrieve-employee-response.md)
81
 
82
  ## Example Usage
83
 
vendor/square/square/doc/apis/gift-card-activities.md CHANGED
@@ -10,8 +10,8 @@ $giftCardActivitiesApi = $client->getGiftCardActivitiesApi();
10
 
11
  ## Methods
12
 
13
- * [List Gift Card Activities](/doc/apis/gift-card-activities.md#list-gift-card-activities)
14
- * [Create Gift Card Activity](/doc/apis/gift-card-activities.md#create-gift-card-activity)
15
 
16
 
17
  # List Gift Card Activities
@@ -38,32 +38,23 @@ function listGiftCardActivities(
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
- | `giftCardId` | `?string` | Query, Optional | If you provide a gift card ID, the endpoint returns activities that belong<br>to the specified gift card. Otherwise, the endpoint returns all gift card activities for<br>the seller. |
42
- | `type` | `?string` | Query, Optional | If you provide a type, the endpoint returns gift card activities of this type.<br>Otherwise, the endpoint returns all types of gift card activities. |
43
- | `locationId` | `?string` | Query, Optional | If you provide a location ID, the endpoint returns gift card activities for that location.<br>Otherwise, the endpoint returns gift card activities for all locations. |
44
- | `beginTime` | `?string` | Query, Optional | The timestamp for the beginning of the reporting period, in RFC 3339 format.<br>Inclusive. Default: The current time minus one year. |
45
- | `endTime` | `?string` | Query, Optional | The timestamp for the end of the reporting period, in RFC 3339 format.<br>Inclusive. Default: The current time. |
46
- | `limit` | `?int` | Query, Optional | If you provide a limit value, the endpoint returns the specified number<br>of results (or less) per page. A maximum value is 100. The default value is 50. |
47
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If you do not provide the cursor, the call returns the first page of the results. |
48
  | `sortOrder` | `?string` | Query, Optional | The order in which the endpoint returns the activities, based on `created_at`.<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
49
 
50
  ## Response Type
51
 
52
- [`ListGiftCardActivitiesResponse`](/doc/models/list-gift-card-activities-response.md)
53
 
54
  ## Example Usage
55
 
56
  ```php
57
- $giftCardId = 'gift_card_id8';
58
- $type = 'type0';
59
- $locationId = 'location_id4';
60
- $beginTime = 'begin_time2';
61
- $endTime = 'end_time2';
62
- $limit = 172;
63
- $cursor = 'cursor6';
64
- $sortOrder = 'sort_order0';
65
-
66
- $apiResponse = $giftCardActivitiesApi->listGiftCardActivities($giftCardId, $type, $locationId, $beginTime, $endTime, $limit, $cursor, $sortOrder);
67
 
68
  if ($apiResponse->isSuccess()) {
69
  $listGiftCardActivitiesResponse = $apiResponse->getResult();
@@ -79,9 +70,9 @@ if ($apiResponse->isSuccess()) {
79
 
80
  # Create Gift Card Activity
81
 
82
- Creates a gift card activity. For more information, see
83
- [GiftCardActivity](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#giftcardactivity) and
84
- [Using activated gift cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#using-activated-gift-cards).
85
 
86
  ```php
87
  function createGiftCardActivity(CreateGiftCardActivityRequest $body): ApiResponse
@@ -91,11 +82,11 @@ function createGiftCardActivity(CreateGiftCardActivityRequest $body): ApiRespons
91
 
92
  | Parameter | Type | Tags | Description |
93
  | --- | --- | --- | --- |
94
- | `body` | [`CreateGiftCardActivityRequest`](/doc/models/create-gift-card-activity-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
95
 
96
  ## Response Type
97
 
98
- [`CreateGiftCardActivityResponse`](/doc/models/create-gift-card-activity-response.md)
99
 
100
  ## Example Usage
101
 
@@ -107,21 +98,10 @@ $body_giftCardActivity = new Models\GiftCardActivity(
107
  $body_giftCardActivity_type,
108
  $body_giftCardActivity_locationId
109
  );
110
- $body_giftCardActivity->setId('id2');
111
- $body_giftCardActivity->setCreatedAt('created_at0');
112
  $body_giftCardActivity->setGiftCardId('gftc:6d55a72470d940c6ba09c0ab8ad08d20');
113
- $body_giftCardActivity->setGiftCardGan('gift_card_gan8');
114
- $body_giftCardActivity->setGiftCardBalanceMoney(new Models\Money);
115
- $body_giftCardActivity->getGiftCardBalanceMoney()->setAmount(88);
116
- $body_giftCardActivity->getGiftCardBalanceMoney()->setCurrency(Models\Currency::ANG);
117
  $body_giftCardActivity->setActivateActivityDetails(new Models\GiftCardActivityActivate);
118
- $body_giftCardActivity->getActivateActivityDetails()->setAmountMoney(new Models\Money);
119
- $body_giftCardActivity->getActivateActivityDetails()->getAmountMoney()->setAmount(10);
120
- $body_giftCardActivity->getActivateActivityDetails()->getAmountMoney()->setCurrency(Models\Currency::MXV);
121
  $body_giftCardActivity->getActivateActivityDetails()->setOrderId('jJNGHm4gLI6XkFbwtiSLqK72KkAZY');
122
  $body_giftCardActivity->getActivateActivityDetails()->setLineItemUid('eIWl7X0nMuO9Ewbh0ChIx');
123
- $body_giftCardActivity->getActivateActivityDetails()->setReferenceId('reference_id4');
124
- $body_giftCardActivity->getActivateActivityDetails()->setBuyerPaymentInstrumentIds(['buyer_payment_instrument_ids4', 'buyer_payment_instrument_ids5', 'buyer_payment_instrument_ids6']);
125
  $body = new Models\CreateGiftCardActivityRequest(
126
  $body_idempotencyKey,
127
  $body_giftCardActivity
10
 
11
  ## Methods
12
 
13
+ * [List Gift Card Activities](../../doc/apis/gift-card-activities.md#list-gift-card-activities)
14
+ * [Create Gift Card Activity](../../doc/apis/gift-card-activities.md#create-gift-card-activity)
15
 
16
 
17
  # List Gift Card Activities
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
+ | `giftCardId` | `?string` | Query, Optional | If a gift card ID is provided, the endpoint returns activities related<br>to the specified gift card. Otherwise, the endpoint returns all gift card activities for<br>the seller. |
42
+ | `type` | `?string` | Query, Optional | If a [type](../../doc/models/gift-card-activity-type.md) is provided, the endpoint returns gift card activities of the specified type.<br>Otherwise, the endpoint returns all types of gift card activities. |
43
+ | `locationId` | `?string` | Query, Optional | If a location ID is provided, the endpoint returns gift card activities for the specified location.<br>Otherwise, the endpoint returns gift card activities for all locations. |
44
+ | `beginTime` | `?string` | Query, Optional | The timestamp for the beginning of the reporting period, in RFC 3339 format.<br>This start time is inclusive. The default value is the current time minus one year. |
45
+ | `endTime` | `?string` | Query, Optional | The timestamp for the end of the reporting period, in RFC 3339 format.<br>This end time is inclusive. The default value is the current time. |
46
+ | `limit` | `?int` | Query, Optional | If a limit is provided, the endpoint returns the specified number<br>of results (or fewer) per page. The maximum value is 100. The default value is 50.<br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
47
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, the endpoint returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
48
  | `sortOrder` | `?string` | Query, Optional | The order in which the endpoint returns the activities, based on `created_at`.<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
49
 
50
  ## Response Type
51
 
52
+ [`ListGiftCardActivitiesResponse`](../../doc/models/list-gift-card-activities-response.md)
53
 
54
  ## Example Usage
55
 
56
  ```php
57
+ $apiResponse = $giftCardActivitiesApi->listGiftCardActivities();
 
 
 
 
 
 
 
 
 
58
 
59
  if ($apiResponse->isSuccess()) {
60
  $listGiftCardActivitiesResponse = $apiResponse->getResult();
70
 
71
  # Create Gift Card Activity
72
 
73
+ Creates a gift card activity to manage the balance or state of a [gift card](../../doc/models/gift-card.md).
74
+ For example, you create an `ACTIVATE` activity to activate a gift card with an initial balance
75
+ before the gift card can be used.
76
 
77
  ```php
78
  function createGiftCardActivity(CreateGiftCardActivityRequest $body): ApiResponse
82
 
83
  | Parameter | Type | Tags | Description |
84
  | --- | --- | --- | --- |
85
+ | `body` | [`CreateGiftCardActivityRequest`](../../doc/models/create-gift-card-activity-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
86
 
87
  ## Response Type
88
 
89
+ [`CreateGiftCardActivityResponse`](../../doc/models/create-gift-card-activity-response.md)
90
 
91
  ## Example Usage
92
 
98
  $body_giftCardActivity_type,
99
  $body_giftCardActivity_locationId
100
  );
 
 
101
  $body_giftCardActivity->setGiftCardId('gftc:6d55a72470d940c6ba09c0ab8ad08d20');
 
 
 
 
102
  $body_giftCardActivity->setActivateActivityDetails(new Models\GiftCardActivityActivate);
 
 
 
103
  $body_giftCardActivity->getActivateActivityDetails()->setOrderId('jJNGHm4gLI6XkFbwtiSLqK72KkAZY');
104
  $body_giftCardActivity->getActivateActivityDetails()->setLineItemUid('eIWl7X0nMuO9Ewbh0ChIx');
 
 
105
  $body = new Models\CreateGiftCardActivityRequest(
106
  $body_idempotencyKey,
107
  $body_giftCardActivity
vendor/square/square/doc/apis/gift-cards.md CHANGED
@@ -10,13 +10,13 @@ $giftCardsApi = $client->getGiftCardsApi();
10
 
11
  ## Methods
12
 
13
- * [List Gift Cards](/doc/apis/gift-cards.md#list-gift-cards)
14
- * [Create Gift Card](/doc/apis/gift-cards.md#create-gift-card)
15
- * [Retrieve Gift Card From GAN](/doc/apis/gift-cards.md#retrieve-gift-card-from-gan)
16
- * [Retrieve Gift Card From Nonce](/doc/apis/gift-cards.md#retrieve-gift-card-from-nonce)
17
- * [Link Customer to Gift Card](/doc/apis/gift-cards.md#link-customer-to-gift-card)
18
- * [Unlink Customer From Gift Card](/doc/apis/gift-cards.md#unlink-customer-from-gift-card)
19
- * [Retrieve Gift Card](/doc/apis/gift-cards.md#retrieve-gift-card)
20
 
21
 
22
  # List Gift Cards
@@ -38,26 +38,20 @@ function listGiftCards(
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
- | `type` | `?string` | Query, Optional | If a type is provided, gift cards of this type are returned<br>(see [GiftCardType](/doc/models/gift-card-type.md)).<br>If no type is provided, it returns gift cards of all types. |
42
- | `state` | `?string` | Query, Optional | If the state is provided, it returns the gift cards in the specified state<br>(see [GiftCardStatus](/doc/models/gift-card-status.md)).<br>Otherwise, it returns the gift cards of all states. |
43
- | `limit` | `?int` | Query, Optional | If a value is provided, it returns only that number of results per page.<br>The maximum number of results allowed per page is 50. The default value is 30. |
44
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, it returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
45
- | `customerId` | `?string` | Query, Optional | If a value is provided, returns only the gift cards linked to the specified customer |
46
 
47
  ## Response Type
48
 
49
- [`ListGiftCardsResponse`](/doc/models/list-gift-cards-response.md)
50
 
51
  ## Example Usage
52
 
53
  ```php
54
- $type = 'type0';
55
- $state = 'state4';
56
- $limit = 172;
57
- $cursor = 'cursor6';
58
- $customerId = 'customer_id8';
59
-
60
- $apiResponse = $giftCardsApi->listGiftCards($type, $state, $limit, $cursor, $customerId);
61
 
62
  if ($apiResponse->isSuccess()) {
63
  $listGiftCardsResponse = $apiResponse->getResult();
@@ -73,9 +67,9 @@ if ($apiResponse->isSuccess()) {
73
 
74
  # Create Gift Card
75
 
76
- Creates a digital gift card or registers a physical (plastic) gift card. You must activate the gift card before
77
- it can be used for payment. For more information, see
78
- [Selling gift cards](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#selling-square-gift-cards).
79
 
80
  ```php
81
  function createGiftCard(CreateGiftCardRequest $body): ApiResponse
@@ -85,11 +79,11 @@ function createGiftCard(CreateGiftCardRequest $body): ApiResponse
85
 
86
  | Parameter | Type | Tags | Description |
87
  | --- | --- | --- | --- |
88
- | `body` | [`CreateGiftCardRequest`](/doc/models/create-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
89
 
90
  ## Response Type
91
 
92
- [`CreateGiftCardResponse`](/doc/models/create-gift-card-response.md)
93
 
94
  ## Example Usage
95
 
@@ -100,13 +94,6 @@ $body_giftCard_type = Models\GiftCardType::DIGITAL;
100
  $body_giftCard = new Models\GiftCard(
101
  $body_giftCard_type
102
  );
103
- $body_giftCard->setId('id4');
104
- $body_giftCard->setGanSource(Models\GiftCardGANSource::SQUARE);
105
- $body_giftCard->setState(Models\GiftCardStatus::ACTIVE);
106
- $body_giftCard->setBalanceMoney(new Models\Money);
107
- $body_giftCard->getBalanceMoney()->setAmount(2);
108
- $body_giftCard->getBalanceMoney()->setCurrency(Models\Currency::DOP);
109
- $body_giftCard->setGan('gan0');
110
  $body = new Models\CreateGiftCardRequest(
111
  $body_idempotencyKey,
112
  $body_locationId,
@@ -139,11 +126,11 @@ function retrieveGiftCardFromGAN(RetrieveGiftCardFromGANRequest $body): ApiRespo
139
 
140
  | Parameter | Type | Tags | Description |
141
  | --- | --- | --- | --- |
142
- | `body` | [`RetrieveGiftCardFromGANRequest`](/doc/models/retrieve-gift-card-from-gan-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
143
 
144
  ## Response Type
145
 
146
- [`RetrieveGiftCardFromGANResponse`](/doc/models/retrieve-gift-card-from-gan-response.md)
147
 
148
  ## Example Usage
149
 
@@ -169,7 +156,7 @@ if ($apiResponse->isSuccess()) {
169
 
170
  # Retrieve Gift Card From Nonce
171
 
172
- Retrieves a gift card using a nonce (a secure token) that represents the gift card.
173
 
174
  ```php
175
  function retrieveGiftCardFromNonce(RetrieveGiftCardFromNonceRequest $body): ApiResponse
@@ -179,11 +166,11 @@ function retrieveGiftCardFromNonce(RetrieveGiftCardFromNonceRequest $body): ApiR
179
 
180
  | Parameter | Type | Tags | Description |
181
  | --- | --- | --- | --- |
182
- | `body` | [`RetrieveGiftCardFromNonceRequest`](/doc/models/retrieve-gift-card-from-nonce-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
183
 
184
  ## Response Type
185
 
186
- [`RetrieveGiftCardFromNonceResponse`](/doc/models/retrieve-gift-card-from-nonce-response.md)
187
 
188
  ## Example Usage
189
 
@@ -209,7 +196,7 @@ if ($apiResponse->isSuccess()) {
209
 
210
  # Link Customer to Gift Card
211
 
212
- Links a customer to a gift card
213
 
214
  ```php
215
  function linkCustomerToGiftCard(string $giftCardId, LinkCustomerToGiftCardRequest $body): ApiResponse
@@ -219,12 +206,12 @@ function linkCustomerToGiftCard(string $giftCardId, LinkCustomerToGiftCardReques
219
 
220
  | Parameter | Type | Tags | Description |
221
  | --- | --- | --- | --- |
222
- | `giftCardId` | `string` | Template, Required | The ID of the gift card to link. |
223
- | `body` | [`LinkCustomerToGiftCardRequest`](/doc/models/link-customer-to-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
224
 
225
  ## Response Type
226
 
227
- [`LinkCustomerToGiftCardResponse`](/doc/models/link-customer-to-gift-card-response.md)
228
 
229
  ## Example Usage
230
 
@@ -251,7 +238,7 @@ if ($apiResponse->isSuccess()) {
251
 
252
  # Unlink Customer From Gift Card
253
 
254
- Unlinks a customer from a gift card
255
 
256
  ```php
257
  function unlinkCustomerFromGiftCard(string $giftCardId, UnlinkCustomerFromGiftCardRequest $body): ApiResponse
@@ -261,12 +248,12 @@ function unlinkCustomerFromGiftCard(string $giftCardId, UnlinkCustomerFromGiftCa
261
 
262
  | Parameter | Type | Tags | Description |
263
  | --- | --- | --- | --- |
264
- | `giftCardId` | `string` | Template, Required | - |
265
- | `body` | [`UnlinkCustomerFromGiftCardRequest`](/doc/models/unlink-customer-from-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
266
 
267
  ## Response Type
268
 
269
- [`UnlinkCustomerFromGiftCardResponse`](/doc/models/unlink-customer-from-gift-card-response.md)
270
 
271
  ## Example Usage
272
 
@@ -293,7 +280,7 @@ if ($apiResponse->isSuccess()) {
293
 
294
  # Retrieve Gift Card
295
 
296
- Retrieves a gift card using its ID.
297
 
298
  ```php
299
  function retrieveGiftCard(string $id): ApiResponse
@@ -307,7 +294,7 @@ function retrieveGiftCard(string $id): ApiResponse
307
 
308
  ## Response Type
309
 
310
- [`RetrieveGiftCardResponse`](/doc/models/retrieve-gift-card-response.md)
311
 
312
  ## Example Usage
313
 
10
 
11
  ## Methods
12
 
13
+ * [List Gift Cards](../../doc/apis/gift-cards.md#list-gift-cards)
14
+ * [Create Gift Card](../../doc/apis/gift-cards.md#create-gift-card)
15
+ * [Retrieve Gift Card From GAN](../../doc/apis/gift-cards.md#retrieve-gift-card-from-gan)
16
+ * [Retrieve Gift Card From Nonce](../../doc/apis/gift-cards.md#retrieve-gift-card-from-nonce)
17
+ * [Link Customer to Gift Card](../../doc/apis/gift-cards.md#link-customer-to-gift-card)
18
+ * [Unlink Customer From Gift Card](../../doc/apis/gift-cards.md#unlink-customer-from-gift-card)
19
+ * [Retrieve Gift Card](../../doc/apis/gift-cards.md#retrieve-gift-card)
20
 
21
 
22
  # List Gift Cards
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
+ | `type` | `?string` | Query, Optional | If a [type](../../doc/models/gift-card-type.md) is provided, the endpoint returns gift cards of the specified type.<br>Otherwise, the endpoint returns gift cards of all types. |
42
+ | `state` | `?string` | Query, Optional | If a [state](../../doc/models/gift-card-status.md) is provided, the endpoint returns the gift cards in the specified state.<br>Otherwise, the endpoint returns the gift cards of all states. |
43
+ | `limit` | `?int` | Query, Optional | If a limit is provided, the endpoint returns only the specified number of results per page.<br>The maximum value is 50. The default value is 30.<br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
44
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>If a cursor is not provided, the endpoint returns the first page of the results.<br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
45
+ | `customerId` | `?string` | Query, Optional | If a customer ID is provided, the endpoint returns only the gift cards linked to the specified customer. |
46
 
47
  ## Response Type
48
 
49
+ [`ListGiftCardsResponse`](../../doc/models/list-gift-cards-response.md)
50
 
51
  ## Example Usage
52
 
53
  ```php
54
+ $apiResponse = $giftCardsApi->listGiftCards();
 
 
 
 
 
 
55
 
56
  if ($apiResponse->isSuccess()) {
57
  $listGiftCardsResponse = $apiResponse->getResult();
67
 
68
  # Create Gift Card
69
 
70
+ Creates a digital gift card or registers a physical (plastic) gift card. After the gift card
71
+ is created, you must call [CreateGiftCardActivity](../../doc/apis/gift-card-activities.md#create-gift-card-activity)
72
+ to activate the card with an initial balance before it can be used for payment.
73
 
74
  ```php
75
  function createGiftCard(CreateGiftCardRequest $body): ApiResponse
79
 
80
  | Parameter | Type | Tags | Description |
81
  | --- | --- | --- | --- |
82
+ | `body` | [`CreateGiftCardRequest`](../../doc/models/create-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
83
 
84
  ## Response Type
85
 
86
+ [`CreateGiftCardResponse`](../../doc/models/create-gift-card-response.md)
87
 
88
  ## Example Usage
89
 
94
  $body_giftCard = new Models\GiftCard(
95
  $body_giftCard_type
96
  );
 
 
 
 
 
 
 
97
  $body = new Models\CreateGiftCardRequest(
98
  $body_idempotencyKey,
99
  $body_locationId,
126
 
127
  | Parameter | Type | Tags | Description |
128
  | --- | --- | --- | --- |
129
+ | `body` | [`RetrieveGiftCardFromGANRequest`](../../doc/models/retrieve-gift-card-from-gan-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
130
 
131
  ## Response Type
132
 
133
+ [`RetrieveGiftCardFromGANResponse`](../../doc/models/retrieve-gift-card-from-gan-response.md)
134
 
135
  ## Example Usage
136
 
156
 
157
  # Retrieve Gift Card From Nonce
158
 
159
+ Retrieves a gift card using a secure payment token that represents the gift card.
160
 
161
  ```php
162
  function retrieveGiftCardFromNonce(RetrieveGiftCardFromNonceRequest $body): ApiResponse
166
 
167
  | Parameter | Type | Tags | Description |
168
  | --- | --- | --- | --- |
169
+ | `body` | [`RetrieveGiftCardFromNonceRequest`](../../doc/models/retrieve-gift-card-from-nonce-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
170
 
171
  ## Response Type
172
 
173
+ [`RetrieveGiftCardFromNonceResponse`](../../doc/models/retrieve-gift-card-from-nonce-response.md)
174
 
175
  ## Example Usage
176
 
196
 
197
  # Link Customer to Gift Card
198
 
199
+ Links a customer to a gift card, which is also referred to as adding a card on file.
200
 
201
  ```php
202
  function linkCustomerToGiftCard(string $giftCardId, LinkCustomerToGiftCardRequest $body): ApiResponse
206
 
207
  | Parameter | Type | Tags | Description |
208
  | --- | --- | --- | --- |
209
+ | `giftCardId` | `string` | Template, Required | The ID of the gift card to be linked. |
210
+ | `body` | [`LinkCustomerToGiftCardRequest`](../../doc/models/link-customer-to-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
211
 
212
  ## Response Type
213
 
214
+ [`LinkCustomerToGiftCardResponse`](../../doc/models/link-customer-to-gift-card-response.md)
215
 
216
  ## Example Usage
217
 
238
 
239
  # Unlink Customer From Gift Card
240
 
241
+ Unlinks a customer from a gift card, which is also referred to as removing a card on file.
242
 
243
  ```php
244
  function unlinkCustomerFromGiftCard(string $giftCardId, UnlinkCustomerFromGiftCardRequest $body): ApiResponse
248
 
249
  | Parameter | Type | Tags | Description |
250
  | --- | --- | --- | --- |
251
+ | `giftCardId` | `string` | Template, Required | The ID of the gift card to be unlinked. |
252
+ | `body` | [`UnlinkCustomerFromGiftCardRequest`](../../doc/models/unlink-customer-from-gift-card-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
253
 
254
  ## Response Type
255
 
256
+ [`UnlinkCustomerFromGiftCardResponse`](../../doc/models/unlink-customer-from-gift-card-response.md)
257
 
258
  ## Example Usage
259
 
280
 
281
  # Retrieve Gift Card
282
 
283
+ Retrieves a gift card using the gift card ID.
284
 
285
  ```php
286
  function retrieveGiftCard(string $id): ApiResponse
294
 
295
  ## Response Type
296
 
297
+ [`RetrieveGiftCardResponse`](../../doc/models/retrieve-gift-card-response.md)
298
 
299
  ## Example Usage
300
 
vendor/square/square/doc/apis/inventory.md CHANGED
@@ -10,26 +10,26 @@ $inventoryApi = $client->getInventoryApi();
10
 
11
  ## Methods
12
 
13
- * [Deprecated Retrieve Inventory Adjustment](/doc/apis/inventory.md#deprecated-retrieve-inventory-adjustment)
14
- * [Retrieve Inventory Adjustment](/doc/apis/inventory.md#retrieve-inventory-adjustment)
15
- * [Deprecated Batch Change Inventory](/doc/apis/inventory.md#deprecated-batch-change-inventory)
16
- * [Deprecated Batch Retrieve Inventory Changes](/doc/apis/inventory.md#deprecated-batch-retrieve-inventory-changes)
17
- * [Deprecated Batch Retrieve Inventory Counts](/doc/apis/inventory.md#deprecated-batch-retrieve-inventory-counts)
18
- * [Batch Change Inventory](/doc/apis/inventory.md#batch-change-inventory)
19
- * [Batch Retrieve Inventory Changes](/doc/apis/inventory.md#batch-retrieve-inventory-changes)
20
- * [Batch Retrieve Inventory Counts](/doc/apis/inventory.md#batch-retrieve-inventory-counts)
21
- * [Deprecated Retrieve Inventory Physical Count](/doc/apis/inventory.md#deprecated-retrieve-inventory-physical-count)
22
- * [Retrieve Inventory Physical Count](/doc/apis/inventory.md#retrieve-inventory-physical-count)
23
- * [Retrieve Inventory Transfer](/doc/apis/inventory.md#retrieve-inventory-transfer)
24
- * [Retrieve Inventory Count](/doc/apis/inventory.md#retrieve-inventory-count)
25
- * [Retrieve Inventory Changes](/doc/apis/inventory.md#retrieve-inventory-changes)
26
 
27
 
28
  # Deprecated Retrieve Inventory Adjustment
29
 
30
  **This endpoint is deprecated.**
31
 
32
- Deprecated version of [RetrieveInventoryAdjustment](/doc/apis/inventory.md#retrieve-inventory-adjustment) after the endpoint URL
33
  is updated to conform to the standard convention.
34
 
35
  ```php
@@ -40,11 +40,11 @@ function deprecatedRetrieveInventoryAdjustment(string $adjustmentId): ApiRespons
40
 
41
  | Parameter | Type | Tags | Description |
42
  | --- | --- | --- | --- |
43
- | `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](/doc/models/inventory-adjustment.md) to retrieve. |
44
 
45
  ## Response Type
46
 
47
- [`RetrieveInventoryAdjustmentResponse`](/doc/models/retrieve-inventory-adjustment-response.md)
48
 
49
  ## Example Usage
50
 
@@ -67,7 +67,7 @@ if ($apiResponse->isSuccess()) {
67
 
68
  # Retrieve Inventory Adjustment
69
 
70
- Returns the [InventoryAdjustment](/doc/models/inventory-adjustment.md) object
71
  with the provided `adjustment_id`.
72
 
73
  ```php
@@ -78,11 +78,11 @@ function retrieveInventoryAdjustment(string $adjustmentId): ApiResponse
78
 
79
  | Parameter | Type | Tags | Description |
80
  | --- | --- | --- | --- |
81
- | `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](/doc/models/inventory-adjustment.md) to retrieve. |
82
 
83
  ## Response Type
84
 
85
- [`RetrieveInventoryAdjustmentResponse`](/doc/models/retrieve-inventory-adjustment-response.md)
86
 
87
  ## Example Usage
88
 
@@ -107,7 +107,7 @@ if ($apiResponse->isSuccess()) {
107
 
108
  **This endpoint is deprecated.**
109
 
110
- Deprecated version of [BatchChangeInventory](/doc/apis/inventory.md#batch-change-inventory) after the endpoint URL
111
  is updated to conform to the standard convention.
112
 
113
  ```php
@@ -118,11 +118,11 @@ function deprecatedBatchChangeInventory(BatchChangeInventoryRequest $body): ApiR
118
 
119
  | Parameter | Type | Tags | Description |
120
  | --- | --- | --- | --- |
121
- | `body` | [`BatchChangeInventoryRequest`](/doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
122
 
123
  ## Response Type
124
 
125
- [`BatchChangeInventoryResponse`](/doc/models/batch-change-inventory-response.md)
126
 
127
  ## Example Usage
128
 
@@ -136,40 +136,13 @@ $body_changes = [];
136
  $body_changes[0] = new Models\InventoryChange;
137
  $body_changes[0]->setType(Models\InventoryChangeType::PHYSICAL_COUNT);
138
  $body_changes[0]->setPhysicalCount(new Models\InventoryPhysicalCount);
139
- $body_changes[0]->getPhysicalCount()->setId('id0');
140
  $body_changes[0]->getPhysicalCount()->setReferenceId('1536bfbf-efed-48bf-b17d-a197141b2a92');
141
  $body_changes[0]->getPhysicalCount()->setCatalogObjectId('W62UWFY35CWMYGVWK6TWJDNI');
142
- $body_changes[0]->getPhysicalCount()->setCatalogObjectType('catalog_object_type4');
143
  $body_changes[0]->getPhysicalCount()->setState(Models\InventoryState::IN_STOCK);
144
  $body_changes[0]->getPhysicalCount()->setLocationId('C6W5YS5QM06F5');
145
  $body_changes[0]->getPhysicalCount()->setQuantity('53');
146
- $body_changes[0]->getPhysicalCount()->setEmployeeId('LRK57NSQ5X7PUD05');
147
  $body_changes[0]->getPhysicalCount()->setOccurredAt('2016-11-16T22:25:24.878Z');
148
- $body_changes[0]->setAdjustment(new Models\InventoryAdjustment);
149
- $body_changes[0]->getAdjustment()->setId('id6');
150
- $body_changes[0]->getAdjustment()->setReferenceId('reference_id4');
151
- $body_changes[0]->getAdjustment()->setFromState(Models\InventoryState::SOLD);
152
- $body_changes[0]->getAdjustment()->setToState(Models\InventoryState::SOLD_ONLINE);
153
- $body_changes[0]->getAdjustment()->setLocationId('location_id0');
154
- $body_changes[0]->setTransfer(new Models\InventoryTransfer);
155
- $body_changes[0]->getTransfer()->setId('id0');
156
- $body_changes[0]->getTransfer()->setReferenceId('reference_id8');
157
- $body_changes[0]->getTransfer()->setState(Models\InventoryState::UNLINKED_RETURN);
158
- $body_changes[0]->getTransfer()->setFromLocationId('from_location_id2');
159
- $body_changes[0]->getTransfer()->setToLocationId('to_location_id2');
160
- $body_changes[0]->setMeasurementUnit(new Models\CatalogMeasurementUnit);
161
- $body_changes[0]->getMeasurementUnit()->setMeasurementUnit(new Models\MeasurementUnit);
162
- $body_changes_0_measurementUnit_measurementUnit_customUnit_name = 'name0';
163
- $body_changes_0_measurementUnit_measurementUnit_customUnit_abbreviation = 'abbreviation2';
164
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
165
- $body_changes_0_measurementUnit_measurementUnit_customUnit_name,
166
- $body_changes_0_measurementUnit_measurementUnit_customUnit_abbreviation
167
- ));
168
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_FOOT);
169
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_METER);
170
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::METRIC_MILLILITER);
171
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::IMPERIAL_WEIGHT_OUNCE);
172
- $body_changes[0]->getMeasurementUnit()->setPrecision(26);
173
  $body->setChanges($body_changes);
174
 
175
  $body->setIgnoreUnchangedCounts(true);
@@ -192,7 +165,7 @@ if ($apiResponse->isSuccess()) {
192
 
193
  **This endpoint is deprecated.**
194
 
195
- Deprecated version of [BatchRetrieveInventoryChanges](/doc/apis/inventory.md#batch-retrieve-inventory-changes) after the endpoint URL
196
  is updated to conform to the standard convention.
197
 
198
  ```php
@@ -203,11 +176,11 @@ function deprecatedBatchRetrieveInventoryChanges(BatchRetrieveInventoryChangesRe
203
 
204
  | Parameter | Type | Tags | Description |
205
  | --- | --- | --- | --- |
206
- | `body` | [`BatchRetrieveInventoryChangesRequest`](/doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
207
 
208
  ## Response Type
209
 
210
- [`BatchRetrieveInventoryChangesResponse`](/doc/models/batch-retrieve-inventory-changes-response.md)
211
 
212
  ## Example Usage
213
 
@@ -238,7 +211,7 @@ if ($apiResponse->isSuccess()) {
238
 
239
  **This endpoint is deprecated.**
240
 
241
- Deprecated version of [BatchRetrieveInventoryCounts](/doc/apis/inventory.md#batch-retrieve-inventory-counts) after the endpoint URL
242
  is updated to conform to the standard convention.
243
 
244
  ```php
@@ -249,11 +222,11 @@ function deprecatedBatchRetrieveInventoryCounts(BatchRetrieveInventoryCountsRequ
249
 
250
  | Parameter | Type | Tags | Description |
251
  | --- | --- | --- | --- |
252
- | `body` | [`BatchRetrieveInventoryCountsRequest`](/doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
253
 
254
  ## Response Type
255
 
256
- [`BatchRetrieveInventoryCountsResponse`](/doc/models/batch-retrieve-inventory-counts-response.md)
257
 
258
  ## Example Usage
259
 
@@ -262,8 +235,6 @@ $body = new Models\BatchRetrieveInventoryCountsRequest;
262
  $body->setCatalogObjectIds(['W62UWFY35CWMYGVWK6TWJDNI']);
263
  $body->setLocationIds(['59TNP9SA8VGDA']);
264
  $body->setUpdatedAfter('2016-11-16T00:00:00.000Z');
265
- $body->setCursor('cursor0');
266
- $body->setStates([Models\InventoryState::SUPPORTED_BY_NEWER_VERSION]);
267
 
268
  $apiResponse = $inventoryApi->deprecatedBatchRetrieveInventoryCounts($body);
269
 
@@ -295,11 +266,11 @@ function batchChangeInventory(BatchChangeInventoryRequest $body): ApiResponse
295
 
296
  | Parameter | Type | Tags | Description |
297
  | --- | --- | --- | --- |
298
- | `body` | [`BatchChangeInventoryRequest`](/doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
299
 
300
  ## Response Type
301
 
302
- [`BatchChangeInventoryResponse`](/doc/models/batch-change-inventory-response.md)
303
 
304
  ## Example Usage
305
 
@@ -313,40 +284,13 @@ $body_changes = [];
313
  $body_changes[0] = new Models\InventoryChange;
314
  $body_changes[0]->setType(Models\InventoryChangeType::PHYSICAL_COUNT);
315
  $body_changes[0]->setPhysicalCount(new Models\InventoryPhysicalCount);
316
- $body_changes[0]->getPhysicalCount()->setId('id0');
317
  $body_changes[0]->getPhysicalCount()->setReferenceId('1536bfbf-efed-48bf-b17d-a197141b2a92');
318
  $body_changes[0]->getPhysicalCount()->setCatalogObjectId('W62UWFY35CWMYGVWK6TWJDNI');
319
- $body_changes[0]->getPhysicalCount()->setCatalogObjectType('catalog_object_type4');
320
  $body_changes[0]->getPhysicalCount()->setState(Models\InventoryState::IN_STOCK);
321
  $body_changes[0]->getPhysicalCount()->setLocationId('C6W5YS5QM06F5');
322
  $body_changes[0]->getPhysicalCount()->setQuantity('53');
323
- $body_changes[0]->getPhysicalCount()->setEmployeeId('LRK57NSQ5X7PUD05');
324
  $body_changes[0]->getPhysicalCount()->setOccurredAt('2016-11-16T22:25:24.878Z');
325
- $body_changes[0]->setAdjustment(new Models\InventoryAdjustment);
326
- $body_changes[0]->getAdjustment()->setId('id6');
327
- $body_changes[0]->getAdjustment()->setReferenceId('reference_id4');
328
- $body_changes[0]->getAdjustment()->setFromState(Models\InventoryState::SOLD);
329
- $body_changes[0]->getAdjustment()->setToState(Models\InventoryState::SOLD_ONLINE);
330
- $body_changes[0]->getAdjustment()->setLocationId('location_id0');
331
- $body_changes[0]->setTransfer(new Models\InventoryTransfer);
332
- $body_changes[0]->getTransfer()->setId('id0');
333
- $body_changes[0]->getTransfer()->setReferenceId('reference_id8');
334
- $body_changes[0]->getTransfer()->setState(Models\InventoryState::UNLINKED_RETURN);
335
- $body_changes[0]->getTransfer()->setFromLocationId('from_location_id2');
336
- $body_changes[0]->getTransfer()->setToLocationId('to_location_id2');
337
- $body_changes[0]->setMeasurementUnit(new Models\CatalogMeasurementUnit);
338
- $body_changes[0]->getMeasurementUnit()->setMeasurementUnit(new Models\MeasurementUnit);
339
- $body_changes_0_measurementUnit_measurementUnit_customUnit_name = 'name0';
340
- $body_changes_0_measurementUnit_measurementUnit_customUnit_abbreviation = 'abbreviation2';
341
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
342
- $body_changes_0_measurementUnit_measurementUnit_customUnit_name,
343
- $body_changes_0_measurementUnit_measurementUnit_customUnit_abbreviation
344
- ));
345
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_FOOT);
346
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_METER);
347
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::METRIC_MILLILITER);
348
- $body_changes[0]->getMeasurementUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::IMPERIAL_WEIGHT_OUNCE);
349
- $body_changes[0]->getMeasurementUnit()->setPrecision(26);
350
  $body->setChanges($body_changes);
351
 
352
  $body->setIgnoreUnchangedCounts(true);
@@ -384,11 +328,11 @@ function batchRetrieveInventoryChanges(BatchRetrieveInventoryChangesRequest $bod
384
 
385
  | Parameter | Type | Tags | Description |
386
  | --- | --- | --- | --- |
387
- | `body` | [`BatchRetrieveInventoryChangesRequest`](/doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
388
 
389
  ## Response Type
390
 
391
- [`BatchRetrieveInventoryChangesResponse`](/doc/models/batch-retrieve-inventory-changes-response.md)
392
 
393
  ## Example Usage
394
 
@@ -418,8 +362,8 @@ if ($apiResponse->isSuccess()) {
418
  # Batch Retrieve Inventory Counts
419
 
420
  Returns current counts for the provided
421
- [CatalogObject](/doc/models/catalog-object.md)s at the requested
422
- [Location](/doc/models/location.md)s.
423
 
424
  Results are paginated and sorted in descending order according to their
425
  `calculated_at` timestamp (newest first).
@@ -437,11 +381,11 @@ function batchRetrieveInventoryCounts(BatchRetrieveInventoryCountsRequest $body)
437
 
438
  | Parameter | Type | Tags | Description |
439
  | --- | --- | --- | --- |
440
- | `body` | [`BatchRetrieveInventoryCountsRequest`](/doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
441
 
442
  ## Response Type
443
 
444
- [`BatchRetrieveInventoryCountsResponse`](/doc/models/batch-retrieve-inventory-counts-response.md)
445
 
446
  ## Example Usage
447
 
@@ -450,8 +394,6 @@ $body = new Models\BatchRetrieveInventoryCountsRequest;
450
  $body->setCatalogObjectIds(['W62UWFY35CWMYGVWK6TWJDNI']);
451
  $body->setLocationIds(['59TNP9SA8VGDA']);
452
  $body->setUpdatedAfter('2016-11-16T00:00:00.000Z');
453
- $body->setCursor('cursor0');
454
- $body->setStates([Models\InventoryState::SUPPORTED_BY_NEWER_VERSION]);
455
 
456
  $apiResponse = $inventoryApi->batchRetrieveInventoryCounts($body);
457
 
@@ -471,7 +413,7 @@ if ($apiResponse->isSuccess()) {
471
 
472
  **This endpoint is deprecated.**
473
 
474
- Deprecated version of [RetrieveInventoryPhysicalCount](/doc/apis/inventory.md#retrieve-inventory-physical-count) after the endpoint URL
475
  is updated to conform to the standard convention.
476
 
477
  ```php
@@ -482,11 +424,11 @@ function deprecatedRetrieveInventoryPhysicalCount(string $physicalCountId): ApiR
482
 
483
  | Parameter | Type | Tags | Description |
484
  | --- | --- | --- | --- |
485
- | `physicalCountId` | `string` | Template, Required | ID of the<br>[InventoryPhysicalCount](/doc/models/inventory-physical-count.md) to retrieve. |
486
 
487
  ## Response Type
488
 
489
- [`RetrieveInventoryPhysicalCountResponse`](/doc/models/retrieve-inventory-physical-count-response.md)
490
 
491
  ## Example Usage
492
 
@@ -509,7 +451,7 @@ if ($apiResponse->isSuccess()) {
509
 
510
  # Retrieve Inventory Physical Count
511
 
512
- Returns the [InventoryPhysicalCount](/doc/models/inventory-physical-count.md)
513
  object with the provided `physical_count_id`.
514
 
515
  ```php
@@ -520,11 +462,11 @@ function retrieveInventoryPhysicalCount(string $physicalCountId): ApiResponse
520
 
521
  | Parameter | Type | Tags | Description |
522
  | --- | --- | --- | --- |
523
- | `physicalCountId` | `string` | Template, Required | ID of the<br>[InventoryPhysicalCount](/doc/models/inventory-physical-count.md) to retrieve. |
524
 
525
  ## Response Type
526
 
527
- [`RetrieveInventoryPhysicalCountResponse`](/doc/models/retrieve-inventory-physical-count-response.md)
528
 
529
  ## Example Usage
530
 
@@ -547,7 +489,7 @@ if ($apiResponse->isSuccess()) {
547
 
548
  # Retrieve Inventory Transfer
549
 
550
- Returns the [InventoryTransfer](/doc/models/inventory-transfer.md) object
551
  with the provided `transfer_id`.
552
 
553
  ```php
@@ -558,11 +500,11 @@ function retrieveInventoryTransfer(string $transferId): ApiResponse
558
 
559
  | Parameter | Type | Tags | Description |
560
  | --- | --- | --- | --- |
561
- | `transferId` | `string` | Template, Required | ID of the [InventoryTransfer](/doc/models/inventory-transfer.md) to retrieve. |
562
 
563
  ## Response Type
564
 
565
- [`RetrieveInventoryTransferResponse`](/doc/models/retrieve-inventory-transfer-response.md)
566
 
567
  ## Example Usage
568
 
@@ -586,8 +528,8 @@ if ($apiResponse->isSuccess()) {
586
  # Retrieve Inventory Count
587
 
588
  Retrieves the current calculated stock count for a given
589
- [CatalogObject](/doc/models/catalog-object.md) at a given set of
590
- [Location](/doc/models/location.md)s. Responses are paginated and unsorted.
591
  For more sophisticated queries, use a batch endpoint.
592
 
593
  ```php
@@ -602,22 +544,20 @@ function retrieveInventoryCount(
602
 
603
  | Parameter | Type | Tags | Description |
604
  | --- | --- | --- | --- |
605
- | `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](/doc/models/catalog-object.md) to retrieve. |
606
- | `locationIds` | `?string` | Query, Optional | The [Location](/doc/models/location.md) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
607
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
608
 
609
  ## Response Type
610
 
611
- [`RetrieveInventoryCountResponse`](/doc/models/retrieve-inventory-count-response.md)
612
 
613
  ## Example Usage
614
 
615
  ```php
616
  $catalogObjectId = 'catalog_object_id6';
617
- $locationIds = 'location_ids0';
618
- $cursor = 'cursor6';
619
 
620
- $apiResponse = $inventoryApi->retrieveInventoryCount($catalogObjectId, $locationIds, $cursor);
621
 
622
  if ($apiResponse->isSuccess()) {
623
  $retrieveInventoryCountResponse = $apiResponse->getResult();
@@ -636,10 +576,10 @@ if ($apiResponse->isSuccess()) {
636
  **This endpoint is deprecated.**
637
 
638
  Returns a set of physical counts and inventory adjustments for the
639
- provided [CatalogObject](/doc/models/catalog-object.md) at the requested
640
- [Location](/doc/models/location.md)s.
641
 
642
- You can achieve the same result by calling [BatchRetrieveInventoryChanges](/doc/apis/inventory.md#batch-retrieve-inventory-changes)
643
  and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
644
 
645
  Results are paginated and sorted in descending order according to their
@@ -661,22 +601,20 @@ function retrieveInventoryChanges(
661
 
662
  | Parameter | Type | Tags | Description |
663
  | --- | --- | --- | --- |
664
- | `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](/doc/models/catalog-object.md) to retrieve. |
665
- | `locationIds` | `?string` | Query, Optional | The [Location](/doc/models/location.md) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
666
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
667
 
668
  ## Response Type
669
 
670
- [`RetrieveInventoryChangesResponse`](/doc/models/retrieve-inventory-changes-response.md)
671
 
672
  ## Example Usage
673
 
674
  ```php
675
  $catalogObjectId = 'catalog_object_id6';
676
- $locationIds = 'location_ids0';
677
- $cursor = 'cursor6';
678
 
679
- $apiResponse = $inventoryApi->retrieveInventoryChanges($catalogObjectId, $locationIds, $cursor);
680
 
681
  if ($apiResponse->isSuccess()) {
682
  $retrieveInventoryChangesResponse = $apiResponse->getResult();
10
 
11
  ## Methods
12
 
13
+ * [Deprecated Retrieve Inventory Adjustment](../../doc/apis/inventory.md#deprecated-retrieve-inventory-adjustment)
14
+ * [Retrieve Inventory Adjustment](../../doc/apis/inventory.md#retrieve-inventory-adjustment)
15
+ * [Deprecated Batch Change Inventory](../../doc/apis/inventory.md#deprecated-batch-change-inventory)
16
+ * [Deprecated Batch Retrieve Inventory Changes](../../doc/apis/inventory.md#deprecated-batch-retrieve-inventory-changes)
17
+ * [Deprecated Batch Retrieve Inventory Counts](../../doc/apis/inventory.md#deprecated-batch-retrieve-inventory-counts)
18
+ * [Batch Change Inventory](../../doc/apis/inventory.md#batch-change-inventory)
19
+ * [Batch Retrieve Inventory Changes](../../doc/apis/inventory.md#batch-retrieve-inventory-changes)
20
+ * [Batch Retrieve Inventory Counts](../../doc/apis/inventory.md#batch-retrieve-inventory-counts)
21
+ * [Deprecated Retrieve Inventory Physical Count](../../doc/apis/inventory.md#deprecated-retrieve-inventory-physical-count)
22
+ * [Retrieve Inventory Physical Count](../../doc/apis/inventory.md#retrieve-inventory-physical-count)
23
+ * [Retrieve Inventory Transfer](../../doc/apis/inventory.md#retrieve-inventory-transfer)
24
+ * [Retrieve Inventory Count](../../doc/apis/inventory.md#retrieve-inventory-count)
25
+ * [Retrieve Inventory Changes](../../doc/apis/inventory.md#retrieve-inventory-changes)
26
 
27
 
28
  # Deprecated Retrieve Inventory Adjustment
29
 
30
  **This endpoint is deprecated.**
31
 
32
+ Deprecated version of [RetrieveInventoryAdjustment](../../doc/apis/inventory.md#retrieve-inventory-adjustment) after the endpoint URL
33
  is updated to conform to the standard convention.
34
 
35
  ```php
40
 
41
  | Parameter | Type | Tags | Description |
42
  | --- | --- | --- | --- |
43
+ | `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](../../doc/models/inventory-adjustment.md) to retrieve. |
44
 
45
  ## Response Type
46
 
47
+ [`RetrieveInventoryAdjustmentResponse`](../../doc/models/retrieve-inventory-adjustment-response.md)
48
 
49
  ## Example Usage
50
 
67
 
68
  # Retrieve Inventory Adjustment
69
 
70
+ Returns the [InventoryAdjustment](../../doc/models/inventory-adjustment.md) object
71
  with the provided `adjustment_id`.
72
 
73
  ```php
78
 
79
  | Parameter | Type | Tags | Description |
80
  | --- | --- | --- | --- |
81
+ | `adjustmentId` | `string` | Template, Required | ID of the [InventoryAdjustment](../../doc/models/inventory-adjustment.md) to retrieve. |
82
 
83
  ## Response Type
84
 
85
+ [`RetrieveInventoryAdjustmentResponse`](../../doc/models/retrieve-inventory-adjustment-response.md)
86
 
87
  ## Example Usage
88
 
107
 
108
  **This endpoint is deprecated.**
109
 
110
+ Deprecated version of [BatchChangeInventory](../../doc/apis/inventory.md#batch-change-inventory) after the endpoint URL
111
  is updated to conform to the standard convention.
112
 
113
  ```php
118
 
119
  | Parameter | Type | Tags | Description |
120
  | --- | --- | --- | --- |
121
+ | `body` | [`BatchChangeInventoryRequest`](../../doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
122
 
123
  ## Response Type
124
 
125
+ [`BatchChangeInventoryResponse`](../../doc/models/batch-change-inventory-response.md)
126
 
127
  ## Example Usage
128
 
136
  $body_changes[0] = new Models\InventoryChange;
137
  $body_changes[0]->setType(Models\InventoryChangeType::PHYSICAL_COUNT);
138
  $body_changes[0]->setPhysicalCount(new Models\InventoryPhysicalCount);
 
139
  $body_changes[0]->getPhysicalCount()->setReferenceId('1536bfbf-efed-48bf-b17d-a197141b2a92');
140
  $body_changes[0]->getPhysicalCount()->setCatalogObjectId('W62UWFY35CWMYGVWK6TWJDNI');
 
141
  $body_changes[0]->getPhysicalCount()->setState(Models\InventoryState::IN_STOCK);
142
  $body_changes[0]->getPhysicalCount()->setLocationId('C6W5YS5QM06F5');
143
  $body_changes[0]->getPhysicalCount()->setQuantity('53');
144
+ $body_changes[0]->getPhysicalCount()->setTeamMemberId('LRK57NSQ5X7PUD05');
145
  $body_changes[0]->getPhysicalCount()->setOccurredAt('2016-11-16T22:25:24.878Z');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  $body->setChanges($body_changes);
147
 
148
  $body->setIgnoreUnchangedCounts(true);
165
 
166
  **This endpoint is deprecated.**
167
 
168
+ Deprecated version of [BatchRetrieveInventoryChanges](../../doc/apis/inventory.md#batch-retrieve-inventory-changes) after the endpoint URL
169
  is updated to conform to the standard convention.
170
 
171
  ```php
176
 
177
  | Parameter | Type | Tags | Description |
178
  | --- | --- | --- | --- |
179
+ | `body` | [`BatchRetrieveInventoryChangesRequest`](../../doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
180
 
181
  ## Response Type
182
 
183
+ [`BatchRetrieveInventoryChangesResponse`](../../doc/models/batch-retrieve-inventory-changes-response.md)
184
 
185
  ## Example Usage
186
 
211
 
212
  **This endpoint is deprecated.**
213
 
214
+ Deprecated version of [BatchRetrieveInventoryCounts](../../doc/apis/inventory.md#batch-retrieve-inventory-counts) after the endpoint URL
215
  is updated to conform to the standard convention.
216
 
217
  ```php
222
 
223
  | Parameter | Type | Tags | Description |
224
  | --- | --- | --- | --- |
225
+ | `body` | [`BatchRetrieveInventoryCountsRequest`](../../doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
226
 
227
  ## Response Type
228
 
229
+ [`BatchRetrieveInventoryCountsResponse`](../../doc/models/batch-retrieve-inventory-counts-response.md)
230
 
231
  ## Example Usage
232
 
235
  $body->setCatalogObjectIds(['W62UWFY35CWMYGVWK6TWJDNI']);
236
  $body->setLocationIds(['59TNP9SA8VGDA']);
237
  $body->setUpdatedAfter('2016-11-16T00:00:00.000Z');
 
 
238
 
239
  $apiResponse = $inventoryApi->deprecatedBatchRetrieveInventoryCounts($body);
240
 
266
 
267
  | Parameter | Type | Tags | Description |
268
  | --- | --- | --- | --- |
269
+ | `body` | [`BatchChangeInventoryRequest`](../../doc/models/batch-change-inventory-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
270
 
271
  ## Response Type
272
 
273
+ [`BatchChangeInventoryResponse`](../../doc/models/batch-change-inventory-response.md)
274
 
275
  ## Example Usage
276
 
284
  $body_changes[0] = new Models\InventoryChange;
285
  $body_changes[0]->setType(Models\InventoryChangeType::PHYSICAL_COUNT);
286
  $body_changes[0]->setPhysicalCount(new Models\InventoryPhysicalCount);
 
287
  $body_changes[0]->getPhysicalCount()->setReferenceId('1536bfbf-efed-48bf-b17d-a197141b2a92');
288
  $body_changes[0]->getPhysicalCount()->setCatalogObjectId('W62UWFY35CWMYGVWK6TWJDNI');
 
289
  $body_changes[0]->getPhysicalCount()->setState(Models\InventoryState::IN_STOCK);
290
  $body_changes[0]->getPhysicalCount()->setLocationId('C6W5YS5QM06F5');
291
  $body_changes[0]->getPhysicalCount()->setQuantity('53');
292
+ $body_changes[0]->getPhysicalCount()->setTeamMemberId('LRK57NSQ5X7PUD05');
293
  $body_changes[0]->getPhysicalCount()->setOccurredAt('2016-11-16T22:25:24.878Z');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  $body->setChanges($body_changes);
295
 
296
  $body->setIgnoreUnchangedCounts(true);
328
 
329
  | Parameter | Type | Tags | Description |
330
  | --- | --- | --- | --- |
331
+ | `body` | [`BatchRetrieveInventoryChangesRequest`](../../doc/models/batch-retrieve-inventory-changes-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
332
 
333
  ## Response Type
334
 
335
+ [`BatchRetrieveInventoryChangesResponse`](../../doc/models/batch-retrieve-inventory-changes-response.md)
336
 
337
  ## Example Usage
338
 
362
  # Batch Retrieve Inventory Counts
363
 
364
  Returns current counts for the provided
365
+ [CatalogObject](../../doc/models/catalog-object.md)s at the requested
366
+ [Location](../../doc/models/location.md)s.
367
 
368
  Results are paginated and sorted in descending order according to their
369
  `calculated_at` timestamp (newest first).
381
 
382
  | Parameter | Type | Tags | Description |
383
  | --- | --- | --- | --- |
384
+ | `body` | [`BatchRetrieveInventoryCountsRequest`](../../doc/models/batch-retrieve-inventory-counts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
385
 
386
  ## Response Type
387
 
388
+ [`BatchRetrieveInventoryCountsResponse`](../../doc/models/batch-retrieve-inventory-counts-response.md)
389
 
390
  ## Example Usage
391
 
394
  $body->setCatalogObjectIds(['W62UWFY35CWMYGVWK6TWJDNI']);
395
  $body->setLocationIds(['59TNP9SA8VGDA']);
396
  $body->setUpdatedAfter('2016-11-16T00:00:00.000Z');
 
 
397
 
398
  $apiResponse = $inventoryApi->batchRetrieveInventoryCounts($body);
399
 
413
 
414
  **This endpoint is deprecated.**
415
 
416
+ Deprecated version of [RetrieveInventoryPhysicalCount](../../doc/apis/inventory.md#retrieve-inventory-physical-count) after the endpoint URL
417
  is updated to conform to the standard convention.
418
 
419
  ```php
424
 
425
  | Parameter | Type | Tags | Description |
426
  | --- | --- | --- | --- |
427
+ | `physicalCountId` | `string` | Template, Required | ID of the<br>[InventoryPhysicalCount](../../doc/models/inventory-physical-count.md) to retrieve. |
428
 
429
  ## Response Type
430
 
431
+ [`RetrieveInventoryPhysicalCountResponse`](../../doc/models/retrieve-inventory-physical-count-response.md)
432
 
433
  ## Example Usage
434
 
451
 
452
  # Retrieve Inventory Physical Count
453
 
454
+ Returns the [InventoryPhysicalCount](../../doc/models/inventory-physical-count.md)
455
  object with the provided `physical_count_id`.
456
 
457
  ```php
462
 
463
  | Parameter | Type | Tags | Description |
464
  | --- | --- | --- | --- |
465
+ | `physicalCountId` | `string` | Template, Required | ID of the<br>[InventoryPhysicalCount](../../doc/models/inventory-physical-count.md) to retrieve. |
466
 
467
  ## Response Type
468
 
469
+ [`RetrieveInventoryPhysicalCountResponse`](../../doc/models/retrieve-inventory-physical-count-response.md)
470
 
471
  ## Example Usage
472
 
489
 
490
  # Retrieve Inventory Transfer
491
 
492
+ Returns the [InventoryTransfer](../../doc/models/inventory-transfer.md) object
493
  with the provided `transfer_id`.
494
 
495
  ```php
500
 
501
  | Parameter | Type | Tags | Description |
502
  | --- | --- | --- | --- |
503
+ | `transferId` | `string` | Template, Required | ID of the [InventoryTransfer](../../doc/models/inventory-transfer.md) to retrieve. |
504
 
505
  ## Response Type
506
 
507
+ [`RetrieveInventoryTransferResponse`](../../doc/models/retrieve-inventory-transfer-response.md)
508
 
509
  ## Example Usage
510
 
528
  # Retrieve Inventory Count
529
 
530
  Retrieves the current calculated stock count for a given
531
+ [CatalogObject](../../doc/models/catalog-object.md) at a given set of
532
+ [Location](../../doc/models/location.md)s. Responses are paginated and unsorted.
533
  For more sophisticated queries, use a batch endpoint.
534
 
535
  ```php
544
 
545
  | Parameter | Type | Tags | Description |
546
  | --- | --- | --- | --- |
547
+ | `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](../../doc/models/catalog-object.md) to retrieve. |
548
+ | `locationIds` | `?string` | Query, Optional | The [Location](../../doc/models/location.md) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
549
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
550
 
551
  ## Response Type
552
 
553
+ [`RetrieveInventoryCountResponse`](../../doc/models/retrieve-inventory-count-response.md)
554
 
555
  ## Example Usage
556
 
557
  ```php
558
  $catalogObjectId = 'catalog_object_id6';
 
 
559
 
560
+ $apiResponse = $inventoryApi->retrieveInventoryCount($catalogObjectId);
561
 
562
  if ($apiResponse->isSuccess()) {
563
  $retrieveInventoryCountResponse = $apiResponse->getResult();
576
  **This endpoint is deprecated.**
577
 
578
  Returns a set of physical counts and inventory adjustments for the
579
+ provided [CatalogObject](../../doc/models/catalog-object.md) at the requested
580
+ [Location](../../doc/models/location.md)s.
581
 
582
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](../../doc/apis/inventory.md#batch-retrieve-inventory-changes)
583
  and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
584
 
585
  Results are paginated and sorted in descending order according to their
601
 
602
  | Parameter | Type | Tags | Description |
603
  | --- | --- | --- | --- |
604
+ | `catalogObjectId` | `string` | Template, Required | ID of the [CatalogObject](../../doc/models/catalog-object.md) to retrieve. |
605
+ | `locationIds` | `?string` | Query, Optional | The [Location](../../doc/models/location.md) IDs to look up as a comma-separated<br>list. An empty list queries all locations. |
606
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. |
607
 
608
  ## Response Type
609
 
610
+ [`RetrieveInventoryChangesResponse`](../../doc/models/retrieve-inventory-changes-response.md)
611
 
612
  ## Example Usage
613
 
614
  ```php
615
  $catalogObjectId = 'catalog_object_id6';
 
 
616
 
617
+ $apiResponse = $inventoryApi->retrieveInventoryChanges($catalogObjectId);
618
 
619
  if ($apiResponse->isSuccess()) {
620
  $retrieveInventoryChangesResponse = $apiResponse->getResult();
vendor/square/square/doc/apis/invoices.md CHANGED
@@ -10,14 +10,14 @@ $invoicesApi = $client->getInvoicesApi();
10
 
11
  ## Methods
12
 
13
- * [List Invoices](/doc/apis/invoices.md#list-invoices)
14
- * [Create Invoice](/doc/apis/invoices.md#create-invoice)
15
- * [Search Invoices](/doc/apis/invoices.md#search-invoices)
16
- * [Delete Invoice](/doc/apis/invoices.md#delete-invoice)
17
- * [Get Invoice](/doc/apis/invoices.md#get-invoice)
18
- * [Update Invoice](/doc/apis/invoices.md#update-invoice)
19
- * [Cancel Invoice](/doc/apis/invoices.md#cancel-invoice)
20
- * [Publish Invoice](/doc/apis/invoices.md#publish-invoice)
21
 
22
 
23
  # List Invoices
@@ -40,16 +40,14 @@ function listInvoices(string $locationId, ?string $cursor = null, ?int $limit =
40
 
41
  ## Response Type
42
 
43
- [`ListInvoicesResponse`](/doc/models/list-invoices-response.md)
44
 
45
  ## Example Usage
46
 
47
  ```php
48
  $locationId = 'location_id4';
49
- $cursor = 'cursor6';
50
- $limit = 172;
51
 
52
- $apiResponse = $invoicesApi->listInvoices($locationId, $cursor, $limit);
53
 
54
  if ($apiResponse->isSuccess()) {
55
  $listInvoicesResponse = $apiResponse->getResult();
@@ -65,7 +63,7 @@ if ($apiResponse->isSuccess()) {
65
 
66
  # Create Invoice
67
 
68
- Creates a draft [invoice](/doc/models/invoice.md)
69
  for an order created using the Orders API.
70
 
71
  A draft invoice remains in your account and no action is taken.
@@ -79,51 +77,32 @@ function createInvoice(CreateInvoiceRequest $body): ApiResponse
79
 
80
  | Parameter | Type | Tags | Description |
81
  | --- | --- | --- | --- |
82
- | `body` | [`CreateInvoiceRequest`](/doc/models/create-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
83
 
84
  ## Response Type
85
 
86
- [`CreateInvoiceResponse`](/doc/models/create-invoice-response.md)
87
 
88
  ## Example Usage
89
 
90
  ```php
91
  $body_invoice = new Models\Invoice;
92
- $body_invoice->setId('id0');
93
- $body_invoice->setVersion(38);
94
  $body_invoice->setLocationId('ES0RJRZYEC39A');
95
  $body_invoice->setOrderId('CAISENgvlJ6jLWAzERDzjyHVybY');
96
  $body_invoice->setPrimaryRecipient(new Models\InvoiceRecipient);
97
  $body_invoice->getPrimaryRecipient()->setCustomerId('JDKYHBWT1D4F8MFH63DBMEN8Y4');
98
- $body_invoice->getPrimaryRecipient()->setGivenName('given_name6');
99
- $body_invoice->getPrimaryRecipient()->setFamilyName('family_name8');
100
- $body_invoice->getPrimaryRecipient()->setEmailAddress('email_address2');
101
- $body_invoice->getPrimaryRecipient()->setAddress(new Models\Address);
102
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine1('address_line_10');
103
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine2('address_line_20');
104
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine3('address_line_36');
105
- $body_invoice->getPrimaryRecipient()->getAddress()->setLocality('locality0');
106
- $body_invoice->getPrimaryRecipient()->getAddress()->setSublocality('sublocality0');
107
  $body_invoice_paymentRequests = [];
108
 
109
  $body_invoice_paymentRequests[0] = new Models\InvoicePaymentRequest;
110
- $body_invoice_paymentRequests[0]->setUid('uid4');
111
- $body_invoice_paymentRequests[0]->setRequestMethod(Models\InvoiceRequestMethod::SMS_CHARGE_CARD_ON_FILE);
112
  $body_invoice_paymentRequests[0]->setRequestType(Models\InvoiceRequestType::BALANCE);
113
  $body_invoice_paymentRequests[0]->setDueDate('2030-01-24');
114
- $body_invoice_paymentRequests[0]->setFixedAmountRequestedMoney(new Models\Money);
115
- $body_invoice_paymentRequests[0]->getFixedAmountRequestedMoney()->setAmount(52);
116
- $body_invoice_paymentRequests[0]->getFixedAmountRequestedMoney()->setCurrency(Models\Currency::USS);
117
  $body_invoice_paymentRequests[0]->setTippingEnabled(true);
118
  $body_invoice_paymentRequests[0]->setAutomaticPaymentSource(Models\InvoiceAutomaticPaymentSource::NONE);
119
  $body_invoice_paymentRequests_0_reminders = [];
120
 
121
  $body_invoice_paymentRequests_0_reminders[0] = new Models\InvoicePaymentReminder;
122
- $body_invoice_paymentRequests_0_reminders[0]->setUid('uid2');
123
  $body_invoice_paymentRequests_0_reminders[0]->setRelativeScheduledDays(-1);
124
  $body_invoice_paymentRequests_0_reminders[0]->setMessage('Your invoice is due tomorrow');
125
- $body_invoice_paymentRequests_0_reminders[0]->setStatus(Models\InvoicePaymentReminderStatus::PENDING);
126
- $body_invoice_paymentRequests_0_reminders[0]->setSentAt('sent_at2');
127
  $body_invoice_paymentRequests[0]->setReminders($body_invoice_paymentRequests_0_reminders);
128
 
129
  $body_invoice->setPaymentRequests($body_invoice_paymentRequests);
@@ -188,11 +167,11 @@ function searchInvoices(SearchInvoicesRequest $body): ApiResponse
188
 
189
  | Parameter | Type | Tags | Description |
190
  | --- | --- | --- | --- |
191
- | `body` | [`SearchInvoicesRequest`](/doc/models/search-invoices-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
192
 
193
  ## Response Type
194
 
195
- [`SearchInvoicesResponse`](/doc/models/search-invoices-response.md)
196
 
197
  ## Example Usage
198
 
@@ -210,8 +189,6 @@ $body_query->getSort()->setOrder(Models\SortOrder::DESC);
210
  $body = new Models\SearchInvoicesRequest(
211
  $body_query
212
  );
213
- $body->setLimit(164);
214
- $body->setCursor('cursor0');
215
 
216
  $apiResponse = $invoicesApi->searchInvoices($body);
217
 
@@ -242,19 +219,18 @@ function deleteInvoice(string $invoiceId, ?int $version = null): ApiResponse
242
  | Parameter | Type | Tags | Description |
243
  | --- | --- | --- | --- |
244
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to delete. |
245
- | `version` | `?int` | Query, Optional | The version of the [invoice](/doc/models/invoice.md) to delete.<br>If you do not know the version, you can call [GetInvoice](/doc/apis/invoices.md#get-invoice) or<br>[ListInvoices](/doc/apis/invoices.md#list-invoices). |
246
 
247
  ## Response Type
248
 
249
- [`DeleteInvoiceResponse`](/doc/models/delete-invoice-response.md)
250
 
251
  ## Example Usage
252
 
253
  ```php
254
  $invoiceId = 'invoice_id0';
255
- $version = 172;
256
 
257
- $apiResponse = $invoicesApi->deleteInvoice($invoiceId, $version);
258
 
259
  if ($apiResponse->isSuccess()) {
260
  $deleteInvoiceResponse = $apiResponse->getResult();
@@ -284,7 +260,7 @@ function getInvoice(string $invoiceId): ApiResponse
284
 
285
  ## Response Type
286
 
287
- [`GetInvoiceResponse`](/doc/models/get-invoice-response.md)
288
 
289
  ## Example Usage
290
 
@@ -321,42 +297,21 @@ function updateInvoice(string $invoiceId, UpdateInvoiceRequest $body): ApiRespon
321
  | Parameter | Type | Tags | Description |
322
  | --- | --- | --- | --- |
323
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to update. |
324
- | `body` | [`UpdateInvoiceRequest`](/doc/models/update-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
325
 
326
  ## Response Type
327
 
328
- [`UpdateInvoiceResponse`](/doc/models/update-invoice-response.md)
329
 
330
  ## Example Usage
331
 
332
  ```php
333
  $invoiceId = 'invoice_id0';
334
  $body_invoice = new Models\Invoice;
335
- $body_invoice->setId('id0');
336
- $body_invoice->setVersion(38);
337
- $body_invoice->setLocationId('location_id4');
338
- $body_invoice->setOrderId('order_id6');
339
- $body_invoice->setPrimaryRecipient(new Models\InvoiceRecipient);
340
- $body_invoice->getPrimaryRecipient()->setCustomerId('customer_id2');
341
- $body_invoice->getPrimaryRecipient()->setGivenName('given_name6');
342
- $body_invoice->getPrimaryRecipient()->setFamilyName('family_name8');
343
- $body_invoice->getPrimaryRecipient()->setEmailAddress('email_address2');
344
- $body_invoice->getPrimaryRecipient()->setAddress(new Models\Address);
345
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine1('address_line_10');
346
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine2('address_line_20');
347
- $body_invoice->getPrimaryRecipient()->getAddress()->setAddressLine3('address_line_36');
348
- $body_invoice->getPrimaryRecipient()->getAddress()->setLocality('locality0');
349
- $body_invoice->getPrimaryRecipient()->getAddress()->setSublocality('sublocality0');
350
  $body_invoice_paymentRequests = [];
351
 
352
  $body_invoice_paymentRequests[0] = new Models\InvoicePaymentRequest;
353
  $body_invoice_paymentRequests[0]->setUid('2da7964f-f3d2-4f43-81e8-5aa220bf3355');
354
- $body_invoice_paymentRequests[0]->setRequestMethod(Models\InvoiceRequestMethod::SMS_CHARGE_CARD_ON_FILE);
355
- $body_invoice_paymentRequests[0]->setRequestType(Models\InvoiceRequestType::DEPOSIT);
356
- $body_invoice_paymentRequests[0]->setDueDate('due_date2');
357
- $body_invoice_paymentRequests[0]->setFixedAmountRequestedMoney(new Models\Money);
358
- $body_invoice_paymentRequests[0]->getFixedAmountRequestedMoney()->setAmount(52);
359
- $body_invoice_paymentRequests[0]->getFixedAmountRequestedMoney()->setCurrency(Models\Currency::USS);
360
  $body_invoice_paymentRequests[0]->setTippingEnabled(false);
361
  $body_invoice->setPaymentRequests($body_invoice_paymentRequests);
362
 
@@ -395,12 +350,12 @@ function cancelInvoice(string $invoiceId, CancelInvoiceRequest $body): ApiRespon
395
 
396
  | Parameter | Type | Tags | Description |
397
  | --- | --- | --- | --- |
398
- | `invoiceId` | `string` | Template, Required | The ID of the [invoice](/doc/models/invoice.md) to cancel. |
399
- | `body` | [`CancelInvoiceRequest`](/doc/models/cancel-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
400
 
401
  ## Response Type
402
 
403
- [`CancelInvoiceResponse`](/doc/models/cancel-invoice-response.md)
404
 
405
  ## Example Usage
406
 
@@ -448,11 +403,11 @@ function publishInvoice(string $invoiceId, PublishInvoiceRequest $body): ApiResp
448
  | Parameter | Type | Tags | Description |
449
  | --- | --- | --- | --- |
450
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to publish. |
451
- | `body` | [`PublishInvoiceRequest`](/doc/models/publish-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
452
 
453
  ## Response Type
454
 
455
- [`PublishInvoiceResponse`](/doc/models/publish-invoice-response.md)
456
 
457
  ## Example Usage
458
 
10
 
11
  ## Methods
12
 
13
+ * [List Invoices](../../doc/apis/invoices.md#list-invoices)
14
+ * [Create Invoice](../../doc/apis/invoices.md#create-invoice)
15
+ * [Search Invoices](../../doc/apis/invoices.md#search-invoices)
16
+ * [Delete Invoice](../../doc/apis/invoices.md#delete-invoice)
17
+ * [Get Invoice](../../doc/apis/invoices.md#get-invoice)
18
+ * [Update Invoice](../../doc/apis/invoices.md#update-invoice)
19
+ * [Cancel Invoice](../../doc/apis/invoices.md#cancel-invoice)
20
+ * [Publish Invoice](../../doc/apis/invoices.md#publish-invoice)
21
 
22
 
23
  # List Invoices
40
 
41
  ## Response Type
42
 
43
+ [`ListInvoicesResponse`](../../doc/models/list-invoices-response.md)
44
 
45
  ## Example Usage
46
 
47
  ```php
48
  $locationId = 'location_id4';
 
 
49
 
50
+ $apiResponse = $invoicesApi->listInvoices($locationId);
51
 
52
  if ($apiResponse->isSuccess()) {
53
  $listInvoicesResponse = $apiResponse->getResult();
63
 
64
  # Create Invoice
65
 
66
+ Creates a draft [invoice](../../doc/models/invoice.md)
67
  for an order created using the Orders API.
68
 
69
  A draft invoice remains in your account and no action is taken.
77
 
78
  | Parameter | Type | Tags | Description |
79
  | --- | --- | --- | --- |
80
+ | `body` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
81
 
82
  ## Response Type
83
 
84
+ [`CreateInvoiceResponse`](../../doc/models/create-invoice-response.md)
85
 
86
  ## Example Usage
87
 
88
  ```php
89
  $body_invoice = new Models\Invoice;
 
 
90
  $body_invoice->setLocationId('ES0RJRZYEC39A');
91
  $body_invoice->setOrderId('CAISENgvlJ6jLWAzERDzjyHVybY');
92
  $body_invoice->setPrimaryRecipient(new Models\InvoiceRecipient);
93
  $body_invoice->getPrimaryRecipient()->setCustomerId('JDKYHBWT1D4F8MFH63DBMEN8Y4');
 
 
 
 
 
 
 
 
 
94
  $body_invoice_paymentRequests = [];
95
 
96
  $body_invoice_paymentRequests[0] = new Models\InvoicePaymentRequest;
 
 
97
  $body_invoice_paymentRequests[0]->setRequestType(Models\InvoiceRequestType::BALANCE);
98
  $body_invoice_paymentRequests[0]->setDueDate('2030-01-24');
 
 
 
99
  $body_invoice_paymentRequests[0]->setTippingEnabled(true);
100
  $body_invoice_paymentRequests[0]->setAutomaticPaymentSource(Models\InvoiceAutomaticPaymentSource::NONE);
101
  $body_invoice_paymentRequests_0_reminders = [];
102
 
103
  $body_invoice_paymentRequests_0_reminders[0] = new Models\InvoicePaymentReminder;
 
104
  $body_invoice_paymentRequests_0_reminders[0]->setRelativeScheduledDays(-1);
105
  $body_invoice_paymentRequests_0_reminders[0]->setMessage('Your invoice is due tomorrow');
 
 
106
  $body_invoice_paymentRequests[0]->setReminders($body_invoice_paymentRequests_0_reminders);
107
 
108
  $body_invoice->setPaymentRequests($body_invoice_paymentRequests);
167
 
168
  | Parameter | Type | Tags | Description |
169
  | --- | --- | --- | --- |
170
+ | `body` | [`SearchInvoicesRequest`](../../doc/models/search-invoices-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
171
 
172
  ## Response Type
173
 
174
+ [`SearchInvoicesResponse`](../../doc/models/search-invoices-response.md)
175
 
176
  ## Example Usage
177
 
189
  $body = new Models\SearchInvoicesRequest(
190
  $body_query
191
  );
 
 
192
 
193
  $apiResponse = $invoicesApi->searchInvoices($body);
194
 
219
  | Parameter | Type | Tags | Description |
220
  | --- | --- | --- | --- |
221
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to delete. |
222
+ | `version` | `?int` | Query, Optional | The version of the [invoice](../../doc/models/invoice.md) to delete.<br>If you do not know the version, you can call [GetInvoice](../../doc/apis/invoices.md#get-invoice) or<br>[ListInvoices](../../doc/apis/invoices.md#list-invoices). |
223
 
224
  ## Response Type
225
 
226
+ [`DeleteInvoiceResponse`](../../doc/models/delete-invoice-response.md)
227
 
228
  ## Example Usage
229
 
230
  ```php
231
  $invoiceId = 'invoice_id0';
 
232
 
233
+ $apiResponse = $invoicesApi->deleteInvoice($invoiceId);
234
 
235
  if ($apiResponse->isSuccess()) {
236
  $deleteInvoiceResponse = $apiResponse->getResult();
260
 
261
  ## Response Type
262
 
263
+ [`GetInvoiceResponse`](../../doc/models/get-invoice-response.md)
264
 
265
  ## Example Usage
266
 
297
  | Parameter | Type | Tags | Description |
298
  | --- | --- | --- | --- |
299
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to update. |
300
+ | `body` | [`UpdateInvoiceRequest`](../../doc/models/update-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
301
 
302
  ## Response Type
303
 
304
+ [`UpdateInvoiceResponse`](../../doc/models/update-invoice-response.md)
305
 
306
  ## Example Usage
307
 
308
  ```php
309
  $invoiceId = 'invoice_id0';
310
  $body_invoice = new Models\Invoice;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  $body_invoice_paymentRequests = [];
312
 
313
  $body_invoice_paymentRequests[0] = new Models\InvoicePaymentRequest;
314
  $body_invoice_paymentRequests[0]->setUid('2da7964f-f3d2-4f43-81e8-5aa220bf3355');
 
 
 
 
 
 
315
  $body_invoice_paymentRequests[0]->setTippingEnabled(false);
316
  $body_invoice->setPaymentRequests($body_invoice_paymentRequests);
317
 
350
 
351
  | Parameter | Type | Tags | Description |
352
  | --- | --- | --- | --- |
353
+ | `invoiceId` | `string` | Template, Required | The ID of the [invoice](../../doc/models/invoice.md) to cancel. |
354
+ | `body` | [`CancelInvoiceRequest`](../../doc/models/cancel-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
355
 
356
  ## Response Type
357
 
358
+ [`CancelInvoiceResponse`](../../doc/models/cancel-invoice-response.md)
359
 
360
  ## Example Usage
361
 
403
  | Parameter | Type | Tags | Description |
404
  | --- | --- | --- | --- |
405
  | `invoiceId` | `string` | Template, Required | The ID of the invoice to publish. |
406
+ | `body` | [`PublishInvoiceRequest`](../../doc/models/publish-invoice-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
407
 
408
  ## Response Type
409
 
410
+ [`PublishInvoiceResponse`](../../doc/models/publish-invoice-response.md)
411
 
412
  ## Example Usage
413
 
vendor/square/square/doc/apis/labor.md CHANGED
@@ -10,22 +10,22 @@ $laborApi = $client->getLaborApi();
10
 
11
  ## Methods
12
 
13
- * [List Break Types](/doc/apis/labor.md#list-break-types)
14
- * [Create Break Type](/doc/apis/labor.md#create-break-type)
15
- * [Delete Break Type](/doc/apis/labor.md#delete-break-type)
16
- * [Get Break Type](/doc/apis/labor.md#get-break-type)
17
- * [Update Break Type](/doc/apis/labor.md#update-break-type)
18
- * [List Employee Wages](/doc/apis/labor.md#list-employee-wages)
19
- * [Get Employee Wage](/doc/apis/labor.md#get-employee-wage)
20
- * [Create Shift](/doc/apis/labor.md#create-shift)
21
- * [Search Shifts](/doc/apis/labor.md#search-shifts)
22
- * [Delete Shift](/doc/apis/labor.md#delete-shift)
23
- * [Get Shift](/doc/apis/labor.md#get-shift)
24
- * [Update Shift](/doc/apis/labor.md#update-shift)
25
- * [List Team Member Wages](/doc/apis/labor.md#list-team-member-wages)
26
- * [Get Team Member Wage](/doc/apis/labor.md#get-team-member-wage)
27
- * [List Workweek Configs](/doc/apis/labor.md#list-workweek-configs)
28
- * [Update Workweek Config](/doc/apis/labor.md#update-workweek-config)
29
 
30
 
31
  # List Break Types
@@ -46,16 +46,12 @@ function listBreakTypes(?string $locationId = null, ?int $limit = null, ?string
46
 
47
  ## Response Type
48
 
49
- [`ListBreakTypesResponse`](/doc/models/list-break-types-response.md)
50
 
51
  ## Example Usage
52
 
53
  ```php
54
- $locationId = 'location_id4';
55
- $limit = 172;
56
- $cursor = 'cursor6';
57
-
58
- $apiResponse = $laborApi->listBreakTypes($locationId, $limit, $cursor);
59
 
60
  if ($apiResponse->isSuccess()) {
61
  $listBreakTypesResponse = $apiResponse->getResult();
@@ -94,11 +90,11 @@ function createBreakType(CreateBreakTypeRequest $body): ApiResponse
94
 
95
  | Parameter | Type | Tags | Description |
96
  | --- | --- | --- | --- |
97
- | `body` | [`CreateBreakTypeRequest`](/doc/models/create-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
98
 
99
  ## Response Type
100
 
101
- [`CreateBreakTypeResponse`](/doc/models/create-break-type-response.md)
102
 
103
  ## Example Usage
104
 
@@ -113,10 +109,6 @@ $body_breakType = new Models\BreakType(
113
  $body_breakType_expectedDuration,
114
  $body_breakType_isPaid
115
  );
116
- $body_breakType->setId('id2');
117
- $body_breakType->setVersion(124);
118
- $body_breakType->setCreatedAt('created_at0');
119
- $body_breakType->setUpdatedAt('updated_at8');
120
  $body = new Models\CreateBreakTypeRequest(
121
  $body_breakType
122
  );
@@ -154,7 +146,7 @@ function deleteBreakType(string $id): ApiResponse
154
 
155
  ## Response Type
156
 
157
- [`DeleteBreakTypeResponse`](/doc/models/delete-break-type-response.md)
158
 
159
  ## Example Usage
160
 
@@ -191,7 +183,7 @@ function getBreakType(string $id): ApiResponse
191
 
192
  ## Response Type
193
 
194
- [`GetBreakTypeResponse`](/doc/models/get-break-type-response.md)
195
 
196
  ## Example Usage
197
 
@@ -225,11 +217,11 @@ function updateBreakType(string $id, UpdateBreakTypeRequest $body): ApiResponse
225
  | Parameter | Type | Tags | Description |
226
  | --- | --- | --- | --- |
227
  | `id` | `string` | Template, Required | The UUID for the `BreakType` being updated. |
228
- | `body` | [`UpdateBreakTypeRequest`](/doc/models/update-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
229
 
230
  ## Response Type
231
 
232
- [`UpdateBreakTypeResponse`](/doc/models/update-break-type-response.md)
233
 
234
  ## Example Usage
235
 
@@ -245,10 +237,7 @@ $body_breakType = new Models\BreakType(
245
  $body_breakType_expectedDuration,
246
  $body_breakType_isPaid
247
  );
248
- $body_breakType->setId('id2');
249
  $body_breakType->setVersion(1);
250
- $body_breakType->setCreatedAt('created_at0');
251
- $body_breakType->setUpdatedAt('updated_at8');
252
  $body = new Models\UpdateBreakTypeRequest(
253
  $body_breakType
254
  );
@@ -287,16 +276,12 @@ function listEmployeeWages(?string $employeeId = null, ?int $limit = null, ?stri
287
 
288
  ## Response Type
289
 
290
- [`ListEmployeeWagesResponse`](/doc/models/list-employee-wages-response.md)
291
 
292
  ## Example Usage
293
 
294
  ```php
295
- $employeeId = 'employee_id0';
296
- $limit = 172;
297
- $cursor = 'cursor6';
298
-
299
- $apiResponse = $laborApi->listEmployeeWages($employeeId, $limit, $cursor);
300
 
301
  if ($apiResponse->isSuccess()) {
302
  $listEmployeeWagesResponse = $apiResponse->getResult();
@@ -328,7 +313,7 @@ function getEmployeeWage(string $id): ApiResponse
328
 
329
  ## Response Type
330
 
331
- [`GetEmployeeWageResponse`](/doc/models/get-employee-wage-response.md)
332
 
333
  ## Example Usage
334
 
@@ -379,11 +364,11 @@ function createShift(CreateShiftRequest $body): ApiResponse
379
 
380
  | Parameter | Type | Tags | Description |
381
  | --- | --- | --- | --- |
382
- | `body` | [`CreateShiftRequest`](/doc/models/create-shift-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
383
 
384
  ## Response Type
385
 
386
- [`CreateShiftResponse`](/doc/models/create-shift-response.md)
387
 
388
  ## Example Usage
389
 
@@ -392,10 +377,7 @@ $body_shift_startAt = '2019-01-25T03:11:00-05:00';
392
  $body_shift = new Models\Shift(
393
  $body_shift_startAt
394
  );
395
- $body_shift->setId('id8');
396
- $body_shift->setEmployeeId('employee_id2');
397
  $body_shift->setLocationId('PAA1RJZZKXBFG');
398
- $body_shift->setTimezone('timezone2');
399
  $body_shift->setEndAt('2019-01-25T13:11:00-05:00');
400
  $body_shift->setWage(new Models\ShiftWage);
401
  $body_shift->getWage()->setTitle('Barista');
@@ -416,7 +398,6 @@ $body_shift_breaks[0] = new Models\MBreak(
416
  $body_shift_breaks_0_expectedDuration,
417
  $body_shift_breaks_0_isPaid
418
  );
419
- $body_shift_breaks[0]->setId('id4');
420
  $body_shift_breaks[0]->setEndAt('2019-01-25T06:16:00-05:00');
421
  $body_shift->setBreaks($body_shift_breaks);
422
 
@@ -467,42 +448,16 @@ function searchShifts(SearchShiftsRequest $body): ApiResponse
467
 
468
  | Parameter | Type | Tags | Description |
469
  | --- | --- | --- | --- |
470
- | `body` | [`SearchShiftsRequest`](/doc/models/search-shifts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
471
 
472
  ## Response Type
473
 
474
- [`SearchShiftsResponse`](/doc/models/search-shifts-response.md)
475
 
476
  ## Example Usage
477
 
478
  ```php
479
  $body = new Models\SearchShiftsRequest;
480
- $body->setQuery(new Models\ShiftQuery);
481
- $body_query_filter_locationIds = ['location_ids2'];
482
- $body_query_filter_teamMemberIds = ['team_member_ids9', 'team_member_ids0'];
483
- $body->getQuery()->setFilter(new Models\ShiftFilter(
484
- $body_query_filter_locationIds,
485
- $body_query_filter_teamMemberIds
486
- ));
487
- $body->getQuery()->getFilter()->setEmployeeIds(['employee_ids7']);
488
- $body->getQuery()->getFilter()->setStatus(Models\ShiftFilterStatus::OPEN);
489
- $body->getQuery()->getFilter()->setStart(new Models\TimeRange);
490
- $body->getQuery()->getFilter()->getStart()->setStartAt('start_at8');
491
- $body->getQuery()->getFilter()->getStart()->setEndAt('end_at4');
492
- $body->getQuery()->getFilter()->setEnd(new Models\TimeRange);
493
- $body->getQuery()->getFilter()->getEnd()->setStartAt('start_at2');
494
- $body->getQuery()->getFilter()->getEnd()->setEndAt('end_at0');
495
- $body->getQuery()->getFilter()->setWorkday(new Models\ShiftWorkday);
496
- $body->getQuery()->getFilter()->getWorkday()->setDateRange(new Models\DateRange);
497
- $body->getQuery()->getFilter()->getWorkday()->getDateRange()->setStartDate('start_date8');
498
- $body->getQuery()->getFilter()->getWorkday()->getDateRange()->setEndDate('end_date4');
499
- $body->getQuery()->getFilter()->getWorkday()->setMatchShiftsBy(Models\ShiftWorkdayMatcher::START_AT);
500
- $body->getQuery()->getFilter()->getWorkday()->setDefaultTimezone('default_timezone8');
501
- $body->getQuery()->setSort(new Models\ShiftSort);
502
- $body->getQuery()->getSort()->setField(Models\ShiftSortField::CREATED_AT);
503
- $body->getQuery()->getSort()->setOrder(Models\SortOrder::DESC);
504
- $body->setLimit(164);
505
- $body->setCursor('cursor0');
506
 
507
  $apiResponse = $laborApi->searchShifts($body);
508
 
@@ -534,7 +489,7 @@ function deleteShift(string $id): ApiResponse
534
 
535
  ## Response Type
536
 
537
- [`DeleteShiftResponse`](/doc/models/delete-shift-response.md)
538
 
539
  ## Example Usage
540
 
@@ -571,7 +526,7 @@ function getShift(string $id): ApiResponse
571
 
572
  ## Response Type
573
 
574
- [`GetShiftResponse`](/doc/models/get-shift-response.md)
575
 
576
  ## Example Usage
577
 
@@ -611,11 +566,11 @@ function updateShift(string $id, UpdateShiftRequest $body): ApiResponse
611
  | Parameter | Type | Tags | Description |
612
  | --- | --- | --- | --- |
613
  | `id` | `string` | Template, Required | The ID of the object being updated. |
614
- | `body` | [`UpdateShiftRequest`](/doc/models/update-shift-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
615
 
616
  ## Response Type
617
 
618
- [`UpdateShiftResponse`](/doc/models/update-shift-response.md)
619
 
620
  ## Example Usage
621
 
@@ -625,10 +580,7 @@ $body_shift_startAt = '2019-01-25T03:11:00-05:00';
625
  $body_shift = new Models\Shift(
626
  $body_shift_startAt
627
  );
628
- $body_shift->setId('id8');
629
- $body_shift->setEmployeeId('employee_id2');
630
  $body_shift->setLocationId('PAA1RJZZKXBFG');
631
- $body_shift->setTimezone('timezone2');
632
  $body_shift->setEndAt('2019-01-25T13:11:00-05:00');
633
  $body_shift->setWage(new Models\ShiftWage);
634
  $body_shift->getWage()->setTitle('Bartender');
@@ -695,16 +647,12 @@ function listTeamMemberWages(
695
 
696
  ## Response Type
697
 
698
- [`ListTeamMemberWagesResponse`](/doc/models/list-team-member-wages-response.md)
699
 
700
  ## Example Usage
701
 
702
  ```php
703
- $teamMemberId = 'team_member_id0';
704
- $limit = 172;
705
- $cursor = 'cursor6';
706
-
707
- $apiResponse = $laborApi->listTeamMemberWages($teamMemberId, $limit, $cursor);
708
 
709
  if ($apiResponse->isSuccess()) {
710
  $listTeamMemberWagesResponse = $apiResponse->getResult();
@@ -734,7 +682,7 @@ function getTeamMemberWage(string $id): ApiResponse
734
 
735
  ## Response Type
736
 
737
- [`GetTeamMemberWageResponse`](/doc/models/get-team-member-wage-response.md)
738
 
739
  ## Example Usage
740
 
@@ -772,15 +720,12 @@ function listWorkweekConfigs(?int $limit = null, ?string $cursor = null): ApiRes
772
 
773
  ## Response Type
774
 
775
- [`ListWorkweekConfigsResponse`](/doc/models/list-workweek-configs-response.md)
776
 
777
  ## Example Usage
778
 
779
  ```php
780
- $limit = 172;
781
- $cursor = 'cursor6';
782
-
783
- $apiResponse = $laborApi->listWorkweekConfigs($limit, $cursor);
784
 
785
  if ($apiResponse->isSuccess()) {
786
  $listWorkweekConfigsResponse = $apiResponse->getResult();
@@ -807,11 +752,11 @@ function updateWorkweekConfig(string $id, UpdateWorkweekConfigRequest $body): Ap
807
  | Parameter | Type | Tags | Description |
808
  | --- | --- | --- | --- |
809
  | `id` | `string` | Template, Required | The UUID for the `WorkweekConfig` object being updated. |
810
- | `body` | [`UpdateWorkweekConfigRequest`](/doc/models/update-workweek-config-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
811
 
812
  ## Response Type
813
 
814
- [`UpdateWorkweekConfigResponse`](/doc/models/update-workweek-config-response.md)
815
 
816
  ## Example Usage
817
 
@@ -823,10 +768,7 @@ $body_workweekConfig = new Models\WorkweekConfig(
823
  $body_workweekConfig_startOfWeek,
824
  $body_workweekConfig_startOfDayLocalTime
825
  );
826
- $body_workweekConfig->setId('id4');
827
  $body_workweekConfig->setVersion(10);
828
- $body_workweekConfig->setCreatedAt('created_at2');
829
- $body_workweekConfig->setUpdatedAt('updated_at0');
830
  $body = new Models\UpdateWorkweekConfigRequest(
831
  $body_workweekConfig
832
  );
10
 
11
  ## Methods
12
 
13
+ * [List Break Types](../../doc/apis/labor.md#list-break-types)
14
+ * [Create Break Type](../../doc/apis/labor.md#create-break-type)
15
+ * [Delete Break Type](../../doc/apis/labor.md#delete-break-type)
16
+ * [Get Break Type](../../doc/apis/labor.md#get-break-type)
17
+ * [Update Break Type](../../doc/apis/labor.md#update-break-type)
18
+ * [List Employee Wages](../../doc/apis/labor.md#list-employee-wages)
19
+ * [Get Employee Wage](../../doc/apis/labor.md#get-employee-wage)
20
+ * [Create Shift](../../doc/apis/labor.md#create-shift)
21
+ * [Search Shifts](../../doc/apis/labor.md#search-shifts)
22
+ * [Delete Shift](../../doc/apis/labor.md#delete-shift)
23
+ * [Get Shift](../../doc/apis/labor.md#get-shift)
24
+ * [Update Shift](../../doc/apis/labor.md#update-shift)
25
+ * [List Team Member Wages](../../doc/apis/labor.md#list-team-member-wages)
26
+ * [Get Team Member Wage](../../doc/apis/labor.md#get-team-member-wage)
27
+ * [List Workweek Configs](../../doc/apis/labor.md#list-workweek-configs)
28
+ * [Update Workweek Config](../../doc/apis/labor.md#update-workweek-config)
29
 
30
 
31
  # List Break Types
46
 
47
  ## Response Type
48
 
49
+ [`ListBreakTypesResponse`](../../doc/models/list-break-types-response.md)
50
 
51
  ## Example Usage
52
 
53
  ```php
54
+ $apiResponse = $laborApi->listBreakTypes();
 
 
 
 
55
 
56
  if ($apiResponse->isSuccess()) {
57
  $listBreakTypesResponse = $apiResponse->getResult();
90
 
91
  | Parameter | Type | Tags | Description |
92
  | --- | --- | --- | --- |
93
+ | `body` | [`CreateBreakTypeRequest`](../../doc/models/create-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
94
 
95
  ## Response Type
96
 
97
+ [`CreateBreakTypeResponse`](../../doc/models/create-break-type-response.md)
98
 
99
  ## Example Usage
100
 
109
  $body_breakType_expectedDuration,
110
  $body_breakType_isPaid
111
  );
 
 
 
 
112
  $body = new Models\CreateBreakTypeRequest(
113
  $body_breakType
114
  );
146
 
147
  ## Response Type
148
 
149
+ [`DeleteBreakTypeResponse`](../../doc/models/delete-break-type-response.md)
150
 
151
  ## Example Usage
152
 
183
 
184
  ## Response Type
185
 
186
+ [`GetBreakTypeResponse`](../../doc/models/get-break-type-response.md)
187
 
188
  ## Example Usage
189
 
217
  | Parameter | Type | Tags | Description |
218
  | --- | --- | --- | --- |
219
  | `id` | `string` | Template, Required | The UUID for the `BreakType` being updated. |
220
+ | `body` | [`UpdateBreakTypeRequest`](../../doc/models/update-break-type-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
221
 
222
  ## Response Type
223
 
224
+ [`UpdateBreakTypeResponse`](../../doc/models/update-break-type-response.md)
225
 
226
  ## Example Usage
227
 
237
  $body_breakType_expectedDuration,
238
  $body_breakType_isPaid
239
  );
 
240
  $body_breakType->setVersion(1);
 
 
241
  $body = new Models\UpdateBreakTypeRequest(
242
  $body_breakType
243
  );
276
 
277
  ## Response Type
278
 
279
+ [`ListEmployeeWagesResponse`](../../doc/models/list-employee-wages-response.md)
280
 
281
  ## Example Usage
282
 
283
  ```php
284
+ $apiResponse = $laborApi->listEmployeeWages();
 
 
 
 
285
 
286
  if ($apiResponse->isSuccess()) {
287
  $listEmployeeWagesResponse = $apiResponse->getResult();
313
 
314
  ## Response Type
315
 
316
+ [`GetEmployeeWageResponse`](../../doc/models/get-employee-wage-response.md)
317
 
318
  ## Example Usage
319
 
364
 
365
  | Parameter | Type | Tags | Description |
366
  | --- | --- | --- | --- |
367
+ | `body` | [`CreateShiftRequest`](../../doc/models/create-shift-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
368
 
369
  ## Response Type
370
 
371
+ [`CreateShiftResponse`](../../doc/models/create-shift-response.md)
372
 
373
  ## Example Usage
374
 
377
  $body_shift = new Models\Shift(
378
  $body_shift_startAt
379
  );
 
 
380
  $body_shift->setLocationId('PAA1RJZZKXBFG');
 
381
  $body_shift->setEndAt('2019-01-25T13:11:00-05:00');
382
  $body_shift->setWage(new Models\ShiftWage);
383
  $body_shift->getWage()->setTitle('Barista');
398
  $body_shift_breaks_0_expectedDuration,
399
  $body_shift_breaks_0_isPaid
400
  );
 
401
  $body_shift_breaks[0]->setEndAt('2019-01-25T06:16:00-05:00');
402
  $body_shift->setBreaks($body_shift_breaks);
403
 
448
 
449
  | Parameter | Type | Tags | Description |
450
  | --- | --- | --- | --- |
451
+ | `body` | [`SearchShiftsRequest`](../../doc/models/search-shifts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
452
 
453
  ## Response Type
454
 
455
+ [`SearchShiftsResponse`](../../doc/models/search-shifts-response.md)
456
 
457
  ## Example Usage
458
 
459
  ```php
460
  $body = new Models\SearchShiftsRequest;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
 
462
  $apiResponse = $laborApi->searchShifts($body);
463
 
489
 
490
  ## Response Type
491
 
492
+ [`DeleteShiftResponse`](../../doc/models/delete-shift-response.md)
493
 
494
  ## Example Usage
495
 
526
 
527
  ## Response Type
528
 
529
+ [`GetShiftResponse`](../../doc/models/get-shift-response.md)
530
 
531
  ## Example Usage
532
 
566
  | Parameter | Type | Tags | Description |
567
  | --- | --- | --- | --- |
568
  | `id` | `string` | Template, Required | The ID of the object being updated. |
569
+ | `body` | [`UpdateShiftRequest`](../../doc/models/update-shift-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
570
 
571
  ## Response Type
572
 
573
+ [`UpdateShiftResponse`](../../doc/models/update-shift-response.md)
574
 
575
  ## Example Usage
576
 
580
  $body_shift = new Models\Shift(
581
  $body_shift_startAt
582
  );
 
 
583
  $body_shift->setLocationId('PAA1RJZZKXBFG');
 
584
  $body_shift->setEndAt('2019-01-25T13:11:00-05:00');
585
  $body_shift->setWage(new Models\ShiftWage);
586
  $body_shift->getWage()->setTitle('Bartender');
647
 
648
  ## Response Type
649
 
650
+ [`ListTeamMemberWagesResponse`](../../doc/models/list-team-member-wages-response.md)
651
 
652
  ## Example Usage
653
 
654
  ```php
655
+ $apiResponse = $laborApi->listTeamMemberWages();
 
 
 
 
656
 
657
  if ($apiResponse->isSuccess()) {
658
  $listTeamMemberWagesResponse = $apiResponse->getResult();
682
 
683
  ## Response Type
684
 
685
+ [`GetTeamMemberWageResponse`](../../doc/models/get-team-member-wage-response.md)
686
 
687
  ## Example Usage
688
 
720
 
721
  ## Response Type
722
 
723
+ [`ListWorkweekConfigsResponse`](../../doc/models/list-workweek-configs-response.md)
724
 
725
  ## Example Usage
726
 
727
  ```php
728
+ $apiResponse = $laborApi->listWorkweekConfigs();
 
 
 
729
 
730
  if ($apiResponse->isSuccess()) {
731
  $listWorkweekConfigsResponse = $apiResponse->getResult();
752
  | Parameter | Type | Tags | Description |
753
  | --- | --- | --- | --- |
754
  | `id` | `string` | Template, Required | The UUID for the `WorkweekConfig` object being updated. |
755
+ | `body` | [`UpdateWorkweekConfigRequest`](../../doc/models/update-workweek-config-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
756
 
757
  ## Response Type
758
 
759
+ [`UpdateWorkweekConfigResponse`](../../doc/models/update-workweek-config-response.md)
760
 
761
  ## Example Usage
762
 
768
  $body_workweekConfig_startOfWeek,
769
  $body_workweekConfig_startOfDayLocalTime
770
  );
 
771
  $body_workweekConfig->setVersion(10);
 
 
772
  $body = new Models\UpdateWorkweekConfigRequest(
773
  $body_workweekConfig
774
  );
vendor/square/square/doc/apis/locations.md CHANGED
@@ -10,19 +10,16 @@ $locationsApi = $client->getLocationsApi();
10
 
11
  ## Methods
12
 
13
- * [List Locations](/doc/apis/locations.md#list-locations)
14
- * [Create Location](/doc/apis/locations.md#create-location)
15
- * [Retrieve Location](/doc/apis/locations.md#retrieve-location)
16
- * [Update Location](/doc/apis/locations.md#update-location)
17
 
18
 
19
  # List Locations
20
 
21
- Provides information of all locations of a business.
22
-
23
- Many Square API endpoints require a `location_id` parameter.
24
- The `id` field of the [`Location`](/doc/models/location.md) objects returned by this
25
- endpoint correspond to that `location_id` parameter.
26
 
27
  ```php
28
  function listLocations(): ApiResponse
@@ -30,7 +27,7 @@ function listLocations(): ApiResponse
30
 
31
  ## Response Type
32
 
33
- [`ListLocationsResponse`](/doc/models/list-locations-response.md)
34
 
35
  ## Example Usage
36
 
@@ -51,7 +48,13 @@ if ($apiResponse->isSuccess()) {
51
 
52
  # Create Location
53
 
54
- Creates a location.
 
 
 
 
 
 
55
 
56
  ```php
57
  function createLocation(CreateLocationRequest $body): ApiResponse
@@ -61,31 +64,24 @@ function createLocation(CreateLocationRequest $body): ApiResponse
61
 
62
  | Parameter | Type | Tags | Description |
63
  | --- | --- | --- | --- |
64
- | `body` | [`CreateLocationRequest`](/doc/models/create-location-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
65
 
66
  ## Response Type
67
 
68
- [`CreateLocationResponse`](/doc/models/create-location-response.md)
69
 
70
  ## Example Usage
71
 
72
  ```php
73
  $body = new Models\CreateLocationRequest;
74
  $body->setLocation(new Models\Location);
75
- $body->getLocation()->setId('id0');
76
- $body->getLocation()->setName('New location name');
77
  $body->getLocation()->setAddress(new Models\Address);
78
  $body->getLocation()->getAddress()->setAddressLine1('1234 Peachtree St. NE');
79
- $body->getLocation()->getAddress()->setAddressLine2('address_line_26');
80
- $body->getLocation()->getAddress()->setAddressLine3('address_line_32');
81
  $body->getLocation()->getAddress()->setLocality('Atlanta');
82
- $body->getLocation()->getAddress()->setSublocality('sublocality6');
83
  $body->getLocation()->getAddress()->setAdministrativeDistrictLevel1('GA');
84
  $body->getLocation()->getAddress()->setPostalCode('30309');
85
- $body->getLocation()->setTimezone('timezone0');
86
- $body->getLocation()->setCapabilities([Models\LocationCapability::AUTOMATIC_TRANSFERS, Models\LocationCapability::CREDIT_CARD_PROCESSING, Models\LocationCapability::AUTOMATIC_TRANSFERS]);
87
- $body->getLocation()->setDescription('My new location.');
88
- $body->getLocation()->setFacebookUrl('null');
89
 
90
  $apiResponse = $locationsApi->createLocation($body);
91
 
@@ -103,9 +99,8 @@ if ($apiResponse->isSuccess()) {
103
 
104
  # Retrieve Location
105
 
106
- Retrieves details of a location. You can specify "main"
107
- as the location ID to retrieve details of the
108
- main location.
109
 
110
  ```php
111
  function retrieveLocation(string $locationId): ApiResponse
@@ -115,11 +110,11 @@ function retrieveLocation(string $locationId): ApiResponse
115
 
116
  | Parameter | Type | Tags | Description |
117
  | --- | --- | --- | --- |
118
- | `locationId` | `string` | Template, Required | The ID of the location to retrieve. If you specify the string "main",<br>then the endpoint returns the main location. |
119
 
120
  ## Response Type
121
 
122
- [`RetrieveLocationResponse`](/doc/models/retrieve-location-response.md)
123
 
124
  ## Example Usage
125
 
@@ -142,7 +137,7 @@ if ($apiResponse->isSuccess()) {
142
 
143
  # Update Location
144
 
145
- Updates a location.
146
 
147
  ```php
148
  function updateLocation(string $locationId, UpdateLocationRequest $body): ApiResponse
@@ -153,11 +148,11 @@ function updateLocation(string $locationId, UpdateLocationRequest $body): ApiRes
153
  | Parameter | Type | Tags | Description |
154
  | --- | --- | --- | --- |
155
  | `locationId` | `string` | Template, Required | The ID of the location to update. |
156
- | `body` | [`UpdateLocationRequest`](/doc/models/update-location-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
157
 
158
  ## Response Type
159
 
160
- [`UpdateLocationResponse`](/doc/models/update-location-response.md)
161
 
162
  ## Example Usage
163
 
@@ -165,31 +160,26 @@ function updateLocation(string $locationId, UpdateLocationRequest $body): ApiRes
165
  $locationId = 'location_id4';
166
  $body = new Models\UpdateLocationRequest;
167
  $body->setLocation(new Models\Location);
168
- $body->getLocation()->setId('id0');
169
- $body->getLocation()->setName('Updated nickname');
170
- $body->getLocation()->setAddress(new Models\Address);
171
- $body->getLocation()->getAddress()->setAddressLine1('1234 Peachtree St. NE');
172
- $body->getLocation()->getAddress()->setAddressLine2('address_line_26');
173
- $body->getLocation()->getAddress()->setAddressLine3('address_line_32');
174
- $body->getLocation()->getAddress()->setLocality('Atlanta');
175
- $body->getLocation()->getAddress()->setSublocality('sublocality6');
176
- $body->getLocation()->getAddress()->setAdministrativeDistrictLevel1('GA');
177
- $body->getLocation()->getAddress()->setPostalCode('30309');
178
- $body->getLocation()->setTimezone('timezone0');
179
- $body->getLocation()->setCapabilities([Models\LocationCapability::AUTOMATIC_TRANSFERS, Models\LocationCapability::CREDIT_CARD_PROCESSING, Models\LocationCapability::AUTOMATIC_TRANSFERS]);
180
  $body->getLocation()->setBusinessHours(new Models\BusinessHours);
181
  $body_location_businessHours_periods = [];
182
 
183
  $body_location_businessHours_periods[0] = new Models\BusinessHoursPeriod;
184
- $body_location_businessHours_periods[0]->setDayOfWeek(Models\DayOfWeek::MON);
185
- $body_location_businessHours_periods[0]->setStartLocalTime('09:00');
186
- $body_location_businessHours_periods[0]->setEndLocalTime('17:00');
 
 
 
 
 
 
 
 
 
 
187
  $body->getLocation()->getBusinessHours()->setPeriods($body_location_businessHours_periods);
188
 
189
- $body->getLocation()->setDescription('Updated description');
190
- $body->getLocation()->setTwitterUsername('twitter');
191
- $body->getLocation()->setInstagramUsername('instagram');
192
- $body->getLocation()->setFacebookUrl('null');
193
 
194
  $apiResponse = $locationsApi->updateLocation($locationId, $body);
195
 
10
 
11
  ## Methods
12
 
13
+ * [List Locations](../../doc/apis/locations.md#list-locations)
14
+ * [Create Location](../../doc/apis/locations.md#create-location)
15
+ * [Retrieve Location](../../doc/apis/locations.md#retrieve-location)
16
+ * [Update Location](../../doc/apis/locations.md#update-location)
17
 
18
 
19
  # List Locations
20
 
21
+ Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api),
22
+ including those with an inactive status.
 
 
 
23
 
24
  ```php
25
  function listLocations(): ApiResponse
27
 
28
  ## Response Type
29
 
30
+ [`ListLocationsResponse`](../../doc/models/list-locations-response.md)
31
 
32
  ## Example Usage
33
 
48
 
49
  # Create Location
50
 
51
+ Creates a [location](https://developer.squareup.com/docs/locations-api).
52
+ Creating new locations allows for separate configuration of receipt layouts, item prices,
53
+ and sales reports. Developers can use locations to separate sales activity through applications
54
+ that integrate with Square from sales activity elsewhere in a seller's account.
55
+ Locations created programmatically with the Locations API last forever and
56
+ are visible to the seller for their own management. Therefore, ensure that
57
+ each location has a sensible and unique name.
58
 
59
  ```php
60
  function createLocation(CreateLocationRequest $body): ApiResponse
64
 
65
  | Parameter | Type | Tags | Description |
66
  | --- | --- | --- | --- |
67
+ | `body` | [`CreateLocationRequest`](../../doc/models/create-location-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
68
 
69
  ## Response Type
70
 
71
+ [`CreateLocationResponse`](../../doc/models/create-location-response.md)
72
 
73
  ## Example Usage
74
 
75
  ```php
76
  $body = new Models\CreateLocationRequest;
77
  $body->setLocation(new Models\Location);
78
+ $body->getLocation()->setName('Midtown');
 
79
  $body->getLocation()->setAddress(new Models\Address);
80
  $body->getLocation()->getAddress()->setAddressLine1('1234 Peachtree St. NE');
 
 
81
  $body->getLocation()->getAddress()->setLocality('Atlanta');
 
82
  $body->getLocation()->getAddress()->setAdministrativeDistrictLevel1('GA');
83
  $body->getLocation()->getAddress()->setPostalCode('30309');
84
+ $body->getLocation()->setDescription('Midtown Atlanta store');
 
 
 
85
 
86
  $apiResponse = $locationsApi->createLocation($body);
87
 
99
 
100
  # Retrieve Location
101
 
102
+ Retrieves details of a single location. Specify "main"
103
+ as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location).
 
104
 
105
  ```php
106
  function retrieveLocation(string $locationId): ApiResponse
110
 
111
  | Parameter | Type | Tags | Description |
112
  | --- | --- | --- | --- |
113
+ | `locationId` | `string` | Template, Required | The ID of the location to retrieve. Specify the string<br>"main" to return the main location. |
114
 
115
  ## Response Type
116
 
117
+ [`RetrieveLocationResponse`](../../doc/models/retrieve-location-response.md)
118
 
119
  ## Example Usage
120
 
137
 
138
  # Update Location
139
 
140
+ Updates a [location](https://developer.squareup.com/docs/locations-api).
141
 
142
  ```php
143
  function updateLocation(string $locationId, UpdateLocationRequest $body): ApiResponse
148
  | Parameter | Type | Tags | Description |
149
  | --- | --- | --- | --- |
150
  | `locationId` | `string` | Template, Required | The ID of the location to update. |
151
+ | `body` | [`UpdateLocationRequest`](../../doc/models/update-location-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
152
 
153
  ## Response Type
154
 
155
+ [`UpdateLocationResponse`](../../doc/models/update-location-response.md)
156
 
157
  ## Example Usage
158
 
160
  $locationId = 'location_id4';
161
  $body = new Models\UpdateLocationRequest;
162
  $body->setLocation(new Models\Location);
 
 
 
 
 
 
 
 
 
 
 
 
163
  $body->getLocation()->setBusinessHours(new Models\BusinessHours);
164
  $body_location_businessHours_periods = [];
165
 
166
  $body_location_businessHours_periods[0] = new Models\BusinessHoursPeriod;
167
+ $body_location_businessHours_periods[0]->setDayOfWeek(Models\DayOfWeek::FRI);
168
+ $body_location_businessHours_periods[0]->setStartLocalTime('07:00');
169
+ $body_location_businessHours_periods[0]->setEndLocalTime('18:00');
170
+
171
+ $body_location_businessHours_periods[1] = new Models\BusinessHoursPeriod;
172
+ $body_location_businessHours_periods[1]->setDayOfWeek(Models\DayOfWeek::SAT);
173
+ $body_location_businessHours_periods[1]->setStartLocalTime('07:00');
174
+ $body_location_businessHours_periods[1]->setEndLocalTime('18:00');
175
+
176
+ $body_location_businessHours_periods[2] = new Models\BusinessHoursPeriod;
177
+ $body_location_businessHours_periods[2]->setDayOfWeek(Models\DayOfWeek::SUN);
178
+ $body_location_businessHours_periods[2]->setStartLocalTime('09:00');
179
+ $body_location_businessHours_periods[2]->setEndLocalTime('15:00');
180
  $body->getLocation()->getBusinessHours()->setPeriods($body_location_businessHours_periods);
181
 
182
+ $body->getLocation()->setDescription('Midtown Atlanta store - Open weekends');
 
 
 
183
 
184
  $apiResponse = $locationsApi->updateLocation($locationId, $body);
185
 
vendor/square/square/doc/apis/loyalty.md CHANGED
@@ -10,20 +10,20 @@ $loyaltyApi = $client->getLoyaltyApi();
10
 
11
  ## Methods
12
 
13
- * [Create Loyalty Account](/doc/apis/loyalty.md#create-loyalty-account)
14
- * [Search Loyalty Accounts](/doc/apis/loyalty.md#search-loyalty-accounts)
15
- * [Retrieve Loyalty Account](/doc/apis/loyalty.md#retrieve-loyalty-account)
16
- * [Accumulate Loyalty Points](/doc/apis/loyalty.md#accumulate-loyalty-points)
17
- * [Adjust Loyalty Points](/doc/apis/loyalty.md#adjust-loyalty-points)
18
- * [Search Loyalty Events](/doc/apis/loyalty.md#search-loyalty-events)
19
- * [List Loyalty Programs](/doc/apis/loyalty.md#list-loyalty-programs)
20
- * [Retrieve Loyalty Program](/doc/apis/loyalty.md#retrieve-loyalty-program)
21
- * [Calculate Loyalty Points](/doc/apis/loyalty.md#calculate-loyalty-points)
22
- * [Create Loyalty Reward](/doc/apis/loyalty.md#create-loyalty-reward)
23
- * [Search Loyalty Rewards](/doc/apis/loyalty.md#search-loyalty-rewards)
24
- * [Delete Loyalty Reward](/doc/apis/loyalty.md#delete-loyalty-reward)
25
- * [Retrieve Loyalty Reward](/doc/apis/loyalty.md#retrieve-loyalty-reward)
26
- * [Redeem Loyalty Reward](/doc/apis/loyalty.md#redeem-loyalty-reward)
27
 
28
 
29
  # Create Loyalty Account
@@ -38,11 +38,11 @@ function createLoyaltyAccount(CreateLoyaltyAccountRequest $body): ApiResponse
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
- | `body` | [`CreateLoyaltyAccountRequest`](/doc/models/create-loyalty-account-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
- [`CreateLoyaltyAccountResponse`](/doc/models/create-loyalty-account-response.md)
46
 
47
  ## Example Usage
48
 
@@ -51,14 +51,7 @@ $body_loyaltyAccount_programId = 'd619f755-2d17-41f3-990d-c04ecedd64dd';
51
  $body_loyaltyAccount = new Models\LoyaltyAccount(
52
  $body_loyaltyAccount_programId
53
  );
54
- $body_loyaltyAccount->setId('id2');
55
- $body_loyaltyAccount->setBalance(14);
56
- $body_loyaltyAccount->setLifetimePoints(38);
57
- $body_loyaltyAccount->setCustomerId('customer_id0');
58
- $body_loyaltyAccount->setEnrolledAt('enrolled_at2');
59
  $body_loyaltyAccount->setMapping(new Models\LoyaltyAccountMapping);
60
- $body_loyaltyAccount->getMapping()->setId('id6');
61
- $body_loyaltyAccount->getMapping()->setCreatedAt('created_at4');
62
  $body_loyaltyAccount->getMapping()->setPhoneNumber('+14155551234');
63
  $body_idempotencyKey = 'ec78c477-b1c3-4899-a209-a4e71337c996';
64
  $body = new Models\CreateLoyaltyAccountRequest(
@@ -96,11 +89,11 @@ function searchLoyaltyAccounts(SearchLoyaltyAccountsRequest $body): ApiResponse
96
 
97
  | Parameter | Type | Tags | Description |
98
  | --- | --- | --- | --- |
99
- | `body` | [`SearchLoyaltyAccountsRequest`](/doc/models/search-loyalty-accounts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
100
 
101
  ## Response Type
102
 
103
- [`SearchLoyaltyAccountsResponse`](/doc/models/search-loyalty-accounts-response.md)
104
 
105
  ## Example Usage
106
 
@@ -110,14 +103,10 @@ $body->setQuery(new Models\SearchLoyaltyAccountsRequestLoyaltyAccountQuery);
110
  $body_query_mappings = [];
111
 
112
  $body_query_mappings[0] = new Models\LoyaltyAccountMapping;
113
- $body_query_mappings[0]->setId('id4');
114
- $body_query_mappings[0]->setCreatedAt('created_at8');
115
  $body_query_mappings[0]->setPhoneNumber('+14155551234');
116
  $body->getQuery()->setMappings($body_query_mappings);
117
 
118
- $body->getQuery()->setCustomerIds(['customer_ids5', 'customer_ids4']);
119
  $body->setLimit(10);
120
- $body->setCursor('cursor0');
121
 
122
  $apiResponse = $loyaltyApi->searchLoyaltyAccounts($body);
123
 
@@ -145,11 +134,11 @@ function retrieveLoyaltyAccount(string $accountId): ApiResponse
145
 
146
  | Parameter | Type | Tags | Description |
147
  | --- | --- | --- | --- |
148
- | `accountId` | `string` | Template, Required | The ID of the [loyalty account](/doc/models/loyalty-account.md) to retrieve. |
149
 
150
  ## Response Type
151
 
152
- [`RetrieveLoyaltyAccountResponse`](/doc/models/retrieve-loyalty-account-response.md)
153
 
154
  ## Example Usage
155
 
@@ -179,12 +168,9 @@ Adds points to a loyalty account.
179
  - If you are not using the Orders API to manage orders,
180
  you first perform a client-side computation to compute the points.
181
  For spend-based and visit-based programs, you can first call
182
- [CalculateLoyaltyPoints](/doc/apis/loyalty.md#calculate-loyalty-points) to compute the points
183
  that you provide to this endpoint.
184
 
185
- __Note:__ The country of the seller's Square account determines whether tax is included in the purchase amount when accruing points for spend-based and visit-based programs.
186
- For more information, see [Availability of Square Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-market-availability).
187
-
188
  ```php
189
  function accumulateLoyaltyPoints(string $accountId, AccumulateLoyaltyPointsRequest $body): ApiResponse
190
  ```
@@ -193,20 +179,18 @@ function accumulateLoyaltyPoints(string $accountId, AccumulateLoyaltyPointsReque
193
 
194
  | Parameter | Type | Tags | Description |
195
  | --- | --- | --- | --- |
196
- | `accountId` | `string` | Template, Required | The [loyalty account](/doc/models/loyalty-account.md) ID to which to add the points. |
197
- | `body` | [`AccumulateLoyaltyPointsRequest`](/doc/models/accumulate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
198
 
199
  ## Response Type
200
 
201
- [`AccumulateLoyaltyPointsResponse`](/doc/models/accumulate-loyalty-points-response.md)
202
 
203
  ## Example Usage
204
 
205
  ```php
206
  $accountId = 'account_id2';
207
  $body_accumulatePoints = new Models\LoyaltyEventAccumulatePoints;
208
- $body_accumulatePoints->setLoyaltyProgramId('loyalty_program_id8');
209
- $body_accumulatePoints->setPoints(90);
210
  $body_accumulatePoints->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
211
  $body_idempotencyKey = '58b90739-c3e8-4b11-85f7-e636d48d72cb';
212
  $body_locationId = 'P034NEENMD09F';
@@ -235,7 +219,7 @@ if ($apiResponse->isSuccess()) {
235
  Adds points to or subtracts points from a buyer's account.
236
 
237
  Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
238
- [AccumulateLoyaltyPoints](/doc/apis/loyalty.md#accumulate-loyalty-points)
239
  to add points when a buyer pays for the purchase.
240
 
241
  ```php
@@ -246,12 +230,12 @@ function adjustLoyaltyPoints(string $accountId, AdjustLoyaltyPointsRequest $body
246
 
247
  | Parameter | Type | Tags | Description |
248
  | --- | --- | --- | --- |
249
- | `accountId` | `string` | Template, Required | The ID of the [loyalty account](/doc/models/loyalty-account.md) in which to adjust the points. |
250
- | `body` | [`AdjustLoyaltyPointsRequest`](/doc/models/adjust-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
251
 
252
  ## Response Type
253
 
254
- [`AdjustLoyaltyPointsResponse`](/doc/models/adjust-loyalty-points-response.md)
255
 
256
  ## Example Usage
257
 
@@ -262,7 +246,6 @@ $body_adjustPoints_points = 10;
262
  $body_adjustPoints = new Models\LoyaltyEventAdjustPoints(
263
  $body_adjustPoints_points
264
  );
265
- $body_adjustPoints->setLoyaltyProgramId('loyalty_program_id4');
266
  $body_adjustPoints->setReason('Complimentary points');
267
  $body = new Models\AdjustLoyaltyPointsRequest(
268
  $body_idempotencyKey,
@@ -302,11 +285,11 @@ function searchLoyaltyEvents(SearchLoyaltyEventsRequest $body): ApiResponse
302
 
303
  | Parameter | Type | Tags | Description |
304
  | --- | --- | --- | --- |
305
- | `body` | [`SearchLoyaltyEventsRequest`](/doc/models/search-loyalty-events-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
306
 
307
  ## Response Type
308
 
309
- [`SearchLoyaltyEventsResponse`](/doc/models/search-loyalty-events-response.md)
310
 
311
  ## Example Usage
312
 
@@ -314,30 +297,11 @@ function searchLoyaltyEvents(SearchLoyaltyEventsRequest $body): ApiResponse
314
  $body = new Models\SearchLoyaltyEventsRequest;
315
  $body->setQuery(new Models\LoyaltyEventQuery);
316
  $body->getQuery()->setFilter(new Models\LoyaltyEventFilter);
317
- $body_query_filter_loyaltyAccountFilter_loyaltyAccountId = 'loyalty_account_id6';
318
- $body->getQuery()->getFilter()->setLoyaltyAccountFilter(new Models\LoyaltyEventLoyaltyAccountFilter(
319
- $body_query_filter_loyaltyAccountFilter_loyaltyAccountId
320
- ));
321
- $body_query_filter_typeFilter_types = [Models\LoyaltyEventType::DELETE_REWARD, Models\LoyaltyEventType::ADJUST_POINTS, Models\LoyaltyEventType::EXPIRE_POINTS];
322
- $body->getQuery()->getFilter()->setTypeFilter(new Models\LoyaltyEventTypeFilter(
323
- $body_query_filter_typeFilter_types
324
- ));
325
- $body_query_filter_dateTimeFilter_createdAt = new Models\TimeRange;
326
- $body_query_filter_dateTimeFilter_createdAt->setStartAt('start_at8');
327
- $body_query_filter_dateTimeFilter_createdAt->setEndAt('end_at4');
328
- $body->getQuery()->getFilter()->setDateTimeFilter(new Models\LoyaltyEventDateTimeFilter(
329
- $body_query_filter_dateTimeFilter_createdAt
330
- ));
331
- $body_query_filter_locationFilter_locationIds = ['location_ids2', 'location_ids3', 'location_ids4'];
332
- $body->getQuery()->getFilter()->setLocationFilter(new Models\LoyaltyEventLocationFilter(
333
- $body_query_filter_locationFilter_locationIds
334
- ));
335
  $body_query_filter_orderFilter_orderId = 'PyATxhYLfsMqpVkcKJITPydgEYfZY';
336
  $body->getQuery()->getFilter()->setOrderFilter(new Models\LoyaltyEventOrderFilter(
337
  $body_query_filter_orderFilter_orderId
338
  ));
339
  $body->setLimit(30);
340
- $body->setCursor('cursor0');
341
 
342
  $apiResponse = $loyaltyApi->searchLoyaltyEvents($body);
343
 
@@ -360,7 +324,7 @@ if ($apiResponse->isSuccess()) {
360
  Returns a list of loyalty programs in the seller's account.
361
  Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
362
 
363
- Replaced with [RetrieveLoyaltyProgram](/doc/apis/loyalty.md#retrieve-loyalty-program) when used with the keyword `main`.
364
 
365
  ```php
366
  function listLoyaltyPrograms(): ApiResponse
@@ -368,7 +332,7 @@ function listLoyaltyPrograms(): ApiResponse
368
 
369
  ## Response Type
370
 
371
- [`ListLoyaltyProgramsResponse`](/doc/models/list-loyalty-programs-response.md)
372
 
373
  ## Example Usage
374
 
@@ -405,7 +369,7 @@ function retrieveLoyaltyProgram(string $programId): ApiResponse
405
 
406
  ## Response Type
407
 
408
- [`RetrieveLoyaltyProgramResponse`](/doc/models/retrieve-loyalty-program-response.md)
409
 
410
  ## Example Usage
411
 
@@ -430,7 +394,7 @@ if ($apiResponse->isSuccess()) {
430
 
431
  Calculates the points a purchase earns.
432
 
433
- - If you are using the Orders API to manage orders, you provide `order_id` in the request. The
434
  endpoint calculates the points by reading the order.
435
  - If you are not using the Orders API to manage orders, you provide the purchase amount in
436
  the request for the endpoint to calculate the points.
@@ -438,8 +402,7 @@ Calculates the points a purchase earns.
438
  An application might call this endpoint to show the points that a buyer can earn with the
439
  specific purchase.
440
 
441
- __Note:__ The country of the seller's Square account determines whether tax is included in the purchase amount when accruing points for spend-based and visit-based programs.
442
- For more information, see [Availability of Square Loyalty](https://developer.squareup.com/docs/loyalty-api/overview#loyalty-market-availability).
443
 
444
  ```php
445
  function calculateLoyaltyPoints(string $programId, CalculateLoyaltyPointsRequest $body): ApiResponse
@@ -449,12 +412,12 @@ function calculateLoyaltyPoints(string $programId, CalculateLoyaltyPointsRequest
449
 
450
  | Parameter | Type | Tags | Description |
451
  | --- | --- | --- | --- |
452
- | `programId` | `string` | Template, Required | The [loyalty program](/doc/models/loyalty-program.md) ID, which defines the rules for accruing points. |
453
- | `body` | [`CalculateLoyaltyPointsRequest`](/doc/models/calculate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
454
 
455
  ## Response Type
456
 
457
- [`CalculateLoyaltyPointsResponse`](/doc/models/calculate-loyalty-points-response.md)
458
 
459
  ## Example Usage
460
 
@@ -462,9 +425,6 @@ function calculateLoyaltyPoints(string $programId, CalculateLoyaltyPointsRequest
462
  $programId = 'program_id0';
463
  $body = new Models\CalculateLoyaltyPointsRequest;
464
  $body->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
465
- $body->setTransactionAmountMoney(new Models\Money);
466
- $body->getTransactionAmountMoney()->setAmount(72);
467
- $body->getTransactionAmountMoney()->setCurrency(Models\Currency::UZS);
468
 
469
  $apiResponse = $loyaltyApi->calculateLoyaltyPoints($programId, $body);
470
 
@@ -499,11 +459,11 @@ function createLoyaltyReward(CreateLoyaltyRewardRequest $body): ApiResponse
499
 
500
  | Parameter | Type | Tags | Description |
501
  | --- | --- | --- | --- |
502
- | `body` | [`CreateLoyaltyRewardRequest`](/doc/models/create-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
503
 
504
  ## Response Type
505
 
506
- [`CreateLoyaltyRewardResponse`](/doc/models/create-loyalty-reward-response.md)
507
 
508
  ## Example Usage
509
 
@@ -514,11 +474,7 @@ $body_reward = new Models\LoyaltyReward(
514
  $body_reward_loyaltyAccountId,
515
  $body_reward_rewardTierId
516
  );
517
- $body_reward->setId('id4');
518
- $body_reward->setStatus(Models\LoyaltyRewardStatus::REDEEMED);
519
- $body_reward->setPoints(230);
520
  $body_reward->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
521
- $body_reward->setCreatedAt('created_at2');
522
  $body_idempotencyKey = '18c2e5ea-a620-4b1f-ad60-7b167285e451';
523
  $body = new Models\CreateLoyaltyRewardRequest(
524
  $body_reward,
@@ -541,12 +497,11 @@ if ($apiResponse->isSuccess()) {
541
 
542
  # Search Loyalty Rewards
543
 
544
- Searches for loyalty rewards in a loyalty account.
545
-
546
- In the current implementation, the endpoint supports search by the reward `status`.
547
 
548
  If you know a reward ID, use the
549
- [RetrieveLoyaltyReward](/doc/apis/loyalty.md#retrieve-loyalty-reward) endpoint.
550
 
551
  Search results are sorted by `updated_at` in descending order.
552
 
@@ -558,11 +513,11 @@ function searchLoyaltyRewards(SearchLoyaltyRewardsRequest $body): ApiResponse
558
 
559
  | Parameter | Type | Tags | Description |
560
  | --- | --- | --- | --- |
561
- | `body` | [`SearchLoyaltyRewardsRequest`](/doc/models/search-loyalty-rewards-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
562
 
563
  ## Response Type
564
 
565
- [`SearchLoyaltyRewardsResponse`](/doc/models/search-loyalty-rewards-response.md)
566
 
567
  ## Example Usage
568
 
@@ -572,9 +527,7 @@ $body_query_loyaltyAccountId = '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd';
572
  $body->setQuery(new Models\SearchLoyaltyRewardsRequestLoyaltyRewardQuery(
573
  $body_query_loyaltyAccountId
574
  ));
575
- $body->getQuery()->setStatus(Models\LoyaltyRewardStatus::REDEEMED);
576
  $body->setLimit(10);
577
- $body->setCursor('cursor0');
578
 
579
  $apiResponse = $loyaltyApi->searchLoyaltyRewards($body);
580
 
@@ -596,7 +549,7 @@ Deletes a loyalty reward by doing the following:
596
 
597
  - Returns the loyalty points back to the loyalty account.
598
  - If an order ID was specified when the reward was created
599
- (see [CreateLoyaltyReward](/doc/apis/loyalty.md#create-loyalty-reward)),
600
  it updates the order by removing the reward and related
601
  discounts.
602
 
@@ -610,11 +563,11 @@ function deleteLoyaltyReward(string $rewardId): ApiResponse
610
 
611
  | Parameter | Type | Tags | Description |
612
  | --- | --- | --- | --- |
613
- | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](/doc/models/loyalty-reward.md) to delete. |
614
 
615
  ## Response Type
616
 
617
- [`DeleteLoyaltyRewardResponse`](/doc/models/delete-loyalty-reward-response.md)
618
 
619
  ## Example Usage
620
 
@@ -647,11 +600,11 @@ function retrieveLoyaltyReward(string $rewardId): ApiResponse
647
 
648
  | Parameter | Type | Tags | Description |
649
  | --- | --- | --- | --- |
650
- | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](/doc/models/loyalty-reward.md) to retrieve. |
651
 
652
  ## Response Type
653
 
654
- [`RetrieveLoyaltyRewardResponse`](/doc/models/retrieve-loyalty-reward-response.md)
655
 
656
  ## Example Usage
657
 
@@ -694,12 +647,12 @@ function redeemLoyaltyReward(string $rewardId, RedeemLoyaltyRewardRequest $body)
694
 
695
  | Parameter | Type | Tags | Description |
696
  | --- | --- | --- | --- |
697
- | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](/doc/models/loyalty-reward.md) to redeem. |
698
- | `body` | [`RedeemLoyaltyRewardRequest`](/doc/models/redeem-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
699
 
700
  ## Response Type
701
 
702
- [`RedeemLoyaltyRewardResponse`](/doc/models/redeem-loyalty-reward-response.md)
703
 
704
  ## Example Usage
705
 
10
 
11
  ## Methods
12
 
13
+ * [Create Loyalty Account](../../doc/apis/loyalty.md#create-loyalty-account)
14
+ * [Search Loyalty Accounts](../../doc/apis/loyalty.md#search-loyalty-accounts)
15
+ * [Retrieve Loyalty Account](../../doc/apis/loyalty.md#retrieve-loyalty-account)
16
+ * [Accumulate Loyalty Points](../../doc/apis/loyalty.md#accumulate-loyalty-points)
17
+ * [Adjust Loyalty Points](../../doc/apis/loyalty.md#adjust-loyalty-points)
18
+ * [Search Loyalty Events](../../doc/apis/loyalty.md#search-loyalty-events)
19
+ * [List Loyalty Programs](../../doc/apis/loyalty.md#list-loyalty-programs)
20
+ * [Retrieve Loyalty Program](../../doc/apis/loyalty.md#retrieve-loyalty-program)
21
+ * [Calculate Loyalty Points](../../doc/apis/loyalty.md#calculate-loyalty-points)
22
+ * [Create Loyalty Reward](../../doc/apis/loyalty.md#create-loyalty-reward)
23
+ * [Search Loyalty Rewards](../../doc/apis/loyalty.md#search-loyalty-rewards)
24
+ * [Delete Loyalty Reward](../../doc/apis/loyalty.md#delete-loyalty-reward)
25
+ * [Retrieve Loyalty Reward](../../doc/apis/loyalty.md#retrieve-loyalty-reward)
26
+ * [Redeem Loyalty Reward](../../doc/apis/loyalty.md#redeem-loyalty-reward)
27
 
28
 
29
  # Create Loyalty Account
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
+ | `body` | [`CreateLoyaltyAccountRequest`](../../doc/models/create-loyalty-account-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
+ [`CreateLoyaltyAccountResponse`](../../doc/models/create-loyalty-account-response.md)
46
 
47
  ## Example Usage
48
 
51
  $body_loyaltyAccount = new Models\LoyaltyAccount(
52
  $body_loyaltyAccount_programId
53
  );
 
 
 
 
 
54
  $body_loyaltyAccount->setMapping(new Models\LoyaltyAccountMapping);
 
 
55
  $body_loyaltyAccount->getMapping()->setPhoneNumber('+14155551234');
56
  $body_idempotencyKey = 'ec78c477-b1c3-4899-a209-a4e71337c996';
57
  $body = new Models\CreateLoyaltyAccountRequest(
89
 
90
  | Parameter | Type | Tags | Description |
91
  | --- | --- | --- | --- |
92
+ | `body` | [`SearchLoyaltyAccountsRequest`](../../doc/models/search-loyalty-accounts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
93
 
94
  ## Response Type
95
 
96
+ [`SearchLoyaltyAccountsResponse`](../../doc/models/search-loyalty-accounts-response.md)
97
 
98
  ## Example Usage
99
 
103
  $body_query_mappings = [];
104
 
105
  $body_query_mappings[0] = new Models\LoyaltyAccountMapping;
 
 
106
  $body_query_mappings[0]->setPhoneNumber('+14155551234');
107
  $body->getQuery()->setMappings($body_query_mappings);
108
 
 
109
  $body->setLimit(10);
 
110
 
111
  $apiResponse = $loyaltyApi->searchLoyaltyAccounts($body);
112
 
134
 
135
  | Parameter | Type | Tags | Description |
136
  | --- | --- | --- | --- |
137
+ | `accountId` | `string` | Template, Required | The ID of the [loyalty account](../../doc/models/loyalty-account.md) to retrieve. |
138
 
139
  ## Response Type
140
 
141
+ [`RetrieveLoyaltyAccountResponse`](../../doc/models/retrieve-loyalty-account-response.md)
142
 
143
  ## Example Usage
144
 
168
  - If you are not using the Orders API to manage orders,
169
  you first perform a client-side computation to compute the points.
170
  For spend-based and visit-based programs, you can first call
171
+ [CalculateLoyaltyPoints](../../doc/apis/loyalty.md#calculate-loyalty-points) to compute the points
172
  that you provide to this endpoint.
173
 
 
 
 
174
  ```php
175
  function accumulateLoyaltyPoints(string $accountId, AccumulateLoyaltyPointsRequest $body): ApiResponse
176
  ```
179
 
180
  | Parameter | Type | Tags | Description |
181
  | --- | --- | --- | --- |
182
+ | `accountId` | `string` | Template, Required | The [loyalty account](../../doc/models/loyalty-account.md) ID to which to add the points. |
183
+ | `body` | [`AccumulateLoyaltyPointsRequest`](../../doc/models/accumulate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
184
 
185
  ## Response Type
186
 
187
+ [`AccumulateLoyaltyPointsResponse`](../../doc/models/accumulate-loyalty-points-response.md)
188
 
189
  ## Example Usage
190
 
191
  ```php
192
  $accountId = 'account_id2';
193
  $body_accumulatePoints = new Models\LoyaltyEventAccumulatePoints;
 
 
194
  $body_accumulatePoints->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
195
  $body_idempotencyKey = '58b90739-c3e8-4b11-85f7-e636d48d72cb';
196
  $body_locationId = 'P034NEENMD09F';
219
  Adds points to or subtracts points from a buyer's account.
220
 
221
  Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call
222
+ [AccumulateLoyaltyPoints](../../doc/apis/loyalty.md#accumulate-loyalty-points)
223
  to add points when a buyer pays for the purchase.
224
 
225
  ```php
230
 
231
  | Parameter | Type | Tags | Description |
232
  | --- | --- | --- | --- |
233
+ | `accountId` | `string` | Template, Required | The ID of the [loyalty account](../../doc/models/loyalty-account.md) in which to adjust the points. |
234
+ | `body` | [`AdjustLoyaltyPointsRequest`](../../doc/models/adjust-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
235
 
236
  ## Response Type
237
 
238
+ [`AdjustLoyaltyPointsResponse`](../../doc/models/adjust-loyalty-points-response.md)
239
 
240
  ## Example Usage
241
 
246
  $body_adjustPoints = new Models\LoyaltyEventAdjustPoints(
247
  $body_adjustPoints_points
248
  );
 
249
  $body_adjustPoints->setReason('Complimentary points');
250
  $body = new Models\AdjustLoyaltyPointsRequest(
251
  $body_idempotencyKey,
285
 
286
  | Parameter | Type | Tags | Description |
287
  | --- | --- | --- | --- |
288
+ | `body` | [`SearchLoyaltyEventsRequest`](../../doc/models/search-loyalty-events-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
289
 
290
  ## Response Type
291
 
292
+ [`SearchLoyaltyEventsResponse`](../../doc/models/search-loyalty-events-response.md)
293
 
294
  ## Example Usage
295
 
297
  $body = new Models\SearchLoyaltyEventsRequest;
298
  $body->setQuery(new Models\LoyaltyEventQuery);
299
  $body->getQuery()->setFilter(new Models\LoyaltyEventFilter);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  $body_query_filter_orderFilter_orderId = 'PyATxhYLfsMqpVkcKJITPydgEYfZY';
301
  $body->getQuery()->getFilter()->setOrderFilter(new Models\LoyaltyEventOrderFilter(
302
  $body_query_filter_orderFilter_orderId
303
  ));
304
  $body->setLimit(30);
 
305
 
306
  $apiResponse = $loyaltyApi->searchLoyaltyEvents($body);
307
 
324
  Returns a list of loyalty programs in the seller's account.
325
  Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview).
326
 
327
+ Replaced with [RetrieveLoyaltyProgram](../../doc/apis/loyalty.md#retrieve-loyalty-program) when used with the keyword `main`.
328
 
329
  ```php
330
  function listLoyaltyPrograms(): ApiResponse
332
 
333
  ## Response Type
334
 
335
+ [`ListLoyaltyProgramsResponse`](../../doc/models/list-loyalty-programs-response.md)
336
 
337
  ## Example Usage
338
 
369
 
370
  ## Response Type
371
 
372
+ [`RetrieveLoyaltyProgramResponse`](../../doc/models/retrieve-loyalty-program-response.md)
373
 
374
  ## Example Usage
375
 
394
 
395
  Calculates the points a purchase earns.
396
 
397
+ - If you are using the Orders API to manage orders, you provide the `order_id` in the request. The
398
  endpoint calculates the points by reading the order.
399
  - If you are not using the Orders API to manage orders, you provide the purchase amount in
400
  the request for the endpoint to calculate the points.
402
  An application might call this endpoint to show the points that a buyer can earn with the
403
  specific purchase.
404
 
405
+ For spend-based and visit-based programs, the `tax_mode` setting of the accrual rule indicates how taxes should be treated for loyalty points accrual.
 
406
 
407
  ```php
408
  function calculateLoyaltyPoints(string $programId, CalculateLoyaltyPointsRequest $body): ApiResponse
412
 
413
  | Parameter | Type | Tags | Description |
414
  | --- | --- | --- | --- |
415
+ | `programId` | `string` | Template, Required | The [loyalty program](../../doc/models/loyalty-program.md) ID, which defines the rules for accruing points. |
416
+ | `body` | [`CalculateLoyaltyPointsRequest`](../../doc/models/calculate-loyalty-points-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
417
 
418
  ## Response Type
419
 
420
+ [`CalculateLoyaltyPointsResponse`](../../doc/models/calculate-loyalty-points-response.md)
421
 
422
  ## Example Usage
423
 
425
  $programId = 'program_id0';
426
  $body = new Models\CalculateLoyaltyPointsRequest;
427
  $body->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
 
 
 
428
 
429
  $apiResponse = $loyaltyApi->calculateLoyaltyPoints($programId, $body);
430
 
459
 
460
  | Parameter | Type | Tags | Description |
461
  | --- | --- | --- | --- |
462
+ | `body` | [`CreateLoyaltyRewardRequest`](../../doc/models/create-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
463
 
464
  ## Response Type
465
 
466
+ [`CreateLoyaltyRewardResponse`](../../doc/models/create-loyalty-reward-response.md)
467
 
468
  ## Example Usage
469
 
474
  $body_reward_loyaltyAccountId,
475
  $body_reward_rewardTierId
476
  );
 
 
 
477
  $body_reward->setOrderId('RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY');
 
478
  $body_idempotencyKey = '18c2e5ea-a620-4b1f-ad60-7b167285e451';
479
  $body = new Models\CreateLoyaltyRewardRequest(
480
  $body_reward,
497
 
498
  # Search Loyalty Rewards
499
 
500
+ Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
501
+ If you include a `query` object, `loyalty_account_id` is required and `status` is optional.
 
502
 
503
  If you know a reward ID, use the
504
+ [RetrieveLoyaltyReward](../../doc/apis/loyalty.md#retrieve-loyalty-reward) endpoint.
505
 
506
  Search results are sorted by `updated_at` in descending order.
507
 
513
 
514
  | Parameter | Type | Tags | Description |
515
  | --- | --- | --- | --- |
516
+ | `body` | [`SearchLoyaltyRewardsRequest`](../../doc/models/search-loyalty-rewards-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
517
 
518
  ## Response Type
519
 
520
+ [`SearchLoyaltyRewardsResponse`](../../doc/models/search-loyalty-rewards-response.md)
521
 
522
  ## Example Usage
523
 
527
  $body->setQuery(new Models\SearchLoyaltyRewardsRequestLoyaltyRewardQuery(
528
  $body_query_loyaltyAccountId
529
  ));
 
530
  $body->setLimit(10);
 
531
 
532
  $apiResponse = $loyaltyApi->searchLoyaltyRewards($body);
533
 
549
 
550
  - Returns the loyalty points back to the loyalty account.
551
  - If an order ID was specified when the reward was created
552
+ (see [CreateLoyaltyReward](../../doc/apis/loyalty.md#create-loyalty-reward)),
553
  it updates the order by removing the reward and related
554
  discounts.
555
 
563
 
564
  | Parameter | Type | Tags | Description |
565
  | --- | --- | --- | --- |
566
+ | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](../../doc/models/loyalty-reward.md) to delete. |
567
 
568
  ## Response Type
569
 
570
+ [`DeleteLoyaltyRewardResponse`](../../doc/models/delete-loyalty-reward-response.md)
571
 
572
  ## Example Usage
573
 
600
 
601
  | Parameter | Type | Tags | Description |
602
  | --- | --- | --- | --- |
603
+ | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](../../doc/models/loyalty-reward.md) to retrieve. |
604
 
605
  ## Response Type
606
 
607
+ [`RetrieveLoyaltyRewardResponse`](../../doc/models/retrieve-loyalty-reward-response.md)
608
 
609
  ## Example Usage
610
 
647
 
648
  | Parameter | Type | Tags | Description |
649
  | --- | --- | --- | --- |
650
+ | `rewardId` | `string` | Template, Required | The ID of the [loyalty reward](../../doc/models/loyalty-reward.md) to redeem. |
651
+ | `body` | [`RedeemLoyaltyRewardRequest`](../../doc/models/redeem-loyalty-reward-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
652
 
653
  ## Response Type
654
 
655
+ [`RedeemLoyaltyRewardResponse`](../../doc/models/redeem-loyalty-reward-response.md)
656
 
657
  ## Example Usage
658
 
vendor/square/square/doc/apis/merchants.md CHANGED
@@ -10,20 +10,22 @@ $merchantsApi = $client->getMerchantsApi();
10
 
11
  ## Methods
12
 
13
- * [List Merchants](/doc/apis/merchants.md#list-merchants)
14
- * [Retrieve Merchant](/doc/apis/merchants.md#retrieve-merchant)
15
 
16
 
17
  # List Merchants
18
 
19
- Returns `Merchant` information for a given access token.
20
 
21
- If you don't know a `Merchant` ID, you can use this endpoint to retrieve the merchant ID for an access token.
22
- You can specify your personal access token to get your own merchant information or specify an OAuth token
23
- to get the information for the merchant that granted you access.
 
 
24
 
25
- If you know the merchant ID, you can also use the [RetrieveMerchant](/doc/apis/merchants.md#retrieve-merchant)
26
- endpoint to get the merchant information.
27
 
28
  ```php
29
  function listMerchants(?int $cursor = null): ApiResponse
@@ -37,14 +39,12 @@ function listMerchants(?int $cursor = null): ApiResponse
37
 
38
  ## Response Type
39
 
40
- [`ListMerchantsResponse`](/doc/models/list-merchants-response.md)
41
 
42
  ## Example Usage
43
 
44
  ```php
45
- $cursor = 210;
46
-
47
- $apiResponse = $merchantsApi->listMerchants($cursor);
48
 
49
  if ($apiResponse->isSuccess()) {
50
  $listMerchantsResponse = $apiResponse->getResult();
@@ -60,7 +60,7 @@ if ($apiResponse->isSuccess()) {
60
 
61
  # Retrieve Merchant
62
 
63
- Retrieve a `Merchant` object for the given `merchant_id`.
64
 
65
  ```php
66
  function retrieveMerchant(string $merchantId): ApiResponse
@@ -74,7 +74,7 @@ function retrieveMerchant(string $merchantId): ApiResponse
74
 
75
  ## Response Type
76
 
77
- [`RetrieveMerchantResponse`](/doc/models/retrieve-merchant-response.md)
78
 
79
  ## Example Usage
80
 
10
 
11
  ## Methods
12
 
13
+ * [List Merchants](../../doc/apis/merchants.md#list-merchants)
14
+ * [Retrieve Merchant](../../doc/apis/merchants.md#retrieve-merchant)
15
 
16
 
17
  # List Merchants
18
 
19
+ Provides details about the merchant associated with a given access token.
20
 
21
+ The access token used to connect your application to a Square seller is associated
22
+ with a single merchant. That means that `ListMerchants` returns a list
23
+ with a single `Merchant` object. You can specify your personal access token
24
+ to get your own merchant information or specify an OAuth token to get the
25
+ information for the merchant that granted your application access.
26
 
27
+ If you know the merchant ID, you can also use the [RetrieveMerchant](../../doc/apis/merchants.md#retrieve-merchant)
28
+ endpoint to retrieve the merchant information.
29
 
30
  ```php
31
  function listMerchants(?int $cursor = null): ApiResponse
39
 
40
  ## Response Type
41
 
42
+ [`ListMerchantsResponse`](../../doc/models/list-merchants-response.md)
43
 
44
  ## Example Usage
45
 
46
  ```php
47
+ $apiResponse = $merchantsApi->listMerchants();
 
 
48
 
49
  if ($apiResponse->isSuccess()) {
50
  $listMerchantsResponse = $apiResponse->getResult();
60
 
61
  # Retrieve Merchant
62
 
63
+ Retrieves the `Merchant` object for the given `merchant_id`.
64
 
65
  ```php
66
  function retrieveMerchant(string $merchantId): ApiResponse
74
 
75
  ## Response Type
76
 
77
+ [`RetrieveMerchantResponse`](../../doc/models/retrieve-merchant-response.md)
78
 
79
  ## Example Usage
80
 
vendor/square/square/doc/apis/mobile-authorization.md CHANGED
@@ -11,9 +11,9 @@ $mobileAuthorizationApi = $client->getMobileAuthorizationApi();
11
 
12
  # Create Mobile Authorization Code
13
 
14
- Generates code to authorize a mobile application to connect to a Square card reader
15
 
16
- Authorization codes are one-time-use and expire __60 minutes__ after being issued.
17
 
18
  __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
19
 
@@ -32,11 +32,11 @@ function createMobileAuthorizationCode(CreateMobileAuthorizationCodeRequest $bod
32
 
33
  | Parameter | Type | Tags | Description |
34
  | --- | --- | --- | --- |
35
- | `body` | [`CreateMobileAuthorizationCodeRequest`](/doc/models/create-mobile-authorization-code-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
36
 
37
  ## Response Type
38
 
39
- [`CreateMobileAuthorizationCodeResponse`](/doc/models/create-mobile-authorization-code-response.md)
40
 
41
  ## Example Usage
42
 
11
 
12
  # Create Mobile Authorization Code
13
 
14
+ Generates code to authorize a mobile application to connect to a Square card reader.
15
 
16
+ Authorization codes are one-time-use codes and expire 60 minutes after being issued.
17
 
18
  __Important:__ The `Authorization` header you provide to this endpoint must have the following format:
19
 
32
 
33
  | Parameter | Type | Tags | Description |
34
  | --- | --- | --- | --- |
35
+ | `body` | [`CreateMobileAuthorizationCodeRequest`](../../doc/models/create-mobile-authorization-code-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
36
 
37
  ## Response Type
38
 
39
+ [`CreateMobileAuthorizationCodeResponse`](../../doc/models/create-mobile-authorization-code-response.md)
40
 
41
  ## Example Usage
42
 
vendor/square/square/doc/apis/o-auth.md CHANGED
@@ -10,9 +10,9 @@ $oAuthApi = $client->getOAuthApi();
10
 
11
  ## Methods
12
 
13
- * [Renew Token](/doc/apis/o-auth.md#renew-token)
14
- * [Revoke Token](/doc/apis/o-auth.md#revoke-token)
15
- * [Obtain Token](/doc/apis/o-auth.md#obtain-token)
16
 
17
 
18
  # Renew Token
@@ -24,10 +24,10 @@ $oAuthApi = $client->getOAuthApi();
24
 
25
  Renews an OAuth access token before it expires.
26
 
27
- OAuth access tokens besides your application's personal access token expire after __30 days__.
28
- You can also renew expired tokens within __15 days__ of their expiration.
29
  You cannot renew an access token that has been expired for more than 15 days.
30
- Instead, the associated user must re-complete the OAuth flow from the beginning.
31
 
32
  __Important:__ The `Authorization` header for this endpoint must have the
33
  following format:
@@ -37,7 +37,7 @@ Authorization: Client APPLICATION_SECRET
37
  ```
38
 
39
  Replace `APPLICATION_SECRET` with the application secret on the Credentials
40
- page in the [developer dashboard](https://developer.squareup.com/apps).
41
 
42
  :information_source: **Note** This endpoint does not require authentication.
43
 
@@ -49,13 +49,13 @@ function renewToken(string $clientId, RenewTokenRequest $body, string $authoriza
49
 
50
  | Parameter | Type | Tags | Description |
51
  | --- | --- | --- | --- |
52
- | `clientId` | `string` | Template, Required | Your application ID, available from the OAuth page for your<br>application on the Developer Dashboard. |
53
- | `body` | [`RenewTokenRequest`](/doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
54
  | `authorization` | `string` | Header, Required | Client APPLICATION_SECRET |
55
 
56
  ## Response Type
57
 
58
- [`RenewTokenResponse`](/doc/models/renew-token-response.md)
59
 
60
  ## Example Usage
61
 
@@ -108,12 +108,12 @@ function revokeToken(RevokeTokenRequest $body, string $authorization): ApiRespon
108
 
109
  | Parameter | Type | Tags | Description |
110
  | --- | --- | --- | --- |
111
- | `body` | [`RevokeTokenRequest`](/doc/models/revoke-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
112
  | `authorization` | `string` | Header, Required | Client APPLICATION_SECRET |
113
 
114
  ## Response Type
115
 
116
- [`RevokeTokenResponse`](/doc/models/revoke-token-response.md)
117
 
118
  ## Example Usage
119
 
@@ -121,8 +121,6 @@ function revokeToken(RevokeTokenRequest $body, string $authorization): ApiRespon
121
  $body = new Models\RevokeTokenRequest;
122
  $body->setClientId('CLIENT_ID');
123
  $body->setAccessToken('ACCESS_TOKEN');
124
- $body->setMerchantId('merchant_id6');
125
- $body->setRevokeOnlyAccessToken(false);
126
  $authorization = 'Client CLIENT_SECRET';
127
 
128
  $apiResponse = $oAuthApi->revokeToken($body, $authorization);
@@ -169,11 +167,11 @@ function obtainToken(ObtainTokenRequest $body): ApiResponse
169
 
170
  | Parameter | Type | Tags | Description |
171
  | --- | --- | --- | --- |
172
- | `body` | [`ObtainTokenRequest`](/doc/models/obtain-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
173
 
174
  ## Response Type
175
 
176
- [`ObtainTokenResponse`](/doc/models/obtain-token-response.md)
177
 
178
  ## Example Usage
179
 
@@ -187,10 +185,6 @@ $body = new Models\ObtainTokenRequest(
187
  $body_grantType
188
  );
189
  $body->setCode('CODE_FROM_AUTHORIZE');
190
- $body->setRedirectUri('redirect_uri4');
191
- $body->setRefreshToken('refresh_token6');
192
- $body->setMigrationToken('migration_token4');
193
- $body->setScopes(['scopes6', 'scopes7', 'scopes8']);
194
 
195
  $apiResponse = $oAuthApi->obtainToken($body);
196
 
10
 
11
  ## Methods
12
 
13
+ * [Renew Token](../../doc/apis/o-auth.md#renew-token)
14
+ * [Revoke Token](../../doc/apis/o-auth.md#revoke-token)
15
+ * [Obtain Token](../../doc/apis/o-auth.md#obtain-token)
16
 
17
 
18
  # Renew Token
24
 
25
  Renews an OAuth access token before it expires.
26
 
27
+ OAuth access tokens besides your application's personal access token expire after 30 days.
28
+ You can also renew expired tokens within 15 days of their expiration.
29
  You cannot renew an access token that has been expired for more than 15 days.
30
+ Instead, the associated user must recomplete the OAuth flow from the beginning.
31
 
32
  __Important:__ The `Authorization` header for this endpoint must have the
33
  following format:
37
  ```
38
 
39
  Replace `APPLICATION_SECRET` with the application secret on the Credentials
40
+ page in the [Developer Dashboard](https://developer.squareup.com/apps).
41
 
42
  :information_source: **Note** This endpoint does not require authentication.
43
 
49
 
50
  | Parameter | Type | Tags | Description |
51
  | --- | --- | --- | --- |
52
+ | `clientId` | `string` | Template, Required | Your application ID, which is available in the OAuth page in the [Developer Dashboard](https://developer.squareup.com/apps). |
53
+ | `body` | [`RenewTokenRequest`](../../doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
54
  | `authorization` | `string` | Header, Required | Client APPLICATION_SECRET |
55
 
56
  ## Response Type
57
 
58
+ [`RenewTokenResponse`](../../doc/models/renew-token-response.md)
59
 
60
  ## Example Usage
61
 
108
 
109
  | Parameter | Type | Tags | Description |
110
  | --- | --- | --- | --- |
111
+ | `body` | [`RevokeTokenRequest`](../../doc/models/revoke-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
112
  | `authorization` | `string` | Header, Required | Client APPLICATION_SECRET |
113
 
114
  ## Response Type
115
 
116
+ [`RevokeTokenResponse`](../../doc/models/revoke-token-response.md)
117
 
118
  ## Example Usage
119
 
121
  $body = new Models\RevokeTokenRequest;
122
  $body->setClientId('CLIENT_ID');
123
  $body->setAccessToken('ACCESS_TOKEN');
 
 
124
  $authorization = 'Client CLIENT_SECRET';
125
 
126
  $apiResponse = $oAuthApi->revokeToken($body, $authorization);
167
 
168
  | Parameter | Type | Tags | Description |
169
  | --- | --- | --- | --- |
170
+ | `body` | [`ObtainTokenRequest`](../../doc/models/obtain-token-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
171
 
172
  ## Response Type
173
 
174
+ [`ObtainTokenResponse`](../../doc/models/obtain-token-response.md)
175
 
176
  ## Example Usage
177
 
185
  $body_grantType
186
  );
187
  $body->setCode('CODE_FROM_AUTHORIZE');
 
 
 
 
188
 
189
  $apiResponse = $oAuthApi->obtainToken($body);
190
 
vendor/square/square/doc/apis/orders.md CHANGED
@@ -10,25 +10,25 @@ $ordersApi = $client->getOrdersApi();
10
 
11
  ## Methods
12
 
13
- * [Create Order](/doc/apis/orders.md#create-order)
14
- * [Batch Retrieve Orders](/doc/apis/orders.md#batch-retrieve-orders)
15
- * [Calculate Order](/doc/apis/orders.md#calculate-order)
16
- * [Clone Order](/doc/apis/orders.md#clone-order)
17
- * [Search Orders](/doc/apis/orders.md#search-orders)
18
- * [Retrieve Order](/doc/apis/orders.md#retrieve-order)
19
- * [Update Order](/doc/apis/orders.md#update-order)
20
- * [Pay Order](/doc/apis/orders.md#pay-order)
21
 
22
 
23
  # Create Order
24
 
25
- Creates a new [order](/doc/models/order.md) that can include information about products for
26
  purchase and settings to apply to the purchase.
27
 
28
  To pay for a created order, see
29
  [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
30
 
31
- You can modify open orders using the [UpdateOrder](/doc/apis/orders.md#update-order) endpoint.
32
 
33
  ```php
34
  function createOrder(CreateOrderRequest $body): ApiResponse
@@ -38,11 +38,11 @@ function createOrder(CreateOrderRequest $body): ApiResponse
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
- | `body` | [`CreateOrderRequest`](/doc/models/create-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
- [`CreateOrderResponse`](/doc/models/create-order-response.md)
46
 
47
  ## Example Usage
48
 
@@ -52,36 +52,14 @@ $body_order_locationId = '057P5VYJ4A5X1';
52
  $body->setOrder(new Models\Order(
53
  $body_order_locationId
54
  ));
55
- $body->getOrder()->setId('id0');
56
  $body->getOrder()->setReferenceId('my-order-001');
57
- $body->getOrder()->setSource(new Models\OrderSource);
58
- $body->getOrder()->getSource()->setName('name6');
59
- $body->getOrder()->setCustomerId('customer_id8');
60
  $body_order_lineItems = [];
61
 
62
  $body_order_lineItems_0_quantity = '1';
63
  $body_order_lineItems[0] = new Models\OrderLineItem(
64
  $body_order_lineItems_0_quantity
65
  );
66
- $body_order_lineItems[0]->setUid('uid1');
67
  $body_order_lineItems[0]->setName('New York Strip Steak');
68
- $body_order_lineItems[0]->setQuantityUnit(new Models\OrderQuantityUnit);
69
- $body_order_lineItems[0]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
70
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name = 'name9';
71
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation1';
72
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
73
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name,
74
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation
75
- ));
76
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_INCH);
77
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_KILOMETER);
78
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_QUART);
79
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_MILLIGRAM);
80
- $body_order_lineItems[0]->getQuantityUnit()->setPrecision(189);
81
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogObjectId('catalog_object_id1');
82
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogVersion(133);
83
- $body_order_lineItems[0]->setNote('note3');
84
- $body_order_lineItems[0]->setCatalogObjectId('catalog_object_id5');
85
  $body_order_lineItems[0]->setBasePriceMoney(new Models\Money);
86
  $body_order_lineItems[0]->getBasePriceMoney()->setAmount(1599);
87
  $body_order_lineItems[0]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
@@ -90,35 +68,11 @@ $body_order_lineItems_1_quantity = '2';
90
  $body_order_lineItems[1] = new Models\OrderLineItem(
91
  $body_order_lineItems_1_quantity
92
  );
93
- $body_order_lineItems[1]->setUid('uid0');
94
- $body_order_lineItems[1]->setName('name0');
95
- $body_order_lineItems[1]->setQuantityUnit(new Models\OrderQuantityUnit);
96
- $body_order_lineItems[1]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
97
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name = 'name8';
98
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation0';
99
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
100
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name,
101
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation
102
- ));
103
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_ACRE);
104
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::IMPERIAL_INCH);
105
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_PINT);
106
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_GRAM);
107
- $body_order_lineItems[1]->getQuantityUnit()->setPrecision(188);
108
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogObjectId('catalog_object_id0');
109
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogVersion(134);
110
- $body_order_lineItems[1]->setNote('note4');
111
  $body_order_lineItems[1]->setCatalogObjectId('BEMYCSMIJL46OCDV4KYIKXIB');
112
  $body_order_lineItems_1_modifiers = [];
113
 
114
  $body_order_lineItems_1_modifiers[0] = new Models\OrderLineItemModifier;
115
- $body_order_lineItems_1_modifiers[0]->setUid('uid1');
116
  $body_order_lineItems_1_modifiers[0]->setCatalogObjectId('CHQX7Y4KY6N5KINJKZCFURPZ');
117
- $body_order_lineItems_1_modifiers[0]->setCatalogVersion(69);
118
- $body_order_lineItems_1_modifiers[0]->setName('name1');
119
- $body_order_lineItems_1_modifiers[0]->setBasePriceMoney(new Models\Money);
120
- $body_order_lineItems_1_modifiers[0]->getBasePriceMoney()->setAmount(53);
121
- $body_order_lineItems_1_modifiers[0]->getBasePriceMoney()->setCurrency(Models\Currency::TTD);
122
  $body_order_lineItems[1]->setModifiers($body_order_lineItems_1_modifiers);
123
 
124
  $body_order_lineItems_1_appliedDiscounts = [];
@@ -127,10 +81,6 @@ $body_order_lineItems_1_appliedDiscounts_0_discountUid = 'one-dollar-off';
127
  $body_order_lineItems_1_appliedDiscounts[0] = new Models\OrderLineItemAppliedDiscount(
128
  $body_order_lineItems_1_appliedDiscounts_0_discountUid
129
  );
130
- $body_order_lineItems_1_appliedDiscounts[0]->setUid('uid4');
131
- $body_order_lineItems_1_appliedDiscounts[0]->setAppliedMoney(new Models\Money);
132
- $body_order_lineItems_1_appliedDiscounts[0]->getAppliedMoney()->setAmount(164);
133
- $body_order_lineItems_1_appliedDiscounts[0]->getAppliedMoney()->setCurrency(Models\Currency::CUC);
134
  $body_order_lineItems[1]->setAppliedDiscounts($body_order_lineItems_1_appliedDiscounts);
135
 
136
  $body->getOrder()->setLineItems($body_order_lineItems);
@@ -139,10 +89,7 @@ $body_order_taxes = [];
139
 
140
  $body_order_taxes[0] = new Models\OrderLineItemTax;
141
  $body_order_taxes[0]->setUid('state-sales-tax');
142
- $body_order_taxes[0]->setCatalogObjectId('catalog_object_id1');
143
- $body_order_taxes[0]->setCatalogVersion(189);
144
  $body_order_taxes[0]->setName('State Sales Tax');
145
- $body_order_taxes[0]->setType(Models\OrderLineItemTaxType::UNKNOWN_TAX);
146
  $body_order_taxes[0]->setPercentage('9');
147
  $body_order_taxes[0]->setScope(Models\OrderLineItemTaxScope::ORDER);
148
  $body->getOrder()->setTaxes($body_order_taxes);
@@ -151,27 +98,18 @@ $body_order_discounts = [];
151
 
152
  $body_order_discounts[0] = new Models\OrderLineItemDiscount;
153
  $body_order_discounts[0]->setUid('labor-day-sale');
154
- $body_order_discounts[0]->setCatalogObjectId('catalog_object_id5');
155
- $body_order_discounts[0]->setCatalogVersion(89);
156
  $body_order_discounts[0]->setName('Labor Day Sale');
157
- $body_order_discounts[0]->setType(Models\OrderLineItemDiscountType::FIXED_PERCENTAGE);
158
  $body_order_discounts[0]->setPercentage('5');
159
  $body_order_discounts[0]->setScope(Models\OrderLineItemDiscountScope::ORDER);
160
 
161
  $body_order_discounts[1] = new Models\OrderLineItemDiscount;
162
  $body_order_discounts[1]->setUid('membership-discount');
163
  $body_order_discounts[1]->setCatalogObjectId('DB7L55ZH2BGWI4H23ULIWOQ7');
164
- $body_order_discounts[1]->setCatalogVersion(90);
165
- $body_order_discounts[1]->setName('name2');
166
- $body_order_discounts[1]->setType(Models\OrderLineItemDiscountType::FIXED_AMOUNT);
167
  $body_order_discounts[1]->setScope(Models\OrderLineItemDiscountScope::ORDER);
168
 
169
  $body_order_discounts[2] = new Models\OrderLineItemDiscount;
170
  $body_order_discounts[2]->setUid('one-dollar-off');
171
- $body_order_discounts[2]->setCatalogObjectId('catalog_object_id7');
172
- $body_order_discounts[2]->setCatalogVersion(91);
173
  $body_order_discounts[2]->setName('Sale - $1.00 off');
174
- $body_order_discounts[2]->setType(Models\OrderLineItemDiscountType::VARIABLE_PERCENTAGE);
175
  $body_order_discounts[2]->setAmountMoney(new Models\Money);
176
  $body_order_discounts[2]->getAmountMoney()->setAmount(100);
177
  $body_order_discounts[2]->getAmountMoney()->setCurrency(Models\Currency::USD);
@@ -196,7 +134,7 @@ if ($apiResponse->isSuccess()) {
196
 
197
  # Batch Retrieve Orders
198
 
199
- Retrieves a set of [orders](/doc/models/order.md) by their IDs.
200
 
201
  If a given order ID does not exist, the ID is ignored instead of generating an error.
202
 
@@ -208,11 +146,11 @@ function batchRetrieveOrders(BatchRetrieveOrdersRequest $body): ApiResponse
208
 
209
  | Parameter | Type | Tags | Description |
210
  | --- | --- | --- | --- |
211
- | `body` | [`BatchRetrieveOrdersRequest`](/doc/models/batch-retrieve-orders-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
212
 
213
  ## Response Type
214
 
215
- [`BatchRetrieveOrdersResponse`](/doc/models/batch-retrieve-orders-response.md)
216
 
217
  ## Example Usage
218
 
@@ -249,11 +187,11 @@ function calculateOrder(CalculateOrderRequest $body): ApiResponse
249
 
250
  | Parameter | Type | Tags | Description |
251
  | --- | --- | --- | --- |
252
- | `body` | [`CalculateOrderRequest`](/doc/models/calculate-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
253
 
254
  ## Response Type
255
 
256
- [`CalculateOrderResponse`](/doc/models/calculate-order-response.md)
257
 
258
  ## Example Usage
259
 
@@ -262,36 +200,13 @@ $body_order_locationId = 'D7AVYMEAPJ3A3';
262
  $body_order = new Models\Order(
263
  $body_order_locationId
264
  );
265
- $body_order->setId('id0');
266
- $body_order->setReferenceId('reference_id8');
267
- $body_order->setSource(new Models\OrderSource);
268
- $body_order->getSource()->setName('name6');
269
- $body_order->setCustomerId('customer_id8');
270
  $body_order_lineItems = [];
271
 
272
  $body_order_lineItems_0_quantity = '1';
273
  $body_order_lineItems[0] = new Models\OrderLineItem(
274
  $body_order_lineItems_0_quantity
275
  );
276
- $body_order_lineItems[0]->setUid('uid1');
277
  $body_order_lineItems[0]->setName('Item 1');
278
- $body_order_lineItems[0]->setQuantityUnit(new Models\OrderQuantityUnit);
279
- $body_order_lineItems[0]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
280
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name = 'name9';
281
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation1';
282
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
283
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name,
284
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation
285
- ));
286
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_INCH);
287
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_KILOMETER);
288
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_QUART);
289
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_MILLIGRAM);
290
- $body_order_lineItems[0]->getQuantityUnit()->setPrecision(189);
291
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogObjectId('catalog_object_id1');
292
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogVersion(133);
293
- $body_order_lineItems[0]->setNote('note3');
294
- $body_order_lineItems[0]->setCatalogObjectId('catalog_object_id5');
295
  $body_order_lineItems[0]->setBasePriceMoney(new Models\Money);
296
  $body_order_lineItems[0]->getBasePriceMoney()->setAmount(500);
297
  $body_order_lineItems[0]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
@@ -300,25 +215,7 @@ $body_order_lineItems_1_quantity = '2';
300
  $body_order_lineItems[1] = new Models\OrderLineItem(
301
  $body_order_lineItems_1_quantity
302
  );
303
- $body_order_lineItems[1]->setUid('uid0');
304
  $body_order_lineItems[1]->setName('Item 2');
305
- $body_order_lineItems[1]->setQuantityUnit(new Models\OrderQuantityUnit);
306
- $body_order_lineItems[1]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
307
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name = 'name8';
308
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation0';
309
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
310
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name,
311
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation
312
- ));
313
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_ACRE);
314
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::IMPERIAL_INCH);
315
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_PINT);
316
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_GRAM);
317
- $body_order_lineItems[1]->getQuantityUnit()->setPrecision(188);
318
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogObjectId('catalog_object_id0');
319
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogVersion(134);
320
- $body_order_lineItems[1]->setNote('note4');
321
- $body_order_lineItems[1]->setCatalogObjectId('catalog_object_id6');
322
  $body_order_lineItems[1]->setBasePriceMoney(new Models\Money);
323
  $body_order_lineItems[1]->getBasePriceMoney()->setAmount(300);
324
  $body_order_lineItems[1]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
@@ -327,11 +224,7 @@ $body_order->setLineItems($body_order_lineItems);
327
  $body_order_discounts = [];
328
 
329
  $body_order_discounts[0] = new Models\OrderLineItemDiscount;
330
- $body_order_discounts[0]->setUid('uid1');
331
- $body_order_discounts[0]->setCatalogObjectId('catalog_object_id5');
332
- $body_order_discounts[0]->setCatalogVersion(89);
333
  $body_order_discounts[0]->setName('50% Off');
334
- $body_order_discounts[0]->setType(Models\OrderLineItemDiscountType::FIXED_PERCENTAGE);
335
  $body_order_discounts[0]->setPercentage('50');
336
  $body_order_discounts[0]->setScope(Models\OrderLineItemDiscountScope::ORDER);
337
  $body_order->setDiscounts($body_order_discounts);
@@ -339,30 +232,6 @@ $body_order->setDiscounts($body_order_discounts);
339
  $body = new Models\CalculateOrderRequest(
340
  $body_order
341
  );
342
- $body_proposedRewards = [];
343
-
344
- $body_proposedRewards_0_id = 'id6';
345
- $body_proposedRewards_0_rewardTierId = 'reward_tier_id2';
346
- $body_proposedRewards[0] = new Models\OrderReward(
347
- $body_proposedRewards_0_id,
348
- $body_proposedRewards_0_rewardTierId
349
- );
350
-
351
- $body_proposedRewards_1_id = 'id7';
352
- $body_proposedRewards_1_rewardTierId = 'reward_tier_id3';
353
- $body_proposedRewards[1] = new Models\OrderReward(
354
- $body_proposedRewards_1_id,
355
- $body_proposedRewards_1_rewardTierId
356
- );
357
-
358
- $body_proposedRewards_2_id = 'id8';
359
- $body_proposedRewards_2_rewardTierId = 'reward_tier_id4';
360
- $body_proposedRewards[2] = new Models\OrderReward(
361
- $body_proposedRewards_2_id,
362
- $body_proposedRewards_2_rewardTierId
363
- );
364
- $body->setProposedRewards($body_proposedRewards);
365
-
366
 
367
  $apiResponse = $ordersApi->calculateOrder($body);
368
 
@@ -391,11 +260,11 @@ function cloneOrder(CloneOrderRequest $body): ApiResponse
391
 
392
  | Parameter | Type | Tags | Description |
393
  | --- | --- | --- | --- |
394
- | `body` | [`CloneOrderRequest`](/doc/models/clone-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
395
 
396
  ## Response Type
397
 
398
- [`CloneOrderResponse`](/doc/models/clone-order-response.md)
399
 
400
  ## Example Usage
401
 
@@ -428,13 +297,13 @@ returns, and exchanges regardless of how or when they entered the Square
428
  ecosystem (such as Point of Sale, Invoices, and Connect APIs).
429
 
430
  `SearchOrders` requests need to specify which locations to search and define a
431
- [SearchOrdersQuery](/doc/models/search-orders-query.md) object that controls
432
  how to sort or filter the results. Your `SearchOrdersQuery` can:
433
 
434
  Set filter criteria.
435
  Set the sort order.
436
  Determine whether to return results as complete `Order` objects or as
437
- [OrderEntry](/doc/models/order-entry.md) objects.
438
 
439
  Note that details for orders processed with Square Point of Sale while in
440
  offline mode might not be transmitted to Square for up to 72 hours. Offline
@@ -449,18 +318,17 @@ function searchOrders(SearchOrdersRequest $body): ApiResponse
449
 
450
  | Parameter | Type | Tags | Description |
451
  | --- | --- | --- | --- |
452
- | `body` | [`SearchOrdersRequest`](/doc/models/search-orders-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
453
 
454
  ## Response Type
455
 
456
- [`SearchOrdersResponse`](/doc/models/search-orders-response.md)
457
 
458
  ## Example Usage
459
 
460
  ```php
461
  $body = new Models\SearchOrdersRequest;
462
  $body->setLocationIds(['057P5VYJ4A5X1', '18YC4JDH91E1H']);
463
- $body->setCursor('cursor0');
464
  $body->setQuery(new Models\SearchOrdersQuery);
465
  $body->getQuery()->setFilter(new Models\SearchOrdersFilter);
466
  $body_query_filter_stateFilter_states = [Models\OrderState::COMPLETED];
@@ -468,22 +336,9 @@ $body->getQuery()->getFilter()->setStateFilter(new Models\SearchOrdersStateFilte
468
  $body_query_filter_stateFilter_states
469
  ));
470
  $body->getQuery()->getFilter()->setDateTimeFilter(new Models\SearchOrdersDateTimeFilter);
471
- $body->getQuery()->getFilter()->getDateTimeFilter()->setCreatedAt(new Models\TimeRange);
472
- $body->getQuery()->getFilter()->getDateTimeFilter()->getCreatedAt()->setStartAt('start_at8');
473
- $body->getQuery()->getFilter()->getDateTimeFilter()->getCreatedAt()->setEndAt('end_at4');
474
- $body->getQuery()->getFilter()->getDateTimeFilter()->setUpdatedAt(new Models\TimeRange);
475
- $body->getQuery()->getFilter()->getDateTimeFilter()->getUpdatedAt()->setStartAt('start_at6');
476
- $body->getQuery()->getFilter()->getDateTimeFilter()->getUpdatedAt()->setEndAt('end_at6');
477
  $body->getQuery()->getFilter()->getDateTimeFilter()->setClosedAt(new Models\TimeRange);
478
  $body->getQuery()->getFilter()->getDateTimeFilter()->getClosedAt()->setStartAt('2018-03-03T20:00:00+00:00');
479
  $body->getQuery()->getFilter()->getDateTimeFilter()->getClosedAt()->setEndAt('2019-03-04T21:54:45+00:00');
480
- $body->getQuery()->getFilter()->setFulfillmentFilter(new Models\SearchOrdersFulfillmentFilter);
481
- $body->getQuery()->getFilter()->getFulfillmentFilter()->setFulfillmentTypes([Models\OrderFulfillmentType::SHIPMENT]);
482
- $body->getQuery()->getFilter()->getFulfillmentFilter()->setFulfillmentStates([Models\OrderFulfillmentState::CANCELED, Models\OrderFulfillmentState::FAILED]);
483
- $body->getQuery()->getFilter()->setSourceFilter(new Models\SearchOrdersSourceFilter);
484
- $body->getQuery()->getFilter()->getSourceFilter()->setSourceNames(['source_names8']);
485
- $body->getQuery()->getFilter()->setCustomerFilter(new Models\SearchOrdersCustomerFilter);
486
- $body->getQuery()->getFilter()->getCustomerFilter()->setCustomerIds(['customer_ids5', 'customer_ids6']);
487
  $body_query_sort_sortField = Models\SearchOrdersSortField::CLOSED_AT;
488
  $body->getQuery()->setSort(new Models\SearchOrdersSort(
489
  $body_query_sort_sortField
@@ -508,7 +363,7 @@ if ($apiResponse->isSuccess()) {
508
 
509
  # Retrieve Order
510
 
511
- Retrieves an [Order](/doc/models/order.md) by ID.
512
 
513
  ```php
514
  function retrieveOrder(string $orderId): ApiResponse
@@ -522,7 +377,7 @@ function retrieveOrder(string $orderId): ApiResponse
522
 
523
  ## Response Type
524
 
525
- [`RetrieveOrderResponse`](/doc/models/retrieve-order-response.md)
526
 
527
  ## Example Usage
528
 
@@ -545,7 +400,7 @@ if ($apiResponse->isSuccess()) {
545
 
546
  # Update Order
547
 
548
- Updates an open [order](/doc/models/order.md) by adding, replacing, or deleting
549
  fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
550
 
551
  An `UpdateOrder` request requires the following:
@@ -570,79 +425,17 @@ function updateOrder(string $orderId, UpdateOrderRequest $body): ApiResponse
570
  | Parameter | Type | Tags | Description |
571
  | --- | --- | --- | --- |
572
  | `orderId` | `string` | Template, Required | The ID of the order to update. |
573
- | `body` | [`UpdateOrderRequest`](/doc/models/update-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
574
 
575
  ## Response Type
576
 
577
- [`UpdateOrderResponse`](/doc/models/update-order-response.md)
578
 
579
  ## Example Usage
580
 
581
  ```php
582
  $orderId = 'order_id6';
583
  $body = new Models\UpdateOrderRequest;
584
- $body_order_locationId = 'location_id4';
585
- $body->setOrder(new Models\Order(
586
- $body_order_locationId
587
- ));
588
- $body->getOrder()->setId('id0');
589
- $body->getOrder()->setReferenceId('reference_id8');
590
- $body->getOrder()->setSource(new Models\OrderSource);
591
- $body->getOrder()->getSource()->setName('name6');
592
- $body->getOrder()->setCustomerId('customer_id8');
593
- $body_order_lineItems = [];
594
-
595
- $body_order_lineItems_0_quantity = 'quantity7';
596
- $body_order_lineItems[0] = new Models\OrderLineItem(
597
- $body_order_lineItems_0_quantity
598
- );
599
- $body_order_lineItems[0]->setUid('uid1');
600
- $body_order_lineItems[0]->setName('name1');
601
- $body_order_lineItems[0]->setQuantityUnit(new Models\OrderQuantityUnit);
602
- $body_order_lineItems[0]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
603
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name = 'name9';
604
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation1';
605
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
606
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_name,
607
- $body_order_lineItems_0_quantityUnit_measurementUnit_customUnit_abbreviation
608
- ));
609
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_SQUARE_INCH);
610
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::METRIC_KILOMETER);
611
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_QUART);
612
- $body_order_lineItems[0]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_MILLIGRAM);
613
- $body_order_lineItems[0]->getQuantityUnit()->setPrecision(189);
614
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogObjectId('catalog_object_id1');
615
- $body_order_lineItems[0]->getQuantityUnit()->setCatalogVersion(133);
616
- $body_order_lineItems[0]->setNote('note3');
617
- $body_order_lineItems[0]->setCatalogObjectId('catalog_object_id5');
618
-
619
- $body_order_lineItems_1_quantity = 'quantity6';
620
- $body_order_lineItems[1] = new Models\OrderLineItem(
621
- $body_order_lineItems_1_quantity
622
- );
623
- $body_order_lineItems[1]->setUid('uid0');
624
- $body_order_lineItems[1]->setName('name0');
625
- $body_order_lineItems[1]->setQuantityUnit(new Models\OrderQuantityUnit);
626
- $body_order_lineItems[1]->getQuantityUnit()->setMeasurementUnit(new Models\MeasurementUnit);
627
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name = 'name8';
628
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation = 'abbreviation0';
629
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setCustomUnit(new Models\MeasurementUnitCustom(
630
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_name,
631
- $body_order_lineItems_1_quantityUnit_measurementUnit_customUnit_abbreviation
632
- ));
633
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setAreaUnit(Models\MeasurementUnitArea::IMPERIAL_ACRE);
634
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setLengthUnit(Models\MeasurementUnitLength::IMPERIAL_INCH);
635
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setVolumeUnit(Models\MeasurementUnitVolume::GENERIC_PINT);
636
- $body_order_lineItems[1]->getQuantityUnit()->getMeasurementUnit()->setWeightUnit(Models\MeasurementUnitWeight::METRIC_GRAM);
637
- $body_order_lineItems[1]->getQuantityUnit()->setPrecision(188);
638
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogObjectId('catalog_object_id0');
639
- $body_order_lineItems[1]->getQuantityUnit()->setCatalogVersion(134);
640
- $body_order_lineItems[1]->setNote('note4');
641
- $body_order_lineItems[1]->setCatalogObjectId('catalog_object_id6');
642
- $body->getOrder()->setLineItems($body_order_lineItems);
643
-
644
- $body->setFieldsToClear(['fields_to_clear7', 'fields_to_clear8']);
645
- $body->setIdempotencyKey('idempotency_key2');
646
 
647
  $apiResponse = $ordersApi->updateOrder($orderId, $body);
648
 
@@ -660,7 +453,7 @@ if ($apiResponse->isSuccess()) {
660
 
661
  # Pay Order
662
 
663
- Pay for an [order](/doc/models/order.md) using one or more approved [payments](/doc/models/payment.md)
664
  or settle an order with a total of `0`.
665
 
666
  The total of the `payment_ids` listed in the request must be equal to the order
@@ -669,10 +462,10 @@ array of `payment_ids` in the request.
669
 
670
  To be used with `PayOrder`, a payment must:
671
 
672
- - Reference the order by specifying the `order_id` when [creating the payment](/doc/apis/payments.md#create-payment).
673
  Any approved payments that reference the same `order_id` not specified in the
674
  `payment_ids` is canceled.
675
- - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments#delayed-capture).
676
  Using a delayed capture payment with `PayOrder` completes the approved payment.
677
 
678
  ```php
@@ -684,11 +477,11 @@ function payOrder(string $orderId, PayOrderRequest $body): ApiResponse
684
  | Parameter | Type | Tags | Description |
685
  | --- | --- | --- | --- |
686
  | `orderId` | `string` | Template, Required | The ID of the order being paid. |
687
- | `body` | [`PayOrderRequest`](/doc/models/pay-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
688
 
689
  ## Response Type
690
 
691
- [`PayOrderResponse`](/doc/models/pay-order-response.md)
692
 
693
  ## Example Usage
694
 
@@ -698,7 +491,6 @@ $body_idempotencyKey = 'c043a359-7ad9-4136-82a9-c3f1d66dcbff';
698
  $body = new Models\PayOrderRequest(
699
  $body_idempotencyKey
700
  );
701
- $body->setOrderVersion(82);
702
  $body->setPaymentIds(['EnZdNAlWCmfh6Mt5FMNST1o7taB', '0LRiVlbXVwe8ozu4KbZxd12mvaB']);
703
 
704
  $apiResponse = $ordersApi->payOrder($orderId, $body);
10
 
11
  ## Methods
12
 
13
+ * [Create Order](../../doc/apis/orders.md#create-order)
14
+ * [Batch Retrieve Orders](../../doc/apis/orders.md#batch-retrieve-orders)
15
+ * [Calculate Order](../../doc/apis/orders.md#calculate-order)
16
+ * [Clone Order](../../doc/apis/orders.md#clone-order)
17
+ * [Search Orders](../../doc/apis/orders.md#search-orders)
18
+ * [Retrieve Order](../../doc/apis/orders.md#retrieve-order)
19
+ * [Update Order](../../doc/apis/orders.md#update-order)
20
+ * [Pay Order](../../doc/apis/orders.md#pay-order)
21
 
22
 
23
  # Create Order
24
 
25
+ Creates a new [order](../../doc/models/order.md) that can include information about products for
26
  purchase and settings to apply to the purchase.
27
 
28
  To pay for a created order, see
29
  [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders).
30
 
31
+ You can modify open orders using the [UpdateOrder](../../doc/apis/orders.md#update-order) endpoint.
32
 
33
  ```php
34
  function createOrder(CreateOrderRequest $body): ApiResponse
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
+ | `body` | [`CreateOrderRequest`](../../doc/models/create-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
+ [`CreateOrderResponse`](../../doc/models/create-order-response.md)
46
 
47
  ## Example Usage
48
 
52
  $body->setOrder(new Models\Order(
53
  $body_order_locationId
54
  ));
 
55
  $body->getOrder()->setReferenceId('my-order-001');
 
 
 
56
  $body_order_lineItems = [];
57
 
58
  $body_order_lineItems_0_quantity = '1';
59
  $body_order_lineItems[0] = new Models\OrderLineItem(
60
  $body_order_lineItems_0_quantity
61
  );
 
62
  $body_order_lineItems[0]->setName('New York Strip Steak');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  $body_order_lineItems[0]->setBasePriceMoney(new Models\Money);
64
  $body_order_lineItems[0]->getBasePriceMoney()->setAmount(1599);
65
  $body_order_lineItems[0]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
68
  $body_order_lineItems[1] = new Models\OrderLineItem(
69
  $body_order_lineItems_1_quantity
70
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  $body_order_lineItems[1]->setCatalogObjectId('BEMYCSMIJL46OCDV4KYIKXIB');
72
  $body_order_lineItems_1_modifiers = [];
73
 
74
  $body_order_lineItems_1_modifiers[0] = new Models\OrderLineItemModifier;
 
75
  $body_order_lineItems_1_modifiers[0]->setCatalogObjectId('CHQX7Y4KY6N5KINJKZCFURPZ');
 
 
 
 
 
76
  $body_order_lineItems[1]->setModifiers($body_order_lineItems_1_modifiers);
77
 
78
  $body_order_lineItems_1_appliedDiscounts = [];
81
  $body_order_lineItems_1_appliedDiscounts[0] = new Models\OrderLineItemAppliedDiscount(
82
  $body_order_lineItems_1_appliedDiscounts_0_discountUid
83
  );
 
 
 
 
84
  $body_order_lineItems[1]->setAppliedDiscounts($body_order_lineItems_1_appliedDiscounts);
85
 
86
  $body->getOrder()->setLineItems($body_order_lineItems);
89
 
90
  $body_order_taxes[0] = new Models\OrderLineItemTax;
91
  $body_order_taxes[0]->setUid('state-sales-tax');
 
 
92
  $body_order_taxes[0]->setName('State Sales Tax');
 
93
  $body_order_taxes[0]->setPercentage('9');
94
  $body_order_taxes[0]->setScope(Models\OrderLineItemTaxScope::ORDER);
95
  $body->getOrder()->setTaxes($body_order_taxes);
98
 
99
  $body_order_discounts[0] = new Models\OrderLineItemDiscount;
100
  $body_order_discounts[0]->setUid('labor-day-sale');
 
 
101
  $body_order_discounts[0]->setName('Labor Day Sale');
 
102
  $body_order_discounts[0]->setPercentage('5');
103
  $body_order_discounts[0]->setScope(Models\OrderLineItemDiscountScope::ORDER);
104
 
105
  $body_order_discounts[1] = new Models\OrderLineItemDiscount;
106
  $body_order_discounts[1]->setUid('membership-discount');
107
  $body_order_discounts[1]->setCatalogObjectId('DB7L55ZH2BGWI4H23ULIWOQ7');
 
 
 
108
  $body_order_discounts[1]->setScope(Models\OrderLineItemDiscountScope::ORDER);
109
 
110
  $body_order_discounts[2] = new Models\OrderLineItemDiscount;
111
  $body_order_discounts[2]->setUid('one-dollar-off');
 
 
112
  $body_order_discounts[2]->setName('Sale - $1.00 off');
 
113
  $body_order_discounts[2]->setAmountMoney(new Models\Money);
114
  $body_order_discounts[2]->getAmountMoney()->setAmount(100);
115
  $body_order_discounts[2]->getAmountMoney()->setCurrency(Models\Currency::USD);
134
 
135
  # Batch Retrieve Orders
136
 
137
+ Retrieves a set of [orders](../../doc/models/order.md) by their IDs.
138
 
139
  If a given order ID does not exist, the ID is ignored instead of generating an error.
140
 
146
 
147
  | Parameter | Type | Tags | Description |
148
  | --- | --- | --- | --- |
149
+ | `body` | [`BatchRetrieveOrdersRequest`](../../doc/models/batch-retrieve-orders-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
150
 
151
  ## Response Type
152
 
153
+ [`BatchRetrieveOrdersResponse`](../../doc/models/batch-retrieve-orders-response.md)
154
 
155
  ## Example Usage
156
 
187
 
188
  | Parameter | Type | Tags | Description |
189
  | --- | --- | --- | --- |
190
+ | `body` | [`CalculateOrderRequest`](../../doc/models/calculate-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
191
 
192
  ## Response Type
193
 
194
+ [`CalculateOrderResponse`](../../doc/models/calculate-order-response.md)
195
 
196
  ## Example Usage
197
 
200
  $body_order = new Models\Order(
201
  $body_order_locationId
202
  );
 
 
 
 
 
203
  $body_order_lineItems = [];
204
 
205
  $body_order_lineItems_0_quantity = '1';
206
  $body_order_lineItems[0] = new Models\OrderLineItem(
207
  $body_order_lineItems_0_quantity
208
  );
 
209
  $body_order_lineItems[0]->setName('Item 1');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  $body_order_lineItems[0]->setBasePriceMoney(new Models\Money);
211
  $body_order_lineItems[0]->getBasePriceMoney()->setAmount(500);
212
  $body_order_lineItems[0]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
215
  $body_order_lineItems[1] = new Models\OrderLineItem(
216
  $body_order_lineItems_1_quantity
217
  );
 
218
  $body_order_lineItems[1]->setName('Item 2');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  $body_order_lineItems[1]->setBasePriceMoney(new Models\Money);
220
  $body_order_lineItems[1]->getBasePriceMoney()->setAmount(300);
221
  $body_order_lineItems[1]->getBasePriceMoney()->setCurrency(Models\Currency::USD);
224
  $body_order_discounts = [];
225
 
226
  $body_order_discounts[0] = new Models\OrderLineItemDiscount;
 
 
 
227
  $body_order_discounts[0]->setName('50% Off');
 
228
  $body_order_discounts[0]->setPercentage('50');
229
  $body_order_discounts[0]->setScope(Models\OrderLineItemDiscountScope::ORDER);
230
  $body_order->setDiscounts($body_order_discounts);
232
  $body = new Models\CalculateOrderRequest(
233
  $body_order
234
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
 
236
  $apiResponse = $ordersApi->calculateOrder($body);
237
 
260
 
261
  | Parameter | Type | Tags | Description |
262
  | --- | --- | --- | --- |
263
+ | `body` | [`CloneOrderRequest`](../../doc/models/clone-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
264
 
265
  ## Response Type
266
 
267
+ [`CloneOrderResponse`](../../doc/models/clone-order-response.md)
268
 
269
  ## Example Usage
270
 
297
  ecosystem (such as Point of Sale, Invoices, and Connect APIs).
298
 
299
  `SearchOrders` requests need to specify which locations to search and define a
300
+ [SearchOrdersQuery](../../doc/models/search-orders-query.md) object that controls
301
  how to sort or filter the results. Your `SearchOrdersQuery` can:
302
 
303
  Set filter criteria.
304
  Set the sort order.
305
  Determine whether to return results as complete `Order` objects or as
306
+ [OrderEntry](../../doc/models/order-entry.md) objects.
307
 
308
  Note that details for orders processed with Square Point of Sale while in
309
  offline mode might not be transmitted to Square for up to 72 hours. Offline
318
 
319
  | Parameter | Type | Tags | Description |
320
  | --- | --- | --- | --- |
321
+ | `body` | [`SearchOrdersRequest`](../../doc/models/search-orders-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
322
 
323
  ## Response Type
324
 
325
+ [`SearchOrdersResponse`](../../doc/models/search-orders-response.md)
326
 
327
  ## Example Usage
328
 
329
  ```php
330
  $body = new Models\SearchOrdersRequest;
331
  $body->setLocationIds(['057P5VYJ4A5X1', '18YC4JDH91E1H']);
 
332
  $body->setQuery(new Models\SearchOrdersQuery);
333
  $body->getQuery()->setFilter(new Models\SearchOrdersFilter);
334
  $body_query_filter_stateFilter_states = [Models\OrderState::COMPLETED];
336
  $body_query_filter_stateFilter_states
337
  ));
338
  $body->getQuery()->getFilter()->setDateTimeFilter(new Models\SearchOrdersDateTimeFilter);
 
 
 
 
 
 
339
  $body->getQuery()->getFilter()->getDateTimeFilter()->setClosedAt(new Models\TimeRange);
340
  $body->getQuery()->getFilter()->getDateTimeFilter()->getClosedAt()->setStartAt('2018-03-03T20:00:00+00:00');
341
  $body->getQuery()->getFilter()->getDateTimeFilter()->getClosedAt()->setEndAt('2019-03-04T21:54:45+00:00');
 
 
 
 
 
 
 
342
  $body_query_sort_sortField = Models\SearchOrdersSortField::CLOSED_AT;
343
  $body->getQuery()->setSort(new Models\SearchOrdersSort(
344
  $body_query_sort_sortField
363
 
364
  # Retrieve Order
365
 
366
+ Retrieves an [Order](../../doc/models/order.md) by ID.
367
 
368
  ```php
369
  function retrieveOrder(string $orderId): ApiResponse
377
 
378
  ## Response Type
379
 
380
+ [`RetrieveOrderResponse`](../../doc/models/retrieve-order-response.md)
381
 
382
  ## Example Usage
383
 
400
 
401
  # Update Order
402
 
403
+ Updates an open [order](../../doc/models/order.md) by adding, replacing, or deleting
404
  fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated.
405
 
406
  An `UpdateOrder` request requires the following:
425
  | Parameter | Type | Tags | Description |
426
  | --- | --- | --- | --- |
427
  | `orderId` | `string` | Template, Required | The ID of the order to update. |
428
+ | `body` | [`UpdateOrderRequest`](../../doc/models/update-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
429
 
430
  ## Response Type
431
 
432
+ [`UpdateOrderResponse`](../../doc/models/update-order-response.md)
433
 
434
  ## Example Usage
435
 
436
  ```php
437
  $orderId = 'order_id6';
438
  $body = new Models\UpdateOrderRequest;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
  $apiResponse = $ordersApi->updateOrder($orderId, $body);
441
 
453
 
454
  # Pay Order
455
 
456
+ Pay for an [order](../../doc/models/order.md) using one or more approved [payments](../../doc/models/payment.md)
457
  or settle an order with a total of `0`.
458
 
459
  The total of the `payment_ids` listed in the request must be equal to the order
462
 
463
  To be used with `PayOrder`, a payment must:
464
 
465
+ - Reference the order by specifying the `order_id` when [creating the payment](../../doc/apis/payments.md#create-payment).
466
  Any approved payments that reference the same `order_id` not specified in the
467
  `payment_ids` is canceled.
468
+ - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture).
469
  Using a delayed capture payment with `PayOrder` completes the approved payment.
470
 
471
  ```php
477
  | Parameter | Type | Tags | Description |
478
  | --- | --- | --- | --- |
479
  | `orderId` | `string` | Template, Required | The ID of the order being paid. |
480
+ | `body` | [`PayOrderRequest`](../../doc/models/pay-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
481
 
482
  ## Response Type
483
 
484
+ [`PayOrderResponse`](../../doc/models/pay-order-response.md)
485
 
486
  ## Example Usage
487
 
491
  $body = new Models\PayOrderRequest(
492
  $body_idempotencyKey
493
  );
 
494
  $body->setPaymentIds(['EnZdNAlWCmfh6Mt5FMNST1o7taB', '0LRiVlbXVwe8ozu4KbZxd12mvaB']);
495
 
496
  $apiResponse = $ordersApi->payOrder($orderId, $body);
vendor/square/square/doc/apis/payments.md CHANGED
@@ -10,13 +10,13 @@ $paymentsApi = $client->getPaymentsApi();
10
 
11
  ## Methods
12
 
13
- * [List Payments](/doc/apis/payments.md#list-payments)
14
- * [Create Payment](/doc/apis/payments.md#create-payment)
15
- * [Cancel Payment by Idempotency Key](/doc/apis/payments.md#cancel-payment-by-idempotency-key)
16
- * [Get Payment](/doc/apis/payments.md#get-payment)
17
- * [Update Payment](/doc/apis/payments.md#update-payment)
18
- * [Cancel Payment](/doc/apis/payments.md#cancel-payment)
19
- * [Complete Payment](/doc/apis/payments.md#complete-payment)
20
 
21
 
22
  # List Payments
@@ -58,22 +58,12 @@ function listPayments(
58
 
59
  ## Response Type
60
 
61
- [`ListPaymentsResponse`](/doc/models/list-payments-response.md)
62
 
63
  ## Example Usage
64
 
65
  ```php
66
- $beginTime = 'begin_time2';
67
- $endTime = 'end_time2';
68
- $sortOrder = 'sort_order0';
69
- $cursor = 'cursor6';
70
- $locationId = 'location_id4';
71
- $total = 10;
72
- $last4 = 'last_42';
73
- $cardBrand = 'card_brand6';
74
- $limit = 172;
75
-
76
- $apiResponse = $paymentsApi->listPayments($beginTime, $endTime, $sortOrder, $cursor, $locationId, $total, $last4, $cardBrand, $limit);
77
 
78
  if ($apiResponse->isSuccess()) {
79
  $listPaymentsResponse = $apiResponse->getResult();
@@ -106,11 +96,11 @@ function createPayment(CreatePaymentRequest $body): ApiResponse
106
 
107
  | Parameter | Type | Tags | Description |
108
  | --- | --- | --- | --- |
109
- | `body` | [`CreatePaymentRequest`](/doc/models/create-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
110
 
111
  ## Response Type
112
 
113
- [`CreatePaymentResponse`](/doc/models/create-payment-response.md)
114
 
115
  ## Example Usage
116
 
@@ -125,15 +115,10 @@ $body = new Models\CreatePaymentRequest(
125
  $body_idempotencyKey,
126
  $body_amountMoney
127
  );
128
- $body->setTipMoney(new Models\Money);
129
- $body->getTipMoney()->setAmount(198);
130
- $body->getTipMoney()->setCurrency(Models\Currency::CHF);
131
  $body->setAppFeeMoney(new Models\Money);
132
  $body->getAppFeeMoney()->setAmount(10);
133
  $body->getAppFeeMoney()->setCurrency(Models\Currency::USD);
134
- $body->setDelayDuration('delay_duration6');
135
  $body->setAutocomplete(true);
136
- $body->setOrderId('order_id0');
137
  $body->setCustomerId('W92WH6P11H4Z77CTET0RNTGFW8');
138
  $body->setLocationId('L88917AVBK2S5');
139
  $body->setReferenceId('123456');
@@ -175,11 +160,11 @@ function cancelPaymentByIdempotencyKey(CancelPaymentByIdempotencyKeyRequest $bod
175
 
176
  | Parameter | Type | Tags | Description |
177
  | --- | --- | --- | --- |
178
- | `body` | [`CancelPaymentByIdempotencyKeyRequest`](/doc/models/cancel-payment-by-idempotency-key-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
179
 
180
  ## Response Type
181
 
182
- [`CancelPaymentByIdempotencyKeyResponse`](/doc/models/cancel-payment-by-idempotency-key-response.md)
183
 
184
  ## Example Usage
185
 
@@ -219,7 +204,7 @@ function getPayment(string $paymentId): ApiResponse
219
 
220
  ## Response Type
221
 
222
- [`GetPaymentResponse`](/doc/models/get-payment-response.md)
223
 
224
  ## Example Usage
225
 
@@ -254,11 +239,11 @@ function updatePayment(string $paymentId, UpdatePaymentRequest $body): ApiRespon
254
  | Parameter | Type | Tags | Description |
255
  | --- | --- | --- | --- |
256
  | `paymentId` | `string` | Template, Required | The ID of the payment to update. |
257
- | `body` | [`UpdatePaymentRequest`](/doc/models/update-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
258
 
259
  ## Response Type
260
 
261
- [`UpdatePaymentResponse`](/doc/models/update-payment-response.md)
262
 
263
  ## Example Usage
264
 
@@ -269,9 +254,6 @@ $body = new Models\UpdatePaymentRequest(
269
  $body_idempotencyKey
270
  );
271
  $body->setPayment(new Models\Payment);
272
- $body->getPayment()->setId('id2');
273
- $body->getPayment()->setCreatedAt('created_at0');
274
- $body->getPayment()->setUpdatedAt('updated_at8');
275
  $body->getPayment()->setAmountMoney(new Models\Money);
276
  $body->getPayment()->getAmountMoney()->setAmount(1000);
277
  $body->getPayment()->getAmountMoney()->setCurrency(Models\Currency::USD);
@@ -311,7 +293,7 @@ function cancelPayment(string $paymentId): ApiResponse
311
 
312
  ## Response Type
313
 
314
- [`CancelPaymentResponse`](/doc/models/cancel-payment-response.md)
315
 
316
  ## Example Usage
317
 
@@ -348,18 +330,17 @@ function completePayment(string $paymentId, CompletePaymentRequest $body): ApiRe
348
  | Parameter | Type | Tags | Description |
349
  | --- | --- | --- | --- |
350
  | `paymentId` | `string` | Template, Required | The unique ID identifying the payment to be completed. |
351
- | `body` | [`CompletePaymentRequest`](/doc/models/complete-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
352
 
353
  ## Response Type
354
 
355
- [`CompletePaymentResponse`](/doc/models/complete-payment-response.md)
356
 
357
  ## Example Usage
358
 
359
  ```php
360
  $paymentId = 'payment_id0';
361
  $body = new Models\CompletePaymentRequest;
362
- $body->setVersionToken('version_token2');
363
 
364
  $apiResponse = $paymentsApi->completePayment($paymentId, $body);
365
 
10
 
11
  ## Methods
12
 
13
+ * [List Payments](../../doc/apis/payments.md#list-payments)
14
+ * [Create Payment](../../doc/apis/payments.md#create-payment)
15
+ * [Cancel Payment by Idempotency Key](../../doc/apis/payments.md#cancel-payment-by-idempotency-key)
16
+ * [Get Payment](../../doc/apis/payments.md#get-payment)
17
+ * [Update Payment](../../doc/apis/payments.md#update-payment)
18
+ * [Cancel Payment](../../doc/apis/payments.md#cancel-payment)
19
+ * [Complete Payment](../../doc/apis/payments.md#complete-payment)
20
 
21
 
22
  # List Payments
58
 
59
  ## Response Type
60
 
61
+ [`ListPaymentsResponse`](../../doc/models/list-payments-response.md)
62
 
63
  ## Example Usage
64
 
65
  ```php
66
+ $apiResponse = $paymentsApi->listPayments();
 
 
 
 
 
 
 
 
 
 
67
 
68
  if ($apiResponse->isSuccess()) {
69
  $listPaymentsResponse = $apiResponse->getResult();
96
 
97
  | Parameter | Type | Tags | Description |
98
  | --- | --- | --- | --- |
99
+ | `body` | [`CreatePaymentRequest`](../../doc/models/create-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
100
 
101
  ## Response Type
102
 
103
+ [`CreatePaymentResponse`](../../doc/models/create-payment-response.md)
104
 
105
  ## Example Usage
106
 
115
  $body_idempotencyKey,
116
  $body_amountMoney
117
  );
 
 
 
118
  $body->setAppFeeMoney(new Models\Money);
119
  $body->getAppFeeMoney()->setAmount(10);
120
  $body->getAppFeeMoney()->setCurrency(Models\Currency::USD);
 
121
  $body->setAutocomplete(true);
 
122
  $body->setCustomerId('W92WH6P11H4Z77CTET0RNTGFW8');
123
  $body->setLocationId('L88917AVBK2S5');
124
  $body->setReferenceId('123456');
160
 
161
  | Parameter | Type | Tags | Description |
162
  | --- | --- | --- | --- |
163
+ | `body` | [`CancelPaymentByIdempotencyKeyRequest`](../../doc/models/cancel-payment-by-idempotency-key-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
164
 
165
  ## Response Type
166
 
167
+ [`CancelPaymentByIdempotencyKeyResponse`](../../doc/models/cancel-payment-by-idempotency-key-response.md)
168
 
169
  ## Example Usage
170
 
204
 
205
  ## Response Type
206
 
207
+ [`GetPaymentResponse`](../../doc/models/get-payment-response.md)
208
 
209
  ## Example Usage
210
 
239
  | Parameter | Type | Tags | Description |
240
  | --- | --- | --- | --- |
241
  | `paymentId` | `string` | Template, Required | The ID of the payment to update. |
242
+ | `body` | [`UpdatePaymentRequest`](../../doc/models/update-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
243
 
244
  ## Response Type
245
 
246
+ [`UpdatePaymentResponse`](../../doc/models/update-payment-response.md)
247
 
248
  ## Example Usage
249
 
254
  $body_idempotencyKey
255
  );
256
  $body->setPayment(new Models\Payment);
 
 
 
257
  $body->getPayment()->setAmountMoney(new Models\Money);
258
  $body->getPayment()->getAmountMoney()->setAmount(1000);
259
  $body->getPayment()->getAmountMoney()->setCurrency(Models\Currency::USD);
293
 
294
  ## Response Type
295
 
296
+ [`CancelPaymentResponse`](../../doc/models/cancel-payment-response.md)
297
 
298
  ## Example Usage
299
 
330
  | Parameter | Type | Tags | Description |
331
  | --- | --- | --- | --- |
332
  | `paymentId` | `string` | Template, Required | The unique ID identifying the payment to be completed. |
333
+ | `body` | [`CompletePaymentRequest`](../../doc/models/complete-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
334
 
335
  ## Response Type
336
 
337
+ [`CompletePaymentResponse`](../../doc/models/complete-payment-response.md)
338
 
339
  ## Example Usage
340
 
341
  ```php
342
  $paymentId = 'payment_id0';
343
  $body = new Models\CompletePaymentRequest;
 
344
 
345
  $apiResponse = $paymentsApi->completePayment($paymentId, $body);
346
 
vendor/square/square/doc/apis/payouts.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Payouts
2
+
3
+ ```php
4
+ $payoutsApi = $client->getPayoutsApi();
5
+ ```
6
+
7
+ ## Class Name
8
+
9
+ `PayoutsApi`
10
+
11
+ ## Methods
12
+
13
+ * [List Payouts](../../doc/apis/payouts.md#list-payouts)
14
+ * [Get Payout](../../doc/apis/payouts.md#get-payout)
15
+ * [List Payout Entries](../../doc/apis/payouts.md#list-payout-entries)
16
+
17
+
18
+ # List Payouts
19
+
20
+ Retrieves a list of all payouts for the default location.
21
+ You can filter payouts by location ID, status, time range, and order them in ascending or descending order.
22
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
23
+
24
+ ```php
25
+ function listPayouts(
26
+ ?string $locationId = null,
27
+ ?string $status = null,
28
+ ?string $beginTime = null,
29
+ ?string $endTime = null,
30
+ ?string $sortOrder = null,
31
+ ?string $cursor = null,
32
+ ?int $limit = null
33
+ ): ApiResponse
34
+ ```
35
+
36
+ ## Parameters
37
+
38
+ | Parameter | Type | Tags | Description |
39
+ | --- | --- | --- | --- |
40
+ | `locationId` | `?string` | Query, Optional | The ID of the location for which to list the payouts.<br>By default, payouts are returned for the default (main) location associated with the seller. |
41
+ | `status` | [`?string (PayoutStatus)`](../../doc/models/payout-status.md) | Query, Optional | If provided, only payouts with the given status are returned. |
42
+ | `beginTime` | `?string` | Query, Optional | The timestamp for the beginning of the payout creation time, in RFC 3339 format.<br>Inclusive. Default: The current time minus one year. |
43
+ | `endTime` | `?string` | Query, Optional | The timestamp for the end of the payout creation time, in RFC 3339 format.<br>Default: The current time. |
44
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payouts are listed. |
45
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).<br>If request parameters change between requests, subsequent results may contain duplicates or missing records. |
46
+ | `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br>Default: `100` |
47
+
48
+ ## Response Type
49
+
50
+ [`ListPayoutsResponse`](../../doc/models/list-payouts-response.md)
51
+
52
+ ## Example Usage
53
+
54
+ ```php
55
+ $apiResponse = $payoutsApi->listPayouts();
56
+
57
+ if ($apiResponse->isSuccess()) {
58
+ $listPayoutsResponse = $apiResponse->getResult();
59
+ } else {
60
+ $errors = $apiResponse->getErrors();
61
+ }
62
+
63
+ // Get more response info...
64
+ // $statusCode = $apiResponse->getStatusCode();
65
+ // $headers = $apiResponse->getHeaders();
66
+ ```
67
+
68
+
69
+ # Get Payout
70
+
71
+ Retrieves details of a specific payout identified by a payout ID.
72
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
73
+
74
+ ```php
75
+ function getPayout(string $payoutId): ApiResponse
76
+ ```
77
+
78
+ ## Parameters
79
+
80
+ | Parameter | Type | Tags | Description |
81
+ | --- | --- | --- | --- |
82
+ | `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. |
83
+
84
+ ## Response Type
85
+
86
+ [`GetPayoutResponse`](../../doc/models/get-payout-response.md)
87
+
88
+ ## Example Usage
89
+
90
+ ```php
91
+ $payoutId = 'payout_id6';
92
+
93
+ $apiResponse = $payoutsApi->getPayout($payoutId);
94
+
95
+ if ($apiResponse->isSuccess()) {
96
+ $getPayoutResponse = $apiResponse->getResult();
97
+ } else {
98
+ $errors = $apiResponse->getErrors();
99
+ }
100
+
101
+ // Get more response info...
102
+ // $statusCode = $apiResponse->getStatusCode();
103
+ // $headers = $apiResponse->getHeaders();
104
+ ```
105
+
106
+
107
+ # List Payout Entries
108
+
109
+ Retrieves a list of all payout entries for a specific payout.
110
+ To call this endpoint, set `PAYOUTS_READ` for the OAuth scope.
111
+
112
+ ```php
113
+ function listPayoutEntries(
114
+ string $payoutId,
115
+ ?string $sortOrder = null,
116
+ ?string $cursor = null,
117
+ ?int $limit = null
118
+ ): ApiResponse
119
+ ```
120
+
121
+ ## Parameters
122
+
123
+ | Parameter | Type | Tags | Description |
124
+ | --- | --- | --- | --- |
125
+ | `payoutId` | `string` | Template, Required | The ID of the payout to retrieve the information for. |
126
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payout entries are listed. |
127
+ | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination).<br>If request parameters change between requests, subsequent results may contain duplicates or missing records. |
128
+ | `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.<br>It is possible to receive fewer results than the specified limit on a given page.<br>The default value of 100 is also the maximum allowed value. If the provided value is<br>greater than 100, it is ignored and the default value is used instead.<br>Default: `100` |
129
+
130
+ ## Response Type
131
+
132
+ [`ListPayoutEntriesResponse`](../../doc/models/list-payout-entries-response.md)
133
+
134
+ ## Example Usage
135
+
136
+ ```php
137
+ $payoutId = 'payout_id6';
138
+
139
+ $apiResponse = $payoutsApi->listPayoutEntries($payoutId);
140
+
141
+ if ($apiResponse->isSuccess()) {
142
+ $listPayoutEntriesResponse = $apiResponse->getResult();
143
+ } else {
144
+ $errors = $apiResponse->getErrors();
145
+ }
146
+
147
+ // Get more response info...
148
+ // $statusCode = $apiResponse->getStatusCode();
149
+ // $headers = $apiResponse->getHeaders();
150
+ ```
151
+
vendor/square/square/doc/apis/refunds.md CHANGED
@@ -10,9 +10,9 @@ $refundsApi = $client->getRefundsApi();
10
 
11
  ## Methods
12
 
13
- * [List Payment Refunds](/doc/apis/refunds.md#list-payment-refunds)
14
- * [Refund Payment](/doc/apis/refunds.md#refund-payment)
15
- * [Get Payment Refund](/doc/apis/refunds.md#get-payment-refund)
16
 
17
 
18
  # List Payment Refunds
@@ -46,27 +46,18 @@ function listPaymentRefunds(
46
  | `sortOrder` | `?string` | Query, Optional | The order in which results are listed:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
47
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
48
  | `locationId` | `?string` | Query, Optional | Limit results to the location supplied. By default, results are returned<br>for all locations associated with the seller. |
49
- | `status` | `?string` | Query, Optional | If provided, only refunds with the given status are returned.<br>For a list of refund status values, see [PaymentRefund](/doc/models/payment-refund.md).<br><br>Default: If omitted, refunds are returned regardless of their status. |
50
- | `sourceType` | `?string` | Query, Optional | If provided, only refunds with the given source type are returned.<br><br>- `CARD` - List refunds only for payments where `CARD` was specified as the payment<br> source.<br><br>Default: If omitted, refunds are returned regardless of the source type. |
51
  | `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.<br><br>It is possible to receive fewer results than the specified limit on a given page.<br><br>If the supplied value is greater than 100, no more than 100 results are returned.<br><br>Default: 100 |
52
 
53
  ## Response Type
54
 
55
- [`ListPaymentRefundsResponse`](/doc/models/list-payment-refunds-response.md)
56
 
57
  ## Example Usage
58
 
59
  ```php
60
- $beginTime = 'begin_time2';
61
- $endTime = 'end_time2';
62
- $sortOrder = 'sort_order0';
63
- $cursor = 'cursor6';
64
- $locationId = 'location_id4';
65
- $status = 'status8';
66
- $sourceType = 'source_type0';
67
- $limit = 172;
68
-
69
- $apiResponse = $refundsApi->listPaymentRefunds($beginTime, $endTime, $sortOrder, $cursor, $locationId, $status, $sourceType, $limit);
70
 
71
  if ($apiResponse->isSuccess()) {
72
  $listPaymentRefundsResponse = $apiResponse->getResult();
@@ -95,11 +86,11 @@ function refundPayment(RefundPaymentRequest $body): ApiResponse
95
 
96
  | Parameter | Type | Tags | Description |
97
  | --- | --- | --- | --- |
98
- | `body` | [`RefundPaymentRequest`](/doc/models/refund-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
99
 
100
  ## Response Type
101
 
102
- [`RefundPaymentResponse`](/doc/models/refund-payment-response.md)
103
 
104
  ## Example Usage
105
 
@@ -108,18 +99,15 @@ $body_idempotencyKey = '9b7f2dcf-49da-4411-b23e-a2d6af21333a';
108
  $body_amountMoney = new Models\Money;
109
  $body_amountMoney->setAmount(1000);
110
  $body_amountMoney->setCurrency(Models\Currency::USD);
111
- $body_paymentId = 'R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY';
112
  $body = new Models\RefundPaymentRequest(
113
  $body_idempotencyKey,
114
- $body_amountMoney,
115
- $body_paymentId
116
  );
117
  $body->setAppFeeMoney(new Models\Money);
118
  $body->getAppFeeMoney()->setAmount(10);
119
  $body->getAppFeeMoney()->setCurrency(Models\Currency::USD);
 
120
  $body->setReason('Example');
121
- $body->setPaymentVersionToken('payment_version_token6');
122
- $body->setTeamMemberId('team_member_id4');
123
 
124
  $apiResponse = $refundsApi->refundPayment($body);
125
 
@@ -151,7 +139,7 @@ function getPaymentRefund(string $refundId): ApiResponse
151
 
152
  ## Response Type
153
 
154
- [`GetPaymentRefundResponse`](/doc/models/get-payment-refund-response.md)
155
 
156
  ## Example Usage
157
 
10
 
11
  ## Methods
12
 
13
+ * [List Payment Refunds](../../doc/apis/refunds.md#list-payment-refunds)
14
+ * [Refund Payment](../../doc/apis/refunds.md#refund-payment)
15
+ * [Get Payment Refund](../../doc/apis/refunds.md#get-payment-refund)
16
 
17
 
18
  # List Payment Refunds
46
  | `sortOrder` | `?string` | Query, Optional | The order in which results are listed:<br><br>- `ASC` - Oldest to newest.<br>- `DESC` - Newest to oldest (default). |
47
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this cursor to retrieve the next set of results for the original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/basics/api101/pagination). |
48
  | `locationId` | `?string` | Query, Optional | Limit results to the location supplied. By default, results are returned<br>for all locations associated with the seller. |
49
+ | `status` | `?string` | Query, Optional | If provided, only refunds with the given status are returned.<br>For a list of refund status values, see [PaymentRefund](../../doc/models/payment-refund.md).<br><br>Default: If omitted, refunds are returned regardless of their status. |
50
+ | `sourceType` | `?string` | Query, Optional | If provided, only returns refunds whose payments have the indicated source type.<br>Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.<br>For information about these payment source types, see<br>[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).<br><br>Default: If omitted, refunds are returned regardless of the source type. |
51
  | `limit` | `?int` | Query, Optional | The maximum number of results to be returned in a single page.<br><br>It is possible to receive fewer results than the specified limit on a given page.<br><br>If the supplied value is greater than 100, no more than 100 results are returned.<br><br>Default: 100 |
52
 
53
  ## Response Type
54
 
55
+ [`ListPaymentRefundsResponse`](../../doc/models/list-payment-refunds-response.md)
56
 
57
  ## Example Usage
58
 
59
  ```php
60
+ $apiResponse = $refundsApi->listPaymentRefunds();
 
 
 
 
 
 
 
 
 
61
 
62
  if ($apiResponse->isSuccess()) {
63
  $listPaymentRefundsResponse = $apiResponse->getResult();
86
 
87
  | Parameter | Type | Tags | Description |
88
  | --- | --- | --- | --- |
89
+ | `body` | [`RefundPaymentRequest`](../../doc/models/refund-payment-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
90
 
91
  ## Response Type
92
 
93
+ [`RefundPaymentResponse`](../../doc/models/refund-payment-response.md)
94
 
95
  ## Example Usage
96
 
99
  $body_amountMoney = new Models\Money;
100
  $body_amountMoney->setAmount(1000);
101
  $body_amountMoney->setCurrency(Models\Currency::USD);
 
102
  $body = new Models\RefundPaymentRequest(
103
  $body_idempotencyKey,
104
+ $body_amountMoney
 
105
  );
106
  $body->setAppFeeMoney(new Models\Money);
107
  $body->getAppFeeMoney()->setAmount(10);
108
  $body->getAppFeeMoney()->setCurrency(Models\Currency::USD);
109
+ $body->setPaymentId('R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY');
110
  $body->setReason('Example');
 
 
111
 
112
  $apiResponse = $refundsApi->refundPayment($body);
113
 
139
 
140
  ## Response Type
141
 
142
+ [`GetPaymentRefundResponse`](../../doc/models/get-payment-refund-response.md)
143
 
144
  ## Example Usage
145
 
vendor/square/square/doc/apis/sites.md CHANGED
@@ -11,7 +11,7 @@ $sitesApi = $client->getSitesApi();
11
 
12
  # List Sites
13
 
14
- Lists the Square Online sites that belong to a seller.
15
 
16
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
17
 
@@ -21,7 +21,7 @@ function listSites(): ApiResponse
21
 
22
  ## Response Type
23
 
24
- [`ListSitesResponse`](/doc/models/list-sites-response.md)
25
 
26
  ## Example Usage
27
 
11
 
12
  # List Sites
13
 
14
+ Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date.
15
 
16
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
17
 
21
 
22
  ## Response Type
23
 
24
+ [`ListSitesResponse`](../../doc/models/list-sites-response.md)
25
 
26
  ## Example Usage
27
 
vendor/square/square/doc/apis/snippets.md CHANGED
@@ -10,16 +10,16 @@ $snippetsApi = $client->getSnippetsApi();
10
 
11
  ## Methods
12
 
13
- * [Delete Snippet](/doc/apis/snippets.md#delete-snippet)
14
- * [Retrieve Snippet](/doc/apis/snippets.md#retrieve-snippet)
15
- * [Upsert Snippet](/doc/apis/snippets.md#upsert-snippet)
16
 
17
 
18
  # Delete Snippet
19
 
20
  Removes your snippet from a Square Online site.
21
 
22
- You can call [ListSites](/doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
23
 
24
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
25
 
@@ -35,7 +35,7 @@ function deleteSnippet(string $siteId): ApiResponse
35
 
36
  ## Response Type
37
 
38
- [`DeleteSnippetResponse`](/doc/models/delete-snippet-response.md)
39
 
40
  ## Example Usage
41
 
@@ -60,7 +60,7 @@ if ($apiResponse->isSuccess()) {
60
 
61
  Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
62
 
63
- You can call [ListSites](/doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
64
 
65
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
66
 
@@ -76,7 +76,7 @@ function retrieveSnippet(string $siteId): ApiResponse
76
 
77
  ## Response Type
78
 
79
- [`RetrieveSnippetResponse`](/doc/models/retrieve-snippet-response.md)
80
 
81
  ## Example Usage
82
 
@@ -102,7 +102,7 @@ if ($apiResponse->isSuccess()) {
102
  Adds a snippet to a Square Online site or updates the existing snippet on the site.
103
  The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
104
 
105
- You can call [ListSites](/doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
106
 
107
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
108
 
@@ -115,11 +115,11 @@ function upsertSnippet(string $siteId, UpsertSnippetRequest $body): ApiResponse
115
  | Parameter | Type | Tags | Description |
116
  | --- | --- | --- | --- |
117
  | `siteId` | `string` | Template, Required | The ID of the site where you want to add or update the snippet. |
118
- | `body` | [`UpsertSnippetRequest`](/doc/models/upsert-snippet-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
119
 
120
  ## Response Type
121
 
122
- [`UpsertSnippetResponse`](/doc/models/upsert-snippet-response.md)
123
 
124
  ## Example Usage
125
 
@@ -129,10 +129,6 @@ $body_snippet_content = '<script>var js = 1;</script>';
129
  $body_snippet = new Models\Snippet(
130
  $body_snippet_content
131
  );
132
- $body_snippet->setId('id4');
133
- $body_snippet->setSiteId('site_id0');
134
- $body_snippet->setCreatedAt('created_at8');
135
- $body_snippet->setUpdatedAt('updated_at0');
136
  $body = new Models\UpsertSnippetRequest(
137
  $body_snippet
138
  );
10
 
11
  ## Methods
12
 
13
+ * [Delete Snippet](../../doc/apis/snippets.md#delete-snippet)
14
+ * [Retrieve Snippet](../../doc/apis/snippets.md#retrieve-snippet)
15
+ * [Upsert Snippet](../../doc/apis/snippets.md#upsert-snippet)
16
 
17
 
18
  # Delete Snippet
19
 
20
  Removes your snippet from a Square Online site.
21
 
22
+ You can call [ListSites](../../doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
23
 
24
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
25
 
35
 
36
  ## Response Type
37
 
38
+ [`DeleteSnippetResponse`](../../doc/models/delete-snippet-response.md)
39
 
40
  ## Example Usage
41
 
60
 
61
  Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application.
62
 
63
+ You can call [ListSites](../../doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
64
 
65
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
66
 
76
 
77
  ## Response Type
78
 
79
+ [`RetrieveSnippetResponse`](../../doc/models/retrieve-snippet-response.md)
80
 
81
  ## Example Usage
82
 
102
  Adds a snippet to a Square Online site or updates the existing snippet on the site.
103
  The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site.
104
 
105
+ You can call [ListSites](../../doc/apis/sites.md#list-sites) to get the IDs of the sites that belong to a seller.
106
 
107
  __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis).
108
 
115
  | Parameter | Type | Tags | Description |
116
  | --- | --- | --- | --- |
117
  | `siteId` | `string` | Template, Required | The ID of the site where you want to add or update the snippet. |
118
+ | `body` | [`UpsertSnippetRequest`](../../doc/models/upsert-snippet-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
119
 
120
  ## Response Type
121
 
122
+ [`UpsertSnippetResponse`](../../doc/models/upsert-snippet-response.md)
123
 
124
  ## Example Usage
125
 
129
  $body_snippet = new Models\Snippet(
130
  $body_snippet_content
131
  );
 
 
 
 
132
  $body = new Models\UpsertSnippetRequest(
133
  $body_snippet
134
  );
vendor/square/square/doc/apis/subscriptions.md CHANGED
@@ -10,18 +10,21 @@ $subscriptionsApi = $client->getSubscriptionsApi();
10
 
11
  ## Methods
12
 
13
- * [Create Subscription](/doc/apis/subscriptions.md#create-subscription)
14
- * [Search Subscriptions](/doc/apis/subscriptions.md#search-subscriptions)
15
- * [Retrieve Subscription](/doc/apis/subscriptions.md#retrieve-subscription)
16
- * [Update Subscription](/doc/apis/subscriptions.md#update-subscription)
17
- * [Cancel Subscription](/doc/apis/subscriptions.md#cancel-subscription)
18
- * [List Subscription Events](/doc/apis/subscriptions.md#list-subscription-events)
19
- * [Resume Subscription](/doc/apis/subscriptions.md#resume-subscription)
 
 
 
20
 
21
 
22
  # Create Subscription
23
 
24
- Creates a subscription for a customer to a subscription plan.
25
 
26
  If you provide a card on file in the request, Square charges the card for
27
  the subscription. Otherwise, Square bills an invoice to the customer's email
@@ -36,11 +39,11 @@ function createSubscription(CreateSubscriptionRequest $body): ApiResponse
36
 
37
  | Parameter | Type | Tags | Description |
38
  | --- | --- | --- | --- |
39
- | `body` | [`CreateSubscriptionRequest`](/doc/models/create-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
40
 
41
  ## Response Type
42
 
43
- [`CreateSubscriptionResponse`](/doc/models/create-subscription-response.md)
44
 
45
  ## Example Usage
46
 
@@ -55,7 +58,6 @@ $body = new Models\CreateSubscriptionRequest(
55
  );
56
  $body->setIdempotencyKey('8193148c-9586-11e6-99f9-28cfe92138cf');
57
  $body->setStartDate('2021-10-20');
58
- $body->setCanceledDate('canceled_date0');
59
  $body->setTaxPercentage('5');
60
  $body->setPriceOverrideMoney(new Models\Money);
61
  $body->getPriceOverrideMoney()->setAmount(100);
@@ -82,6 +84,7 @@ if ($apiResponse->isSuccess()) {
82
  # Search Subscriptions
83
 
84
  Searches for subscriptions.
 
85
  Results are ordered chronologically by subscription creation date. If
86
  the request specifies more than one location ID,
87
  the endpoint orders the result
@@ -106,18 +109,16 @@ function searchSubscriptions(SearchSubscriptionsRequest $body): ApiResponse
106
 
107
  | Parameter | Type | Tags | Description |
108
  | --- | --- | --- | --- |
109
- | `body` | [`SearchSubscriptionsRequest`](/doc/models/search-subscriptions-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
110
 
111
  ## Response Type
112
 
113
- [`SearchSubscriptionsResponse`](/doc/models/search-subscriptions-response.md)
114
 
115
  ## Example Usage
116
 
117
  ```php
118
  $body = new Models\SearchSubscriptionsRequest;
119
- $body->setCursor('cursor0');
120
- $body->setLimit(164);
121
  $body->setQuery(new Models\SearchSubscriptionsQuery);
122
  $body->getQuery()->setFilter(new Models\SearchSubscriptionsFilter);
123
  $body->getQuery()->getFilter()->setCustomerIds(['CHFGVKYY8RSV93M5KCYTG4PN0G']);
@@ -143,7 +144,7 @@ if ($apiResponse->isSuccess()) {
143
  Retrieves a subscription.
144
 
145
  ```php
146
- function retrieveSubscription(string $subscriptionId): ApiResponse
147
  ```
148
 
149
  ## Parameters
@@ -151,10 +152,11 @@ function retrieveSubscription(string $subscriptionId): ApiResponse
151
  | Parameter | Type | Tags | Description |
152
  | --- | --- | --- | --- |
153
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve. |
 
154
 
155
  ## Response Type
156
 
157
- [`RetrieveSubscriptionResponse`](/doc/models/retrieve-subscription-response.md)
158
 
159
  ## Example Usage
160
 
@@ -188,12 +190,12 @@ function updateSubscription(string $subscriptionId, UpdateSubscriptionRequest $b
188
 
189
  | Parameter | Type | Tags | Description |
190
  | --- | --- | --- | --- |
191
- | `subscriptionId` | `string` | Template, Required | The ID for the subscription to update. |
192
- | `body` | [`UpdateSubscriptionRequest`](/doc/models/update-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
193
 
194
  ## Response Type
195
 
196
- [`UpdateSubscriptionResponse`](/doc/models/update-subscription-response.md)
197
 
198
  ## Example Usage
199
 
@@ -201,11 +203,6 @@ function updateSubscription(string $subscriptionId, UpdateSubscriptionRequest $b
201
  $subscriptionId = 'subscription_id0';
202
  $body = new Models\UpdateSubscriptionRequest;
203
  $body->setSubscription(new Models\Subscription);
204
- $body->getSubscription()->setId('id8');
205
- $body->getSubscription()->setLocationId('location_id2');
206
- $body->getSubscription()->setPlanId('plan_id0');
207
- $body->getSubscription()->setCustomerId('customer_id6');
208
- $body->getSubscription()->setStartDate('start_date2');
209
  $body->getSubscription()->setTaxPercentage('null');
210
  $body->getSubscription()->setPriceOverrideMoney(new Models\Money);
211
  $body->getSubscription()->getPriceOverrideMoney()->setAmount(2000);
@@ -226,10 +223,50 @@ if ($apiResponse->isSuccess()) {
226
  ```
227
 
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  # Cancel Subscription
230
 
231
- Sets the `canceled_date` field to the end of the active billing period.
232
- After this date, the status changes from ACTIVE to CANCELED.
 
233
 
234
  ```php
235
  function cancelSubscription(string $subscriptionId): ApiResponse
@@ -243,7 +280,7 @@ function cancelSubscription(string $subscriptionId): ApiResponse
243
 
244
  ## Response Type
245
 
246
- [`CancelSubscriptionResponse`](/doc/models/cancel-subscription-response.md)
247
 
248
  ## Example Usage
249
 
@@ -267,7 +304,6 @@ if ($apiResponse->isSuccess()) {
267
  # List Subscription Events
268
 
269
  Lists all events for a specific subscription.
270
- In the current implementation, only `START_SUBSCRIPTION` and `STOP_SUBSCRIPTION` (when the subscription was canceled) events are returned.
271
 
272
  ```php
273
  function listSubscriptionEvents(string $subscriptionId, ?string $cursor = null, ?int $limit = null): ApiResponse
@@ -278,21 +314,19 @@ function listSubscriptionEvents(string $subscriptionId, ?string $cursor = null,
278
  | Parameter | Type | Tags | Description |
279
  | --- | --- | --- | --- |
280
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve the events for. |
281
- | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
282
- | `limit` | `?int` | Query, Optional | The upper limit on the number of subscription events to return<br>in the response.<br><br>Default: `200` |
283
 
284
  ## Response Type
285
 
286
- [`ListSubscriptionEventsResponse`](/doc/models/list-subscription-events-response.md)
287
 
288
  ## Example Usage
289
 
290
  ```php
291
  $subscriptionId = 'subscription_id0';
292
- $cursor = 'cursor6';
293
- $limit = 172;
294
 
295
- $apiResponse = $subscriptionsApi->listSubscriptionEvents($subscriptionId, $cursor, $limit);
296
 
297
  if ($apiResponse->isSuccess()) {
298
  $listSubscriptionEventsResponse = $apiResponse->getResult();
@@ -306,12 +340,51 @@ if ($apiResponse->isSuccess()) {
306
  ```
307
 
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  # Resume Subscription
310
 
311
- Resumes a deactivated subscription.
312
 
313
  ```php
314
- function resumeSubscription(string $subscriptionId): ApiResponse
315
  ```
316
 
317
  ## Parameters
@@ -319,17 +392,19 @@ function resumeSubscription(string $subscriptionId): ApiResponse
319
  | Parameter | Type | Tags | Description |
320
  | --- | --- | --- | --- |
321
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to resume. |
 
322
 
323
  ## Response Type
324
 
325
- [`ResumeSubscriptionResponse`](/doc/models/resume-subscription-response.md)
326
 
327
  ## Example Usage
328
 
329
  ```php
330
  $subscriptionId = 'subscription_id0';
 
331
 
332
- $apiResponse = $subscriptionsApi->resumeSubscription($subscriptionId);
333
 
334
  if ($apiResponse->isSuccess()) {
335
  $resumeSubscriptionResponse = $apiResponse->getResult();
@@ -342,3 +417,45 @@ if ($apiResponse->isSuccess()) {
342
  // $headers = $apiResponse->getHeaders();
343
  ```
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  ## Methods
12
 
13
+ * [Create Subscription](../../doc/apis/subscriptions.md#create-subscription)
14
+ * [Search Subscriptions](../../doc/apis/subscriptions.md#search-subscriptions)
15
+ * [Retrieve Subscription](../../doc/apis/subscriptions.md#retrieve-subscription)
16
+ * [Update Subscription](../../doc/apis/subscriptions.md#update-subscription)
17
+ * [Delete Subscription Action](../../doc/apis/subscriptions.md#delete-subscription-action)
18
+ * [Cancel Subscription](../../doc/apis/subscriptions.md#cancel-subscription)
19
+ * [List Subscription Events](../../doc/apis/subscriptions.md#list-subscription-events)
20
+ * [Pause Subscription](../../doc/apis/subscriptions.md#pause-subscription)
21
+ * [Resume Subscription](../../doc/apis/subscriptions.md#resume-subscription)
22
+ * [Swap Plan](../../doc/apis/subscriptions.md#swap-plan)
23
 
24
 
25
  # Create Subscription
26
 
27
+ Creates a subscription to a subscription plan by a customer.
28
 
29
  If you provide a card on file in the request, Square charges the card for
30
  the subscription. Otherwise, Square bills an invoice to the customer's email
39
 
40
  | Parameter | Type | Tags | Description |
41
  | --- | --- | --- | --- |
42
+ | `body` | [`CreateSubscriptionRequest`](../../doc/models/create-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
43
 
44
  ## Response Type
45
 
46
+ [`CreateSubscriptionResponse`](../../doc/models/create-subscription-response.md)
47
 
48
  ## Example Usage
49
 
58
  );
59
  $body->setIdempotencyKey('8193148c-9586-11e6-99f9-28cfe92138cf');
60
  $body->setStartDate('2021-10-20');
 
61
  $body->setTaxPercentage('5');
62
  $body->setPriceOverrideMoney(new Models\Money);
63
  $body->getPriceOverrideMoney()->setAmount(100);
84
  # Search Subscriptions
85
 
86
  Searches for subscriptions.
87
+
88
  Results are ordered chronologically by subscription creation date. If
89
  the request specifies more than one location ID,
90
  the endpoint orders the result
109
 
110
  | Parameter | Type | Tags | Description |
111
  | --- | --- | --- | --- |
112
+ | `body` | [`SearchSubscriptionsRequest`](../../doc/models/search-subscriptions-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
113
 
114
  ## Response Type
115
 
116
+ [`SearchSubscriptionsResponse`](../../doc/models/search-subscriptions-response.md)
117
 
118
  ## Example Usage
119
 
120
  ```php
121
  $body = new Models\SearchSubscriptionsRequest;
 
 
122
  $body->setQuery(new Models\SearchSubscriptionsQuery);
123
  $body->getQuery()->setFilter(new Models\SearchSubscriptionsFilter);
124
  $body->getQuery()->getFilter()->setCustomerIds(['CHFGVKYY8RSV93M5KCYTG4PN0G']);
144
  Retrieves a subscription.
145
 
146
  ```php
147
+ function retrieveSubscription(string $subscriptionId, ?string $mInclude = null): ApiResponse
148
  ```
149
 
150
  ## Parameters
152
  | Parameter | Type | Tags | Description |
153
  | --- | --- | --- | --- |
154
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve. |
155
+ | `mInclude` | `?string` | Query, Optional | A query parameter to specify related information to be included in the response.<br><br>The supported query parameter values are:<br><br>- `actions`: to include scheduled actions on the targeted subscription. |
156
 
157
  ## Response Type
158
 
159
+ [`RetrieveSubscriptionResponse`](../../doc/models/retrieve-subscription-response.md)
160
 
161
  ## Example Usage
162
 
190
 
191
  | Parameter | Type | Tags | Description |
192
  | --- | --- | --- | --- |
193
+ | `subscriptionId` | `string` | Template, Required | The ID of the subscription to update. |
194
+ | `body` | [`UpdateSubscriptionRequest`](../../doc/models/update-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
195
 
196
  ## Response Type
197
 
198
+ [`UpdateSubscriptionResponse`](../../doc/models/update-subscription-response.md)
199
 
200
  ## Example Usage
201
 
203
  $subscriptionId = 'subscription_id0';
204
  $body = new Models\UpdateSubscriptionRequest;
205
  $body->setSubscription(new Models\Subscription);
 
 
 
 
 
206
  $body->getSubscription()->setTaxPercentage('null');
207
  $body->getSubscription()->setPriceOverrideMoney(new Models\Money);
208
  $body->getSubscription()->getPriceOverrideMoney()->setAmount(2000);
223
  ```
224
 
225
 
226
+ # Delete Subscription Action
227
+
228
+ Deletes a scheduled action for a subscription.
229
+
230
+ ```php
231
+ function deleteSubscriptionAction(string $subscriptionId, string $actionId): ApiResponse
232
+ ```
233
+
234
+ ## Parameters
235
+
236
+ | Parameter | Type | Tags | Description |
237
+ | --- | --- | --- | --- |
238
+ | `subscriptionId` | `string` | Template, Required | The ID of the subscription the targeted action is to act upon. |
239
+ | `actionId` | `string` | Template, Required | The ID of the targeted action to be deleted. |
240
+
241
+ ## Response Type
242
+
243
+ [`DeleteSubscriptionActionResponse`](../../doc/models/delete-subscription-action-response.md)
244
+
245
+ ## Example Usage
246
+
247
+ ```php
248
+ $subscriptionId = 'subscription_id0';
249
+ $actionId = 'action_id6';
250
+
251
+ $apiResponse = $subscriptionsApi->deleteSubscriptionAction($subscriptionId, $actionId);
252
+
253
+ if ($apiResponse->isSuccess()) {
254
+ $deleteSubscriptionActionResponse = $apiResponse->getResult();
255
+ } else {
256
+ $errors = $apiResponse->getErrors();
257
+ }
258
+
259
+ // Get more response info...
260
+ // $statusCode = $apiResponse->getStatusCode();
261
+ // $headers = $apiResponse->getHeaders();
262
+ ```
263
+
264
+
265
  # Cancel Subscription
266
 
267
+ Schedules a `CANCEL` action to cancel an active subscription
268
+ by setting the `canceled_date` field to the end of the active billing period
269
+ and changing the subscription status from ACTIVE to CANCELED after this date.
270
 
271
  ```php
272
  function cancelSubscription(string $subscriptionId): ApiResponse
280
 
281
  ## Response Type
282
 
283
+ [`CancelSubscriptionResponse`](../../doc/models/cancel-subscription-response.md)
284
 
285
  ## Example Usage
286
 
304
  # List Subscription Events
305
 
306
  Lists all events for a specific subscription.
 
307
 
308
  ```php
309
  function listSubscriptionEvents(string $subscriptionId, ?string $cursor = null, ?int $limit = null): ApiResponse
314
  | Parameter | Type | Tags | Description |
315
  | --- | --- | --- | --- |
316
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve the events for. |
317
+ | `cursor` | `?string` | Query, Optional | When the total number of resulting subscription events exceeds the limit of a paged response,<br>specify the cursor returned from a preceding response here to fetch the next set of results.<br>If the cursor is unset, the response contains the last page of the results.<br><br>For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). |
318
+ | `limit` | `?int` | Query, Optional | The upper limit on the number of subscription events to return<br>in a paged response. |
319
 
320
  ## Response Type
321
 
322
+ [`ListSubscriptionEventsResponse`](../../doc/models/list-subscription-events-response.md)
323
 
324
  ## Example Usage
325
 
326
  ```php
327
  $subscriptionId = 'subscription_id0';
 
 
328
 
329
+ $apiResponse = $subscriptionsApi->listSubscriptionEvents($subscriptionId);
330
 
331
  if ($apiResponse->isSuccess()) {
332
  $listSubscriptionEventsResponse = $apiResponse->getResult();
340
  ```
341
 
342
 
343
+ # Pause Subscription
344
+
345
+ Schedules a `PAUSE` action to pause an active subscription.
346
+
347
+ ```php
348
+ function pauseSubscription(string $subscriptionId, PauseSubscriptionRequest $body): ApiResponse
349
+ ```
350
+
351
+ ## Parameters
352
+
353
+ | Parameter | Type | Tags | Description |
354
+ | --- | --- | --- | --- |
355
+ | `subscriptionId` | `string` | Template, Required | The ID of the subscription to pause. |
356
+ | `body` | [`PauseSubscriptionRequest`](../../doc/models/pause-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
357
+
358
+ ## Response Type
359
+
360
+ [`PauseSubscriptionResponse`](../../doc/models/pause-subscription-response.md)
361
+
362
+ ## Example Usage
363
+
364
+ ```php
365
+ $subscriptionId = 'subscription_id0';
366
+ $body = new Models\PauseSubscriptionRequest;
367
+
368
+ $apiResponse = $subscriptionsApi->pauseSubscription($subscriptionId, $body);
369
+
370
+ if ($apiResponse->isSuccess()) {
371
+ $pauseSubscriptionResponse = $apiResponse->getResult();
372
+ } else {
373
+ $errors = $apiResponse->getErrors();
374
+ }
375
+
376
+ // Get more response info...
377
+ // $statusCode = $apiResponse->getStatusCode();
378
+ // $headers = $apiResponse->getHeaders();
379
+ ```
380
+
381
+
382
  # Resume Subscription
383
 
384
+ Schedules a `RESUME` action to resume a paused or a deactivated subscription.
385
 
386
  ```php
387
+ function resumeSubscription(string $subscriptionId, ResumeSubscriptionRequest $body): ApiResponse
388
  ```
389
 
390
  ## Parameters
392
  | Parameter | Type | Tags | Description |
393
  | --- | --- | --- | --- |
394
  | `subscriptionId` | `string` | Template, Required | The ID of the subscription to resume. |
395
+ | `body` | [`ResumeSubscriptionRequest`](../../doc/models/resume-subscription-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
396
 
397
  ## Response Type
398
 
399
+ [`ResumeSubscriptionResponse`](../../doc/models/resume-subscription-response.md)
400
 
401
  ## Example Usage
402
 
403
  ```php
404
  $subscriptionId = 'subscription_id0';
405
+ $body = new Models\ResumeSubscriptionRequest;
406
 
407
+ $apiResponse = $subscriptionsApi->resumeSubscription($subscriptionId, $body);
408
 
409
  if ($apiResponse->isSuccess()) {
410
  $resumeSubscriptionResponse = $apiResponse->getResult();
417
  // $headers = $apiResponse->getHeaders();
418
  ```
419
 
420
+
421
+ # Swap Plan
422
+
423
+ Schedules a `SWAP_PLAN` action to swap a subscription plan in an existing subscription.
424
+
425
+ ```php
426
+ function swapPlan(string $subscriptionId, SwapPlanRequest $body): ApiResponse
427
+ ```
428
+
429
+ ## Parameters
430
+
431
+ | Parameter | Type | Tags | Description |
432
+ | --- | --- | --- | --- |
433
+ | `subscriptionId` | `string` | Template, Required | The ID of the subscription to swap the subscription plan for. |
434
+ | `body` | [`SwapPlanRequest`](../../doc/models/swap-plan-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
435
+
436
+ ## Response Type
437
+
438
+ [`SwapPlanResponse`](../../doc/models/swap-plan-response.md)
439
+
440
+ ## Example Usage
441
+
442
+ ```php
443
+ $subscriptionId = 'subscription_id0';
444
+ $body_newPlanId = 'new_plan_id2';
445
+ $body = new Models\SwapPlanRequest(
446
+ $body_newPlanId
447
+ );
448
+
449
+ $apiResponse = $subscriptionsApi->swapPlan($subscriptionId, $body);
450
+
451
+ if ($apiResponse->isSuccess()) {
452
+ $swapPlanResponse = $apiResponse->getResult();
453
+ } else {
454
+ $errors = $apiResponse->getErrors();
455
+ }
456
+
457
+ // Get more response info...
458
+ // $statusCode = $apiResponse->getStatusCode();
459
+ // $headers = $apiResponse->getHeaders();
460
+ ```
461
+
vendor/square/square/doc/apis/team.md CHANGED
@@ -10,14 +10,14 @@ $teamApi = $client->getTeamApi();
10
 
11
  ## Methods
12
 
13
- * [Create Team Member](/doc/apis/team.md#create-team-member)
14
- * [Bulk Create Team Members](/doc/apis/team.md#bulk-create-team-members)
15
- * [Bulk Update Team Members](/doc/apis/team.md#bulk-update-team-members)
16
- * [Search Team Members](/doc/apis/team.md#search-team-members)
17
- * [Retrieve Team Member](/doc/apis/team.md#retrieve-team-member)
18
- * [Update Team Member](/doc/apis/team.md#update-team-member)
19
- * [Retrieve Wage Setting](/doc/apis/team.md#retrieve-wage-setting)
20
- * [Update Wage Setting](/doc/apis/team.md#update-wage-setting)
21
 
22
 
23
  # Create Team Member
@@ -38,11 +38,11 @@ function createTeamMember(CreateTeamMemberRequest $body): ApiResponse
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
- | `body` | [`CreateTeamMemberRequest`](/doc/models/create-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
- [`CreateTeamMemberResponse`](/doc/models/create-team-member-response.md)
46
 
47
  ## Example Usage
48
 
@@ -50,9 +50,7 @@ function createTeamMember(CreateTeamMemberRequest $body): ApiResponse
50
  $body = new Models\CreateTeamMemberRequest;
51
  $body->setIdempotencyKey('idempotency-key-0');
52
  $body->setTeamMember(new Models\TeamMember);
53
- $body->getTeamMember()->setId('id2');
54
  $body->getTeamMember()->setReferenceId('reference_id_1');
55
- $body->getTeamMember()->setIsOwner(false);
56
  $body->getTeamMember()->setStatus(Models\TeamMemberStatus::ACTIVE);
57
  $body->getTeamMember()->setGivenName('Joe');
58
  $body->getTeamMember()->setFamilyName('Doe');
@@ -93,11 +91,11 @@ function bulkCreateTeamMembers(BulkCreateTeamMembersRequest $body): ApiResponse
93
 
94
  | Parameter | Type | Tags | Description |
95
  | --- | --- | --- | --- |
96
- | `body` | [`BulkCreateTeamMembersRequest`](/doc/models/bulk-create-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
97
 
98
  ## Response Type
99
 
100
- [`BulkCreateTeamMembersResponse`](/doc/models/bulk-create-team-members-response.md)
101
 
102
  ## Example Usage
103
 
@@ -142,11 +140,11 @@ function bulkUpdateTeamMembers(BulkUpdateTeamMembersRequest $body): ApiResponse
142
 
143
  | Parameter | Type | Tags | Description |
144
  | --- | --- | --- | --- |
145
- | `body` | [`BulkUpdateTeamMembersRequest`](/doc/models/bulk-update-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
146
 
147
  ## Response Type
148
 
149
- [`BulkUpdateTeamMembersResponse`](/doc/models/bulk-update-team-members-response.md)
150
 
151
  ## Example Usage
152
 
@@ -191,11 +189,11 @@ function searchTeamMembers(SearchTeamMembersRequest $body): ApiResponse
191
 
192
  | Parameter | Type | Tags | Description |
193
  | --- | --- | --- | --- |
194
- | `body` | [`SearchTeamMembersRequest`](/doc/models/search-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
195
 
196
  ## Response Type
197
 
198
- [`SearchTeamMembersResponse`](/doc/models/search-team-members-response.md)
199
 
200
  ## Example Usage
201
 
@@ -205,9 +203,7 @@ $body->setQuery(new Models\SearchTeamMembersQuery);
205
  $body->getQuery()->setFilter(new Models\SearchTeamMembersFilter);
206
  $body->getQuery()->getFilter()->setLocationIds(['0G5P3VGACMMQZ']);
207
  $body->getQuery()->getFilter()->setStatus(Models\TeamMemberStatus::ACTIVE);
208
- $body->getQuery()->getFilter()->setIsOwner(false);
209
  $body->setLimit(10);
210
- $body->setCursor('cursor0');
211
 
212
  $apiResponse = $teamApi->searchTeamMembers($body);
213
 
@@ -240,7 +236,7 @@ function retrieveTeamMember(string $teamMemberId): ApiResponse
240
 
241
  ## Response Type
242
 
243
- [`RetrieveTeamMemberResponse`](/doc/models/retrieve-team-member-response.md)
244
 
245
  ## Example Usage
246
 
@@ -275,11 +271,11 @@ function updateTeamMember(string $teamMemberId, UpdateTeamMemberRequest $body):
275
  | Parameter | Type | Tags | Description |
276
  | --- | --- | --- | --- |
277
  | `teamMemberId` | `string` | Template, Required | The ID of the team member to update. |
278
- | `body` | [`UpdateTeamMemberRequest`](/doc/models/update-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
279
 
280
  ## Response Type
281
 
282
- [`UpdateTeamMemberResponse`](/doc/models/update-team-member-response.md)
283
 
284
  ## Example Usage
285
 
@@ -287,9 +283,7 @@ function updateTeamMember(string $teamMemberId, UpdateTeamMemberRequest $body):
287
  $teamMemberId = 'team_member_id0';
288
  $body = new Models\UpdateTeamMemberRequest;
289
  $body->setTeamMember(new Models\TeamMember);
290
- $body->getTeamMember()->setId('id2');
291
  $body->getTeamMember()->setReferenceId('reference_id_1');
292
- $body->getTeamMember()->setIsOwner(false);
293
  $body->getTeamMember()->setStatus(Models\TeamMemberStatus::ACTIVE);
294
  $body->getTeamMember()->setGivenName('Joe');
295
  $body->getTeamMember()->setFamilyName('Doe');
@@ -331,7 +325,7 @@ function retrieveWageSetting(string $teamMemberId): ApiResponse
331
 
332
  ## Response Type
333
 
334
- [`RetrieveWageSettingResponse`](/doc/models/retrieve-wage-setting-response.md)
335
 
336
  ## Example Usage
337
 
@@ -369,18 +363,17 @@ function updateWageSetting(string $teamMemberId, UpdateWageSettingRequest $body)
369
  | Parameter | Type | Tags | Description |
370
  | --- | --- | --- | --- |
371
  | `teamMemberId` | `string` | Template, Required | The ID of the team member for which to update the `WageSetting` object. |
372
- | `body` | [`UpdateWageSettingRequest`](/doc/models/update-wage-setting-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
373
 
374
  ## Response Type
375
 
376
- [`UpdateWageSettingResponse`](/doc/models/update-wage-setting-response.md)
377
 
378
  ## Example Usage
379
 
380
  ```php
381
  $teamMemberId = 'team_member_id0';
382
  $body_wageSetting = new Models\WageSetting;
383
- $body_wageSetting->setTeamMemberId('team_member_id2');
384
  $body_wageSetting_jobAssignments = [];
385
 
386
  $body_wageSetting_jobAssignments_0_jobTitle = 'Manager';
@@ -389,9 +382,6 @@ $body_wageSetting_jobAssignments[0] = new Models\JobAssignment(
389
  $body_wageSetting_jobAssignments_0_jobTitle,
390
  $body_wageSetting_jobAssignments_0_payType
391
  );
392
- $body_wageSetting_jobAssignments[0]->setHourlyRate(new Models\Money);
393
- $body_wageSetting_jobAssignments[0]->getHourlyRate()->setAmount(117);
394
- $body_wageSetting_jobAssignments[0]->getHourlyRate()->setCurrency(Models\Currency::ERN);
395
  $body_wageSetting_jobAssignments[0]->setAnnualRate(new Models\Money);
396
  $body_wageSetting_jobAssignments[0]->getAnnualRate()->setAmount(3000000);
397
  $body_wageSetting_jobAssignments[0]->getAnnualRate()->setCurrency(Models\Currency::USD);
@@ -406,15 +396,9 @@ $body_wageSetting_jobAssignments[1] = new Models\JobAssignment(
406
  $body_wageSetting_jobAssignments[1]->setHourlyRate(new Models\Money);
407
  $body_wageSetting_jobAssignments[1]->getHourlyRate()->setAmount(1200);
408
  $body_wageSetting_jobAssignments[1]->getHourlyRate()->setCurrency(Models\Currency::USD);
409
- $body_wageSetting_jobAssignments[1]->setAnnualRate(new Models\Money);
410
- $body_wageSetting_jobAssignments[1]->getAnnualRate()->setAmount(58);
411
- $body_wageSetting_jobAssignments[1]->getAnnualRate()->setCurrency(Models\Currency::DZD);
412
- $body_wageSetting_jobAssignments[1]->setWeeklyHours(226);
413
  $body_wageSetting->setJobAssignments($body_wageSetting_jobAssignments);
414
 
415
  $body_wageSetting->setIsOvertimeExempt(true);
416
- $body_wageSetting->setVersion(122);
417
- $body_wageSetting->setCreatedAt('created_at0');
418
  $body = new Models\UpdateWageSettingRequest(
419
  $body_wageSetting
420
  );
10
 
11
  ## Methods
12
 
13
+ * [Create Team Member](../../doc/apis/team.md#create-team-member)
14
+ * [Bulk Create Team Members](../../doc/apis/team.md#bulk-create-team-members)
15
+ * [Bulk Update Team Members](../../doc/apis/team.md#bulk-update-team-members)
16
+ * [Search Team Members](../../doc/apis/team.md#search-team-members)
17
+ * [Retrieve Team Member](../../doc/apis/team.md#retrieve-team-member)
18
+ * [Update Team Member](../../doc/apis/team.md#update-team-member)
19
+ * [Retrieve Wage Setting](../../doc/apis/team.md#retrieve-wage-setting)
20
+ * [Update Wage Setting](../../doc/apis/team.md#update-wage-setting)
21
 
22
 
23
  # Create Team Member
38
 
39
  | Parameter | Type | Tags | Description |
40
  | --- | --- | --- | --- |
41
+ | `body` | [`CreateTeamMemberRequest`](../../doc/models/create-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
42
 
43
  ## Response Type
44
 
45
+ [`CreateTeamMemberResponse`](../../doc/models/create-team-member-response.md)
46
 
47
  ## Example Usage
48
 
50
  $body = new Models\CreateTeamMemberRequest;
51
  $body->setIdempotencyKey('idempotency-key-0');
52
  $body->setTeamMember(new Models\TeamMember);
 
53
  $body->getTeamMember()->setReferenceId('reference_id_1');
 
54
  $body->getTeamMember()->setStatus(Models\TeamMemberStatus::ACTIVE);
55
  $body->getTeamMember()->setGivenName('Joe');
56
  $body->getTeamMember()->setFamilyName('Doe');
91
 
92
  | Parameter | Type | Tags | Description |
93
  | --- | --- | --- | --- |
94
+ | `body` | [`BulkCreateTeamMembersRequest`](../../doc/models/bulk-create-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
95
 
96
  ## Response Type
97
 
98
+ [`BulkCreateTeamMembersResponse`](../../doc/models/bulk-create-team-members-response.md)
99
 
100
  ## Example Usage
101
 
140
 
141
  | Parameter | Type | Tags | Description |
142
  | --- | --- | --- | --- |
143
+ | `body` | [`BulkUpdateTeamMembersRequest`](../../doc/models/bulk-update-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
144
 
145
  ## Response Type
146
 
147
+ [`BulkUpdateTeamMembersResponse`](../../doc/models/bulk-update-team-members-response.md)
148
 
149
  ## Example Usage
150
 
189
 
190
  | Parameter | Type | Tags | Description |
191
  | --- | --- | --- | --- |
192
+ | `body` | [`SearchTeamMembersRequest`](../../doc/models/search-team-members-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
193
 
194
  ## Response Type
195
 
196
+ [`SearchTeamMembersResponse`](../../doc/models/search-team-members-response.md)
197
 
198
  ## Example Usage
199
 
203
  $body->getQuery()->setFilter(new Models\SearchTeamMembersFilter);
204
  $body->getQuery()->getFilter()->setLocationIds(['0G5P3VGACMMQZ']);
205
  $body->getQuery()->getFilter()->setStatus(Models\TeamMemberStatus::ACTIVE);
 
206
  $body->setLimit(10);
 
207
 
208
  $apiResponse = $teamApi->searchTeamMembers($body);
209
 
236
 
237
  ## Response Type
238
 
239
+ [`RetrieveTeamMemberResponse`](../../doc/models/retrieve-team-member-response.md)
240
 
241
  ## Example Usage
242
 
271
  | Parameter | Type | Tags | Description |
272
  | --- | --- | --- | --- |
273
  | `teamMemberId` | `string` | Template, Required | The ID of the team member to update. |
274
+ | `body` | [`UpdateTeamMemberRequest`](../../doc/models/update-team-member-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
275
 
276
  ## Response Type
277
 
278
+ [`UpdateTeamMemberResponse`](../../doc/models/update-team-member-response.md)
279
 
280
  ## Example Usage
281
 
283
  $teamMemberId = 'team_member_id0';
284
  $body = new Models\UpdateTeamMemberRequest;
285
  $body->setTeamMember(new Models\TeamMember);
 
286
  $body->getTeamMember()->setReferenceId('reference_id_1');
 
287
  $body->getTeamMember()->setStatus(Models\TeamMemberStatus::ACTIVE);
288
  $body->getTeamMember()->setGivenName('Joe');
289
  $body->getTeamMember()->setFamilyName('Doe');
325
 
326
  ## Response Type
327
 
328
+ [`RetrieveWageSettingResponse`](../../doc/models/retrieve-wage-setting-response.md)
329
 
330
  ## Example Usage
331
 
363
  | Parameter | Type | Tags | Description |
364
  | --- | --- | --- | --- |
365
  | `teamMemberId` | `string` | Template, Required | The ID of the team member for which to update the `WageSetting` object. |
366
+ | `body` | [`UpdateWageSettingRequest`](../../doc/models/update-wage-setting-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
367
 
368
  ## Response Type
369
 
370
+ [`UpdateWageSettingResponse`](../../doc/models/update-wage-setting-response.md)
371
 
372
  ## Example Usage
373
 
374
  ```php
375
  $teamMemberId = 'team_member_id0';
376
  $body_wageSetting = new Models\WageSetting;
 
377
  $body_wageSetting_jobAssignments = [];
378
 
379
  $body_wageSetting_jobAssignments_0_jobTitle = 'Manager';
382
  $body_wageSetting_jobAssignments_0_jobTitle,
383
  $body_wageSetting_jobAssignments_0_payType
384
  );
 
 
 
385
  $body_wageSetting_jobAssignments[0]->setAnnualRate(new Models\Money);
386
  $body_wageSetting_jobAssignments[0]->getAnnualRate()->setAmount(3000000);
387
  $body_wageSetting_jobAssignments[0]->getAnnualRate()->setCurrency(Models\Currency::USD);
396
  $body_wageSetting_jobAssignments[1]->setHourlyRate(new Models\Money);
397
  $body_wageSetting_jobAssignments[1]->getHourlyRate()->setAmount(1200);
398
  $body_wageSetting_jobAssignments[1]->getHourlyRate()->setCurrency(Models\Currency::USD);
 
 
 
 
399
  $body_wageSetting->setJobAssignments($body_wageSetting_jobAssignments);
400
 
401
  $body_wageSetting->setIsOvertimeExempt(true);
 
 
402
  $body = new Models\UpdateWageSettingRequest(
403
  $body_wageSetting
404
  );
vendor/square/square/doc/apis/terminal.md CHANGED
@@ -10,14 +10,187 @@ $terminalApi = $client->getTerminalApi();
10
 
11
  ## Methods
12
 
13
- * [Create Terminal Checkout](/doc/apis/terminal.md#create-terminal-checkout)
14
- * [Search Terminal Checkouts](/doc/apis/terminal.md#search-terminal-checkouts)
15
- * [Get Terminal Checkout](/doc/apis/terminal.md#get-terminal-checkout)
16
- * [Cancel Terminal Checkout](/doc/apis/terminal.md#cancel-terminal-checkout)
17
- * [Create Terminal Refund](/doc/apis/terminal.md#create-terminal-refund)
18
- * [Search Terminal Refunds](/doc/apis/terminal.md#search-terminal-refunds)
19
- * [Get Terminal Refund](/doc/apis/terminal.md#get-terminal-refund)
20
- * [Cancel Terminal Refund](/doc/apis/terminal.md#cancel-terminal-refund)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  # Create Terminal Checkout
@@ -33,11 +206,11 @@ function createTerminalCheckout(CreateTerminalCheckoutRequest $body): ApiRespons
33
 
34
  | Parameter | Type | Tags | Description |
35
  | --- | --- | --- | --- |
36
- | `body` | [`CreateTerminalCheckoutRequest`](/doc/models/create-terminal-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
37
 
38
  ## Response Type
39
 
40
- [`CreateTerminalCheckoutResponse`](/doc/models/create-terminal-checkout-response.md)
41
 
42
  ## Example Usage
43
 
@@ -50,22 +223,12 @@ $body_checkout_deviceOptions_deviceId = 'dbb5d83a-7838-11ea-bc55-0242ac130003';
50
  $body_checkout_deviceOptions = new Models\DeviceCheckoutOptions(
51
  $body_checkout_deviceOptions_deviceId
52
  );
53
- $body_checkout_deviceOptions->setSkipReceiptScreen(false);
54
- $body_checkout_deviceOptions->setTipSettings(new Models\TipSettings);
55
- $body_checkout_deviceOptions->getTipSettings()->setAllowTipping(false);
56
- $body_checkout_deviceOptions->getTipSettings()->setSeparateTipScreen(false);
57
- $body_checkout_deviceOptions->getTipSettings()->setCustomTipField(false);
58
- $body_checkout_deviceOptions->getTipSettings()->setTipPercentages([148, 149, 150]);
59
- $body_checkout_deviceOptions->getTipSettings()->setSmartTipping(false);
60
  $body_checkout = new Models\TerminalCheckout(
61
  $body_checkout_amountMoney,
62
  $body_checkout_deviceOptions
63
  );
64
- $body_checkout->setId('id8');
65
  $body_checkout->setReferenceId('id11572');
66
  $body_checkout->setNote('A brief note');
67
- $body_checkout->setDeadlineDuration('deadline_duration0');
68
- $body_checkout->setStatus('status0');
69
  $body = new Models\CreateTerminalCheckoutRequest(
70
  $body_idempotencyKey,
71
  $body_checkout
@@ -87,7 +250,7 @@ if ($apiResponse->isSuccess()) {
87
 
88
  # Search Terminal Checkouts
89
 
90
- Retrieves a filtered list of Terminal checkout requests created by the account making the request.
91
 
92
  ```php
93
  function searchTerminalCheckouts(SearchTerminalCheckoutsRequest $body): ApiResponse
@@ -97,11 +260,11 @@ function searchTerminalCheckouts(SearchTerminalCheckoutsRequest $body): ApiRespo
97
 
98
  | Parameter | Type | Tags | Description |
99
  | --- | --- | --- | --- |
100
- | `body` | [`SearchTerminalCheckoutsRequest`](/doc/models/search-terminal-checkouts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
101
 
102
  ## Response Type
103
 
104
- [`SearchTerminalCheckoutsResponse`](/doc/models/search-terminal-checkouts-response.md)
105
 
106
  ## Example Usage
107
 
@@ -109,14 +272,7 @@ function searchTerminalCheckouts(SearchTerminalCheckoutsRequest $body): ApiRespo
109
  $body = new Models\SearchTerminalCheckoutsRequest;
110
  $body->setQuery(new Models\TerminalCheckoutQuery);
111
  $body->getQuery()->setFilter(new Models\TerminalCheckoutQueryFilter);
112
- $body->getQuery()->getFilter()->setDeviceId('device_id8');
113
- $body->getQuery()->getFilter()->setCreatedAt(new Models\TimeRange);
114
- $body->getQuery()->getFilter()->getCreatedAt()->setStartAt('start_at2');
115
- $body->getQuery()->getFilter()->getCreatedAt()->setEndAt('end_at0');
116
  $body->getQuery()->getFilter()->setStatus('COMPLETED');
117
- $body->getQuery()->setSort(new Models\TerminalCheckoutQuerySort);
118
- $body->getQuery()->getSort()->setSortOrder(Models\SortOrder::DESC);
119
- $body->setCursor('cursor0');
120
  $body->setLimit(2);
121
 
122
  $apiResponse = $terminalApi->searchTerminalCheckouts($body);
@@ -135,7 +291,7 @@ if ($apiResponse->isSuccess()) {
135
 
136
  # Get Terminal Checkout
137
 
138
- Retrieves a Terminal checkout request by `checkout_id`.
139
 
140
  ```php
141
  function getTerminalCheckout(string $checkoutId): ApiResponse
@@ -149,7 +305,7 @@ function getTerminalCheckout(string $checkoutId): ApiResponse
149
 
150
  ## Response Type
151
 
152
- [`GetTerminalCheckoutResponse`](/doc/models/get-terminal-checkout-response.md)
153
 
154
  ## Example Usage
155
 
@@ -186,7 +342,7 @@ function cancelTerminalCheckout(string $checkoutId): ApiResponse
186
 
187
  ## Response Type
188
 
189
- [`CancelTerminalCheckoutResponse`](/doc/models/cancel-terminal-checkout-response.md)
190
 
191
  ## Example Usage
192
 
@@ -209,7 +365,7 @@ if ($apiResponse->isSuccess()) {
209
 
210
  # Create Terminal Refund
211
 
212
- Creates a request to refund an Interac payment completed on a Square Terminal.
213
 
214
  ```php
215
  function createTerminalRefund(CreateTerminalRefundRequest $body): ApiResponse
@@ -219,11 +375,11 @@ function createTerminalRefund(CreateTerminalRefundRequest $body): ApiResponse
219
 
220
  | Parameter | Type | Tags | Description |
221
  | --- | --- | --- | --- |
222
- | `body` | [`CreateTerminalRefundRequest`](/doc/models/create-terminal-refund-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
223
 
224
  ## Response Type
225
 
226
- [`CreateTerminalRefundResponse`](/doc/models/create-terminal-refund-response.md)
227
 
228
  ## Example Usage
229
 
@@ -236,15 +392,14 @@ $body_refund_paymentId = '5O5OvgkcNUhl7JBuINflcjKqUzXZY';
236
  $body_refund_amountMoney = new Models\Money;
237
  $body_refund_amountMoney->setAmount(111);
238
  $body_refund_amountMoney->setCurrency(Models\Currency::CAD);
 
 
239
  $body->setRefund(new Models\TerminalRefund(
240
  $body_refund_paymentId,
241
- $body_refund_amountMoney
 
 
242
  ));
243
- $body->getRefund()->setId('id4');
244
- $body->getRefund()->setRefundId('refund_id8');
245
- $body->getRefund()->setOrderId('order_id8');
246
- $body->getRefund()->setReason('Returning items');
247
- $body->getRefund()->setDeviceId('f72dfb8e-4d65-4e56-aade-ec3fb8d33291');
248
 
249
  $apiResponse = $terminalApi->createTerminalRefund($body);
250
 
@@ -262,7 +417,7 @@ if ($apiResponse->isSuccess()) {
262
 
263
  # Search Terminal Refunds
264
 
265
- Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request.
266
 
267
  ```php
268
  function searchTerminalRefunds(SearchTerminalRefundsRequest $body): ApiResponse
@@ -272,11 +427,11 @@ function searchTerminalRefunds(SearchTerminalRefundsRequest $body): ApiResponse
272
 
273
  | Parameter | Type | Tags | Description |
274
  | --- | --- | --- | --- |
275
- | `body` | [`SearchTerminalRefundsRequest`](/doc/models/search-terminal-refunds-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
276
 
277
  ## Response Type
278
 
279
- [`SearchTerminalRefundsResponse`](/doc/models/search-terminal-refunds-response.md)
280
 
281
  ## Example Usage
282
 
@@ -284,14 +439,7 @@ function searchTerminalRefunds(SearchTerminalRefundsRequest $body): ApiResponse
284
  $body = new Models\SearchTerminalRefundsRequest;
285
  $body->setQuery(new Models\TerminalRefundQuery);
286
  $body->getQuery()->setFilter(new Models\TerminalRefundQueryFilter);
287
- $body->getQuery()->getFilter()->setDeviceId('device_id8');
288
- $body->getQuery()->getFilter()->setCreatedAt(new Models\TimeRange);
289
- $body->getQuery()->getFilter()->getCreatedAt()->setStartAt('start_at2');
290
- $body->getQuery()->getFilter()->getCreatedAt()->setEndAt('end_at0');
291
  $body->getQuery()->getFilter()->setStatus('COMPLETED');
292
- $body->getQuery()->setSort(new Models\TerminalRefundQuerySort);
293
- $body->getQuery()->getSort()->setSortOrder('sort_order8');
294
- $body->setCursor('cursor0');
295
  $body->setLimit(1);
296
 
297
  $apiResponse = $terminalApi->searchTerminalRefunds($body);
@@ -310,7 +458,7 @@ if ($apiResponse->isSuccess()) {
310
 
311
  # Get Terminal Refund
312
 
313
- Retrieves an Interac Terminal refund object by ID.
314
 
315
  ```php
316
  function getTerminalRefund(string $terminalRefundId): ApiResponse
@@ -324,7 +472,7 @@ function getTerminalRefund(string $terminalRefundId): ApiResponse
324
 
325
  ## Response Type
326
 
327
- [`GetTerminalRefundResponse`](/doc/models/get-terminal-refund-response.md)
328
 
329
  ## Example Usage
330
 
@@ -361,7 +509,7 @@ function cancelTerminalRefund(string $terminalRefundId): ApiResponse
361
 
362
  ## Response Type
363
 
364
- [`CancelTerminalRefundResponse`](/doc/models/cancel-terminal-refund-response.md)
365
 
366
  ## Example Usage
367
 
10
 
11
  ## Methods
12
 
13
+ * [Create Terminal Action](../../doc/apis/terminal.md#create-terminal-action)
14
+ * [Search Terminal Actions](../../doc/apis/terminal.md#search-terminal-actions)
15
+ * [Get Terminal Action](../../doc/apis/terminal.md#get-terminal-action)
16
+ * [Cancel Terminal Action](../../doc/apis/terminal.md#cancel-terminal-action)
17
+ * [Create Terminal Checkout](../../doc/apis/terminal.md#create-terminal-checkout)
18
+ * [Search Terminal Checkouts](../../doc/apis/terminal.md#search-terminal-checkouts)
19
+ * [Get Terminal Checkout](../../doc/apis/terminal.md#get-terminal-checkout)
20
+ * [Cancel Terminal Checkout](../../doc/apis/terminal.md#cancel-terminal-checkout)
21
+ * [Create Terminal Refund](../../doc/apis/terminal.md#create-terminal-refund)
22
+ * [Search Terminal Refunds](../../doc/apis/terminal.md#search-terminal-refunds)
23
+ * [Get Terminal Refund](../../doc/apis/terminal.md#get-terminal-refund)
24
+ * [Cancel Terminal Refund](../../doc/apis/terminal.md#cancel-terminal-refund)
25
+
26
+
27
+ # Create Terminal Action
28
+
29
+ Creates a Terminal action request and sends it to the specified device to take a payment
30
+ for the requested amount.
31
+
32
+ ```php
33
+ function createTerminalAction(CreateTerminalActionRequest $body): ApiResponse
34
+ ```
35
+
36
+ ## Parameters
37
+
38
+ | Parameter | Type | Tags | Description |
39
+ | --- | --- | --- | --- |
40
+ | `body` | [`CreateTerminalActionRequest`](../../doc/models/create-terminal-action-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
41
+
42
+ ## Response Type
43
+
44
+ [`CreateTerminalActionResponse`](../../doc/models/create-terminal-action-response.md)
45
+
46
+ ## Example Usage
47
+
48
+ ```php
49
+ $body_idempotencyKey = 'thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e';
50
+ $body_action = new Models\TerminalAction;
51
+ $body_action->setDeviceId('{{DEVICE_ID}}');
52
+ $body_action->setDeadlineDuration('PT5M');
53
+ $body_action->setType(Models\TerminalActionActionType::SAVE_CARD);
54
+ $body_action_saveCardOptions_customerId = '{{CUSTOMER_ID}}';
55
+ $body_action->setSaveCardOptions(new Models\SaveCardOptions(
56
+ $body_action_saveCardOptions_customerId
57
+ ));
58
+ $body_action->getSaveCardOptions()->setReferenceId('user-id-1');
59
+ $body = new Models\CreateTerminalActionRequest(
60
+ $body_idempotencyKey,
61
+ $body_action
62
+ );
63
+
64
+ $apiResponse = $terminalApi->createTerminalAction($body);
65
+
66
+ if ($apiResponse->isSuccess()) {
67
+ $createTerminalActionResponse = $apiResponse->getResult();
68
+ } else {
69
+ $errors = $apiResponse->getErrors();
70
+ }
71
+
72
+ // Get more response info...
73
+ // $statusCode = $apiResponse->getStatusCode();
74
+ // $headers = $apiResponse->getHeaders();
75
+ ```
76
+
77
+
78
+ # Search Terminal Actions
79
+
80
+ Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
81
+
82
+ ```php
83
+ function searchTerminalActions(SearchTerminalActionsRequest $body): ApiResponse
84
+ ```
85
+
86
+ ## Parameters
87
+
88
+ | Parameter | Type | Tags | Description |
89
+ | --- | --- | --- | --- |
90
+ | `body` | [`SearchTerminalActionsRequest`](../../doc/models/search-terminal-actions-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
91
+
92
+ ## Response Type
93
+
94
+ [`SearchTerminalActionsResponse`](../../doc/models/search-terminal-actions-response.md)
95
+
96
+ ## Example Usage
97
+
98
+ ```php
99
+ $body = new Models\SearchTerminalActionsRequest;
100
+ $body->setQuery(new Models\TerminalActionQuery);
101
+ $body->getQuery()->setFilter(new Models\TerminalActionQueryFilter);
102
+ $body->getQuery()->getFilter()->setCreatedAt(new Models\TimeRange);
103
+ $body->getQuery()->getFilter()->getCreatedAt()->setStartAt('2022-04-01T00:00:00.000Z');
104
+ $body->getQuery()->setSort(new Models\TerminalActionQuerySort);
105
+ $body->getQuery()->getSort()->setSortOrder(Models\SortOrder::DESC);
106
+ $body->setLimit(2);
107
+
108
+ $apiResponse = $terminalApi->searchTerminalActions($body);
109
+
110
+ if ($apiResponse->isSuccess()) {
111
+ $searchTerminalActionsResponse = $apiResponse->getResult();
112
+ } else {
113
+ $errors = $apiResponse->getErrors();
114
+ }
115
+
116
+ // Get more response info...
117
+ // $statusCode = $apiResponse->getStatusCode();
118
+ // $headers = $apiResponse->getHeaders();
119
+ ```
120
+
121
+
122
+ # Get Terminal Action
123
+
124
+ Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days.
125
+
126
+ ```php
127
+ function getTerminalAction(string $actionId): ApiResponse
128
+ ```
129
+
130
+ ## Parameters
131
+
132
+ | Parameter | Type | Tags | Description |
133
+ | --- | --- | --- | --- |
134
+ | `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction` |
135
+
136
+ ## Response Type
137
+
138
+ [`GetTerminalActionResponse`](../../doc/models/get-terminal-action-response.md)
139
+
140
+ ## Example Usage
141
+
142
+ ```php
143
+ $actionId = 'action_id6';
144
+
145
+ $apiResponse = $terminalApi->getTerminalAction($actionId);
146
+
147
+ if ($apiResponse->isSuccess()) {
148
+ $getTerminalActionResponse = $apiResponse->getResult();
149
+ } else {
150
+ $errors = $apiResponse->getErrors();
151
+ }
152
+
153
+ // Get more response info...
154
+ // $statusCode = $apiResponse->getStatusCode();
155
+ // $headers = $apiResponse->getHeaders();
156
+ ```
157
+
158
+
159
+ # Cancel Terminal Action
160
+
161
+ Cancels a Terminal action request if the status of the request permits it.
162
+
163
+ ```php
164
+ function cancelTerminalAction(string $actionId): ApiResponse
165
+ ```
166
+
167
+ ## Parameters
168
+
169
+ | Parameter | Type | Tags | Description |
170
+ | --- | --- | --- | --- |
171
+ | `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction` |
172
+
173
+ ## Response Type
174
+
175
+ [`CancelTerminalActionResponse`](../../doc/models/cancel-terminal-action-response.md)
176
+
177
+ ## Example Usage
178
+
179
+ ```php
180
+ $actionId = 'action_id6';
181
+
182
+ $apiResponse = $terminalApi->cancelTerminalAction($actionId);
183
+
184
+ if ($apiResponse->isSuccess()) {
185
+ $cancelTerminalActionResponse = $apiResponse->getResult();
186
+ } else {
187
+ $errors = $apiResponse->getErrors();
188
+ }
189
+
190
+ // Get more response info...
191
+ // $statusCode = $apiResponse->getStatusCode();
192
+ // $headers = $apiResponse->getHeaders();
193
+ ```
194
 
195
 
196
  # Create Terminal Checkout
206
 
207
  | Parameter | Type | Tags | Description |
208
  | --- | --- | --- | --- |
209
+ | `body` | [`CreateTerminalCheckoutRequest`](../../doc/models/create-terminal-checkout-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
210
 
211
  ## Response Type
212
 
213
+ [`CreateTerminalCheckoutResponse`](../../doc/models/create-terminal-checkout-response.md)
214
 
215
  ## Example Usage
216
 
223
  $body_checkout_deviceOptions = new Models\DeviceCheckoutOptions(
224
  $body_checkout_deviceOptions_deviceId
225
  );
 
 
 
 
 
 
 
226
  $body_checkout = new Models\TerminalCheckout(
227
  $body_checkout_amountMoney,
228
  $body_checkout_deviceOptions
229
  );
 
230
  $body_checkout->setReferenceId('id11572');
231
  $body_checkout->setNote('A brief note');
 
 
232
  $body = new Models\CreateTerminalCheckoutRequest(
233
  $body_idempotencyKey,
234
  $body_checkout
250
 
251
  # Search Terminal Checkouts
252
 
253
+ Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
254
 
255
  ```php
256
  function searchTerminalCheckouts(SearchTerminalCheckoutsRequest $body): ApiResponse
260
 
261
  | Parameter | Type | Tags | Description |
262
  | --- | --- | --- | --- |
263
+ | `body` | [`SearchTerminalCheckoutsRequest`](../../doc/models/search-terminal-checkouts-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
264
 
265
  ## Response Type
266
 
267
+ [`SearchTerminalCheckoutsResponse`](../../doc/models/search-terminal-checkouts-response.md)
268
 
269
  ## Example Usage
270
 
272
  $body = new Models\SearchTerminalCheckoutsRequest;
273
  $body->setQuery(new Models\TerminalCheckoutQuery);
274
  $body->getQuery()->setFilter(new Models\TerminalCheckoutQueryFilter);
 
 
 
 
275
  $body->getQuery()->getFilter()->setStatus('COMPLETED');
 
 
 
276
  $body->setLimit(2);
277
 
278
  $apiResponse = $terminalApi->searchTerminalCheckouts($body);
291
 
292
  # Get Terminal Checkout
293
 
294
+ Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days.
295
 
296
  ```php
297
  function getTerminalCheckout(string $checkoutId): ApiResponse
305
 
306
  ## Response Type
307
 
308
+ [`GetTerminalCheckoutResponse`](../../doc/models/get-terminal-checkout-response.md)
309
 
310
  ## Example Usage
311
 
342
 
343
  ## Response Type
344
 
345
+ [`CancelTerminalCheckoutResponse`](../../doc/models/cancel-terminal-checkout-response.md)
346
 
347
  ## Example Usage
348
 
365
 
366
  # Create Terminal Refund
367
 
368
+ Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](../../doc/apis/refunds.md).
369
 
370
  ```php
371
  function createTerminalRefund(CreateTerminalRefundRequest $body): ApiResponse
375
 
376
  | Parameter | Type | Tags | Description |
377
  | --- | --- | --- | --- |
378
+ | `body` | [`CreateTerminalRefundRequest`](../../doc/models/create-terminal-refund-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
379
 
380
  ## Response Type
381
 
382
+ [`CreateTerminalRefundResponse`](../../doc/models/create-terminal-refund-response.md)
383
 
384
  ## Example Usage
385
 
392
  $body_refund_amountMoney = new Models\Money;
393
  $body_refund_amountMoney->setAmount(111);
394
  $body_refund_amountMoney->setCurrency(Models\Currency::CAD);
395
+ $body_refund_reason = 'Returning items';
396
+ $body_refund_deviceId = 'f72dfb8e-4d65-4e56-aade-ec3fb8d33291';
397
  $body->setRefund(new Models\TerminalRefund(
398
  $body_refund_paymentId,
399
+ $body_refund_amountMoney,
400
+ $body_refund_reason,
401
+ $body_refund_deviceId
402
  ));
 
 
 
 
 
403
 
404
  $apiResponse = $terminalApi->createTerminalRefund($body);
405
 
417
 
418
  # Search Terminal Refunds
419
 
420
+ Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
421
 
422
  ```php
423
  function searchTerminalRefunds(SearchTerminalRefundsRequest $body): ApiResponse
427
 
428
  | Parameter | Type | Tags | Description |
429
  | --- | --- | --- | --- |
430
+ | `body` | [`SearchTerminalRefundsRequest`](../../doc/models/search-terminal-refunds-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
431
 
432
  ## Response Type
433
 
434
+ [`SearchTerminalRefundsResponse`](../../doc/models/search-terminal-refunds-response.md)
435
 
436
  ## Example Usage
437
 
439
  $body = new Models\SearchTerminalRefundsRequest;
440
  $body->setQuery(new Models\TerminalRefundQuery);
441
  $body->getQuery()->setFilter(new Models\TerminalRefundQueryFilter);
 
 
 
 
442
  $body->getQuery()->getFilter()->setStatus('COMPLETED');
 
 
 
443
  $body->setLimit(1);
444
 
445
  $apiResponse = $terminalApi->searchTerminalRefunds($body);
458
 
459
  # Get Terminal Refund
460
 
461
+ Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
462
 
463
  ```php
464
  function getTerminalRefund(string $terminalRefundId): ApiResponse
472
 
473
  ## Response Type
474
 
475
+ [`GetTerminalRefundResponse`](../../doc/models/get-terminal-refund-response.md)
476
 
477
  ## Example Usage
478
 
509
 
510
  ## Response Type
511
 
512
+ [`CancelTerminalRefundResponse`](../../doc/models/cancel-terminal-refund-response.md)
513
 
514
  ## Example Usage
515
 
vendor/square/square/doc/apis/transactions.md CHANGED
@@ -10,10 +10,10 @@ $transactionsApi = $client->getTransactionsApi();
10
 
11
  ## Methods
12
 
13
- * [List Transactions](/doc/apis/transactions.md#list-transactions)
14
- * [Retrieve Transaction](/doc/apis/transactions.md#retrieve-transaction)
15
- * [Capture Transaction](/doc/apis/transactions.md#capture-transaction)
16
- * [Void Transaction](/doc/apis/transactions.md#void-transaction)
17
 
18
 
19
  # List Transactions
@@ -44,23 +44,19 @@ function listTransactions(
44
  | `locationId` | `string` | Template, Required | The ID of the location to list transactions for. |
45
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in RFC 3339 format.<br><br>See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.<br><br>Default value: The current time minus one year. |
46
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in RFC 3339 format.<br><br>See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.<br><br>Default value: The current time. |
47
- | `sortOrder` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which results are listed in the response (`ASC` for<br>oldest first, `DESC` for newest first).<br><br>Default value: `DESC` |
48
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. |
49
 
50
  ## Response Type
51
 
52
- [`ListTransactionsResponse`](/doc/models/list-transactions-response.md)
53
 
54
  ## Example Usage
55
 
56
  ```php
57
  $locationId = 'location_id4';
58
- $beginTime = 'begin_time2';
59
- $endTime = 'end_time2';
60
- $sortOrder = Models\SortOrder::DESC;
61
- $cursor = 'cursor6';
62
 
63
- $apiResponse = $transactionsApi->listTransactions($locationId, $beginTime, $endTime, $sortOrder, $cursor);
64
 
65
  if ($apiResponse->isSuccess()) {
66
  $listTransactionsResponse = $apiResponse->getResult();
@@ -93,7 +89,7 @@ function retrieveTransaction(string $locationId, string $transactionId): ApiResp
93
 
94
  ## Response Type
95
 
96
- [`RetrieveTransactionResponse`](/doc/models/retrieve-transaction-response.md)
97
 
98
  ## Example Usage
99
 
@@ -138,7 +134,7 @@ function captureTransaction(string $locationId, string $transactionId): ApiRespo
138
 
139
  ## Response Type
140
 
141
- [`CaptureTransactionResponse`](/doc/models/capture-transaction-response.md)
142
 
143
  ## Example Usage
144
 
@@ -183,7 +179,7 @@ function voidTransaction(string $locationId, string $transactionId): ApiResponse
183
 
184
  ## Response Type
185
 
186
- [`VoidTransactionResponse`](/doc/models/void-transaction-response.md)
187
 
188
  ## Example Usage
189
 
10
 
11
  ## Methods
12
 
13
+ * [List Transactions](../../doc/apis/transactions.md#list-transactions)
14
+ * [Retrieve Transaction](../../doc/apis/transactions.md#retrieve-transaction)
15
+ * [Capture Transaction](../../doc/apis/transactions.md#capture-transaction)
16
+ * [Void Transaction](../../doc/apis/transactions.md#void-transaction)
17
 
18
 
19
  # List Transactions
44
  | `locationId` | `string` | Template, Required | The ID of the location to list transactions for. |
45
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in RFC 3339 format.<br><br>See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.<br><br>Default value: The current time minus one year. |
46
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in RFC 3339 format.<br><br>See [Date ranges](https://developer.squareup.com/docs/build-basics/working-with-dates) for details on date inclusivity/exclusivity.<br><br>Default value: The current time. |
47
+ | `sortOrder` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which results are listed in the response (`ASC` for<br>oldest first, `DESC` for newest first).<br><br>Default value: `DESC` |
48
  | `cursor` | `?string` | Query, Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for your original query.<br><br>See [Paginating results](https://developer.squareup.com/docs/working-with-apis/pagination) for more information. |
49
 
50
  ## Response Type
51
 
52
+ [`ListTransactionsResponse`](../../doc/models/list-transactions-response.md)
53
 
54
  ## Example Usage
55
 
56
  ```php
57
  $locationId = 'location_id4';
 
 
 
 
58
 
59
+ $apiResponse = $transactionsApi->listTransactions($locationId);
60
 
61
  if ($apiResponse->isSuccess()) {
62
  $listTransactionsResponse = $apiResponse->getResult();
89
 
90
  ## Response Type
91
 
92
+ [`RetrieveTransactionResponse`](../../doc/models/retrieve-transaction-response.md)
93
 
94
  ## Example Usage
95
 
134
 
135
  ## Response Type
136
 
137
+ [`CaptureTransactionResponse`](../../doc/models/capture-transaction-response.md)
138
 
139
  ## Example Usage
140
 
179
 
180
  ## Response Type
181
 
182
+ [`VoidTransactionResponse`](../../doc/models/void-transaction-response.md)
183
 
184
  ## Example Usage
185
 
vendor/square/square/doc/apis/v1-transactions.md CHANGED
@@ -10,15 +10,15 @@ $v1TransactionsApi = $client->getV1TransactionsApi();
10
 
11
  ## Methods
12
 
13
- * [List Orders](/doc/apis/v1-transactions.md#list-orders)
14
- * [Retrieve Order](/doc/apis/v1-transactions.md#retrieve-order)
15
- * [Update Order](/doc/apis/v1-transactions.md#update-order)
16
- * [List Payments](/doc/apis/v1-transactions.md#list-payments)
17
- * [Retrieve Payment](/doc/apis/v1-transactions.md#retrieve-payment)
18
- * [List Refunds](/doc/apis/v1-transactions.md#list-refunds)
19
- * [Create Refund](/doc/apis/v1-transactions.md#create-refund)
20
- * [List Settlements](/doc/apis/v1-transactions.md#list-settlements)
21
- * [Retrieve Settlement](/doc/apis/v1-transactions.md#retrieve-settlement)
22
 
23
 
24
  # List Orders
@@ -41,23 +41,20 @@ function listOrders(
41
  | Parameter | Type | Tags | Description |
42
  | --- | --- | --- | --- |
43
  | `locationId` | `string` | Template, Required | The ID of the location to list online store orders for. |
44
- | `order` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
45
  | `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. |
46
  | `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your<br>original query to the endpoint. |
47
 
48
  ## Response Type
49
 
50
- [`V1Order[]`](/doc/models/v1-order.md)
51
 
52
  ## Example Usage
53
 
54
  ```php
55
  $locationId = 'location_id4';
56
- $order = Models\SortOrder::DESC;
57
- $limit = 172;
58
- $batchToken = 'batch_token2';
59
 
60
- $apiResponse = $v1TransactionsApi->listOrders($locationId, $order, $limit, $batchToken);
61
 
62
  if ($apiResponse->isSuccess()) {
63
  $v1Order = $apiResponse->getResult();
@@ -90,7 +87,7 @@ function retrieveOrder(string $locationId, string $orderId): ApiResponse
90
 
91
  ## Response Type
92
 
93
- [`V1Order`](/doc/models/v1-order.md)
94
 
95
  ## Example Usage
96
 
@@ -128,11 +125,11 @@ function updateOrder(string $locationId, string $orderId, V1UpdateOrderRequest $
128
  | --- | --- | --- | --- |
129
  | `locationId` | `string` | Template, Required | The ID of the order's associated location. |
130
  | `orderId` | `string` | Template, Required | The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint |
131
- | `body` | [`V1UpdateOrderRequest`](/doc/models/v1-update-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
132
 
133
  ## Response Type
134
 
135
- [`V1Order`](/doc/models/v1-order.md)
136
 
137
  ## Example Usage
138
 
@@ -143,10 +140,6 @@ $body_action = Models\V1UpdateOrderRequestAction::REFUND;
143
  $body = new Models\V1UpdateOrderRequest(
144
  $body_action
145
  );
146
- $body->setShippedTrackingNumber('shipped_tracking_number6');
147
- $body->setCompletedNote('completed_note6');
148
- $body->setRefundedNote('refunded_note0');
149
- $body->setCanceledNote('canceled_note4');
150
 
151
  $apiResponse = $v1TransactionsApi->updateOrder($locationId, $orderId, $body);
152
 
@@ -195,7 +188,7 @@ function listPayments(
195
  | Parameter | Type | Tags | Description |
196
  | --- | --- | --- | --- |
197
  | `locationId` | `string` | Template, Required | The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. |
198
- | `order` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
199
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
200
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
201
  | `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. |
@@ -204,20 +197,15 @@ function listPayments(
204
 
205
  ## Response Type
206
 
207
- [`V1Payment[]`](/doc/models/v1-payment.md)
208
 
209
  ## Example Usage
210
 
211
  ```php
212
  $locationId = 'location_id4';
213
- $order = Models\SortOrder::DESC;
214
- $beginTime = 'begin_time2';
215
- $endTime = 'end_time2';
216
- $limit = 172;
217
- $batchToken = 'batch_token2';
218
  $includePartial = false;
219
 
220
- $apiResponse = $v1TransactionsApi->listPayments($locationId, $order, $beginTime, $endTime, $limit, $batchToken, $includePartial);
221
 
222
  if ($apiResponse->isSuccess()) {
223
  $v1Payment = $apiResponse->getResult();
@@ -250,7 +238,7 @@ function retrievePayment(string $locationId, string $paymentId): ApiResponse
250
 
251
  ## Response Type
252
 
253
- [`V1Payment`](/doc/models/v1-payment.md)
254
 
255
  ## Example Usage
256
 
@@ -294,7 +282,7 @@ function listRefunds(
294
  | Parameter | Type | Tags | Description |
295
  | --- | --- | --- | --- |
296
  | `locationId` | `string` | Template, Required | The ID of the location to list refunds for. |
297
- | `order` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
298
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
299
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
300
  | `limit` | `?int` | Query, Optional | The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. |
@@ -302,19 +290,14 @@ function listRefunds(
302
 
303
  ## Response Type
304
 
305
- [`V1Refund[]`](/doc/models/v1-refund.md)
306
 
307
  ## Example Usage
308
 
309
  ```php
310
  $locationId = 'location_id4';
311
- $order = Models\SortOrder::DESC;
312
- $beginTime = 'begin_time2';
313
- $endTime = 'end_time2';
314
- $limit = 172;
315
- $batchToken = 'batch_token2';
316
 
317
- $apiResponse = $v1TransactionsApi->listRefunds($locationId, $order, $beginTime, $endTime, $limit, $batchToken);
318
 
319
  if ($apiResponse->isSuccess()) {
320
  $v1Refund = $apiResponse->getResult();
@@ -354,11 +337,11 @@ function createRefund(string $locationId, V1CreateRefundRequest $body): ApiRespo
354
  | Parameter | Type | Tags | Description |
355
  | --- | --- | --- | --- |
356
  | `locationId` | `string` | Template, Required | The ID of the original payment's associated location. |
357
- | `body` | [`V1CreateRefundRequest`](/doc/models/v1-create-refund-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
358
 
359
  ## Response Type
360
 
361
- [`V1Refund`](/doc/models/v1-refund.md)
362
 
363
  ## Example Usage
364
 
@@ -372,10 +355,6 @@ $body = new Models\V1CreateRefundRequest(
372
  $body_type,
373
  $body_reason
374
  );
375
- $body->setRefundedMoney(new Models\V1Money);
376
- $body->getRefundedMoney()->setAmount(222);
377
- $body->getRefundedMoney()->setCurrencyCode(Models\Currency::CLF);
378
- $body->setRequestIdempotenceKey('request_idempotence_key2');
379
 
380
  $apiResponse = $v1TransactionsApi->createRefund($locationId, $body);
381
 
@@ -419,29 +398,23 @@ function listSettlements(
419
  | Parameter | Type | Tags | Description |
420
  | --- | --- | --- | --- |
421
  | `locationId` | `string` | Template, Required | The ID of the location to list settlements for. If you specify me, this endpoint returns settlements aggregated from all of the business's locations. |
422
- | `order` | [`?string (SortOrder)`](/doc/models/sort-order.md) | Query, Optional | The order in which settlements are listed in the response. |
423
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
424
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
425
  | `limit` | `?int` | Query, Optional | The maximum number of settlements to return in a single response. This value cannot exceed 200. |
426
- | `status` | [`?string (V1ListSettlementsRequestStatus)`](/doc/models/v1-list-settlements-request-status.md) | Query, Optional | Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). |
427
  | `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your<br>original query to the endpoint. |
428
 
429
  ## Response Type
430
 
431
- [`V1Settlement[]`](/doc/models/v1-settlement.md)
432
 
433
  ## Example Usage
434
 
435
  ```php
436
  $locationId = 'location_id4';
437
- $order = Models\SortOrder::DESC;
438
- $beginTime = 'begin_time2';
439
- $endTime = 'end_time2';
440
- $limit = 172;
441
- $status = Models\V1ListSettlementsRequestStatus::SENT;
442
- $batchToken = 'batch_token2';
443
 
444
- $apiResponse = $v1TransactionsApi->listSettlements($locationId, $order, $beginTime, $endTime, $limit, $status, $batchToken);
445
 
446
  if ($apiResponse->isSuccess()) {
447
  $v1Settlement = $apiResponse->getResult();
@@ -490,7 +463,7 @@ function retrieveSettlement(string $locationId, string $settlementId): ApiRespon
490
 
491
  ## Response Type
492
 
493
- [`V1Settlement`](/doc/models/v1-settlement.md)
494
 
495
  ## Example Usage
496
 
10
 
11
  ## Methods
12
 
13
+ * [List Orders](../../doc/apis/v1-transactions.md#list-orders)
14
+ * [Retrieve Order](../../doc/apis/v1-transactions.md#retrieve-order)
15
+ * [Update Order](../../doc/apis/v1-transactions.md#update-order)
16
+ * [List Payments](../../doc/apis/v1-transactions.md#list-payments)
17
+ * [Retrieve Payment](../../doc/apis/v1-transactions.md#retrieve-payment)
18
+ * [List Refunds](../../doc/apis/v1-transactions.md#list-refunds)
19
+ * [Create Refund](../../doc/apis/v1-transactions.md#create-refund)
20
+ * [List Settlements](../../doc/apis/v1-transactions.md#list-settlements)
21
+ * [Retrieve Settlement](../../doc/apis/v1-transactions.md#retrieve-settlement)
22
 
23
 
24
  # List Orders
41
  | Parameter | Type | Tags | Description |
42
  | --- | --- | --- | --- |
43
  | `locationId` | `string` | Template, Required | The ID of the location to list online store orders for. |
44
+ | `order` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
45
  | `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. |
46
  | `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your<br>original query to the endpoint. |
47
 
48
  ## Response Type
49
 
50
+ [`V1Order[]`](../../doc/models/v1-order.md)
51
 
52
  ## Example Usage
53
 
54
  ```php
55
  $locationId = 'location_id4';
 
 
 
56
 
57
+ $apiResponse = $v1TransactionsApi->listOrders($locationId);
58
 
59
  if ($apiResponse->isSuccess()) {
60
  $v1Order = $apiResponse->getResult();
87
 
88
  ## Response Type
89
 
90
+ [`V1Order`](../../doc/models/v1-order.md)
91
 
92
  ## Example Usage
93
 
125
  | --- | --- | --- | --- |
126
  | `locationId` | `string` | Template, Required | The ID of the order's associated location. |
127
  | `orderId` | `string` | Template, Required | The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint |
128
+ | `body` | [`V1UpdateOrderRequest`](../../doc/models/v1-update-order-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
129
 
130
  ## Response Type
131
 
132
+ [`V1Order`](../../doc/models/v1-order.md)
133
 
134
  ## Example Usage
135
 
140
  $body = new Models\V1UpdateOrderRequest(
141
  $body_action
142
  );
 
 
 
 
143
 
144
  $apiResponse = $v1TransactionsApi->updateOrder($locationId, $orderId, $body);
145
 
188
  | Parameter | Type | Tags | Description |
189
  | --- | --- | --- | --- |
190
  | `locationId` | `string` | Template, Required | The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. |
191
+ | `order` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
192
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
193
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
194
  | `limit` | `?int` | Query, Optional | The maximum number of payments to return in a single response. This value cannot exceed 200. |
197
 
198
  ## Response Type
199
 
200
+ [`V1Payment[]`](../../doc/models/v1-payment.md)
201
 
202
  ## Example Usage
203
 
204
  ```php
205
  $locationId = 'location_id4';
 
 
 
 
 
206
  $includePartial = false;
207
 
208
+ $apiResponse = $v1TransactionsApi->listPayments($locationId, null, null, null, null, null, $includePartial);
209
 
210
  if ($apiResponse->isSuccess()) {
211
  $v1Payment = $apiResponse->getResult();
238
 
239
  ## Response Type
240
 
241
+ [`V1Payment`](../../doc/models/v1-payment.md)
242
 
243
  ## Example Usage
244
 
282
  | Parameter | Type | Tags | Description |
283
  | --- | --- | --- | --- |
284
  | `locationId` | `string` | Template, Required | The ID of the location to list refunds for. |
285
+ | `order` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which payments are listed in the response. |
286
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
287
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
288
  | `limit` | `?int` | Query, Optional | The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. |
290
 
291
  ## Response Type
292
 
293
+ [`V1Refund[]`](../../doc/models/v1-refund.md)
294
 
295
  ## Example Usage
296
 
297
  ```php
298
  $locationId = 'location_id4';
 
 
 
 
 
299
 
300
+ $apiResponse = $v1TransactionsApi->listRefunds($locationId);
301
 
302
  if ($apiResponse->isSuccess()) {
303
  $v1Refund = $apiResponse->getResult();
337
  | Parameter | Type | Tags | Description |
338
  | --- | --- | --- | --- |
339
  | `locationId` | `string` | Template, Required | The ID of the original payment's associated location. |
340
+ | `body` | [`V1CreateRefundRequest`](../../doc/models/v1-create-refund-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
341
 
342
  ## Response Type
343
 
344
+ [`V1Refund`](../../doc/models/v1-refund.md)
345
 
346
  ## Example Usage
347
 
355
  $body_type,
356
  $body_reason
357
  );
 
 
 
 
358
 
359
  $apiResponse = $v1TransactionsApi->createRefund($locationId, $body);
360
 
398
  | Parameter | Type | Tags | Description |
399
  | --- | --- | --- | --- |
400
  | `locationId` | `string` | Template, Required | The ID of the location to list settlements for. If you specify me, this endpoint returns settlements aggregated from all of the business's locations. |
401
+ | `order` | [`?string (SortOrder)`](../../doc/models/sort-order.md) | Query, Optional | The order in which settlements are listed in the response. |
402
  | `beginTime` | `?string` | Query, Optional | The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. |
403
  | `endTime` | `?string` | Query, Optional | The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. |
404
  | `limit` | `?int` | Query, Optional | The maximum number of settlements to return in a single response. This value cannot exceed 200. |
405
+ | `status` | [`?string (V1ListSettlementsRequestStatus)`](../../doc/models/v1-list-settlements-request-status.md) | Query, Optional | Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). |
406
  | `batchToken` | `?string` | Query, Optional | A pagination cursor to retrieve the next set of results for your<br>original query to the endpoint. |
407
 
408
  ## Response Type
409
 
410
+ [`V1Settlement[]`](../../doc/models/v1-settlement.md)
411
 
412
  ## Example Usage
413
 
414
  ```php
415
  $locationId = 'location_id4';
 
 
 
 
 
 
416
 
417
+ $apiResponse = $v1TransactionsApi->listSettlements($locationId);
418
 
419
  if ($apiResponse->isSuccess()) {
420
  $v1Settlement = $apiResponse->getResult();
463
 
464
  ## Response Type
465
 
466
+ [`V1Settlement`](../../doc/models/v1-settlement.md)
467
 
468
  ## Example Usage
469
 
vendor/square/square/doc/apis/vendors.md ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Vendors
2
+
3
+ ```php
4
+ $vendorsApi = $client->getVendorsApi();
5
+ ```
6
+
7
+ ## Class Name
8
+
9
+ `VendorsApi`
10
+
11
+ ## Methods
12
+
13
+ * [Bulk Create Vendors](../../doc/apis/vendors.md#bulk-create-vendors)
14
+ * [Bulk Retrieve Vendors](../../doc/apis/vendors.md#bulk-retrieve-vendors)
15
+ * [Bulk Update Vendors](../../doc/apis/vendors.md#bulk-update-vendors)
16
+ * [Create Vendor](../../doc/apis/vendors.md#create-vendor)
17
+ * [Search Vendors](../../doc/apis/vendors.md#search-vendors)
18
+ * [Retrieve Vendor](../../doc/apis/vendors.md#retrieve-vendor)
19
+ * [Update Vendor](../../doc/apis/vendors.md#update-vendor)
20
+
21
+
22
+ # Bulk Create Vendors
23
+
24
+ Creates one or more [Vendor](../../doc/models/vendor.md) objects to represent suppliers to a seller.
25
+
26
+ ```php
27
+ function bulkCreateVendors(BulkCreateVendorsRequest $body): ApiResponse
28
+ ```
29
+
30
+ ## Parameters
31
+
32
+ | Parameter | Type | Tags | Description |
33
+ | --- | --- | --- | --- |
34
+ | `body` | [`BulkCreateVendorsRequest`](../../doc/models/bulk-create-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
35
+
36
+ ## Response Type
37
+
38
+ [`BulkCreateVendorsResponse`](../../doc/models/bulk-create-vendors-response.md)
39
+
40
+ ## Example Usage
41
+
42
+ ```php
43
+ $body_vendors = [];
44
+
45
+ $body_vendors[''] = new Models\Vendor;
46
+
47
+ $body_vendors[''] = new Models\Vendor;
48
+
49
+ $body = new Models\BulkCreateVendorsRequest(
50
+ $body_vendors
51
+ );
52
+
53
+ $apiResponse = $vendorsApi->bulkCreateVendors($body);
54
+
55
+ if ($apiResponse->isSuccess()) {
56
+ $bulkCreateVendorsResponse = $apiResponse->getResult();
57
+ } else {
58
+ $errors = $apiResponse->getErrors();
59
+ }
60
+
61
+ // Get more response info...
62
+ // $statusCode = $apiResponse->getStatusCode();
63
+ // $headers = $apiResponse->getHeaders();
64
+ ```
65
+
66
+
67
+ # Bulk Retrieve Vendors
68
+
69
+ Retrieves one or more vendors of specified [Vendor](../../doc/models/vendor.md) IDs.
70
+
71
+ ```php
72
+ function bulkRetrieveVendors(BulkRetrieveVendorsRequest $body): ApiResponse
73
+ ```
74
+
75
+ ## Parameters
76
+
77
+ | Parameter | Type | Tags | Description |
78
+ | --- | --- | --- | --- |
79
+ | `body` | [`BulkRetrieveVendorsRequest`](../../doc/models/bulk-retrieve-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
80
+
81
+ ## Response Type
82
+
83
+ [`BulkRetrieveVendorsResponse`](../../doc/models/bulk-retrieve-vendors-response.md)
84
+
85
+ ## Example Usage
86
+
87
+ ```php
88
+ $body = new Models\BulkRetrieveVendorsRequest;
89
+ $body->setVendorIds(['INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4']);
90
+
91
+ $apiResponse = $vendorsApi->bulkRetrieveVendors($body);
92
+
93
+ if ($apiResponse->isSuccess()) {
94
+ $bulkRetrieveVendorsResponse = $apiResponse->getResult();
95
+ } else {
96
+ $errors = $apiResponse->getErrors();
97
+ }
98
+
99
+ // Get more response info...
100
+ // $statusCode = $apiResponse->getStatusCode();
101
+ // $headers = $apiResponse->getHeaders();
102
+ ```
103
+
104
+
105
+ # Bulk Update Vendors
106
+
107
+ Updates one or more of existing [Vendor](../../doc/models/vendor.md) objects as suppliers to a seller.
108
+
109
+ ```php
110
+ function bulkUpdateVendors(BulkUpdateVendorsRequest $body): ApiResponse
111
+ ```
112
+
113
+ ## Parameters
114
+
115
+ | Parameter | Type | Tags | Description |
116
+ | --- | --- | --- | --- |
117
+ | `body` | [`BulkUpdateVendorsRequest`](../../doc/models/bulk-update-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
118
+
119
+ ## Response Type
120
+
121
+ [`BulkUpdateVendorsResponse`](../../doc/models/bulk-update-vendors-response.md)
122
+
123
+ ## Example Usage
124
+
125
+ ```php
126
+ $body_vendors = [];
127
+
128
+ $body_vendors__vendor = new Models\Vendor;
129
+ $body_vendors[''] = new Models\UpdateVendorRequest(
130
+ $body_vendors__vendor
131
+ );
132
+
133
+ $body_vendors__vendor = new Models\Vendor;
134
+ $body_vendors[''] = new Models\UpdateVendorRequest(
135
+ $body_vendors__vendor
136
+ );
137
+
138
+ $body = new Models\BulkUpdateVendorsRequest(
139
+ $body_vendors
140
+ );
141
+
142
+ $apiResponse = $vendorsApi->bulkUpdateVendors($body);
143
+
144
+ if ($apiResponse->isSuccess()) {
145
+ $bulkUpdateVendorsResponse = $apiResponse->getResult();
146
+ } else {
147
+ $errors = $apiResponse->getErrors();
148
+ }
149
+
150
+ // Get more response info...
151
+ // $statusCode = $apiResponse->getStatusCode();
152
+ // $headers = $apiResponse->getHeaders();
153
+ ```
154
+
155
+
156
+ # Create Vendor
157
+
158
+ Creates a single [Vendor](../../doc/models/vendor.md) object to represent a supplier to a seller.
159
+
160
+ ```php
161
+ function createVendor(CreateVendorRequest $body): ApiResponse
162
+ ```
163
+
164
+ ## Parameters
165
+
166
+ | Parameter | Type | Tags | Description |
167
+ | --- | --- | --- | --- |
168
+ | `body` | [`CreateVendorRequest`](../../doc/models/create-vendor-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
169
+
170
+ ## Response Type
171
+
172
+ [`CreateVendorResponse`](../../doc/models/create-vendor-response.md)
173
+
174
+ ## Example Usage
175
+
176
+ ```php
177
+ $body_idempotencyKey = 'idempotency_key2';
178
+ $body = new Models\CreateVendorRequest(
179
+ $body_idempotencyKey
180
+ );
181
+
182
+ $apiResponse = $vendorsApi->createVendor($body);
183
+
184
+ if ($apiResponse->isSuccess()) {
185
+ $createVendorResponse = $apiResponse->getResult();
186
+ } else {
187
+ $errors = $apiResponse->getErrors();
188
+ }
189
+
190
+ // Get more response info...
191
+ // $statusCode = $apiResponse->getStatusCode();
192
+ // $headers = $apiResponse->getHeaders();
193
+ ```
194
+
195
+
196
+ # Search Vendors
197
+
198
+ Searches for vendors using a filter against supported [Vendor](../../doc/models/vendor.md) properties and a supported sorter.
199
+
200
+ ```php
201
+ function searchVendors(SearchVendorsRequest $body): ApiResponse
202
+ ```
203
+
204
+ ## Parameters
205
+
206
+ | Parameter | Type | Tags | Description |
207
+ | --- | --- | --- | --- |
208
+ | `body` | [`SearchVendorsRequest`](../../doc/models/search-vendors-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
209
+
210
+ ## Response Type
211
+
212
+ [`SearchVendorsResponse`](../../doc/models/search-vendors-response.md)
213
+
214
+ ## Example Usage
215
+
216
+ ```php
217
+ $body = new Models\SearchVendorsRequest;
218
+
219
+ $apiResponse = $vendorsApi->searchVendors($body);
220
+
221
+ if ($apiResponse->isSuccess()) {
222
+ $searchVendorsResponse = $apiResponse->getResult();
223
+ } else {
224
+ $errors = $apiResponse->getErrors();
225
+ }
226
+
227
+ // Get more response info...
228
+ // $statusCode = $apiResponse->getStatusCode();
229
+ // $headers = $apiResponse->getHeaders();
230
+ ```
231
+
232
+
233
+ # Retrieve Vendor
234
+
235
+ Retrieves the vendor of a specified [Vendor](../../doc/models/vendor.md) ID.
236
+
237
+ ```php
238
+ function retrieveVendor(string $vendorId): ApiResponse
239
+ ```
240
+
241
+ ## Parameters
242
+
243
+ | Parameter | Type | Tags | Description |
244
+ | --- | --- | --- | --- |
245
+ | `vendorId` | `string` | Template, Required | ID of the [Vendor](../../doc/models/vendor.md) to retrieve. |
246
+
247
+ ## Response Type
248
+
249
+ [`RetrieveVendorResponse`](../../doc/models/retrieve-vendor-response.md)
250
+
251
+ ## Example Usage
252
+
253
+ ```php
254
+ $vendorId = 'vendor_id8';
255
+
256
+ $apiResponse = $vendorsApi->retrieveVendor($vendorId);
257
+
258
+ if ($apiResponse->isSuccess()) {
259
+ $retrieveVendorResponse = $apiResponse->getResult();
260
+ } else {
261
+ $errors = $apiResponse->getErrors();
262
+ }
263
+
264
+ // Get more response info...
265
+ // $statusCode = $apiResponse->getStatusCode();
266
+ // $headers = $apiResponse->getHeaders();
267
+ ```
268
+
269
+
270
+ # Update Vendor
271
+
272
+ Updates an existing [Vendor](../../doc/models/vendor.md) object as a supplier to a seller.
273
+
274
+ ```php
275
+ function updateVendor(UpdateVendorRequest $body, string $vendorId): ApiResponse
276
+ ```
277
+
278
+ ## Parameters
279
+
280
+ | Parameter | Type | Tags | Description |
281
+ | --- | --- | --- | --- |
282
+ | `body` | [`UpdateVendorRequest`](../../doc/models/update-vendor-request.md) | Body, Required | An object containing the fields to POST for the request.<br><br>See the corresponding object definition for field details. |
283
+ | `vendorId` | `string` | Template, Required | - |
284
+
285
+ ## Response Type
286
+
287
+ [`UpdateVendorResponse`](../../doc/models/update-vendor-response.md)
288
+
289
+ ## Example Usage
290
+
291
+ ```php
292
+ $body_vendor = new Models\Vendor;
293
+ $body_vendor->setId('INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4');
294
+ $body_vendor->setName('Jack\'s Chicken Shack');
295
+ $body_vendor->setVersion(1);
296
+ $body_vendor->setStatus(Models\VendorStatus::ACTIVE);
297
+ $body = new Models\UpdateVendorRequest(
298
+ $body_vendor
299
+ );
300
+ $body->setIdempotencyKey('8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe');
301
+ $vendorId = 'vendor_id8';
302
+
303
+ $apiResponse = $vendorsApi->updateVendor($body, $vendorId);
304
+
305
+ if ($apiResponse->isSuccess()) {
306
+ $updateVendorResponse = $apiResponse->getResult();
307
+ } else {
308
+ $errors = $apiResponse->getErrors();
309
+ }
310
+
311
+ // Get more response info...
312
+ // $statusCode = $apiResponse->getStatusCode();
313
+ // $headers = $apiResponse->getHeaders();
314
+ ```
315
+
vendor/square/square/doc/client.md CHANGED
@@ -5,11 +5,21 @@ The following parameters are configurable for the API Client:
5
 
6
  | Parameter | Type | Description |
7
  | --- | --- | --- |
8
- | `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2021-10-20'` |
9
  | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
10
  | `environment` | `string` | The API environment. <br> **Default: `production`** |
11
- | `timeout` | `int` | Timeout for API calls |
12
- | `additionalHeaders` | `array` | Additional headers to add to each API call |
 
 
 
 
 
 
 
 
 
 
13
 
14
  The API client can be initialized as follows:
15
 
@@ -17,7 +27,7 @@ The API client can be initialized as follows:
17
  $client = new Square\SquareClient([
18
  // Set authentication parameters
19
  'accessToken' => 'AccessToken',
20
- 'squareVersion' => '2021-10-20',
21
 
22
  // Set the environment
23
  'environment' => 'production',
@@ -44,7 +54,7 @@ require_once "vendor/autoload.php";
44
 
45
  $client = new Square\SquareClient([
46
  'accessToken' => 'AccessToken',
47
- 'squareVersion' => '2021-10-20',
48
  ]);
49
 
50
  $locationsApi = $client->getLocationsApi();
@@ -80,6 +90,7 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
80
  | getCashDrawersApi() | Gets CashDrawersApi |
81
  | getCatalogApi() | Gets CatalogApi |
82
  | getCustomersApi() | Gets CustomersApi |
 
83
  | getCustomerGroupsApi() | Gets CustomerGroupsApi |
84
  | getCustomerSegmentsApi() | Gets CustomerSegmentsApi |
85
  | getDevicesApi() | Gets DevicesApi |
@@ -97,10 +108,12 @@ The gateway for the SDK. This class acts as a factory for the Apis and also hold
97
  | getMerchantsApi() | Gets MerchantsApi |
98
  | getOrdersApi() | Gets OrdersApi |
99
  | getPaymentsApi() | Gets PaymentsApi |
 
100
  | getRefundsApi() | Gets RefundsApi |
101
  | getSitesApi() | Gets SitesApi |
102
  | getSnippetsApi() | Gets SnippetsApi |
103
  | getSubscriptionsApi() | Gets SubscriptionsApi |
104
  | getTeamApi() | Gets TeamApi |
105
  | getTerminalApi() | Gets TerminalApi |
 
106
 
5
 
6
  | Parameter | Type | Description |
7
  | --- | --- | --- |
8
+ | `squareVersion` | `string` | Square Connect API versions<br>*Default*: `'2022-05-12'` |
9
  | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`<br>*Default*: `'https://connect.squareup.com'` |
10
  | `environment` | `string` | The API environment. <br> **Default: `production`** |
11
+ | `timeout` | `int` | Timeout for API calls in seconds.<br>*Default*: `60` |
12
+ | `enableRetries` | `bool` | Whether to enable retries and backoff feature.<br>*Default*: `false` |
13
+ | `numberOfRetries` | `int` | The number of retries to make.<br>*Default*: `0` |
14
+ | `retryInterval` | `float` | The retry time interval between the endpoint calls.<br>*Default*: `1` |
15
+ | `backOffFactor` | `float` | Exponential backoff factor to increase interval between retries.<br>*Default*: `2` |
16
+ | `maximumRetryWaitTime` | `int` | The maximum wait time in seconds for overall retrying requests.<br>*Default*: `0` |
17
+ | `retryOnTimeout` | `bool` | Whether to retry on request timeout.<br>*Default*: `true` |
18
+ | `httpStatusCodesToRetry` | `array` | Http status codes to retry against.<br>*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` |
19
+ | `httpMethodsToRetry` | `array` | Http methods to retry against.<br>*Default*: `'GET', 'PUT'` |
20
+ | `additionalHeaders` | `array` | Additional headers to add to each API call<br>*Default*: `[]` |
21
+ | `userAgentDetail` | `string` | User agent detail, to be appended with user-agent header. |
22
+ | `accessToken` | `string` | The OAuth 2.0 Access Token to use for API requests. |
23
 
24
  The API client can be initialized as follows:
25
 
27
  $client = new Square\SquareClient([
28
  // Set authentication parameters
29
  'accessToken' => 'AccessToken',
30
+ 'squareVersion' => '2022-05-12',
31
 
32
  // Set the environment
33
  'environment' => 'production',
54
 
55
  $client = new Square\SquareClient([
56
  'accessToken' => 'AccessToken',
57
+ 'squareVersion' => '2022-05-12',
58
  ]);
59
 
60
  $locationsApi = $client->getLocationsApi();
90
  | getCashDrawersApi() | Gets CashDrawersApi |
91
  | getCatalogApi() | Gets CatalogApi |
92
  | getCustomersApi() | Gets CustomersApi |
93
+ | getCustomerCustomAttributesApi() | Gets CustomerCustomAttributesApi |
94
  | getCustomerGroupsApi() | Gets CustomerGroupsApi |
95
  | getCustomerSegmentsApi() | Gets CustomerSegmentsApi |
96
  | getDevicesApi() | Gets DevicesApi |
108
  | getMerchantsApi() | Gets MerchantsApi |
109
  | getOrdersApi() | Gets OrdersApi |
110
  | getPaymentsApi() | Gets PaymentsApi |
111
+ | getPayoutsApi() | Gets PayoutsApi |
112
  | getRefundsApi() | Gets RefundsApi |
113
  | getSitesApi() | Gets SitesApi |
114
  | getSnippetsApi() | Gets SnippetsApi |
115
  | getSubscriptionsApi() | Gets SubscriptionsApi |
116
  | getTeamApi() | Gets TeamApi |
117
  | getTerminalApi() | Gets TerminalApi |
118
+ | getVendorsApi() | Gets VendorsApi |
119
 
vendor/square/square/doc/models/accept-dispute-response.md CHANGED
@@ -11,8 +11,8 @@ Defines the fields in an `AcceptDispute` response.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
- | `dispute` | [`?Dispute`](/doc/models/dispute.md) | Optional | Represents a dispute a cardholder initiated with their bank. | getDispute(): ?Dispute | setDispute(?Dispute dispute): void |
16
 
17
  ## Example (as JSON)
18
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
+ | `dispute` | [`?Dispute`](../../doc/models/dispute.md) | Optional | Represents a dispute a cardholder initiated with their bank. | getDispute(): ?Dispute | setDispute(?Dispute dispute): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/accepted-payment-methods.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Accepted Payment Methods
3
+
4
+ ## Structure
5
+
6
+ `AcceptedPaymentMethods`
7
+
8
+ ## Fields
9
+
10
+ | Name | Type | Tags | Description | Getter | Setter |
11
+ | --- | --- | --- | --- | --- | --- |
12
+ | `applePay` | `?bool` | Optional | Whether Apple Pay is accepted at checkout | getApplePay(): ?bool | setApplePay(?bool applePay): void |
13
+ | `googlePay` | `?bool` | Optional | Whether Google Pay is accepted at checkout | getGooglePay(): ?bool | setGooglePay(?bool googlePay): void |
14
+ | `cashAppPay` | `?bool` | Optional | Whether Cash App Pay is accepted at checkout | getCashAppPay(): ?bool | setCashAppPay(?bool cashAppPay): void |
15
+ | `afterpayClearpay` | `?bool` | Optional | Whether Afterpay/Clearpay is accepted at checkout | getAfterpayClearpay(): ?bool | setAfterpayClearpay(?bool afterpayClearpay): void |
16
+
17
+ ## Example (as JSON)
18
+
19
+ ```json
20
+ {
21
+ "apple_pay": null,
22
+ "google_pay": null,
23
+ "cash_app_pay": null,
24
+ "afterpay_clearpay": null
25
+ }
26
+ ```
27
+
vendor/square/square/doc/models/accumulate-loyalty-points-request.md CHANGED
@@ -11,9 +11,9 @@ A request to accumulate points for a purchase.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `accumulatePoints` | [`LoyaltyEventAccumulatePoints`](/doc/models/loyalty-event-accumulate-points.md) | Required | Provides metadata when the event `type` is `ACCUMULATE_POINTS`. | getAccumulatePoints(): LoyaltyEventAccumulatePoints | setAccumulatePoints(LoyaltyEventAccumulatePoints accumulatePoints): void |
15
  | `idempotencyKey` | `string` | Required | A unique string that identifies the `AccumulateLoyaltyPoints` request.<br>Keys can be any valid string but must be unique for every request.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
16
- | `locationId` | `string` | Required | The [location](/doc/models/location.md) where the purchase was made. | getLocationId(): string | setLocationId(string locationId): void |
17
 
18
  ## Example (as JSON)
19
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `accumulatePoints` | [`LoyaltyEventAccumulatePoints`](../../doc/models/loyalty-event-accumulate-points.md) | Required | Provides metadata when the event `type` is `ACCUMULATE_POINTS`. | getAccumulatePoints(): LoyaltyEventAccumulatePoints | setAccumulatePoints(LoyaltyEventAccumulatePoints accumulatePoints): void |
15
  | `idempotencyKey` | `string` | Required | A unique string that identifies the `AccumulateLoyaltyPoints` request.<br>Keys can be any valid string but must be unique for every request.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
16
+ | `locationId` | `string` | Required | The [location](../../doc/models/location.md) where the purchase was made. | getLocationId(): string | setLocationId(string locationId): void |
17
 
18
  ## Example (as JSON)
19
 
vendor/square/square/doc/models/accumulate-loyalty-points-response.md CHANGED
@@ -11,8 +11,8 @@ A response containing the resulting loyalty event.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
- | `event` | [`?LoyaltyEvent`](/doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.<br>For more information, see [Loyalty events](https://developer.squareup.com/docs/loyalty-api/overview/#loyalty-events). | getEvent(): ?LoyaltyEvent | setEvent(?LoyaltyEvent event): void |
16
 
17
  ## Example (as JSON)
18
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
+ | `event` | [`?LoyaltyEvent`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.<br>For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | getEvent(): ?LoyaltyEvent | setEvent(?LoyaltyEvent event): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/ach-details.md CHANGED
@@ -19,9 +19,9 @@ ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type`
19
 
20
  ```json
21
  {
22
- "routing_number": "routing_number4",
23
- "account_number_suffix": "account_number_suffix8",
24
- "account_type": "account_type4"
25
  }
26
  ```
27
 
19
 
20
  ```json
21
  {
22
+ "routing_number": null,
23
+ "account_number_suffix": null,
24
+ "account_type": null
25
  }
26
  ```
27
 
vendor/square/square/doc/models/activity-type.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Activity Type
3
+
4
+ ## Enumeration
5
+
6
+ `ActivityType`
7
+
8
+ ## Fields
9
+
10
+ | Name | Description |
11
+ | --- | --- |
12
+ | `ADJUSTMENT` | A manual adjustment applied to the seller's account by Square. |
13
+ | `APP_FEE_REFUND` | A refund for an application fee on a payment. |
14
+ | `APP_FEE_REVENUE` | Revenue generated from an application fee on a payment. |
15
+ | `AUTOMATIC_SAVINGS` | An automatic transfer from the payment processing balance to the Square Savings account.<br>These are, generally, proportional to the seller's sales. |
16
+ | `AUTOMATIC_SAVINGS_REVERSED` | An automatic transfer from the Square Savings account back to the processing balance.<br>These are, generally, proportional to the seller's refunds. |
17
+ | `CHARGE` | A credit card payment capture. |
18
+ | `DEPOSIT_FEE` | Any fees involved with deposits such as instant deposits. |
19
+ | `DISPUTE` | The balance change due to a dispute event. |
20
+ | `ESCHEATMENT` | An escheatment entry for remittance. |
21
+ | `FEE` | The Square processing fee. |
22
+ | `FREE_PROCESSING` | Square offers free payments processing for a variety of business scenarios, including seller<br>referrals or when Square wants to apologize (for example, for a bug, customer service, or repricing complication).<br>This entry represents a credit to the seller for the purposes of free processing. |
23
+ | `HOLD_ADJUSTMENT` | An adjustment made by Square related to holding a payment. |
24
+ | `INITIAL_BALANCE_CHANGE` | An external change to a seller's balance. Initial, in the sense that it<br>causes the creation of the other activity types, such as hold and refund. |
25
+ | `MONEY_TRANSFER` | The balance change from a money transfer. |
26
+ | `MONEY_TRANSFER_REVERSAL` | The reversal of a money transfer. |
27
+ | `OPEN_DISPUTE` | The balance change for a chargeback that has been filed. |
28
+ | `OTHER` | Any other type that does not belong in the rest of the types. |
29
+ | `OTHER_ADJUSTMENT` | Any other type of adjustment that does not fall under existing types. |
30
+ | `PAID_SERVICE_FEE` | A fee paid to a third-party merchant. |
31
+ | `PAID_SERVICE_FEE_REFUND` | A fee paid to a third-party merchant. |
32
+ | `REDEMPTION_CODE` | Repayment for a redemption code. |
33
+ | `REFUND` | A refund for an existing card payment. |
34
+ | `RELEASE_ADJUSTMENT` | An adjustment made by Square related to releasing a payment. |
35
+ | `RESERVE_HOLD` | Fees paid for funding risk reserve. |
36
+ | `RESERVE_RELEASE` | Fees released from risk reserve. |
37
+ | `RETURNED_PAYOUT` | An entry created when Square receives a response for the ACH file that Square sent indicating that the<br>settlement of the original entry failed. |
38
+ | `SQUARE_CAPITAL_PAYMENT` | A capital merchant cash advance (MCA) assessment. These are, generally,<br>proportional to the merchant's sales but can be issued for other reasons related to the MCA. |
39
+ | `SQUARE_CAPITAL_REVERSED_PAYMENT` | A capital merchant cash advance (MCA) assessment refund. These are, generally,<br>proportional to the merchant's refunds but can be issued for other reasons related to the MCA. |
40
+ | `SUBSCRIPTION_FEE` | A fee charged for subscription to a Square product. |
41
+ | `SUBSCRIPTION_FEE_PAID_REFUND` | A Square subscription fee that has been refunded. |
42
+ | `SUBSCRIPTION_FEE_REFUND` | The refund of a previously charged Square product subscription fee. |
43
+ | `TAX_ON_FEE` | The tax paid on fee amounts. |
44
+ | `THIRD_PARTY_FEE` | Fees collected by a third-party platform. |
45
+ | `THIRD_PARTY_FEE_REFUND` | Refunded fees from a third-party platform. |
46
+
vendor/square/square/doc/models/add-group-to-customer-response.md CHANGED
@@ -2,7 +2,7 @@
2
  # Add Group to Customer Response
3
 
4
  Defines the fields that are included in the response body of
5
- a request to the [AddGroupToCustomer](/doc/apis/customers.md#add-group-to-customer) endpoint.
6
 
7
  ## Structure
8
 
@@ -12,7 +12,7 @@ a request to the [AddGroupToCustomer](/doc/apis/customers.md#add-group-to-custom
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
2
  # Add Group to Customer Response
3
 
4
  Defines the fields that are included in the response body of
5
+ a request to the [AddGroupToCustomer](../../doc/apis/customers.md#add-group-to-customer) endpoint.
6
 
7
  ## Structure
8
 
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/additional-recipient.md CHANGED
@@ -13,20 +13,20 @@ Represents an additional recipient (other than the merchant) receiving a portion
13
  | --- | --- | --- | --- | --- | --- |
14
  | `locationId` | `string` | Required | The location ID for a recipient (other than the merchant) receiving a portion of this tender.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | getLocationId(): string | setLocationId(string locationId): void |
15
  | `description` | `?string` | Optional | The description of the additional recipient.<br>**Constraints**: *Maximum Length*: `100` | getDescription(): ?string | setDescription(?string description): void |
16
- | `amountMoney` | [`Money`](/doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getAmountMoney(): Money | setAmountMoney(Money amountMoney): void |
17
- | `receivableId` | `?string` | Optional | The unique ID for this [AdditionalRecipientReceivable]($m/AdditionalRecipientReceivable), assigned by the server.<br>**Constraints**: *Maximum Length*: `192` | getReceivableId(): ?string | setReceivableId(?string receivableId): void |
18
 
19
  ## Example (as JSON)
20
 
21
  ```json
22
  {
23
  "location_id": "location_id4",
24
- "description": "description0",
25
  "amount_money": {
26
- "amount": 186,
27
- "currency": "NGN"
28
  },
29
- "receivable_id": "receivable_id0"
30
  }
31
  ```
32
 
13
  | --- | --- | --- | --- | --- | --- |
14
  | `locationId` | `string` | Required | The location ID for a recipient (other than the merchant) receiving a portion of this tender.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `50` | getLocationId(): string | setLocationId(string locationId): void |
15
  | `description` | `?string` | Optional | The description of the additional recipient.<br>**Constraints**: *Maximum Length*: `100` | getDescription(): ?string | setDescription(?string description): void |
16
+ | `amountMoney` | [`Money`](../../doc/models/money.md) | Required | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getAmountMoney(): Money | setAmountMoney(Money amountMoney): void |
17
+ | `receivableId` | `?string` | Optional | The unique ID for the RETIRED `AdditionalRecipientReceivable` object. This field should be empty for any `AdditionalRecipient` objects created after the retirement.<br>**Constraints**: *Maximum Length*: `192` | getReceivableId(): ?string | setReceivableId(?string receivableId): void |
18
 
19
  ## Example (as JSON)
20
 
21
  ```json
22
  {
23
  "location_id": "location_id4",
24
+ "description": null,
25
  "amount_money": {
26
+ "amount": null,
27
+ "currency": null
28
  },
29
+ "receivable_id": null
30
  }
31
  ```
32
 
vendor/square/square/doc/models/address.md CHANGED
@@ -1,34 +1,8 @@
1
 
2
  # Address
3
 
4
- Represents a postal address in a country. The address format is based
5
- on an [open-source library from Google](https://github.com/google/libaddressinput). For more information,
6
- see [AddressValidationMetadata](https://github.com/google/libaddressinput/wiki/AddressValidationMetadata).
7
- This format has dedicated fields for four address components: postal code,
8
- locality (city), administrative district (state, prefecture, or province), and
9
- sublocality (town or village). These components have dedicated fields in the
10
- `Address` object because software sometimes behaves differently based on them.
11
- For example, sales tax software may charge different amounts of sales tax
12
- based on the postal code, and some software is only available in
13
- certain states due to compliance reasons.
14
-
15
- For the remaining address components, the `Address` type provides the
16
- `address_line_1` and `address_line_2` fields for free-form data entry.
17
- These fields are free-form because the remaining address components have
18
- too many variations around the world and typical software does not parse
19
- these components. These fields enable users to enter anything they want.
20
-
21
- Note that, in the current implementation, all other `Address` type fields are blank.
22
- These include `address_line_3`, `sublocality_2`, `sublocality_3`,
23
- `administrative_district_level_2`, `administrative_district_level_3`,
24
- `first_name`, `last_name`, and `organization`.
25
-
26
- When it comes to localization, the seller's language preferences
27
- (see [Language preferences](https://developer.squareup.com/docs/locations-api#location-specific-and-seller-level-language-preferences))
28
- are ignored for addresses. Even though Square products (such as Square Point of Sale
29
- and the Seller Dashboard) mostly use a seller's language preference in
30
- communication, when it comes to addresses, they will use English for a US address,
31
- Japanese for an address in Japan, and so on.
32
 
33
  ## Structure
34
 
@@ -41,28 +15,24 @@ Japanese for an address in Japan, and so on.
41
  | `addressLine1` | `?string` | Optional | The first line of the address.<br><br>Fields that start with `address_line` provide the address's most specific<br>details, like street number, street name, and building name. They do *not*<br>provide less specific details like city, state/province, or country (these<br>details are provided in other fields). | getAddressLine1(): ?string | setAddressLine1(?string addressLine1): void |
42
  | `addressLine2` | `?string` | Optional | The second line of the address, if any. | getAddressLine2(): ?string | setAddressLine2(?string addressLine2): void |
43
  | `addressLine3` | `?string` | Optional | The third line of the address, if any. | getAddressLine3(): ?string | setAddressLine3(?string addressLine3): void |
44
- | `locality` | `?string` | Optional | The city or town of the address. | getLocality(): ?string | setLocality(?string locality): void |
45
  | `sublocality` | `?string` | Optional | A civil region within the address's `locality`, if any. | getSublocality(): ?string | setSublocality(?string sublocality): void |
46
- | `sublocality2` | `?string` | Optional | A civil region within the address's `sublocality`, if any. | getSublocality2(): ?string | setSublocality2(?string sublocality2): void |
47
- | `sublocality3` | `?string` | Optional | A civil region within the address's `sublocality_2`, if any. | getSublocality3(): ?string | setSublocality3(?string sublocality3): void |
48
- | `administrativeDistrictLevel1` | `?string` | Optional | A civil entity within the address's country. In the US, this<br>is the state. | getAdministrativeDistrictLevel1(): ?string | setAdministrativeDistrictLevel1(?string administrativeDistrictLevel1): void |
49
- | `administrativeDistrictLevel2` | `?string` | Optional | A civil entity within the address's `administrative_district_level_1`.<br>In the US, this is the county. | getAdministrativeDistrictLevel2(): ?string | setAdministrativeDistrictLevel2(?string administrativeDistrictLevel2): void |
50
- | `administrativeDistrictLevel3` | `?string` | Optional | A civil entity within the address's `administrative_district_level_2`,<br>if any. | getAdministrativeDistrictLevel3(): ?string | setAdministrativeDistrictLevel3(?string administrativeDistrictLevel3): void |
51
- | `postalCode` | `?string` | Optional | The address's postal code. | getPostalCode(): ?string | setPostalCode(?string postalCode): void |
52
- | `country` | [`?string (Country)`](/doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.<br>Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | getCountry(): ?string | setCountry(?string country): void |
53
- | `firstName` | `?string` | Optional | Optional first name when it's representing recipient. | getFirstName(): ?string | setFirstName(?string firstName): void |
54
- | `lastName` | `?string` | Optional | Optional last name when it's representing recipient. | getLastName(): ?string | setLastName(?string lastName): void |
55
- | `organization` | `?string` | Optional | Optional organization name when it's representing recipient. | getOrganization(): ?string | setOrganization(?string organization): void |
56
 
57
  ## Example (as JSON)
58
 
59
  ```json
60
  {
61
- "address_line_1": "address_line_10",
62
- "address_line_2": "address_line_20",
63
- "address_line_3": "address_line_36",
64
- "locality": "locality0",
65
- "sublocality": "sublocality0"
 
 
 
66
  }
67
  ```
68
 
1
 
2
  # Address
3
 
4
+ Represents a postal address in a country.
5
+ For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  ## Structure
8
 
15
  | `addressLine1` | `?string` | Optional | The first line of the address.<br><br>Fields that start with `address_line` provide the address's most specific<br>details, like street number, street name, and building name. They do *not*<br>provide less specific details like city, state/province, or country (these<br>details are provided in other fields). | getAddressLine1(): ?string | setAddressLine1(?string addressLine1): void |
16
  | `addressLine2` | `?string` | Optional | The second line of the address, if any. | getAddressLine2(): ?string | setAddressLine2(?string addressLine2): void |
17
  | `addressLine3` | `?string` | Optional | The third line of the address, if any. | getAddressLine3(): ?string | setAddressLine3(?string addressLine3): void |
18
+ | `locality` | `?string` | Optional | The city or town of the address. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | getLocality(): ?string | setLocality(?string locality): void |
19
  | `sublocality` | `?string` | Optional | A civil region within the address's `locality`, if any. | getSublocality(): ?string | setSublocality(?string sublocality): void |
20
+ | `administrativeDistrictLevel1` | `?string` | Optional | A civil entity within the address's country. In the US, this<br>is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | getAdministrativeDistrictLevel1(): ?string | setAdministrativeDistrictLevel1(?string administrativeDistrictLevel1): void |
21
+ | `postalCode` | `?string` | Optional | The address's postal code. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). | getPostalCode(): ?string | setPostalCode(?string postalCode): void |
22
+ | `country` | [`?string (Country)`](../../doc/models/country.md) | Optional | Indicates the country associated with another entity, such as a business.<br>Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | getCountry(): ?string | setCountry(?string country): void |
 
 
 
 
 
 
 
23
 
24
  ## Example (as JSON)
25
 
26
  ```json
27
  {
28
+ "address_line_1": null,
29
+ "address_line_2": null,
30
+ "address_line_3": null,
31
+ "locality": null,
32
+ "sublocality": null,
33
+ "administrative_district_level_1": null,
34
+ "postal_code": null,
35
+ "country": null
36
  }
37
  ```
38
 
vendor/square/square/doc/models/adjust-loyalty-points-request.md CHANGED
@@ -12,7 +12,7 @@ A request to adjust (add or subtract) points manually.
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
  | `idempotencyKey` | `string` | Required | A unique string that identifies this `AdjustLoyaltyPoints` request.<br>Keys can be any valid string, but must be unique for every request.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
15
- | `adjustPoints` | [`LoyaltyEventAdjustPoints`](/doc/models/loyalty-event-adjust-points.md) | Required | Provides metadata when the event `type` is `ADJUST_POINTS`. | getAdjustPoints(): LoyaltyEventAdjustPoints | setAdjustPoints(LoyaltyEventAdjustPoints adjustPoints): void |
16
 
17
  ## Example (as JSON)
18
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
  | `idempotencyKey` | `string` | Required | A unique string that identifies this `AdjustLoyaltyPoints` request.<br>Keys can be any valid string, but must be unique for every request.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
15
+ | `adjustPoints` | [`LoyaltyEventAdjustPoints`](../../doc/models/loyalty-event-adjust-points.md) | Required | Provides metadata when the event `type` is `ADJUST_POINTS`. | getAdjustPoints(): LoyaltyEventAdjustPoints | setAdjustPoints(LoyaltyEventAdjustPoints adjustPoints): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/adjust-loyalty-points-response.md CHANGED
@@ -12,8 +12,8 @@ resulted from the successful API call.
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
- | `event` | [`?LoyaltyEvent`](/doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.<br>For more information, see [Loyalty events](https://developer.squareup.com/docs/loyalty-api/overview/#loyalty-events). | getEvent(): ?LoyaltyEvent | setEvent(?LoyaltyEvent event): void |
17
 
18
  ## Example (as JSON)
19
 
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
+ | `event` | [`?LoyaltyEvent`](../../doc/models/loyalty-event.md) | Optional | Provides information about a loyalty event.<br>For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). | getEvent(): ?LoyaltyEvent | setEvent(?LoyaltyEvent event): void |
17
 
18
  ## Example (as JSON)
19
 
vendor/square/square/doc/models/afterpay-details.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Afterpay Details
3
+
4
+ Additional details about Afterpay payments.
5
+
6
+ ## Structure
7
+
8
+ `AfterpayDetails`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `emailAddress` | `?string` | Optional | Email address on the buyer's Afterpay account.<br>**Constraints**: *Maximum Length*: `255` | getEmailAddress(): ?string | setEmailAddress(?string emailAddress): void |
15
+
16
+ ## Example (as JSON)
17
+
18
+ ```json
19
+ {
20
+ "email_address": null
21
+ }
22
+ ```
23
+
vendor/square/square/doc/models/application-details.md CHANGED
@@ -11,15 +11,15 @@ Details about the application that took the payment.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `squareProduct` | [`?string (ApplicationDetailsExternalSquareProduct)`](/doc/models/application-details-external-square-product.md) | Optional | A list of products to return to external callers. | getSquareProduct(): ?string | setSquareProduct(?string squareProduct): void |
15
  | `applicationId` | `?string` | Optional | The Square ID assigned to the application used to take the payment.<br>Application developers can use this information to identify payments that<br>their application processed.<br>For example, if a developer uses a custom application to process payments,<br>this field contains the application ID from the Developer Dashboard.<br>If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)<br>application to process payments, the field contains the corresponding application ID. | getApplicationId(): ?string | setApplicationId(?string applicationId): void |
16
 
17
  ## Example (as JSON)
18
 
19
  ```json
20
  {
21
- "square_product": "TERMINAL_API",
22
- "application_id": "application_id4"
23
  }
24
  ```
25
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `squareProduct` | [`?string (ApplicationDetailsExternalSquareProduct)`](../../doc/models/application-details-external-square-product.md) | Optional | A list of products to return to external callers. | getSquareProduct(): ?string | setSquareProduct(?string squareProduct): void |
15
  | `applicationId` | `?string` | Optional | The Square ID assigned to the application used to take the payment.<br>Application developers can use this information to identify payments that<br>their application processed.<br>For example, if a developer uses a custom application to process payments,<br>this field contains the application ID from the Developer Dashboard.<br>If a seller uses a [Square App Marketplace](https://developer.squareup.com/docs/app-marketplace)<br>application to process payments, the field contains the corresponding application ID. | getApplicationId(): ?string | setApplicationId(?string applicationId): void |
16
 
17
  ## Example (as JSON)
18
 
19
  ```json
20
  {
21
+ "square_product": null,
22
+ "application_id": null
23
  }
24
  ```
25
 
vendor/square/square/doc/models/appointment-segment.md CHANGED
@@ -11,19 +11,25 @@ Defines an appointment segment of a booking.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `durationMinutes` | `int` | Required | The time span in minutes of an appointment segment.<br>**Constraints**: `<= 1500` | getDurationMinutes(): int | setDurationMinutes(int durationMinutes): void |
15
- | `serviceVariationId` | `string` | Required | The ID of the [CatalogItemVariation](/doc/models/catalog-item-variation.md) object representing the service booked in this segment.<br>**Constraints**: *Minimum Length*: `1` | getServiceVariationId(): string | setServiceVariationId(string serviceVariationId): void |
16
- | `teamMemberId` | `string` | Required | The ID of the [TeamMember](/doc/models/team-member.md) object representing the team member booked in this segment.<br>**Constraints**: *Minimum Length*: `1` | getTeamMemberId(): string | setTeamMemberId(string teamMemberId): void |
17
  | `serviceVariationVersion` | `int` | Required | The current version of the item variation representing the service booked in this segment. | getServiceVariationVersion(): int | setServiceVariationVersion(int serviceVariationVersion): void |
 
 
 
18
 
19
  ## Example (as JSON)
20
 
21
  ```json
22
  {
23
- "duration_minutes": 144,
24
  "service_variation_id": "service_variation_id6",
25
  "team_member_id": "team_member_id0",
26
- "service_variation_version": 56
 
 
 
27
  }
28
  ```
29
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `durationMinutes` | `?int` | Optional | The time span in minutes of an appointment segment.<br>**Constraints**: `<= 1500` | getDurationMinutes(): ?int | setDurationMinutes(?int durationMinutes): void |
15
+ | `serviceVariationId` | `string` | Required | The ID of the [CatalogItemVariation](../../doc/models/catalog-item-variation.md) object representing the service booked in this segment.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `36` | getServiceVariationId(): string | setServiceVariationId(string serviceVariationId): void |
16
+ | `teamMemberId` | `string` | Required | The ID of the [TeamMember](../../doc/models/team-member.md) object representing the team member booked in this segment.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `32` | getTeamMemberId(): string | setTeamMemberId(string teamMemberId): void |
17
  | `serviceVariationVersion` | `int` | Required | The current version of the item variation representing the service booked in this segment. | getServiceVariationVersion(): int | setServiceVariationVersion(int serviceVariationVersion): void |
18
+ | `intermissionMinutes` | `?int` | Optional | Time between the end of this segment and the beginning of the subsequent segment. | getIntermissionMinutes(): ?int | setIntermissionMinutes(?int intermissionMinutes): void |
19
+ | `anyTeamMember` | `?bool` | Optional | Whether the customer accepts any team member, instead of a specific one, to serve this segment. | getAnyTeamMember(): ?bool | setAnyTeamMember(?bool anyTeamMember): void |
20
+ | `resourceIds` | `?(string[])` | Optional | The IDs of the seller-accessible resources used for this appointment segment. | getResourceIds(): ?array | setResourceIds(?array resourceIds): void |
21
 
22
  ## Example (as JSON)
23
 
24
  ```json
25
  {
26
+ "duration_minutes": null,
27
  "service_variation_id": "service_variation_id6",
28
  "team_member_id": "team_member_id0",
29
+ "service_variation_version": 56,
30
+ "intermission_minutes": null,
31
+ "any_team_member": null,
32
+ "resource_ids": null
33
  }
34
  ```
35
 
vendor/square/square/doc/models/availability.md CHANGED
@@ -1,7 +1,7 @@
1
 
2
  # Availability
3
 
4
- Describes a slot available for booking, encapsulating appointment segments, the location and starting time.
5
 
6
  ## Structure
7
 
@@ -12,23 +12,16 @@ Describes a slot available for booking, encapsulating appointment segments, the
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
  | `startAt` | `?string` | Optional | The RFC 3339 timestamp specifying the beginning time of the slot available for booking. | getStartAt(): ?string | setStartAt(?string startAt): void |
15
- | `locationId` | `?string` | Optional | The ID of the location available for booking. | getLocationId(): ?string | setLocationId(?string locationId): void |
16
- | `appointmentSegments` | [`?(AppointmentSegment[])`](/doc/models/appointment-segment.md) | Optional | The list of appointment segments available for booking | getAppointmentSegments(): ?array | setAppointmentSegments(?array appointmentSegments): void |
17
 
18
  ## Example (as JSON)
19
 
20
  ```json
21
  {
22
- "start_at": "start_at2",
23
- "location_id": "location_id4",
24
- "appointment_segments": [
25
- {
26
- "duration_minutes": 4,
27
- "service_variation_id": "service_variation_id4",
28
- "team_member_id": "team_member_id0",
29
- "service_variation_version": 172
30
- }
31
- ]
32
  }
33
  ```
34
 
1
 
2
  # Availability
3
 
4
+ Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking.
5
 
6
  ## Structure
7
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
  | `startAt` | `?string` | Optional | The RFC 3339 timestamp specifying the beginning time of the slot available for booking. | getStartAt(): ?string | setStartAt(?string startAt): void |
15
+ | `locationId` | `?string` | Optional | The ID of the location available for booking.<br>**Constraints**: *Maximum Length*: `32` | getLocationId(): ?string | setLocationId(?string locationId): void |
16
+ | `appointmentSegments` | [`?(AppointmentSegment[])`](../../doc/models/appointment-segment.md) | Optional | The list of appointment segments available for booking | getAppointmentSegments(): ?array | setAppointmentSegments(?array appointmentSegments): void |
17
 
18
  ## Example (as JSON)
19
 
20
  ```json
21
  {
22
+ "start_at": null,
23
+ "location_id": null,
24
+ "appointment_segments": null
 
 
 
 
 
 
 
25
  }
26
  ```
27
 
vendor/square/square/doc/models/bank-account-payment-details.md CHANGED
@@ -17,18 +17,21 @@ Additional details about BANK_ACCOUNT type payments.
17
  | `fingerprint` | `?string` | Optional | Uniquely identifies the bank account for this seller and can be used<br>to determine if payments are from the same bank account.<br>**Constraints**: *Maximum Length*: `255` | getFingerprint(): ?string | setFingerprint(?string fingerprint): void |
18
  | `country` | `?string` | Optional | The two-letter ISO code representing the country the bank account is located in.<br>**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `2` | getCountry(): ?string | setCountry(?string country): void |
19
  | `statementDescription` | `?string` | Optional | The statement description as sent to the bank.<br>**Constraints**: *Maximum Length*: `1000` | getStatementDescription(): ?string | setStatementDescription(?string statementDescription): void |
20
- | `achDetails` | [`?ACHDetails`](/doc/models/ach-details.md) | Optional | ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. | getAchDetails(): ?ACHDetails | setAchDetails(?ACHDetails achDetails): void |
21
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void |
22
 
23
  ## Example (as JSON)
24
 
25
  ```json
26
  {
27
- "bank_name": "bank_name4",
28
- "transfer_type": "transfer_type8",
29
- "account_ownership_type": "account_ownership_type8",
30
- "fingerprint": "fingerprint6",
31
- "country": "country4"
 
 
 
32
  }
33
  ```
34
 
17
  | `fingerprint` | `?string` | Optional | Uniquely identifies the bank account for this seller and can be used<br>to determine if payments are from the same bank account.<br>**Constraints**: *Maximum Length*: `255` | getFingerprint(): ?string | setFingerprint(?string fingerprint): void |
18
  | `country` | `?string` | Optional | The two-letter ISO code representing the country the bank account is located in.<br>**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `2` | getCountry(): ?string | setCountry(?string country): void |
19
  | `statementDescription` | `?string` | Optional | The statement description as sent to the bank.<br>**Constraints**: *Maximum Length*: `1000` | getStatementDescription(): ?string | setStatementDescription(?string statementDescription): void |
20
+ | `achDetails` | [`?ACHDetails`](../../doc/models/ach-details.md) | Optional | ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. | getAchDetails(): ?ACHDetails | setAchDetails(?ACHDetails achDetails): void |
21
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Information about errors encountered during the request. | getErrors(): ?array | setErrors(?array errors): void |
22
 
23
  ## Example (as JSON)
24
 
25
  ```json
26
  {
27
+ "bank_name": null,
28
+ "transfer_type": null,
29
+ "account_ownership_type": null,
30
+ "fingerprint": null,
31
+ "country": null,
32
+ "statement_description": null,
33
+ "ach_details": null,
34
+ "errors": null
35
  }
36
  ```
37
 
vendor/square/square/doc/models/bank-account.md CHANGED
@@ -15,16 +15,16 @@ linking a bank account to a Square account, see
15
  | --- | --- | --- | --- | --- | --- |
16
  | `id` | `string` | Required | The unique, Square-issued identifier for the bank account.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` | getId(): string | setId(string id): void |
17
  | `accountNumberSuffix` | `string` | Required | The last few digits of the account number.<br>**Constraints**: *Minimum Length*: `1` | getAccountNumberSuffix(): string | setAccountNumberSuffix(string accountNumberSuffix): void |
18
- | `country` | [`string (Country)`](/doc/models/country.md) | Required | Indicates the country associated with another entity, such as a business.<br>Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | getCountry(): string | setCountry(string country): void |
19
- | `currency` | [`string (Currency)`](/doc/models/currency.md) | Required | Indicates the associated currency for an amount of money. Values correspond<br>to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | getCurrency(): string | setCurrency(string currency): void |
20
- | `accountType` | [`string (BankAccountType)`](/doc/models/bank-account-type.md) | Required | Indicates the financial purpose of the bank account. | getAccountType(): string | setAccountType(string accountType): void |
21
  | `holderName` | `string` | Required | Name of the account holder. This name must match the name<br>on the targeted bank account record.<br>**Constraints**: *Minimum Length*: `1` | getHolderName(): string | setHolderName(string holderName): void |
22
  | `primaryBankIdentificationNumber` | `string` | Required | Primary identifier for the bank. For more information, see<br>[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).<br>**Constraints**: *Maximum Length*: `40` | getPrimaryBankIdentificationNumber(): string | setPrimaryBankIdentificationNumber(string primaryBankIdentificationNumber): void |
23
  | `secondaryBankIdentificationNumber` | `?string` | Optional | Secondary identifier for the bank. For more information, see<br>[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).<br>**Constraints**: *Maximum Length*: `40` | getSecondaryBankIdentificationNumber(): ?string | setSecondaryBankIdentificationNumber(?string secondaryBankIdentificationNumber): void |
24
  | `debitMandateReferenceId` | `?string` | Optional | Reference identifier that will be displayed to UK bank account owners<br>when collecting direct debit authorization. Only required for UK bank accounts. | getDebitMandateReferenceId(): ?string | setDebitMandateReferenceId(?string debitMandateReferenceId): void |
25
  | `referenceId` | `?string` | Optional | Client-provided identifier for linking the banking account to an entity<br>in a third-party system (for example, a bank account number or a user identifier). | getReferenceId(): ?string | setReferenceId(?string referenceId): void |
26
  | `locationId` | `?string` | Optional | The location to which the bank account belongs. | getLocationId(): ?string | setLocationId(?string locationId): void |
27
- | `status` | [`string (BankAccountStatus)`](/doc/models/bank-account-status.md) | Required | Indicates the current verification status of a `BankAccount` object. | getStatus(): string | setStatus(string status): void |
28
  | `creditable` | `bool` | Required | Indicates whether it is possible for Square to send money to this bank account. | getCreditable(): bool | setCreditable(bool creditable): void |
29
  | `debitable` | `bool` | Required | Indicates whether it is possible for Square to take money from this<br>bank account. | getDebitable(): bool | setDebitable(bool debitable): void |
30
  | `fingerprint` | `?string` | Optional | A Square-assigned, unique identifier for the bank account based on the<br>account information. The account fingerprint can be used to compare account<br>entries and determine if the they represent the same real-world bank account. | getFingerprint(): ?string | setFingerprint(?string fingerprint): void |
@@ -42,14 +42,16 @@ linking a bank account to a Square account, see
42
  "account_type": "BUSINESS_CHECKING",
43
  "holder_name": "holder_name4",
44
  "primary_bank_identification_number": "primary_bank_identification_number8",
45
- "secondary_bank_identification_number": "secondary_bank_identification_number0",
46
- "debit_mandate_reference_id": "debit_mandate_reference_id4",
47
- "reference_id": "reference_id2",
48
- "location_id": "location_id4",
49
  "status": "DISABLED",
50
  "creditable": false,
51
  "debitable": false,
52
- "fingerprint": "fingerprint6"
 
 
53
  }
54
  ```
55
 
15
  | --- | --- | --- | --- | --- | --- |
16
  | `id` | `string` | Required | The unique, Square-issued identifier for the bank account.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `30` | getId(): string | setId(string id): void |
17
  | `accountNumberSuffix` | `string` | Required | The last few digits of the account number.<br>**Constraints**: *Minimum Length*: `1` | getAccountNumberSuffix(): string | setAccountNumberSuffix(string accountNumberSuffix): void |
18
+ | `country` | [`string (Country)`](../../doc/models/country.md) | Required | Indicates the country associated with another entity, such as a business.<br>Values are in [ISO 3166-1-alpha-2 format](http://www.iso.org/iso/home/standards/country_codes.htm). | getCountry(): string | setCountry(string country): void |
19
+ | `currency` | [`string (Currency)`](../../doc/models/currency.md) | Required | Indicates the associated currency for an amount of money. Values correspond<br>to [ISO 4217](https://wikipedia.org/wiki/ISO_4217). | getCurrency(): string | setCurrency(string currency): void |
20
+ | `accountType` | [`string (BankAccountType)`](../../doc/models/bank-account-type.md) | Required | Indicates the financial purpose of the bank account. | getAccountType(): string | setAccountType(string accountType): void |
21
  | `holderName` | `string` | Required | Name of the account holder. This name must match the name<br>on the targeted bank account record.<br>**Constraints**: *Minimum Length*: `1` | getHolderName(): string | setHolderName(string holderName): void |
22
  | `primaryBankIdentificationNumber` | `string` | Required | Primary identifier for the bank. For more information, see<br>[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).<br>**Constraints**: *Maximum Length*: `40` | getPrimaryBankIdentificationNumber(): string | setPrimaryBankIdentificationNumber(string primaryBankIdentificationNumber): void |
23
  | `secondaryBankIdentificationNumber` | `?string` | Optional | Secondary identifier for the bank. For more information, see<br>[Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api).<br>**Constraints**: *Maximum Length*: `40` | getSecondaryBankIdentificationNumber(): ?string | setSecondaryBankIdentificationNumber(?string secondaryBankIdentificationNumber): void |
24
  | `debitMandateReferenceId` | `?string` | Optional | Reference identifier that will be displayed to UK bank account owners<br>when collecting direct debit authorization. Only required for UK bank accounts. | getDebitMandateReferenceId(): ?string | setDebitMandateReferenceId(?string debitMandateReferenceId): void |
25
  | `referenceId` | `?string` | Optional | Client-provided identifier for linking the banking account to an entity<br>in a third-party system (for example, a bank account number or a user identifier). | getReferenceId(): ?string | setReferenceId(?string referenceId): void |
26
  | `locationId` | `?string` | Optional | The location to which the bank account belongs. | getLocationId(): ?string | setLocationId(?string locationId): void |
27
+ | `status` | [`string (BankAccountStatus)`](../../doc/models/bank-account-status.md) | Required | Indicates the current verification status of a `BankAccount` object. | getStatus(): string | setStatus(string status): void |
28
  | `creditable` | `bool` | Required | Indicates whether it is possible for Square to send money to this bank account. | getCreditable(): bool | setCreditable(bool creditable): void |
29
  | `debitable` | `bool` | Required | Indicates whether it is possible for Square to take money from this<br>bank account. | getDebitable(): bool | setDebitable(bool debitable): void |
30
  | `fingerprint` | `?string` | Optional | A Square-assigned, unique identifier for the bank account based on the<br>account information. The account fingerprint can be used to compare account<br>entries and determine if the they represent the same real-world bank account. | getFingerprint(): ?string | setFingerprint(?string fingerprint): void |
42
  "account_type": "BUSINESS_CHECKING",
43
  "holder_name": "holder_name4",
44
  "primary_bank_identification_number": "primary_bank_identification_number8",
45
+ "secondary_bank_identification_number": null,
46
+ "debit_mandate_reference_id": null,
47
+ "reference_id": null,
48
+ "location_id": null,
49
  "status": "DISABLED",
50
  "creditable": false,
51
  "debitable": false,
52
+ "fingerprint": null,
53
+ "version": null,
54
+ "bank_name": null
55
  }
56
  ```
57
 
vendor/square/square/doc/models/batch-change-inventory-request.md CHANGED
@@ -10,7 +10,7 @@
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `idempotencyKey` | `string` | Required | A client-supplied, universally unique identifier (UUID) for the<br>request.<br><br>See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) in the<br>[API Development 101](https://developer.squareup.com/docs/basics/api101/overview) section for more<br>information.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
13
- | `changes` | [`?(InventoryChange[])`](/doc/models/inventory-change.md) | Optional | The set of physical counts and inventory adjustments to be made.<br>Changes are applied based on the client-supplied timestamp and may be sent<br>out of order. | getChanges(): ?array | setChanges(?array changes): void |
14
  | `ignoreUnchangedCounts` | `?bool` | Optional | Indicates whether the current physical count should be ignored if<br>the quantity is unchanged since the last physical count. Default: `true`. | getIgnoreUnchangedCounts(): ?bool | setIgnoreUnchangedCounts(?bool ignoreUnchangedCounts): void |
15
 
16
  ## Example (as JSON)
@@ -21,12 +21,12 @@
21
  {
22
  "physical_count": {
23
  "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
24
- "employee_id": "LRK57NSQ5X7PUD05",
25
  "location_id": "C6W5YS5QM06F5",
26
  "occurred_at": "2016-11-16T22:25:24.878Z",
27
  "quantity": "53",
28
  "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
29
- "state": "IN_STOCK"
 
30
  },
31
  "type": "PHYSICAL_COUNT"
32
  }
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `idempotencyKey` | `string` | Required | A client-supplied, universally unique identifier (UUID) for the<br>request.<br><br>See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) in the<br>[API Development 101](https://developer.squareup.com/docs/basics/api101/overview) section for more<br>information.<br>**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `128` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
13
+ | `changes` | [`?(InventoryChange[])`](../../doc/models/inventory-change.md) | Optional | The set of physical counts and inventory adjustments to be made.<br>Changes are applied based on the client-supplied timestamp and may be sent<br>out of order. | getChanges(): ?array | setChanges(?array changes): void |
14
  | `ignoreUnchangedCounts` | `?bool` | Optional | Indicates whether the current physical count should be ignored if<br>the quantity is unchanged since the last physical count. Default: `true`. | getIgnoreUnchangedCounts(): ?bool | setIgnoreUnchangedCounts(?bool ignoreUnchangedCounts): void |
15
 
16
  ## Example (as JSON)
21
  {
22
  "physical_count": {
23
  "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
 
24
  "location_id": "C6W5YS5QM06F5",
25
  "occurred_at": "2016-11-16T22:25:24.878Z",
26
  "quantity": "53",
27
  "reference_id": "1536bfbf-efed-48bf-b17d-a197141b2a92",
28
+ "state": "IN_STOCK",
29
+ "team_member_id": "LRK57NSQ5X7PUD05"
30
  },
31
  "type": "PHYSICAL_COUNT"
32
  }
vendor/square/square/doc/models/batch-change-inventory-response.md CHANGED
@@ -9,9 +9,9 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
- | `counts` | [`?(InventoryCount[])`](/doc/models/inventory-count.md) | Optional | The current counts for all objects referenced in the request. | getCounts(): ?array | setCounts(?array counts): void |
14
- | `changes` | [`?(InventoryChange[])`](/doc/models/inventory-change.md) | Optional | Changes created for the request. | getChanges(): ?array | setChanges(?array changes): void |
15
 
16
  ## Example (as JSON)
17
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
+ | `counts` | [`?(InventoryCount[])`](../../doc/models/inventory-count.md) | Optional | The current counts for all objects referenced in the request. | getCounts(): ?array | setCounts(?array counts): void |
14
+ | `changes` | [`?(InventoryChange[])`](../../doc/models/inventory-change.md) | Optional | Changes created for the request. | getChanges(): ?array | setChanges(?array changes): void |
15
 
16
  ## Example (as JSON)
17
 
vendor/square/square/doc/models/batch-delete-catalog-objects-response.md CHANGED
@@ -9,7 +9,7 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
  | `deletedObjectIds` | `?(string[])` | Optional | The IDs of all CatalogObjects deleted by this request. | getDeletedObjectIds(): ?array | setDeletedObjectIds(?array deletedObjectIds): void |
14
  | `deletedAt` | `?string` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | getDeletedAt(): ?string | setDeletedAt(?string deletedAt): void |
15
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
  | `deletedObjectIds` | `?(string[])` | Optional | The IDs of all CatalogObjects deleted by this request. | getDeletedObjectIds(): ?array | setDeletedObjectIds(?array deletedObjectIds): void |
14
  | `deletedAt` | `?string` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this deletion in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | getDeletedAt(): ?string | setDeletedAt(?string deletedAt): void |
15
 
vendor/square/square/doc/models/batch-retrieve-catalog-objects-request.md CHANGED
@@ -10,8 +10,9 @@
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `objectIds` | `string[]` | Required | The IDs of the CatalogObjects to be retrieved. | getObjectIds(): array | setObjectIds(array objectIds): void |
13
- | `includeRelatedObjects` | `?bool` | Optional | If `true`, the response will include additional objects that are related to the<br>requested objects, as follows:<br><br>If the `objects` field of the response contains a CatalogItem, its associated<br>CatalogCategory objects, CatalogTax objects, CatalogImage objects and<br>CatalogModifierLists will be returned in the `related_objects` field of the<br>response. If the `objects` field of the response contains a CatalogItemVariation,<br>its parent CatalogItem will be returned in the `related_objects` field of<br>the response. | getIncludeRelatedObjects(): ?bool | setIncludeRelatedObjects(?bool includeRelatedObjects): void |
14
- | `catalogVersion` | `?int` | Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical versions of objects. The specified version value is matched against<br>the [CatalogObject](/doc/models/catalog-object.md)s' `version` attribute. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void |
 
15
 
16
  ## Example (as JSON)
17
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `objectIds` | `string[]` | Required | The IDs of the CatalogObjects to be retrieved. | getObjectIds(): array | setObjectIds(array objectIds): void |
13
+ | `includeRelatedObjects` | `?bool` | Optional | If `true`, the response will include additional objects that are related to the<br>requested objects. Related objects are defined as any objects referenced by ID by the results in the `objects` field<br>of the response. These objects are put in the `related_objects` field. Setting this to `true` is<br>helpful when the objects are needed for immediate display to a user.<br>This process only goes one level deep. Objects referenced by the related objects will not be included. For example,<br><br>if the `objects` field of the response contains a CatalogItem, its associated<br>CatalogCategory objects, CatalogTax objects, CatalogImage objects and<br>CatalogModifierLists will be returned in the `related_objects` field of the<br>response. If the `objects` field of the response contains a CatalogItemVariation,<br>its parent CatalogItem will be returned in the `related_objects` field of<br>the response.<br><br>Default value: `false` | getIncludeRelatedObjects(): ?bool | setIncludeRelatedObjects(?bool includeRelatedObjects): void |
14
+ | `catalogVersion` | `?int` | Optional | The specific version of the catalog objects to be included in the response.<br>This allows you to retrieve historical versions of objects. The specified version value is matched against<br>the [CatalogObject](../../doc/models/catalog-object.md)s' `version` attribute. If not included, results will<br>be from the current version of the catalog. | getCatalogVersion(): ?int | setCatalogVersion(?int catalogVersion): void |
15
+ | `includeDeletedObjects` | `?bool` | Optional | Indicates whether to include (`true`) or not (`false`) in the response deleted objects, namely, those with the `is_deleted` attribute set to `true`. | getIncludeDeletedObjects(): ?bool | setIncludeDeletedObjects(?bool includeDeletedObjects): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/batch-retrieve-catalog-objects-response.md CHANGED
@@ -9,9 +9,9 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
- | `objects` | [`?(CatalogObject[])`](/doc/models/catalog-object.md) | Optional | A list of [CatalogObject](/doc/models/catalog-object.md)s returned. | getObjects(): ?array | setObjects(?array objects): void |
14
- | `relatedObjects` | [`?(CatalogObject[])`](/doc/models/catalog-object.md) | Optional | A list of [CatalogObject](/doc/models/catalog-object.md)s referenced by the object in the `objects` field. | getRelatedObjects(): ?array | setRelatedObjects(?array relatedObjects): void |
15
 
16
  ## Example (as JSON)
17
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
+ | `objects` | [`?(CatalogObject[])`](../../doc/models/catalog-object.md) | Optional | A list of [CatalogObject](../../doc/models/catalog-object.md)s returned. | getObjects(): ?array | setObjects(?array objects): void |
14
+ | `relatedObjects` | [`?(CatalogObject[])`](../../doc/models/catalog-object.md) | Optional | A list of [CatalogObject](../../doc/models/catalog-object.md)s referenced by the object in the `objects` field. | getRelatedObjects(): ?array | setRelatedObjects(?array relatedObjects): void |
15
 
16
  ## Example (as JSON)
17
 
vendor/square/square/doc/models/batch-retrieve-inventory-changes-request.md CHANGED
@@ -11,8 +11,8 @@
11
  | --- | --- | --- | --- | --- | --- |
12
  | `catalogObjectIds` | `?(string[])` | Optional | The filter to return results by `CatalogObject` ID.<br>The filter is only applicable when set. The default value is null. | getCatalogObjectIds(): ?array | setCatalogObjectIds(?array catalogObjectIds): void |
13
  | `locationIds` | `?(string[])` | Optional | The filter to return results by `Location` ID.<br>The filter is only applicable when set. The default value is null. | getLocationIds(): ?array | setLocationIds(?array locationIds): void |
14
- | `types` | [`?(string[]) (InventoryChangeType)`](/doc/models/inventory-change-type.md) | Optional | The filter to return results by `InventoryChangeType` values other than `TRANSFER`.<br>The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. | getTypes(): ?array | setTypes(?array types): void |
15
- | `states` | [`?(string[]) (InventoryState)`](/doc/models/inventory-state.md) | Optional | The filter to return `ADJUSTMENT` query results by<br>`InventoryState`. This filter is only applied when set.<br>The default value is null. | getStates(): ?array | setStates(?array states): void |
16
  | `updatedAfter` | `?string` | Optional | The filter to return results with their `calculated_at` value <br>after the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedAfter(): ?string | setUpdatedAfter(?string updatedAfter): void |
17
  | `updatedBefore` | `?string` | Optional | The filter to return results with their `created_at` or `calculated_at` value <br>strictly before the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedBefore(): ?string | setUpdatedBefore(?string updatedBefore): void |
18
  | `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `catalogObjectIds` | `?(string[])` | Optional | The filter to return results by `CatalogObject` ID.<br>The filter is only applicable when set. The default value is null. | getCatalogObjectIds(): ?array | setCatalogObjectIds(?array catalogObjectIds): void |
13
  | `locationIds` | `?(string[])` | Optional | The filter to return results by `Location` ID.<br>The filter is only applicable when set. The default value is null. | getLocationIds(): ?array | setLocationIds(?array locationIds): void |
14
+ | `types` | [`?(string[]) (InventoryChangeType)`](../../doc/models/inventory-change-type.md) | Optional | The filter to return results by `InventoryChangeType` values other than `TRANSFER`.<br>The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`. | getTypes(): ?array | setTypes(?array types): void |
15
+ | `states` | [`?(string[]) (InventoryState)`](../../doc/models/inventory-state.md) | Optional | The filter to return `ADJUSTMENT` query results by<br>`InventoryState`. This filter is only applied when set.<br>The default value is null. | getStates(): ?array | setStates(?array states): void |
16
  | `updatedAfter` | `?string` | Optional | The filter to return results with their `calculated_at` value <br>after the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedAfter(): ?string | setUpdatedAfter(?string updatedAfter): void |
17
  | `updatedBefore` | `?string` | Optional | The filter to return results with their `created_at` or `calculated_at` value <br>strictly before the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedBefore(): ?string | setUpdatedBefore(?string updatedBefore): void |
18
  | `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
vendor/square/square/doc/models/batch-retrieve-inventory-changes-response.md CHANGED
@@ -9,8 +9,8 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
- | `changes` | [`?(InventoryChange[])`](/doc/models/inventory-change.md) | Optional | The current calculated inventory changes for the requested objects<br>and locations. | getChanges(): ?array | setChanges(?array changes): void |
14
  | `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,<br>this is the final response.<br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
15
 
16
  ## Example (as JSON)
@@ -23,7 +23,6 @@
23
  "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
24
  "catalog_object_type": "ITEM_VARIATION",
25
  "created_at": "2016-11-16T22:25:24.878Z",
26
- "employee_id": "LRK57NSQ5X7PUD05",
27
  "id": "46YDTW253DWGGK9HMAE6XCAO",
28
  "location_id": "C6W5YS5QM06F5",
29
  "occurred_at": "2016-11-16T22:24:49.028Z",
@@ -34,7 +33,8 @@
34
  "name": "Square Point of Sale 4.37",
35
  "product": "SQUARE_POS"
36
  },
37
- "state": "IN_STOCK"
 
38
  },
39
  "type": "PHYSICAL_COUNT"
40
  }
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
+ | `changes` | [`?(InventoryChange[])`](../../doc/models/inventory-change.md) | Optional | The current calculated inventory changes for the requested objects<br>and locations. | getChanges(): ?array | setChanges(?array changes): void |
14
  | `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,<br>this is the final response.<br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
15
 
16
  ## Example (as JSON)
23
  "catalog_object_id": "W62UWFY35CWMYGVWK6TWJDNI",
24
  "catalog_object_type": "ITEM_VARIATION",
25
  "created_at": "2016-11-16T22:25:24.878Z",
 
26
  "id": "46YDTW253DWGGK9HMAE6XCAO",
27
  "location_id": "C6W5YS5QM06F5",
28
  "occurred_at": "2016-11-16T22:24:49.028Z",
33
  "name": "Square Point of Sale 4.37",
34
  "product": "SQUARE_POS"
35
  },
36
+ "state": "IN_STOCK",
37
+ "team_member_id": "LRK57NSQ5X7PUD05"
38
  },
39
  "type": "PHYSICAL_COUNT"
40
  }
vendor/square/square/doc/models/batch-retrieve-inventory-counts-request.md CHANGED
@@ -13,7 +13,7 @@
13
  | `locationIds` | `?(string[])` | Optional | The filter to return results by `Location` ID.<br>This filter is applicable only when set. The default is null. | getLocationIds(): ?array | setLocationIds(?array locationIds): void |
14
  | `updatedAfter` | `?string` | Optional | The filter to return results with their `calculated_at` value<br>after the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedAfter(): ?string | setUpdatedAfter(?string updatedAfter): void |
15
  | `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
16
- | `states` | [`?(string[]) (InventoryState)`](/doc/models/inventory-state.md) | Optional | The filter to return results by `InventoryState`. The filter is only applicable when set.<br>Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.<br>The default is null. | getStates(): ?array | setStates(?array states): void |
17
 
18
  ## Example (as JSON)
19
 
13
  | `locationIds` | `?(string[])` | Optional | The filter to return results by `Location` ID.<br>This filter is applicable only when set. The default is null. | getLocationIds(): ?array | setLocationIds(?array locationIds): void |
14
  | `updatedAfter` | `?string` | Optional | The filter to return results with their `calculated_at` value<br>after the given time as specified in an RFC 3339 timestamp.<br>The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`). | getUpdatedAfter(): ?string | setUpdatedAfter(?string updatedAfter): void |
15
  | `cursor` | `?string` | Optional | A pagination cursor returned by a previous call to this endpoint.<br>Provide this to retrieve the next set of results for the original query.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
16
+ | `states` | [`?(string[]) (InventoryState)`](../../doc/models/inventory-state.md) | Optional | The filter to return results by `InventoryState`. The filter is only applicable when set.<br>Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.<br>The default is null. | getStates(): ?array | setStates(?array states): void |
17
 
18
  ## Example (as JSON)
19
 
vendor/square/square/doc/models/batch-retrieve-inventory-counts-response.md CHANGED
@@ -9,8 +9,8 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
- | `counts` | [`?(InventoryCount[])`](/doc/models/inventory-count.md) | Optional | The current calculated inventory counts for the requested objects<br>and locations. | getCounts(): ?array | setCounts(?array counts): void |
14
  | `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,<br>this is the final response.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
15
 
16
  ## Example (as JSON)
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
+ | `counts` | [`?(InventoryCount[])`](../../doc/models/inventory-count.md) | Optional | The current calculated inventory counts for the requested objects<br>and locations. | getCounts(): ?array | setCounts(?array counts): void |
14
  | `cursor` | `?string` | Optional | The pagination cursor to be used in a subsequent request. If unset,<br>this is the final response.<br><br>See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. | getCursor(): ?string | setCursor(?string cursor): void |
15
 
16
  ## Example (as JSON)
vendor/square/square/doc/models/batch-retrieve-orders-response.md CHANGED
@@ -12,8 +12,8 @@ a request to the `BatchRetrieveOrders` endpoint.
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `orders` | [`?(Order[])`](/doc/models/order.md) | Optional | The requested orders. This will omit any requested orders that do not exist. | getOrders(): ?array | setOrders(?array orders): void |
16
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
17
 
18
  ## Example (as JSON)
19
 
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `orders` | [`?(Order[])`](../../doc/models/order.md) | Optional | The requested orders. This will omit any requested orders that do not exist. | getOrders(): ?array | setOrders(?array orders): void |
16
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
17
 
18
  ## Example (as JSON)
19
 
vendor/square/square/doc/models/batch-upsert-catalog-objects-request.md CHANGED
@@ -10,7 +10,7 @@
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this<br>request among all your requests. A common way to create<br>a valid idempotency key is to use a Universally unique<br>identifier (UUID).<br><br>If you're unsure whether a particular request was successful,<br>you can reattempt it with the same idempotency key without<br>worrying about creating duplicate objects.<br><br>See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.<br>**Constraints**: *Minimum Length*: `1` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
13
- | `batches` | [`CatalogObjectBatch[]`](/doc/models/catalog-object-batch.md) | Required | A batch of CatalogObjects to be inserted/updated atomically.<br>The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs<br>attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error<br>in one batch will not affect other batches within the same request.<br><br>For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its<br>`is_deleted` field must not be set to `true`.<br><br>To modify an existing object, supply its ID. To create a new object, use an ID starting<br>with `#`. These IDs may be used to create relationships between an object and attributes of<br>other objects that reference it. For example, you can create a CatalogItem with<br>ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to<br>`#ABC` in order to associate the CatalogItemVariation with its parent<br>CatalogItem.<br><br>Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs.<br><br>Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request<br>may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will<br>be inserted or updated. | getBatches(): array | setBatches(array batches): void |
14
 
15
  ## Example (as JSON)
16
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
  | `idempotencyKey` | `string` | Required | A value you specify that uniquely identifies this<br>request among all your requests. A common way to create<br>a valid idempotency key is to use a Universally unique<br>identifier (UUID).<br><br>If you're unsure whether a particular request was successful,<br>you can reattempt it with the same idempotency key without<br>worrying about creating duplicate objects.<br><br>See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) for more information.<br>**Constraints**: *Minimum Length*: `1` | getIdempotencyKey(): string | setIdempotencyKey(string idempotencyKey): void |
13
+ | `batches` | [`CatalogObjectBatch[]`](../../doc/models/catalog-object-batch.md) | Required | A batch of CatalogObjects to be inserted/updated atomically.<br>The objects within a batch will be inserted in an all-or-nothing fashion, i.e., if an error occurs<br>attempting to insert or update an object within a batch, the entire batch will be rejected. However, an error<br>in one batch will not affect other batches within the same request.<br><br>For each object, its `updated_at` field is ignored and replaced with a current [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates), and its<br>`is_deleted` field must not be set to `true`.<br><br>To modify an existing object, supply its ID. To create a new object, use an ID starting<br>with `#`. These IDs may be used to create relationships between an object and attributes of<br>other objects that reference it. For example, you can create a CatalogItem with<br>ID `#ABC` and a CatalogItemVariation with its `item_id` attribute set to<br>`#ABC` in order to associate the CatalogItemVariation with its parent<br>CatalogItem.<br><br>Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by server-generated IDs.<br><br>Each batch may contain up to 1,000 objects. The total number of objects across all batches for a single request<br>may not exceed 10,000. If either of these limits is violated, an error will be returned and no objects will<br>be inserted or updated. | getBatches(): array | setBatches(array batches): void |
14
 
15
  ## Example (as JSON)
16
 
vendor/square/square/doc/models/batch-upsert-catalog-objects-response.md CHANGED
@@ -9,10 +9,10 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
- | `objects` | [`?(CatalogObject[])`](/doc/models/catalog-object.md) | Optional | The created successfully created CatalogObjects. | getObjects(): ?array | setObjects(?array objects): void |
14
  | `updatedAt` | `?string` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void |
15
- | `idMappings` | [`?(CatalogIdMapping[])`](/doc/models/catalog-id-mapping.md) | Optional | The mapping between client and server IDs for this upsert. | getIdMappings(): ?array | setIdMappings(?array idMappings): void |
16
 
17
  ## Example (as JSON)
18
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
13
+ | `objects` | [`?(CatalogObject[])`](../../doc/models/catalog-object.md) | Optional | The created successfully created CatalogObjects. | getObjects(): ?array | setObjects(?array objects): void |
14
  | `updatedAt` | `?string` | Optional | The database [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) of this update in RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void |
15
+ | `idMappings` | [`?(CatalogIdMapping[])`](../../doc/models/catalog-id-mapping.md) | Optional | The mapping between client and server IDs for this upsert. | getIdMappings(): ?array | setIdMappings(?array idMappings): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/booking-booking-source.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Booking Booking Source
3
+
4
+ Supported sources a booking was created from.
5
+
6
+ ## Enumeration
7
+
8
+ `BookingBookingSource`
9
+
10
+ ## Fields
11
+
12
+ | Name | Description |
13
+ | --- | --- |
14
+ | `FIRST_PARTY_MERCHANT` | The booking was created by a seller from a Square Appointments application, such as the Square Appointments Dashboard or a Square Appointments mobile app. |
15
+ | `FIRST_PARTY_BUYER` | The booking was created by a buyer from a Square Appointments application, such as Square Online Booking Site. |
16
+ | `THIRD_PARTY_BUYER` | The booking was created by a buyer created from a third-party application. |
17
+ | `API` | The booking was created by a seller or a buyer from the Square Bookings API. |
18
+
vendor/square/square/doc/models/booking-creator-details-creator-type.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Booking Creator Details Creator Type
3
+
4
+ Supported types of a booking creator.
5
+
6
+ ## Enumeration
7
+
8
+ `BookingCreatorDetailsCreatorType`
9
+
10
+ ## Fields
11
+
12
+ | Name | Description |
13
+ | --- | --- |
14
+ | `TEAM_MEMBER` | The creator is of the seller type. |
15
+ | `CUSTOMER` | The creator is of the buyer type. |
16
+
vendor/square/square/doc/models/booking-creator-details.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Booking Creator Details
3
+
4
+ Information about a booking creator.
5
+
6
+ ## Structure
7
+
8
+ `BookingCreatorDetails`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `creatorType` | [`?string (BookingCreatorDetailsCreatorType)`](../../doc/models/booking-creator-details-creator-type.md) | Optional | Supported types of a booking creator. | getCreatorType(): ?string | setCreatorType(?string creatorType): void |
15
+ | `teamMemberId` | `?string` | Optional | The ID of the team member who created the booking, when the booking creator is of the `TEAM_MEMBER` type.<br>Access to this field requires seller-level permissions.<br>**Constraints**: *Maximum Length*: `32` | getTeamMemberId(): ?string | setTeamMemberId(?string teamMemberId): void |
16
+ | `customerId` | `?string` | Optional | The ID of the customer who created the booking, when the booking creator is of the `CUSTOMER` type.<br>Access to this field requires seller-level permissions.<br>**Constraints**: *Maximum Length*: `192` | getCustomerId(): ?string | setCustomerId(?string customerId): void |
17
+
18
+ ## Example (as JSON)
19
+
20
+ ```json
21
+ {
22
+ "creator_type": null,
23
+ "team_member_id": null,
24
+ "customer_id": null
25
+ }
26
+ ```
27
+
vendor/square/square/doc/models/booking.md CHANGED
@@ -12,27 +12,43 @@ at a given location to a requesting customer in one or more appointment segments
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `id` | `?string` | Optional | A unique ID of this object representing a booking. | getId(): ?string | setId(?string id): void |
16
  | `version` | `?int` | Optional | The revision number for the booking used for optimistic concurrency. | getVersion(): ?int | setVersion(?int version): void |
17
- | `status` | [`?string (BookingStatus)`](/doc/models/booking-status.md) | Optional | Supported booking statuses. | getStatus(): ?string | setStatus(?string status): void |
18
- | `createdAt` | `?string` | Optional | The timestamp specifying the creation time of this booking, in RFC 3339 format. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void |
19
- | `updatedAt` | `?string` | Optional | The timestamp specifying the most recent update time of this booking, in RFC 3339 format. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void |
20
- | `startAt` | `?string` | Optional | The timestamp specifying the starting time of this booking, in RFC 3339 format. | getStartAt(): ?string | setStartAt(?string startAt): void |
21
- | `locationId` | `?string` | Optional | The ID of the [Location](/doc/models/location.md) object representing the location where the booked service is provided. | getLocationId(): ?string | setLocationId(?string locationId): void |
22
- | `customerId` | `?string` | Optional | The ID of the [Customer](/doc/models/customer.md) object representing the customer attending this booking | getCustomerId(): ?string | setCustomerId(?string customerId): void |
23
- | `customerNote` | `?string` | Optional | The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](/doc/models/catalog-object.md) instance.<br>**Constraints**: *Maximum Length*: `4096` | getCustomerNote(): ?string | setCustomerNote(?string customerNote): void |
24
- | `sellerNote` | `?string` | Optional | The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](/doc/models/catalog-object.md) instance.<br>This field should not be visible to customers.<br>**Constraints**: *Maximum Length*: `4096` | getSellerNote(): ?string | setSellerNote(?string sellerNote): void |
25
- | `appointmentSegments` | [`?(AppointmentSegment[])`](/doc/models/appointment-segment.md) | Optional | A list of appointment segments for this booking. | getAppointmentSegments(): ?array | setAppointmentSegments(?array appointmentSegments): void |
 
 
 
 
 
26
 
27
  ## Example (as JSON)
28
 
29
  ```json
30
  {
31
- "id": "id0",
32
- "version": 172,
33
- "status": "CANCELLED_BY_SELLER",
34
- "created_at": "created_at2",
35
- "updated_at": "updated_at4"
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  ```
38
 
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `id` | `?string` | Optional | A unique ID of this object representing a booking.<br>**Constraints**: *Maximum Length*: `36` | getId(): ?string | setId(?string id): void |
16
  | `version` | `?int` | Optional | The revision number for the booking used for optimistic concurrency. | getVersion(): ?int | setVersion(?int version): void |
17
+ | `status` | [`?string (BookingStatus)`](../../doc/models/booking-status.md) | Optional | Supported booking statuses. | getStatus(): ?string | setStatus(?string status): void |
18
+ | `createdAt` | `?string` | Optional | The RFC 3339 timestamp specifying the creation time of this booking. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void |
19
+ | `updatedAt` | `?string` | Optional | The RFC 3339 timestamp specifying the most recent update time of this booking. | getUpdatedAt(): ?string | setUpdatedAt(?string updatedAt): void |
20
+ | `startAt` | `?string` | Optional | The RFC 3339 timestamp specifying the starting time of this booking. | getStartAt(): ?string | setStartAt(?string startAt): void |
21
+ | `locationId` | `?string` | Optional | The ID of the [Location](../../doc/models/location.md) object representing the location where the booked service is provided. Once set when the booking is created, its value cannot be changed.<br>**Constraints**: *Maximum Length*: `32` | getLocationId(): ?string | setLocationId(?string locationId): void |
22
+ | `customerId` | `?string` | Optional | The ID of the [Customer](../../doc/models/customer.md) object representing the customer receiving the booked service.<br>**Constraints**: *Maximum Length*: `192` | getCustomerId(): ?string | setCustomerId(?string customerId): void |
23
+ | `customerNote` | `?string` | Optional | The free-text field for the customer to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a relevant [CatalogObject](../../doc/models/catalog-object.md) instance.<br>**Constraints**: *Maximum Length*: `4096` | getCustomerNote(): ?string | setCustomerNote(?string customerNote): void |
24
+ | `sellerNote` | `?string` | Optional | The free-text field for the seller to supply notes about the booking. For example, the note can be preferences that cannot be expressed by supported attributes of a specific [CatalogObject](../../doc/models/catalog-object.md) instance.<br>This field should not be visible to customers.<br>**Constraints**: *Maximum Length*: `4096` | getSellerNote(): ?string | setSellerNote(?string sellerNote): void |
25
+ | `appointmentSegments` | [`?(AppointmentSegment[])`](../../doc/models/appointment-segment.md) | Optional | A list of appointment segments for this booking. | getAppointmentSegments(): ?array | setAppointmentSegments(?array appointmentSegments): void |
26
+ | `transitionTimeMinutes` | `?int` | Optional | Additional time at the end of a booking.<br>Applications should not make this field visible to customers of a seller. | getTransitionTimeMinutes(): ?int | setTransitionTimeMinutes(?int transitionTimeMinutes): void |
27
+ | `allDay` | `?bool` | Optional | Whether the booking is of a full business day. | getAllDay(): ?bool | setAllDay(?bool allDay): void |
28
+ | `locationType` | [`?string (BusinessAppointmentSettingsBookingLocationType)`](../../doc/models/business-appointment-settings-booking-location-type.md) | Optional | Supported types of location where service is provided. | getLocationType(): ?string | setLocationType(?string locationType): void |
29
+ | `creatorDetails` | [`?BookingCreatorDetails`](../../doc/models/booking-creator-details.md) | Optional | Information about a booking creator. | getCreatorDetails(): ?BookingCreatorDetails | setCreatorDetails(?BookingCreatorDetails creatorDetails): void |
30
+ | `source` | [`?string (BookingBookingSource)`](../../doc/models/booking-booking-source.md) | Optional | Supported sources a booking was created from. | getSource(): ?string | setSource(?string source): void |
31
 
32
  ## Example (as JSON)
33
 
34
  ```json
35
  {
36
+ "id": null,
37
+ "version": null,
38
+ "status": null,
39
+ "created_at": null,
40
+ "updated_at": null,
41
+ "start_at": null,
42
+ "location_id": null,
43
+ "customer_id": null,
44
+ "customer_note": null,
45
+ "seller_note": null,
46
+ "appointment_segments": null,
47
+ "transition_time_minutes": null,
48
+ "all_day": null,
49
+ "location_type": null,
50
+ "creator_details": null,
51
+ "source": null
52
  }
53
  ```
54
 
vendor/square/square/doc/models/break-type.md CHANGED
@@ -25,14 +25,14 @@ instances on a `Shift`.
25
 
26
  ```json
27
  {
28
- "id": "id0",
29
  "location_id": "location_id4",
30
  "break_name": "break_name8",
31
  "expected_duration": "expected_duration4",
32
  "is_paid": false,
33
- "version": 172,
34
- "created_at": "created_at2",
35
- "updated_at": "updated_at4"
36
  }
37
  ```
38
 
25
 
26
  ```json
27
  {
28
+ "id": null,
29
  "location_id": "location_id4",
30
  "break_name": "break_name8",
31
  "expected_duration": "expected_duration4",
32
  "is_paid": false,
33
+ "version": null,
34
+ "created_at": null,
35
+ "updated_at": null
36
  }
37
  ```
38
 
vendor/square/square/doc/models/bulk-create-team-members-request.md CHANGED
@@ -11,7 +11,7 @@ Represents a bulk create request for `TeamMember` objects.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `teamMembers` | [`array`](/doc/models/create-team-member-request.md) | Required | The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. | getTeamMembers(): array | setTeamMembers(array teamMembers): void |
15
 
16
  ## Example (as JSON)
17
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `teamMembers` | [`array<string,CreateTeamMemberRequest>`](../../doc/models/create-team-member-request.md) | Required | The data used to create the `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. | getTeamMembers(): array | setTeamMembers(array teamMembers): void |
15
 
16
  ## Example (as JSON)
17
 
vendor/square/square/doc/models/bulk-create-team-members-response.md CHANGED
@@ -11,8 +11,8 @@ Represents a response from a bulk create request containing the created `TeamMem
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `teamMembers` | [`?array`](/doc/models/create-team-member-response.md) | Optional | The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. | getTeamMembers(): ?array | setTeamMembers(?array teamMembers): void |
15
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | The errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `teamMembers` | [`?array<string,CreateTeamMemberResponse>`](../../doc/models/create-team-member-response.md) | Optional | The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the `CreateTeamMemberRequest`. | getTeamMembers(): ?array | setTeamMembers(?array teamMembers): void |
15
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
vendor/square/square/doc/models/bulk-create-vendors-request.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Create Vendors Request
3
+
4
+ Represents an input to a call to [BulkCreateVendors](../../doc/apis/vendors.md#bulk-create-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkCreateVendorsRequest`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `vendors` | [`array<string,Vendor>`](../../doc/models/vendor.md) | Required | Specifies a set of new [Vendor](../../doc/models/vendor.md) objects as represented by a collection of idempotency-key/`Vendor`-object pairs. | getVendors(): array | setVendors(array vendors): void |
15
+
16
+ ## Example (as JSON)
17
+
18
+ ```json
19
+ {
20
+ "vendors": {
21
+ "key0": {
22
+ "id": null,
23
+ "created_at": null,
24
+ "updated_at": null,
25
+ "name": null,
26
+ "address": null,
27
+ "contacts": null,
28
+ "account_number": null,
29
+ "note": null,
30
+ "version": null,
31
+ "status": null
32
+ },
33
+ "key1": {
34
+ "id": null,
35
+ "created_at": null,
36
+ "updated_at": null,
37
+ "name": null,
38
+ "address": null,
39
+ "contacts": null,
40
+ "account_number": null,
41
+ "note": null,
42
+ "version": null,
43
+ "status": null
44
+ },
45
+ "key2": {
46
+ "id": null,
47
+ "created_at": null,
48
+ "updated_at": null,
49
+ "name": null,
50
+ "address": null,
51
+ "contacts": null,
52
+ "account_number": null,
53
+ "note": null,
54
+ "version": null,
55
+ "status": null
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
vendor/square/square/doc/models/bulk-create-vendors-response.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Create Vendors Response
3
+
4
+ Represents an output from a call to [BulkCreateVendors](../../doc/apis/vendors.md#bulk-create-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkCreateVendorsResponse`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
+ | `responses` | [`?array<string,CreateVendorResponse>`](../../doc/models/create-vendor-response.md) | Optional | A set of [CreateVendorResponse](../../doc/models/create-vendor-response.md) objects encapsulating successfully created [Vendor](../../doc/models/vendor.md)<br>objects or error responses for failed attempts. The set is represented by<br>a collection of idempotency-key/`Vendor`-object or idempotency-key/error-object pairs. The idempotency keys correspond to those specified<br>in the input. | getResponses(): ?array | setResponses(?array responses): void |
16
+
17
+ ## Example (as JSON)
18
+
19
+ ```json
20
+ {
21
+ "47bb76a8-c9fb-4f33-9df8-25ce02ca4505": {
22
+ "vendor": {
23
+ "contacts": [
24
+ {
25
+ "email_address": "annie@annieshotsauce.com",
26
+ "id": "INV_VC_ABYYHBWT1TPL8MFH52PBMENPJ4",
27
+ "name": "Annie Thomas",
28
+ "phone_number": "1-212-555-4250"
29
+ }
30
+ ],
31
+ "created_at": "2022-03-16T10:21:54.859Z",
32
+ "id": "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A",
33
+ "name": "Annie’s Hot Sauce",
34
+ "status": "ACTIVE",
35
+ "updated_at": "2022-03-16T10:21:54.859Z",
36
+ "version": 1
37
+ }
38
+ },
39
+ "errors": [],
40
+ "vendors": {
41
+ "8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe": {
42
+ "vendor": {
43
+ "account_number": "4025391",
44
+ "address": {
45
+ "address_line_1": "505 Electric Ave",
46
+ "address_line_2": "Suite 600",
47
+ "administrative_district_level_1": "NY",
48
+ "country": "US",
49
+ "locality": "New York",
50
+ "postal_code": "10003"
51
+ },
52
+ "contacts": [
53
+ {
54
+ "email_address": "joe@joesfreshseafood.com",
55
+ "id": "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A",
56
+ "name": "Joe Burrow",
57
+ "phone_number": "1-212-555-4250"
58
+ }
59
+ ],
60
+ "created_at": "2022-03-16T10:21:54.859Z",
61
+ "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4",
62
+ "name": "Joe's Fresh Seafood",
63
+ "note": "a vendor",
64
+ "status": "ACTIVE",
65
+ "updated_at": "2022-03-16T10:21:54.859Z",
66
+ "version": 0
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
vendor/square/square/doc/models/bulk-retrieve-vendors-request.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Retrieve Vendors Request
3
+
4
+ Represents an input to a call to [BulkRetrieveVendors](../../doc/apis/vendors.md#bulk-retrieve-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkRetrieveVendorsRequest`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `vendorIds` | `?(string[])` | Optional | IDs of the [Vendor](../../doc/models/vendor.md) objects to retrieve. | getVendorIds(): ?array | setVendorIds(?array vendorIds): void |
15
+
16
+ ## Example (as JSON)
17
+
18
+ ```json
19
+ {
20
+ "vendor_ids": [
21
+ "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4"
22
+ ]
23
+ }
24
+ ```
25
+
vendor/square/square/doc/models/bulk-retrieve-vendors-response.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Retrieve Vendors Response
3
+
4
+ Represents an output from a call to [BulkRetrieveVendors](../../doc/apis/vendors.md#bulk-retrieve-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkRetrieveVendorsResponse`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
15
+ | `responses` | [`?array<string,RetrieveVendorResponse>`](../../doc/models/retrieve-vendor-response.md) | Optional | The set of [RetrieveVendorResponse](../../doc/models/retrieve-vendor-response.md) objects encapsulating successfully retrieved [Vendor](../../doc/models/vendor.md)<br>objects or error responses for failed attempts. The set is represented by<br>a collection of `Vendor`-ID/`Vendor`-object or `Vendor`-ID/error-object pairs. | getResponses(): ?array | setResponses(?array responses): void |
16
+
17
+ ## Example (as JSON)
18
+
19
+ ```json
20
+ {
21
+ "errors": [],
22
+ "vendors": {
23
+ "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": {
24
+ "vendor": {
25
+ "account_number": "4025391",
26
+ "address": {
27
+ "address_line_1": "505 Electric Ave",
28
+ "address_line_2": "Suite 600",
29
+ "administrative_district_level_1": "NY",
30
+ "country": "US",
31
+ "locality": "New York",
32
+ "postal_code": "10003"
33
+ },
34
+ "contacts": [
35
+ {
36
+ "email_address": "joe@joesfreshseafood.com",
37
+ "id": "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A",
38
+ "name": "Joe Burrow",
39
+ "phone_number": "1-212-555-4250"
40
+ }
41
+ ],
42
+ "created_at": "2022-03-16T10:21:54.859Z",
43
+ "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4",
44
+ "name": "Joe's Fresh Seafood",
45
+ "note": "a vendor",
46
+ "status": "ACTIVE",
47
+ "updated_at": "2022-03-16T10:21:54.859Z",
48
+ "version": 1
49
+ }
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
vendor/square/square/doc/models/bulk-update-team-members-request.md CHANGED
@@ -11,7 +11,7 @@ Represents a bulk update request for `TeamMember` objects.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `teamMembers` | [`array`](/doc/models/update-team-member-request.md) | Required | The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. | getTeamMembers(): array | setTeamMembers(array teamMembers): void |
15
 
16
  ## Example (as JSON)
17
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `teamMembers` | [`array<string,UpdateTeamMemberRequest>`](../../doc/models/update-team-member-request.md) | Required | The data used to update the `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. | getTeamMembers(): array | setTeamMembers(array teamMembers): void |
15
 
16
  ## Example (as JSON)
17
 
vendor/square/square/doc/models/bulk-update-team-members-response.md CHANGED
@@ -11,8 +11,8 @@ Represents a response from a bulk update request containing the updated `TeamMem
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `teamMembers` | [`?array`](/doc/models/update-team-member-response.md) | Optional | The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. | getTeamMembers(): ?array | setTeamMembers(?array teamMembers): void |
15
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | The errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
@@ -24,15 +24,16 @@ Represents a response from a bulk update request containing the updated `TeamMem
24
  "assigned_locations": {
25
  "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
26
  },
27
- "created_at": "2020-06-11T22:46:57.001Z",
28
- "email_address": "jane_smith@gmail.com",
29
  "family_name": "Smith",
30
  "given_name": "Jane",
31
  "id": "AFMwA08kR-MIF-3Vs0OE",
32
  "is_owner": false,
33
  "phone_number": "+14159223334",
34
  "reference_id": "reference_id_2",
35
- "status": "ACTIVE"
 
36
  }
37
  },
38
  "fpgteZNMaf0qOK-a4t6P": {
@@ -44,15 +45,16 @@ Represents a response from a bulk update request containing the updated `TeamMem
44
  "YSGH2WBKG94QZ"
45
  ]
46
  },
47
- "created_at": "2020-06-11T22:46:57.095Z",
48
- "email_address": "joe_doe@gmail.com",
49
  "family_name": "Doe",
50
  "given_name": "Joe",
51
  "id": "fpgteZNMaf0qOK-a4t6P",
52
  "is_owner": false,
53
  "phone_number": "+14159283333",
54
  "reference_id": "reference_id_1",
55
- "status": "ACTIVE"
 
56
  }
57
  }
58
  }
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `teamMembers` | [`?array<string,UpdateTeamMemberResponse>`](../../doc/models/update-team-member-response.md) | Optional | The successfully updated `TeamMember` objects. Each key is the `team_member_id` that maps to the `UpdateTeamMemberRequest`. | getTeamMembers(): ?array | setTeamMembers(?array teamMembers): void |
15
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | The errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
 
17
  ## Example (as JSON)
18
 
24
  "assigned_locations": {
25
  "assignment_type": "ALL_CURRENT_AND_FUTURE_LOCATIONS"
26
  },
27
+ "created_at": "2020-03-24T18:14:00Z",
28
+ "email_address": "jane_smith@example.com",
29
  "family_name": "Smith",
30
  "given_name": "Jane",
31
  "id": "AFMwA08kR-MIF-3Vs0OE",
32
  "is_owner": false,
33
  "phone_number": "+14159223334",
34
  "reference_id": "reference_id_2",
35
+ "status": "ACTIVE",
36
+ "updated_at": "2020-03-24T18:18:00Z"
37
  }
38
  },
39
  "fpgteZNMaf0qOK-a4t6P": {
45
  "YSGH2WBKG94QZ"
46
  ]
47
  },
48
+ "created_at": "2020-03-24T18:14:00Z",
49
+ "email_address": "joe_doe@example.com",
50
  "family_name": "Doe",
51
  "given_name": "Joe",
52
  "id": "fpgteZNMaf0qOK-a4t6P",
53
  "is_owner": false,
54
  "phone_number": "+14159283333",
55
  "reference_id": "reference_id_1",
56
+ "status": "ACTIVE",
57
+ "updated_at": "2020-03-24T18:18:00Z"
58
  }
59
  }
60
  }
vendor/square/square/doc/models/bulk-update-vendors-request.md ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Update Vendors Request
3
+
4
+ Represents an input to a call to [BulkUpdateVendors](../../doc/apis/vendors.md#bulk-update-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkUpdateVendorsRequest`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `vendors` | [`array<string,UpdateVendorRequest>`](../../doc/models/update-vendor-request.md) | Required | A set of [UpdateVendorRequest](../../doc/models/update-vendor-request.md) objects encapsulating to-be-updated [Vendor](../../doc/models/vendor.md)<br>objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorRequest`-object pairs. | getVendors(): array | setVendors(array vendors): void |
15
+
16
+ ## Example (as JSON)
17
+
18
+ ```json
19
+ {
20
+ "vendors": {
21
+ "key0": {
22
+ "idempotency_key": null,
23
+ "vendor": {
24
+ "id": null,
25
+ "created_at": null,
26
+ "updated_at": null,
27
+ "name": null,
28
+ "address": null,
29
+ "contacts": null,
30
+ "account_number": null,
31
+ "note": null,
32
+ "version": null,
33
+ "status": null
34
+ }
35
+ },
36
+ "key1": {
37
+ "idempotency_key": null,
38
+ "vendor": {
39
+ "id": null,
40
+ "created_at": null,
41
+ "updated_at": null,
42
+ "name": null,
43
+ "address": null,
44
+ "contacts": null,
45
+ "account_number": null,
46
+ "note": null,
47
+ "version": null,
48
+ "status": null
49
+ }
50
+ },
51
+ "key2": {
52
+ "idempotency_key": null,
53
+ "vendor": {
54
+ "id": null,
55
+ "created_at": null,
56
+ "updated_at": null,
57
+ "name": null,
58
+ "address": null,
59
+ "contacts": null,
60
+ "account_number": null,
61
+ "note": null,
62
+ "version": null,
63
+ "status": null
64
+ }
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
vendor/square/square/doc/models/bulk-update-vendors-response.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Update Vendors Response
3
+
4
+ Represents an output from a call to [BulkUpdateVendors](../../doc/apis/vendors.md#bulk-update-vendors).
5
+
6
+ ## Structure
7
+
8
+ `BulkUpdateVendorsResponse`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Errors encountered when the request fails. | getErrors(): ?array | setErrors(?array errors): void |
15
+ | `responses` | [`?array<string,UpdateVendorResponse>`](../../doc/models/update-vendor-response.md) | Optional | A set of [UpdateVendorResponse](../../doc/models/update-vendor-response.md) objects encapsulating successfully created [Vendor](../../doc/models/vendor.md)<br>objects or error responses for failed attempts. The set is represented by a collection of `Vendor`-ID/`UpdateVendorResponse`-object or<br>`Vendor`-ID/error-object pairs. | getResponses(): ?array | setResponses(?array responses): void |
16
+
17
+ ## Example (as JSON)
18
+
19
+ ```json
20
+ {
21
+ "vendors": {
22
+ "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A": {
23
+ "address": {
24
+ "address_line_1": "202 Mill St",
25
+ "administrative_district_level_1": "NJ",
26
+ "country": "US",
27
+ "locality": "Moorestown",
28
+ "postal_code": "08057"
29
+ },
30
+ "contacts": [
31
+ {
32
+ "email_address": "annie@annieshotsauce.com",
33
+ "id": "INV_VC_ABYYHBWT1TPL8MFH52PBMENPJ4",
34
+ "name": "Annie Thomas",
35
+ "ordinal": 0,
36
+ "phone_number": "1-212-555-4250"
37
+ }
38
+ ],
39
+ "created_at": "2022-03-16T10:21:54.859Z",
40
+ "id": "INV_V_FMCYHBWT1TPL8MFH52PBMEN92A",
41
+ "name": "Annie’s Hot Sauce",
42
+ "status": "ACTIVE",
43
+ "updated_at": "2022-03-16T20:21:54.859Z",
44
+ "version": 11
45
+ },
46
+ "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4": {
47
+ "account_number": "4025391",
48
+ "address": {
49
+ "address_line_1": "505 Electric Ave",
50
+ "address_line_2": "Suite 600",
51
+ "administrative_district_level_1": "NY",
52
+ "country": "US",
53
+ "locality": "New York",
54
+ "postal_code": "10003"
55
+ },
56
+ "contacts": [
57
+ {
58
+ "email_address": "joe@joesfreshseafood.com",
59
+ "id": "INV_VC_FMCYHBWT1TPL8MFH52PBMEN92A",
60
+ "name": "Joe Burrow",
61
+ "ordinal": 0,
62
+ "phone_number": "1-212-555-4250"
63
+ }
64
+ ],
65
+ "created_at": "2022-03-16T10:10:54.859Z",
66
+ "id": "INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4",
67
+ "name": "Joe's Fresh Seafood",
68
+ "note": "favorite vendor",
69
+ "status": "ACTIVE",
70
+ "updated_at": "2022-03-16T20:21:54.859Z",
71
+ "version": 31
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Upsert Customer Custom Attributes Request Customer Custom Attribute Upsert Request
3
+
4
+ Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes)
5
+ request. An individual request contains a customer ID, the custom attribute to create or update,
6
+ and an optional idempotency key.
7
+
8
+ ## Structure
9
+
10
+ `BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest`
11
+
12
+ ## Fields
13
+
14
+ | Name | Type | Tags | Description | Getter | Setter |
15
+ | --- | --- | --- | --- | --- | --- |
16
+ | `customerId` | `string` | Required | The ID of the target [customer profile](../../doc/models/customer.md).<br>**Constraints**: *Minimum Length*: `1` | getCustomerId(): string | setCustomerId(string customerId): void |
17
+ | `customAttribute` | [`CustomAttribute`](../../doc/models/custom-attribute.md) | Required | A custom attribute value. Each custom attribute value has a corresponding<br>`CustomAttributeDefinition` object. | getCustomAttribute(): CustomAttribute | setCustomAttribute(CustomAttribute customAttribute): void |
18
+ | `idempotencyKey` | `?string` | Optional | A unique identifier for this individual upsert request, used to ensure idempotency.<br>For more information, see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).<br>**Constraints**: *Maximum Length*: `45` | getIdempotencyKey(): ?string | setIdempotencyKey(?string idempotencyKey): void |
19
+
20
+ ## Example (as JSON)
21
+
22
+ ```json
23
+ {
24
+ "customer_id": "customer_id8",
25
+ "custom_attribute": {
26
+ "key": null,
27
+ "value": null,
28
+ "version": null,
29
+ "visibility": null,
30
+ "definition": null,
31
+ "updated_at": null,
32
+ "created_at": null
33
+ },
34
+ "idempotency_key": null
35
+ }
36
+ ```
37
+
vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-request.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Upsert Customer Custom Attributes Request
3
+
4
+ Represents a [BulkUpsertCustomerCustomAttributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) request.
5
+
6
+ ## Structure
7
+
8
+ `BulkUpsertCustomerCustomAttributesRequest`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `values` | [`array<string,BulkUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest>`](../../doc/models/bulk-upsert-customer-custom-attributes-request-customer-custom-attribute-upsert-request.md) | Required | A map containing 1 to 25 individual upsert requests. For each request, provide an<br>arbitrary ID that is unique for this `BulkUpsertCustomerCustomAttributes` request and the<br>information needed to create or update a custom attribute. | getValues(): array | setValues(array values): void |
15
+
16
+ ## Example (as JSON)
17
+
18
+ ```json
19
+ {
20
+ "values": {
21
+ "id1": {
22
+ "custom_attribute": {
23
+ "key": "favoritemovie",
24
+ "value": "Dune"
25
+ },
26
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8"
27
+ },
28
+ "id2": {
29
+ "custom_attribute": {
30
+ "key": "ownsmovie",
31
+ "value": false
32
+ },
33
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM"
34
+ },
35
+ "id3": {
36
+ "custom_attribute": {
37
+ "key": "favoritemovie",
38
+ "value": "Star Wars"
39
+ },
40
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM"
41
+ },
42
+ "id4": {
43
+ "custom_attribute": {
44
+ "key": "square:a0f1505a-2aa1-490d-91a8-8d31ff181808",
45
+ "value": "10.5"
46
+ },
47
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8"
48
+ },
49
+ "id5": {
50
+ "custom_attribute": {
51
+ "key": "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail",
52
+ "value": "fake-email@squareup.com"
53
+ },
54
+ "customer_id": "70548QG1HN43B05G0KCZ4MMC1G"
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Upsert Customer Custom Attributes Response Customer Custom Attribute Upsert Response
3
+
4
+ Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) operation.
5
+
6
+ ## Structure
7
+
8
+ `BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `customerId` | `?string` | Optional | The ID of the customer profile associated with the custom attribute. | getCustomerId(): ?string | setCustomerId(?string customerId): void |
15
+ | `customAttribute` | [`?CustomAttribute`](../../doc/models/custom-attribute.md) | Optional | A custom attribute value. Each custom attribute value has a corresponding<br>`CustomAttributeDefinition` object. | getCustomAttribute(): ?CustomAttribute | setCustomAttribute(?CustomAttribute customAttribute): void |
16
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred while processing the individual request. | getErrors(): ?array | setErrors(?array errors): void |
17
+
18
+ ## Example (as JSON)
19
+
20
+ ```json
21
+ {
22
+ "custom_attribute": {
23
+ "created_at": "2021-12-08T23:14:47Z",
24
+ "key": "favoritemovie",
25
+ "updated_at": "2021-12-09T00:16:23Z",
26
+ "value": "Dune",
27
+ "version": 1,
28
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
29
+ },
30
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8"
31
+ }
32
+ ```
33
+
vendor/square/square/doc/models/bulk-upsert-customer-custom-attributes-response.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Bulk Upsert Customer Custom Attributes Response
3
+
4
+ Represents a [BulkUpsertCustomerCustomAttributes](../../doc/apis/customer-custom-attributes.md#bulk-upsert-customer-custom-attributes) response,
5
+ which contains a map of responses that each corresponds to an individual upsert request.
6
+
7
+ ## Structure
8
+
9
+ `BulkUpsertCustomerCustomAttributesResponse`
10
+
11
+ ## Fields
12
+
13
+ | Name | Type | Tags | Description | Getter | Setter |
14
+ | --- | --- | --- | --- | --- | --- |
15
+ | `values` | [`?array<string,BulkUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse>`](../../doc/models/bulk-upsert-customer-custom-attributes-response-customer-custom-attribute-upsert-response.md) | Optional | A map of responses that correspond to individual upsert requests. Each response has the<br>same ID as the corresponding request and contains either a `customer_id` and `custom_attribute` or an `errors` field. | getValues(): ?array | setValues(?array values): void |
16
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
17
+
18
+ ## Example (as JSON)
19
+
20
+ ```json
21
+ {
22
+ "values": {
23
+ "id1": {
24
+ "custom_attribute": {
25
+ "created_at": "2021-12-08T23:14:47Z",
26
+ "key": "favoritemovie",
27
+ "updated_at": "2021-12-09T00:16:23Z",
28
+ "value": "Dune",
29
+ "version": 1,
30
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
31
+ },
32
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8"
33
+ },
34
+ "id2": {
35
+ "custom_attribute": {
36
+ "created_at": "2021-12-09T00:16:20Z",
37
+ "key": "ownsmovie",
38
+ "updated_at": "2021-12-09T00:16:23Z",
39
+ "value": false,
40
+ "version": 2,
41
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
42
+ },
43
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM"
44
+ },
45
+ "id3": {
46
+ "custom_attribute": {
47
+ "created_at": "2021-12-09T00:16:20Z",
48
+ "key": "favoritemovie",
49
+ "updated_at": "2021-12-09T00:16:23Z",
50
+ "value": "Star Wars",
51
+ "version": 2,
52
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
53
+ },
54
+ "customer_id": "SY8EMWRNDN3TQDP2H4KS1QWMMM"
55
+ },
56
+ "id4": {
57
+ "custom_attribute": {
58
+ "created_at": "2021-12-08T23:14:47Z",
59
+ "key": "square:a0f1505a-2aa1-490d-91a8-8d31ff181808",
60
+ "updated_at": "2021-12-09T00:16:23Z",
61
+ "value": "10.5",
62
+ "version": 1,
63
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
64
+ },
65
+ "customer_id": "N3NCVYY3WS27HF0HKANA3R9FP8"
66
+ },
67
+ "id5": {
68
+ "custom_attribute": {
69
+ "created_at": "2021-12-09T00:16:20Z",
70
+ "key": "sq0ids-0evKIskIGaY45fCyNL66aw:backupemail",
71
+ "updated_at": "2021-12-09T00:16:23Z",
72
+ "value": "fake-email@squareup.com",
73
+ "version": 2,
74
+ "visibility": "VISIBILITY_READ_WRITE_VALUES"
75
+ },
76
+ "customer_id": "70548QG1HN43B05G0KCZ4MMC1G"
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
vendor/square/square/doc/models/business-appointment-settings-booking-location-type.md CHANGED
@@ -1,7 +1,7 @@
1
 
2
  # Business Appointment Settings Booking Location Type
3
 
4
- Types of location where service is provided.
5
 
6
  ## Enumeration
7
 
1
 
2
  # Business Appointment Settings Booking Location Type
3
 
4
+ Supported types of location where service is provided.
5
 
6
  ## Enumeration
7
 
vendor/square/square/doc/models/business-appointment-settings.md CHANGED
@@ -11,32 +11,37 @@ The service appointment settings, including where and how the service is provide
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `locationTypes` | [`?(string[]) (BusinessAppointmentSettingsBookingLocationType)`](/doc/models/business-appointment-settings-booking-location-type.md) | Optional | Types of the location allowed for bookings.<br>See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values | getLocationTypes(): ?array | setLocationTypes(?array locationTypes): void |
15
- | `alignmentTime` | [`?string (BusinessAppointmentSettingsAlignmentTime)`](/doc/models/business-appointment-settings-alignment-time.md) | Optional | Time units of a service duration for bookings. | getAlignmentTime(): ?string | setAlignmentTime(?string alignmentTime): void |
16
  | `minBookingLeadTimeSeconds` | `?int` | Optional | The minimum lead time in seconds before a service can be booked. Bookings must be created at least this far ahead of the booking's starting time. | getMinBookingLeadTimeSeconds(): ?int | setMinBookingLeadTimeSeconds(?int minBookingLeadTimeSeconds): void |
17
  | `maxBookingLeadTimeSeconds` | `?int` | Optional | The maximum lead time in seconds before a service can be booked. Bookings must be created at most this far ahead of the booking's starting time. | getMaxBookingLeadTimeSeconds(): ?int | setMaxBookingLeadTimeSeconds(?int maxBookingLeadTimeSeconds): void |
18
  | `anyTeamMemberBookingEnabled` | `?bool` | Optional | Indicates whether a customer can choose from all available time slots and have a staff member assigned<br>automatically (`true`) or not (`false`). | getAnyTeamMemberBookingEnabled(): ?bool | setAnyTeamMemberBookingEnabled(?bool anyTeamMemberBookingEnabled): void |
19
  | `multipleServiceBookingEnabled` | `?bool` | Optional | Indicates whether a customer can book multiple services in a single online booking. | getMultipleServiceBookingEnabled(): ?bool | setMultipleServiceBookingEnabled(?bool multipleServiceBookingEnabled): void |
20
- | `maxAppointmentsPerDayLimitType` | [`?string (BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType)`](/doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md) | Optional | Types of daily appointment limits. | getMaxAppointmentsPerDayLimitType(): ?string | setMaxAppointmentsPerDayLimitType(?string maxAppointmentsPerDayLimitType): void |
21
  | `maxAppointmentsPerDayLimit` | `?int` | Optional | The maximum number of daily appointments per team member or per location. | getMaxAppointmentsPerDayLimit(): ?int | setMaxAppointmentsPerDayLimit(?int maxAppointmentsPerDayLimit): void |
22
  | `cancellationWindowSeconds` | `?int` | Optional | The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. | getCancellationWindowSeconds(): ?int | setCancellationWindowSeconds(?int cancellationWindowSeconds): void |
23
- | `cancellationFeeMoney` | [`?Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getCancellationFeeMoney(): ?Money | setCancellationFeeMoney(?Money cancellationFeeMoney): void |
24
- | `cancellationPolicy` | [`?string (BusinessAppointmentSettingsCancellationPolicy)`](/doc/models/business-appointment-settings-cancellation-policy.md) | Optional | The category of the seller’s cancellation policy. | getCancellationPolicy(): ?string | setCancellationPolicy(?string cancellationPolicy): void |
25
- | `cancellationPolicyText` | `?string` | Optional | The free-form text of the seller's cancellation policy. | getCancellationPolicyText(): ?string | setCancellationPolicyText(?string cancellationPolicyText): void |
26
  | `skipBookingFlowStaffSelection` | `?bool` | Optional | Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). | getSkipBookingFlowStaffSelection(): ?bool | setSkipBookingFlowStaffSelection(?bool skipBookingFlowStaffSelection): void |
27
 
28
  ## Example (as JSON)
29
 
30
  ```json
31
  {
32
- "location_types": [
33
- "BUSINESS_LOCATION",
34
- "CUSTOMER_LOCATION"
35
- ],
36
- "alignment_time": "HALF_HOURLY",
37
- "min_booking_lead_time_seconds": 38,
38
- "max_booking_lead_time_seconds": 48,
39
- "any_team_member_booking_enabled": false
 
 
 
 
 
40
  }
41
  ```
42
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `locationTypes` | [`?(string[]) (BusinessAppointmentSettingsBookingLocationType)`](../../doc/models/business-appointment-settings-booking-location-type.md) | Optional | Types of the location allowed for bookings.<br>See [BusinessAppointmentSettingsBookingLocationType](#type-businessappointmentsettingsbookinglocationtype) for possible values | getLocationTypes(): ?array | setLocationTypes(?array locationTypes): void |
15
+ | `alignmentTime` | [`?string (BusinessAppointmentSettingsAlignmentTime)`](../../doc/models/business-appointment-settings-alignment-time.md) | Optional | Time units of a service duration for bookings. | getAlignmentTime(): ?string | setAlignmentTime(?string alignmentTime): void |
16
  | `minBookingLeadTimeSeconds` | `?int` | Optional | The minimum lead time in seconds before a service can be booked. Bookings must be created at least this far ahead of the booking's starting time. | getMinBookingLeadTimeSeconds(): ?int | setMinBookingLeadTimeSeconds(?int minBookingLeadTimeSeconds): void |
17
  | `maxBookingLeadTimeSeconds` | `?int` | Optional | The maximum lead time in seconds before a service can be booked. Bookings must be created at most this far ahead of the booking's starting time. | getMaxBookingLeadTimeSeconds(): ?int | setMaxBookingLeadTimeSeconds(?int maxBookingLeadTimeSeconds): void |
18
  | `anyTeamMemberBookingEnabled` | `?bool` | Optional | Indicates whether a customer can choose from all available time slots and have a staff member assigned<br>automatically (`true`) or not (`false`). | getAnyTeamMemberBookingEnabled(): ?bool | setAnyTeamMemberBookingEnabled(?bool anyTeamMemberBookingEnabled): void |
19
  | `multipleServiceBookingEnabled` | `?bool` | Optional | Indicates whether a customer can book multiple services in a single online booking. | getMultipleServiceBookingEnabled(): ?bool | setMultipleServiceBookingEnabled(?bool multipleServiceBookingEnabled): void |
20
+ | `maxAppointmentsPerDayLimitType` | [`?string (BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType)`](../../doc/models/business-appointment-settings-max-appointments-per-day-limit-type.md) | Optional | Types of daily appointment limits. | getMaxAppointmentsPerDayLimitType(): ?string | setMaxAppointmentsPerDayLimitType(?string maxAppointmentsPerDayLimitType): void |
21
  | `maxAppointmentsPerDayLimit` | `?int` | Optional | The maximum number of daily appointments per team member or per location. | getMaxAppointmentsPerDayLimit(): ?int | setMaxAppointmentsPerDayLimit(?int maxAppointmentsPerDayLimit): void |
22
  | `cancellationWindowSeconds` | `?int` | Optional | The cut-off time in seconds for allowing clients to cancel or reschedule an appointment. | getCancellationWindowSeconds(): ?int | setCancellationWindowSeconds(?int cancellationWindowSeconds): void |
23
+ | `cancellationFeeMoney` | [`?Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getCancellationFeeMoney(): ?Money | setCancellationFeeMoney(?Money cancellationFeeMoney): void |
24
+ | `cancellationPolicy` | [`?string (BusinessAppointmentSettingsCancellationPolicy)`](../../doc/models/business-appointment-settings-cancellation-policy.md) | Optional | The category of the seller’s cancellation policy. | getCancellationPolicy(): ?string | setCancellationPolicy(?string cancellationPolicy): void |
25
+ | `cancellationPolicyText` | `?string` | Optional | The free-form text of the seller's cancellation policy.<br>**Constraints**: *Maximum Length*: `65536` | getCancellationPolicyText(): ?string | setCancellationPolicyText(?string cancellationPolicyText): void |
26
  | `skipBookingFlowStaffSelection` | `?bool` | Optional | Indicates whether customers has an assigned staff member (`true`) or can select s staff member of their choice (`false`). | getSkipBookingFlowStaffSelection(): ?bool | setSkipBookingFlowStaffSelection(?bool skipBookingFlowStaffSelection): void |
27
 
28
  ## Example (as JSON)
29
 
30
  ```json
31
  {
32
+ "location_types": null,
33
+ "alignment_time": null,
34
+ "min_booking_lead_time_seconds": null,
35
+ "max_booking_lead_time_seconds": null,
36
+ "any_team_member_booking_enabled": null,
37
+ "multiple_service_booking_enabled": null,
38
+ "max_appointments_per_day_limit_type": null,
39
+ "max_appointments_per_day_limit": null,
40
+ "cancellation_window_seconds": null,
41
+ "cancellation_fee_money": null,
42
+ "cancellation_policy": null,
43
+ "cancellation_policy_text": null,
44
+ "skip_booking_flow_staff_selection": null
45
  }
46
  ```
47
 
vendor/square/square/doc/models/business-booking-profile.md CHANGED
@@ -9,23 +9,27 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `sellerId` | `?string` | Optional | The ID of the seller, obtainable using the Merchants API. | getSellerId(): ?string | setSellerId(?string sellerId): void |
13
  | `createdAt` | `?string` | Optional | The RFC 3339 timestamp specifying the booking's creation time. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void |
14
  | `bookingEnabled` | `?bool` | Optional | Indicates whether the seller is open for booking. | getBookingEnabled(): ?bool | setBookingEnabled(?bool bookingEnabled): void |
15
- | `customerTimezoneChoice` | [`?string (BusinessBookingProfileCustomerTimezoneChoice)`](/doc/models/business-booking-profile-customer-timezone-choice.md) | Optional | Choices of customer-facing time zone used for bookings. | getCustomerTimezoneChoice(): ?string | setCustomerTimezoneChoice(?string customerTimezoneChoice): void |
16
- | `bookingPolicy` | [`?string (BusinessBookingProfileBookingPolicy)`](/doc/models/business-booking-profile-booking-policy.md) | Optional | Policies for accepting bookings. | getBookingPolicy(): ?string | setBookingPolicy(?string bookingPolicy): void |
17
  | `allowUserCancel` | `?bool` | Optional | Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). | getAllowUserCancel(): ?bool | setAllowUserCancel(?bool allowUserCancel): void |
18
- | `businessAppointmentSettings` | [`?BusinessAppointmentSettings`](/doc/models/business-appointment-settings.md) | Optional | The service appointment settings, including where and how the service is provided. | getBusinessAppointmentSettings(): ?BusinessAppointmentSettings | setBusinessAppointmentSettings(?BusinessAppointmentSettings businessAppointmentSettings): void |
 
19
 
20
  ## Example (as JSON)
21
 
22
  ```json
23
  {
24
- "seller_id": "seller_id8",
25
- "created_at": "created_at2",
26
- "booking_enabled": false,
27
- "customer_timezone_choice": "BUSINESS_LOCATION_TIMEZONE",
28
- "booking_policy": "ACCEPT_ALL"
 
 
 
29
  }
30
  ```
31
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `sellerId` | `?string` | Optional | The ID of the seller, obtainable using the Merchants API.<br>**Constraints**: *Maximum Length*: `32` | getSellerId(): ?string | setSellerId(?string sellerId): void |
13
  | `createdAt` | `?string` | Optional | The RFC 3339 timestamp specifying the booking's creation time. | getCreatedAt(): ?string | setCreatedAt(?string createdAt): void |
14
  | `bookingEnabled` | `?bool` | Optional | Indicates whether the seller is open for booking. | getBookingEnabled(): ?bool | setBookingEnabled(?bool bookingEnabled): void |
15
+ | `customerTimezoneChoice` | [`?string (BusinessBookingProfileCustomerTimezoneChoice)`](../../doc/models/business-booking-profile-customer-timezone-choice.md) | Optional | Choices of customer-facing time zone used for bookings. | getCustomerTimezoneChoice(): ?string | setCustomerTimezoneChoice(?string customerTimezoneChoice): void |
16
+ | `bookingPolicy` | [`?string (BusinessBookingProfileBookingPolicy)`](../../doc/models/business-booking-profile-booking-policy.md) | Optional | Policies for accepting bookings. | getBookingPolicy(): ?string | setBookingPolicy(?string bookingPolicy): void |
17
  | `allowUserCancel` | `?bool` | Optional | Indicates whether customers can cancel or reschedule their own bookings (`true`) or not (`false`). | getAllowUserCancel(): ?bool | setAllowUserCancel(?bool allowUserCancel): void |
18
+ | `businessAppointmentSettings` | [`?BusinessAppointmentSettings`](../../doc/models/business-appointment-settings.md) | Optional | The service appointment settings, including where and how the service is provided. | getBusinessAppointmentSettings(): ?BusinessAppointmentSettings | setBusinessAppointmentSettings(?BusinessAppointmentSettings businessAppointmentSettings): void |
19
+ | `supportSellerLevelWrites` | `?bool` | Optional | Indicates whether the seller's subscription to Square Appointments supports creating, updating or canceling an appointment through the API (`true`) or not (`false`) using seller permission. | getSupportSellerLevelWrites(): ?bool | setSupportSellerLevelWrites(?bool supportSellerLevelWrites): void |
20
 
21
  ## Example (as JSON)
22
 
23
  ```json
24
  {
25
+ "seller_id": null,
26
+ "created_at": null,
27
+ "booking_enabled": null,
28
+ "customer_timezone_choice": null,
29
+ "booking_policy": null,
30
+ "allow_user_cancel": null,
31
+ "business_appointment_settings": null,
32
+ "support_seller_level_writes": null
33
  }
34
  ```
35
 
vendor/square/square/doc/models/business-hours-period.md CHANGED
@@ -11,17 +11,17 @@ Represents a period of time during which a business location is open.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `dayOfWeek` | [`?string (DayOfWeek)`](/doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. | getDayOfWeek(): ?string | setDayOfWeek(?string dayOfWeek): void |
15
- | `startLocalTime` | `?string` | Optional | The start time of a business hours period, specified in local time using partial-time<br>RFC 3339 format. | getStartLocalTime(): ?string | setStartLocalTime(?string startLocalTime): void |
16
- | `endLocalTime` | `?string` | Optional | The end time of a business hours period, specified in local time using partial-time<br>RFC 3339 format. | getEndLocalTime(): ?string | setEndLocalTime(?string endLocalTime): void |
17
 
18
  ## Example (as JSON)
19
 
20
  ```json
21
  {
22
- "day_of_week": "SAT",
23
- "start_local_time": "start_local_time6",
24
- "end_local_time": "end_local_time8"
25
  }
26
  ```
27
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `dayOfWeek` | [`?string (DayOfWeek)`](../../doc/models/day-of-week.md) | Optional | Indicates the specific day of the week. | getDayOfWeek(): ?string | setDayOfWeek(?string dayOfWeek): void |
15
+ | `startLocalTime` | `?string` | Optional | The start time of a business hours period, specified in local time using partial-time<br>RFC 3339 format. For example, `8:30:00` for a period starting at 8:30 in the morning.<br>Note that the seconds value is always :00, but it is appended for conformance to the RFC. | getStartLocalTime(): ?string | setStartLocalTime(?string startLocalTime): void |
16
+ | `endLocalTime` | `?string` | Optional | The end time of a business hours period, specified in local time using partial-time<br>RFC 3339 format. For example, `21:00:00` for a period ending at 9:00 in the evening.<br>Note that the seconds value is always :00, but it is appended for conformance to the RFC. | getEndLocalTime(): ?string | setEndLocalTime(?string endLocalTime): void |
17
 
18
  ## Example (as JSON)
19
 
20
  ```json
21
  {
22
+ "day_of_week": null,
23
+ "start_local_time": null,
24
+ "end_local_time": null
25
  }
26
  ```
27
 
vendor/square/square/doc/models/business-hours.md CHANGED
@@ -1,7 +1,7 @@
1
 
2
  # Business Hours
3
 
4
- Represents the hours of operation for a business location.
5
 
6
  ## Structure
7
 
@@ -11,29 +11,13 @@ Represents the hours of operation for a business location.
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
- | `periods` | [`?(BusinessHoursPeriod[])`](/doc/models/business-hours-period.md) | Optional | The list of time periods during which the business is open. There may be at most 10<br>periods per day. | getPeriods(): ?array | setPeriods(?array periods): void |
15
 
16
  ## Example (as JSON)
17
 
18
  ```json
19
  {
20
- "periods": [
21
- {
22
- "day_of_week": "MON",
23
- "start_local_time": "start_local_time5",
24
- "end_local_time": "end_local_time7"
25
- },
26
- {
27
- "day_of_week": "SUN",
28
- "start_local_time": "start_local_time6",
29
- "end_local_time": "end_local_time8"
30
- },
31
- {
32
- "day_of_week": "SAT",
33
- "start_local_time": "start_local_time7",
34
- "end_local_time": "end_local_time9"
35
- }
36
- ]
37
  }
38
  ```
39
 
1
 
2
  # Business Hours
3
 
4
+ The hours of operation for a location.
5
 
6
  ## Structure
7
 
11
 
12
  | Name | Type | Tags | Description | Getter | Setter |
13
  | --- | --- | --- | --- | --- | --- |
14
+ | `periods` | [`?(BusinessHoursPeriod[])`](../../doc/models/business-hours-period.md) | Optional | The list of time periods during which the business is open. There can be at most 10 periods per day. | getPeriods(): ?array | setPeriods(?array periods): void |
15
 
16
  ## Example (as JSON)
17
 
18
  ```json
19
  {
20
+ "periods": null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
  ```
23
 
vendor/square/square/doc/models/buy-now-pay-later-details.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Buy Now Pay Later Details
3
+
4
+ Additional details about a Buy Now Pay Later payment type.
5
+
6
+ ## Structure
7
+
8
+ `BuyNowPayLaterDetails`
9
+
10
+ ## Fields
11
+
12
+ | Name | Type | Tags | Description | Getter | Setter |
13
+ | --- | --- | --- | --- | --- | --- |
14
+ | `brand` | `?string` | Optional | The brand used for the Buy Now Pay Later payment.<br>The brand can be `AFTERPAY` or `UNKNOWN`.<br>**Constraints**: *Maximum Length*: `50` | getBrand(): ?string | setBrand(?string brand): void |
15
+ | `afterpayDetails` | [`?AfterpayDetails`](../../doc/models/afterpay-details.md) | Optional | Additional details about Afterpay payments. | getAfterpayDetails(): ?AfterpayDetails | setAfterpayDetails(?AfterpayDetails afterpayDetails): void |
16
+
17
+ ## Example (as JSON)
18
+
19
+ ```json
20
+ {
21
+ "brand": null,
22
+ "afterpay_details": null
23
+ }
24
+ ```
25
+
vendor/square/square/doc/models/calculate-loyalty-points-request.md CHANGED
@@ -12,8 +12,8 @@ a specified purchase.
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `orderId` | `?string` | Optional | The [order](/doc/models/order.md) ID for which to calculate the points.<br>Specify this field if your application uses the Orders API to process orders.<br>Otherwise, specify the `transaction_amount_money`. | getOrderId(): ?string | setOrderId(?string orderId): void |
16
- | `transactionAmountMoney` | [`?Money`](/doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getTransactionAmountMoney(): ?Money | setTransactionAmountMoney(?Money transactionAmountMoney): void |
17
 
18
  ## Example (as JSON)
19
 
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `orderId` | `?string` | Optional | The [order](../../doc/models/order.md) ID for which to calculate the points.<br>Specify this field if your application uses the Orders API to process orders.<br>Otherwise, specify the `transaction_amount_money`. | getOrderId(): ?string | setOrderId(?string orderId): void |
16
+ | `transactionAmountMoney` | [`?Money`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.<br>Fields that do not explicitly define whether they are signed or unsigned are<br>considered unsigned and can only hold positive amounts. For signed fields, the<br>sign of the value indicates the purpose of the money transfer. See<br>[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)<br>for more information. | getTransactionAmountMoney(): ?Money | setTransactionAmountMoney(?Money transactionAmountMoney): void |
17
 
18
  ## Example (as JSON)
19
 
vendor/square/square/doc/models/calculate-loyalty-points-response.md CHANGED
@@ -12,7 +12,7 @@ a specified purchase.
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
  | `points` | `?int` | Optional | The points that the buyer can earn from a specified purchase. | getPoints(): ?int | setPoints(?int points): void |
17
 
18
  ## Example (as JSON)
12
 
13
  | Name | Type | Tags | Description | Getter | Setter |
14
  | --- | --- | --- | --- | --- | --- |
15
+ | `errors` | [`?(Error[])`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(?array errors): void |
16
  | `points` | `?int` | Optional | The points that the buyer can earn from a specified purchase. | getPoints(): ?int | setPoints(?int points): void |
17
 
18
  ## Example (as JSON)
vendor/square/square/doc/models/calculate-order-request.md CHANGED
@@ -9,8 +9,8 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `order` | [`Order`](/doc/models/order.md) | Required | Contains all information related to a single order to process with Square,<br>including line items that specify the products to purchase. `Order` objects also<br>include information about any associated tenders, refunds, and returns.<br><br>All Connect V2 Transactions have all been converted to Orders including all associated<br>itemization data. | getOrder(): Order | setOrder(Order order): void |
13
- | `proposedRewards` | [`?(OrderReward[])`](/doc/models/order-reward.md) | Optional | Identifies one or more loyalty reward tiers to apply during the order calculation.<br>The discounts defined by the reward tiers are added to the order only to preview the<br>effect of applying the specified rewards. The rewards do not correspond to actual<br>redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are<br>random strings used only to reference the reward tier. | getProposedRewards(): ?array | setProposedRewards(?array proposedRewards): void |
14
 
15
  ## Example (as JSON)
16
 
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
+ | `order` | [`Order`](../../doc/models/order.md) | Required | Contains all information related to a single order to process with Square,<br>including line items that specify the products to purchase. `Order` objects also<br>include information about any associated tenders, refunds, and returns.<br><br>All Connect V2 Transactions have all been converted to Orders including all associated<br>itemization data. | getOrder(): Order | setOrder(Order order): void |
13
+ | `proposedRewards` | [`?(OrderReward[])`](../../doc/models/order-reward.md) | Optional | Identifies one or more loyalty reward tiers to apply during the order calculation.<br>The discounts defined by the reward tiers are added to the order only to preview the<br>effect of applying the specified rewards. The rewards do not correspond to actual<br>redemptions; that is, no `reward`s are created. Therefore, the reward `id`s are<br>random strings used only to reference the reward tier. | getProposedRewards(): ?array | setProposedRewards(?array proposedRewards): void |
14
 
15
  ## Example (as JSON)
16
 
vendor/square/square/doc/models/calculate-order-response.md CHANGED
@@ -9,8 +9,8 @@
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |
12
- | `order` | [`?Order`](/doc/models/order.md) | Optional | Contains all information related to a single order to process with Square,<br>including line items that specify the products to purchase. `Order` objects also<br>include information about any associated tenders, refunds, and returns.<br><br>All Connect V2 Transactions have all been converted to Orders including all associated<br>itemization data. | getOrder(): ?Order | setOrder(?Order order): void |
13
- | `errors` | [`?(Error[])`](/doc/models/error.md) | Optional | Any errors that occurred during the request. | getErrors(): ?array | setErrors(
9
 
10
  | Name | Type | Tags | Description | Getter | Setter |
11
  | --- | --- | --- | --- | --- | --- |