Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-4832

Stripe Payments: Fatal error on payment error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.6.1
    • Component/s: None
    • Labels:
      None

      Description

      Error: Cannot use object of type stdClass as array #0 /components/gateway_payments/gateway_payments.php(755): StripePayments->processStoredCc()

      I haven't reproduced personally yet but my understanding is that this would occur on a declined payment

        Activity

        jonathan Jonathan Reissmueller created issue -
        jonathan Jonathan Reissmueller made changes -
        Field Original Value New Value
        Rank Ranked higher
        jonathan Jonathan Reissmueller made changes -
        Sprint 5.7.0 Sprint 4 [ 173 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked higher
        Hide
        jonathan Jonathan Reissmueller added a comment -

        This may be a bit excessive but this is one solution.

        In components/gateways/merchant/stripe_payments/stripe_payments.php around line 707 change:

                if (isset($payment['error'])
                    && (isset($payment['error']['code']) ? $payment['error']['code'] : null) === 'card_declined'
                ) {
                    $status = 'declined';
                } elseif (!isset($payment->error)
                    && empty($errors)
                    && isset($payment->status)
                    && $payment->status === 'succeeded'
                ) {
                    $status = 'approved';
                } else {
                    $message = isset($payment->error)
                        ? (isset($payment->error->message) ? $payment->error->message : null)
                        : (isset($payment['error']['message']) ? $payment['error']['message'] : '');
                }
        

        To

                if ((is_array($payment)
                        && isset($payment['error'])
                        && (isset($payment['error']['code']) ? $payment['error']['code'] : null) === 'card_declined'
                    ) || (is_object($payment)
                        && isset($payment->error)
                        && (isset($payment->error->code) ? $payment->error->code : null) === 'card_declined'
                    )
                ) {
                    $status = 'declined';
                } elseif (!isset($payment->error)
                    && empty($errors)
                    && isset($payment->status)
                    && $payment->status === 'succeeded'
                ) {
                    $status = 'approved';
                } else {
                    $message = (is_object($payment) && isset($payment->error))
                        ? (isset($payment->error->message) ? $payment->error->message : null)
                        : ((is_array($payment) && isset($payment['error']['message'])) ? $payment['error']['message'] : null);
                }
        
        Show
        jonathan Jonathan Reissmueller added a comment - This may be a bit excessive but this is one solution. In components/gateways/merchant/stripe_payments/stripe_payments.php around line 707 change: if (isset($payment['error']) && (isset($payment['error']['code']) ? $payment['error']['code'] : null ) === 'card_declined' ) { $status = 'declined'; } elseif (!isset($payment->error) && empty($errors) && isset($payment->status) && $payment->status === 'succeeded' ) { $status = 'approved'; } else { $message = isset($payment->error) ? (isset($payment->error->message) ? $payment->error->message : null ) : (isset($payment['error']['message']) ? $payment['error']['message'] : ''); } To if ((is_array($payment) && isset($payment['error']) && (isset($payment['error']['code']) ? $payment['error']['code'] : null ) === 'card_declined' ) || (is_object($payment) && isset($payment->error) && (isset($payment->error->code) ? $payment->error->code : null ) === 'card_declined' ) ) { $status = 'declined'; } elseif (!isset($payment->error) && empty($errors) && isset($payment->status) && $payment->status === 'succeeded' ) { $status = 'approved'; } else { $message = (is_object($payment) && isset($payment->error)) ? (isset($payment->error->message) ? $payment->error->message : null ) : ((is_array($payment) && isset($payment['error']['message'])) ? $payment['error']['message'] : null ); }
        jonathan Jonathan Reissmueller made changes -
        Description {quote}Error: Cannot use object of type stdClass as array #0 /components/gateway_payments/gateway_payments.php(755): StripePayments->processStoredCc(){quote}
        {quote}Error: Cannot use object of type stdClass as array #0 /components/gateway_payments/gateway_payments.php(755): StripePayments->processStoredCc(){quote}

        I haven't reproduced personally yet but my understanding is that this would occur on a declined payment
        abdy Abdy Franco made changes -
        Assignee Abdy Franco [ abdy ]
        abdy Abdy Franco made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        abdy Abdy Franco made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 58 minutes [ 3480 ]
        Worklog Id 16114 [ 16114 ]
        abdy Abdy Franco made changes -
        Status In Progress [ 3 ] In Review [ 5 ]
        Resolution Fixed [ 1 ]
        jonathan Jonathan Reissmueller made changes -
        Status In Review [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            abdy Abdy Franco
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              18/Jan/23

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 58 minutes
              58m

                Agile