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

Stripe Payments: Failed payment attempts always marked as error

    Details

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

      Description

      StripePayments::processStoredCc() needs to be updated. It contains the following code block (starting around line 615):

              $payment = $this->handleApiRequest(
                  ['Stripe\PaymentIntent', 'create'],
                  [$charge],
                  $this->base_url . 'payment_intents - create'
              );
              $errors = $this->Input->errors();
      
              // Set whether there was an error
              $status = 'error';
              if (isset($payment->error) && $this->ifSet($payment->error->code) === 'card_declined') {
                  $status = 'declined';
              } elseif (!isset($payment->error)
                  && empty($errors)
                  && isset($payment->status)
                  && $payment->status === 'succeeded'
              ) {
                  $status = 'approved';
              } else {
                  $message = isset($payment->error) ? $this->ifSet($payment->error->message) : '';
              }
      

      The problem is that $payment->error will never be defined by the logic of handleApiRequest() so transactions are never marked as declined, always error. One consequence of this is that autodebit will continue to try and charge a card rather than disabling autodebit for the payment account.

        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.0.3 Sprint 1 [ 130 ]
        jonathan Jonathan Reissmueller made changes -
        Rank Ranked lower
        jonathan Jonathan Reissmueller made changes -
        Fix Version/s 5.0.3 [ 11707 ]
        Fix Version/s Short Term [ 10800 ]
        Assignee Jonathan Reissmueller [ jonathan ]
        jonathan Jonathan Reissmueller made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        jonathan Jonathan Reissmueller made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 2 hours, 3 minutes [ 7380 ]
        Worklog Id 14758 [ 14758 ]
        jonathan Jonathan Reissmueller 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:
            jonathan Jonathan Reissmueller
            Reporter:
            jonathan Jonathan Reissmueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              23/Feb/21

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours, 3 minutes
              2h 3m

                Agile