sphereio / google-glass-demo Goto Github PK
View Code? Open in Web Editor NEWSample application allowing to buy products managed in sphere.io using a google glass device.
Home Page: http://dev.sphere.io/
License: MIT License
Sample application allowing to buy products managed in sphere.io using a google glass device.
Home Page: http://dev.sphere.io/
License: MIT License
Sample CURL request:
$ curl -X POST -d '{"currency":"EUR"}' "https://api.sphere.io/google-glass-demo/carts" -H "Authorization: Bearer XXXXXXXXXXX"
{"type":"Cart","id":"96ffaf06-cfd5-4b0e-8ba8-a8d9e61647b6","version":1,"createdAt":"2014-11-14T13:35:24.701Z","lastModifiedAt":"2014-11-14T13:35:24.701Z","lineItems":[],"cartState":"Active","totalPrice":{"currencyCode":"EUR","centAmount":0},"inventoryMode":"None","customLineItems":[]}
We have a API playground which allows you playing around with our API without all the hassle. Please have a look here: https://impex.sphere.io/playground
question from @fvillalbacar:
Im currently working with the cart and its actions. Right now I can add products to a cart, but the thing is that I would like to convert a cart into an order. Hence I add the "setShippingAddress" as action to the cart, but when trying to convert it into an order it says that the cart has no Shipping address. Any idea?
The request endpoint is : https://api.sphere.io/google-glass-demo/carts/a548304d-98d7-4e3f-9471-f07cd393a7be . The raw data is:
payload
{
"version": 29,
"actions": [
{
"action": "addLineItem",
"productId": "f4d2cfe8-378a-4c55-b1a6-da02ac29fc7c",
"variantId": 1,
"quantity": 1
},
{
"action": "setShippingAddress",
"adress": {
"id": "One",
"title": "test",
"salutation": "sir",
"firstName": "dummy",
"lastName": "dummy",
"streetName": "dummy",
"streetNumber": "dummy",
"additionalStreetInfo": "dummy",
"postalCode": "dummy",
"city": "Barcelona",
"region": "Barcelona",
"state": "SP",
"country": "ES",
"company": "dummy",
"department": "dummy",
"building": "dummy",
"apartment": "dummy",
"pOBox": "dummy",
"phone": "dummy",
"mobile": "dummy",
"email": "dummy",
"additionalAddressInfo": "dummy"
}
}
]
}
response
{
"type": "Cart",
"id": "a548304d-98d7-4e3f-9471-f07cd393a7be",
"version": 32,
"createdAt": "2014-11-14T14:31:36.182Z",
"lastModifiedAt": "2014-11-18T10:57:07.461Z",
"lineItems": [
{
"id": "2f6094f1-1b17-49ae-be28-a26df6b336eb",
"productId": "f4d2cfe8-378a-4c55-b1a6-da02ac29fc7c",
"name": {
"en": "MB PREMIUM TECH T"
},
"variant": {
"id": 1,
"sku": "sku_MB_PREMIUM_TECH_T_variant1_1415189355070",
"prices": [
{
"value": {
"currencyCode": "EUR",
"centAmount": 10000
}
}
],
"images": [
{
"url": "https:\/\/www.commercetools.com\/cli\/data\/253245821_1.jpg",
"dimensions": {
"w": 1400,
"h": 1400
}
}
],
"attributes": [
]
},
"price": {
"value": {
"currencyCode": "EUR",
"centAmount": 10000
}
},
"quantity": 11,
"state": [
{
"quantity": 1,
"state": {
"typeId": "state",
"id": "a1cbc772-89e6-45c5-8425-1b2199746f0c"
}
}
]
}
],
"cartState": "Active",
"totalPrice": {
"currencyCode": "EUR",
"centAmount": 110000
},
"inventoryMode": "None",
"customLineItems": [
]
}
But when I try to set the cart as order it responses
{
"statusCode": 400,
"message": "The cart is missing a shipping address.",
"errors": [
{
"code": "InvalidOperation",
"message": "The cart is missing a shipping address."
}
]
}
smueller@Miami-2 ~/dev/src/google-glass-demo $ ./gradlew build --stacktrace connectedCheck
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/model/product/submodels/Value.java:18: error: cannot find symbol
private ConcreteValue value;
^
symbol: class ConcreteValue
location: class Value
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/model/product/submodels/Value.java:20: error: cannot find symbol
public ConcreteValue getValue() {
^
symbol: class ConcreteValue
location: class Value
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/model/product/submodels/Value.java:24: error: cannot find symbol
public void setValue(ConcreteValue value) {
^
symbol: class ConcreteValue
location: class Value
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/activities/ProductActivity.java:51: error: cannot find symbol
getMenuInflater().inflate(R.menu.product, menu);
^
symbol: variable product
location: class menu
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/activities/ProductActivity.java:59: error: cannot find symbol
getMenuInflater().inflate(R.menu.product, menu);
^
symbol: variable product
location: class menu
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/activities/ProductActivity.java:67: error: cannot find symbol
case R.id.prod_nav_buy:
^
symbol: variable prod_nav_buy
location: class id
/Users/smueller/dev/src/google-glass-demo/app/src/main/java/com/sphere/io/glass/activities/ProductActivity.java:70: error: cannot find symbol
case R.id.prod_nav_scan:
^
symbol: variable prod_nav_scan
location: class id
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
7 errors
:app:compileDebugJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJava'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:47)
at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:38)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:96)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:49)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:35)
at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)
at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:33)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:24)
at org.gradle.api.tasks.compile.Compile.performCompilation(Compile.java:165)
at org.gradle.api.tasks.compile.Compile.compile(Compile.java:153)
at org.gradle.api.tasks.compile.Compile.compile(Compile.java:87)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:236)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:223)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 46 more
BUILD FAILED
Total time: 6.232 secs
To avoid showing n/a
in the Merchant Center.
which tooling should we use to create QR codes? any experiences?
find the proper project_id
, client_id
/client_secret
values in the developer section of the merchant center:
https://admin.sphere.io/google-glass-demo/developers/clients
$ curl https://<client_id>:<client_secret>@auth.sphere.io/oauth/token -X POST -d "grant_type=client_credentials&scope=manage_project:<project_id>"
{"access_token":"XXXXXXXXXXXXX","token_type":"Bearer","expires_in":172800,"scope":"manage_project:google-glass-demo"}
Unencoded predicate used for querying
"masterData(current(masterVariant(sku=\"sku_MB_PREMIUM_TECH_T_variant1_1415189355070\")))"
$ curl "https://api.sphere.io/google-glass-demo/product-projections?where=masterVariant(sku%20%3D%20%22sku_MB_PREMIUM_TECH_T_variant1_1415189355070%22)%20or%20variants(sku%20%3D%20%22sku_MB_PREMIUM_TECH_T_variant1_1415189355070%22)" -H "Authorization: Bearer XXXXXXXXXXXXX"
{"offset":0,"count":1,"total":1,"results":[{"id":"f4d2cfe8-378a-4c55-b1a6-da02ac29fc7c","version":2,"productType":{"typeId":"product-type","id":"4c68efc5-e044-45d4-8408-eb127de8429b"},"name":{"en":"MB PREMIUM TECH T"},"description":{"en":"Sample description"},"categories":[{"typeId":"category","id":"03a6041a-7953-4dd0-9e03-2ac764520699"}],"slug":{"en":"mb-premium-tech-t1415189355070"},"masterVariant":{"id":1,"sku":"sku_MB_PREMIUM_TECH_T_variant1_1415189355070","prices":[{"value":{"currencyCode":"EUR","centAmount":10000}}],"images":[{"url":"https://www.commercetools.com/cli/data/253245821_1.jpg","dimensions":{"w":1400,"h":1400}}],"attributes":[]},"variants":[],"searchKeywords":{},"hasStagedChanges":false,"published":true,"taxCategory":{"typeId":"tax-category","id":"80aa5db7-c0a6-4590-a2ce-e8c8b7527d07"},"createdAt":"2014-11-05T12:09:15.090Z","lastModifiedAt":"2014-11-05T12:09:15.234Z"}]}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.