Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Download URL not generating #122

Closed
Afan417 opened this issue May 16, 2023 · 1 comment · Fixed by #123
Closed

Download URL not generating #122

Afan417 opened this issue May 16, 2023 · 1 comment · Fixed by #123
Labels
bug Something isn't working (only for confirmed bugs)

Comments

@Afan417
Copy link

Afan417 commented May 16, 2023

Description

After upgrading to Simple Commerce & SC Digital Products to 5.0 from 4.0, when confirming a order payment, it doesn't create a metadata: download_url

CP Product (I have added a .zip file and made the asset downloadable):

Screenshot 2023-05-16 at 13 29 21

My current config, this is how I add the product to the cart:

Screenshot 2023-05-16 at 13 30 17

afterwards on Checkout page with Stripe:

{{ sc:checkout id="checkout-form" redirect="/checkout/thanks" }}

{{ if {sc:cart:rawGrandTotal} !== 0 }}
                                <!-- Stripe Elements -->
                                <script src="https://js.stripe.com/v3/"></script>
                                <script>
                                    let stripe = Stripe('{{ stripe:config:key }}')
                                    let elements = stripe.elements()

                                    const card = elements.create('cardNumber')
                                    card.mount('#card-details', {
                                        placeholder: '',
                                    })

                                    const cardExpiry = elements.create('cardExpiry')
                                    cardExpiry.mount('#card-expiry', {
                                        placeholder: '',
                                    })

                                    const cardCvc = elements.create('cardCvc')
                                    cardCvc.mount('#card-cvc', {
                                        placeholder: '',
                                    })

                                    document.getElementById('checkout-form').addEventListener('submit', (e) => {
                                        e.preventDefault()

                                        document.getElementById('checkout-submit-button').disabled = true

                                        stripe
                                            .confirmCardPayment('{{ stripe:client_secret }}', {
                                                payment_method: {
                                                    card: card,
                                                    billing_details: {
                                                        name: document.getElementById('name-on-card').value,
                                                    },
                                                },
                                            })
                                            .then((result) => {
                                                if (result.paymentIntent.status === 'succeeded') {
                                                    document.getElementById('stripePaymentMethod').value =
                                                        result
                                                        .paymentIntent.payment_method
                                                    document.getElementById('checkout-form').submit()
                                                } else if (result.error) {
                                                    alert("There was an issue processing your payment: " +
                                                        result
                                                        .error)

                                                    document.getElementById('checkout-submit-button')
                                                        .disabled = false
                                                }
                                            })
                                            .catch((error) => {
                                                alert(
                                                    `Sorry, there was an issue with the payment details you provided.`)

                                                document.getElementById('checkout-submit-button').disabled =
                                                    false
                                            })
                                    })
                                </script>
                            {{ /if }}
{{ /sc:checkout }}

then the payment is confirmed and I redirect to a checkout page, in the old 4.0 version it used to generate a download_url, however on 5.0 it doesn't generate anything for me to download, here is the order in CP after successful payment:

Screenshot 2023-05-16 at 13 29 47

the .md file:

...
items:
  -
    id: d1f8a913-67f9-4c9f-9cf2-a7e8128fc137
    product: 8f4a0ed7-396a-49a3-939c-00882e0ddafb
    variant: null
    quantity: 1
    total: 2995
    tax:
      amount: 0
      rate: 0
      price_includes_tax: false
    metadata: {  } -> this is empty

Steps to reproduce

  1. Upgrade SC to 5.0
  2. Upgrade SC Digital Products to 5.0
  3. Add product to cart then checkout

Environment

Environment
Application Name: Statamic
Laravel Version: 10.10.1
PHP Version: 8.2.6
Composer Version: 2.5.5
Environment: local
Debug Mode: ENABLED
URL: chillidogsoftware.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Simple Commerce
Currencies: GBP
Gateways: Stripe
Repository: Customer: DoubleThreeDigital\SimpleCommerce\Customers\UserCustomerRepository
Repository: Order: DoubleThreeDigital\SimpleCommerce\Orders\EntryOrderRepository
Repository: Product: DoubleThreeDigital\SimpleCommerce\Products\EntryProductRepository
Shipping Methods: Free Shipping
Tax Engine: DoubleThreeDigital\SimpleCommerce\Tax\Standard\TaxEngine

Statamic
Addons: 2
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.1.0 PRO

Statamic Addons
doublethreedigital/sc-digital-products: 5.0.0
doublethreedigital/simple-commerce: 5.0.0
@Afan417 Afan417 added the bug Something isn't working (only for confirmed bugs) label May 16, 2023
@github-actions
Copy link

Released as part of v5.0.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working (only for confirmed bugs)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant