From 38c398d932b87488355220e129533513806b87f5 Mon Sep 17 00:00:00 2001 From: Seth Sharp Date: Sun, 26 Nov 2023 16:35:14 +1000 Subject: [PATCH] wip --- app/Http/Controllers/ShowStoreController.php | 26 ++++++++ composer.json | 1 + composer.lock | 63 +++++++++++++++++++- resources/js/Pages/Store.vue | 34 +++++++++-- routes/web.php | 2 +- 5 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 app/Http/Controllers/ShowStoreController.php diff --git a/app/Http/Controllers/ShowStoreController.php b/app/Http/Controllers/ShowStoreController.php new file mode 100644 index 0000000..32f754e --- /dev/null +++ b/app/Http/Controllers/ShowStoreController.php @@ -0,0 +1,26 @@ +products->all(['limit' => 3]); + + foreach ($items->data as $item) { + $item['price'] = $stripe->prices->retrieve( + $item->default_price, + [] + )->unit_amount / 100; + } + + return Inertia::render('Store', [ + 'items' => $items + ]); + } +} diff --git a/composer.json b/composer.json index f780669..82d9d27 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "laravel/framework": "^10.10", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8", + "stripe/stripe-php": "^13.4", "tightenco/ziggy": "^1.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index caecd57..45fc76c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "09c4a553ccd3ef972392522bea4ca0cf", + "content-hash": "dda483c5bc5c294d445f2660ba095f5b", "packages": [ { "name": "brick/math", @@ -3165,6 +3165,65 @@ ], "time": "2023-04-15T23:01:58+00:00" }, + { + "name": "stripe/stripe-php", + "version": "v13.4.0", + "source": { + "type": "git", + "url": "https://github.com/stripe/stripe-php.git", + "reference": "ff0a56c75ff50b50ed97c45c02dfaa2dd341c5b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/ff0a56c75ff50b50ed97c45c02dfaa2dd341c5b1", + "reference": "ff0a56c75ff50b50ed97c45c02dfaa2dd341c5b1", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "3.5.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^5.7 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Stripe\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Stripe and contributors", + "homepage": "https://github.com/stripe/stripe-php/contributors" + } + ], + "description": "Stripe PHP Library", + "homepage": "https://stripe.com/", + "keywords": [ + "api", + "payment processing", + "stripe" + ], + "support": { + "issues": "https://github.com/stripe/stripe-php/issues", + "source": "https://github.com/stripe/stripe-php/tree/v13.4.0" + }, + "time": "2023-11-21T20:08:15+00:00" + }, { "name": "symfony/console", "version": "v6.3.4", @@ -8199,5 +8258,5 @@ "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/resources/js/Pages/Store.vue b/resources/js/Pages/Store.vue index 823b046..34ebf41 100644 --- a/resources/js/Pages/Store.vue +++ b/resources/js/Pages/Store.vue @@ -2,6 +2,10 @@ import { Head } from '@inertiajs/vue3' import PrimaryLayout from '@/Layouts/PrimaryLayout.vue' import Section from '@/Components/Section.vue' + +defineProps({ + items: Object, +})