Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No such charge" errors with charge.dispute.funds_withdrawn #590

Open
blueyed opened this issue Sep 13, 2018 · 0 comments · Fixed by #591
Open

"No such charge" errors with charge.dispute.funds_withdrawn #590

blueyed opened this issue Sep 13, 2018 · 0 comments · Fixed by #591

Comments

@blueyed
Copy link
Contributor

blueyed commented Sep 13, 2018

charge.dispute.funds_withdrawn events get processed through the
ChargeWebhook, but that fails, because it tried to fetch dp_XXX as a charge.

Example event:

{
  "id": "evt_1D9mkxEsFcHZcT2Dtd91RhSB",
  "object": "event",
  "account": "acct_XXX",
  "api_version": "2017-08-15",
  "created": 1536814123,
  "data": {
    "object": {
      "id": "dp_XXX",
      "object": "dispute",
      "amount": 851,
      "balance_transaction": "txn_XXX",
      "balance_transactions": [
        {
          "id": "txn_XXX",
          "object": "balance_transaction",
          "amount": -851,
          "available_on": 1536796800,
          "created": 1536814122,
          "currency": "usd",
          "description": "Chargeback withdrawal for ch_XXX",
          "exchange_rate": null,
          "fee": 1500,
          "fee_details": [
            {
              "amount": 1500,
              "application": null,
              "currency": "usd",
              "description": "Dispute fee",
              "type": "stripe_fee"
            }
          ],
          "net": -2351,
          "source": "dp_XXX",
          "status": "available",
          "type": "adjustment"
        }
      ],
      "charge": "ch_XXX",
      "created": 1536814121,
      "currency": "usd",
      "evidence": {
        "access_activity_log": null,
        "billing_address": "\nUS",
        "cancellation_policy": null,
        "cancellation_policy_disclosure": null,
        "cancellation_rebuttal": null,
        "customer_communication": null,
        "customer_email_address": "bedreib@gmail.com",
        "customer_name": null,
        "customer_purchase_ip": "107.77.224.235",
        "customer_signature": null,
        "duplicate_charge_documentation": null,
        "duplicate_charge_explanation": null,
        "duplicate_charge_id": null,
        "product_description": null,
        "receipt": "file_1D9mkvEsFcHZcT2DXEvpPVh9",
        "refund_policy": null,
        "refund_policy_disclosure": null,
        "refund_refusal_explanation": null,
        "service_date": null,
        "service_documentation": null,
        "shipping_address": null,
        "shipping_carrier": null,
        "shipping_date": null,
        "shipping_documentation": null,
        "shipping_tracking_number": null,
        "uncategorized_file": null,
        "uncategorized_text": null
      },
      "evidence_details": {
        "due_by": 1537660799,
        "has_evidence": false,
        "past_due": false,
        "submission_count": 0
      },
      "is_charge_refundable": false,
      "livemode": true,
      "metadata": {},
      "reason": "duplicate",
      "status": "needs_response"
    }
  },
  "livemode": true,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "charge.dispute.created"
}
InvalidRequestError: Request req_XXX: No such charge: dp_XXX
  File "velodrome/lock8/utils.py", line 385, in ingest_stripe_event
    message=data)
  File "pinax/stripe/actions/events.py", line 39, in add_event
    webhook.process()
  File "pinax/stripe/webhooks.py", line 138, in process
    raise e
  File "pinax/stripe/webhooks.py", line 129, in process
    self.process_webhook()
  File "pinax/stripe/webhooks.py", line 248, in process_webhook
    stripe_account=self.event.stripe_account_stripe_id,
  File "pinax/stripe/actions/charges.py", line 170, in sync_charge
    retrieve(stripe_id, stripe_account=stripe_account)
  File "pinax/stripe/actions/charges.py", line 152, in retrieve
    expand=["balance_transaction"]
  File "stripe/api_resources/abstract/api_resource.py", line 13, in retrieve
    instance.refresh()
  File "stripe/api_resources/abstract/api_resource.py", line 17, in refresh
    self.refresh_from(self.request('get', self.instance_url()))
  File "stripe/stripe_object.py", line 207, in request
    response, api_key = requestor.request(method, url, params, headers)
  File "stripe/api_requestor.py", line 94, in request
    resp = self.interpret_response(rbody, rcode, rheaders)
  File "stripe/api_requestor.py", line 306, in interpret_response
    self.handle_error_response(rbody, rcode, resp.data, rheaders)
  File "stripe/api_requestor.py", line 119, in handle_error_response
    raise err
blueyed added a commit to blueyed/pinax-stripe that referenced this issue Sep 13, 2018
blueyed added a commit to blueyed/pinax-stripe that referenced this issue Sep 13, 2018
blueyed added a commit to blueyed/pinax-stripe that referenced this issue Sep 13, 2018
blueyed added a commit to blueyed/pinax-stripe that referenced this issue Sep 13, 2018
@blueyed blueyed reopened this Sep 13, 2018
@paltman paltman added this to the Next milestone Oct 9, 2018
@paltman paltman removed this from the Next milestone Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants