def getTimestamp = System.currentTimeMillis()

in handlers/stripe-webhook-endpoints/src/main/scala/com/gu/paymentIntentIssues/Local.scala [50:245]


  def getTimestamp = System.currentTimeMillis() / 1000L

  def getJson(timestamp: Long) = s"""
{
  "id": "evt_2JPS0AItVxyc3Q6n1kS8z3uw",
  "object": "event",
  "api_version": "2019-08-14",
  "created": ${timestamp},
  "data": {
    "object": {
      "id": "pi_2JPS0AItVxyc3Q6n1Eai3ExG",
      "object": "payment_intent",
      "amount": 500,
      "amount_capturable": 0,
      "amount_received": 0,
      "application": "ca_InA7dYYPZTUPuEBolrjvtCzbkivYpfeM",
      "application_fee_amount": null,
      "canceled_at": null,
      "cancellation_reason": null,
      "capture_method": "automatic",
      "charges": {
        "object": "list",
        "data": [
          {
            "id": "py_2JPS0AItVxyc3Q6n1O3eyhB5",
            "object": "charge",
            "amount": 500,
            "amount_captured": 500,
            "amount_refunded": 0,
            "application": "ca_InA7dYYPZTUPuEBolrjvtCzbkivYpfeM",
            "application_fee": null,
            "application_fee_amount": null,
            "balance_transaction": null,
            "billing_details": {
              "address": {
                "city": null,
                "country": null,
                "line1": null,
                "line2": null,
                "postal_code": null,
                "state": null
              },
              "email": "mr.test@guardian.co.uk",
              "name": "mr test",
              "phone": null
            },
            "calculated_statement_descriptor": null,
            "captured": true,
            "created": 1629205606,
            "currency": "eur",
            "customer": "cus_K3Z8s1gjto6COh",
            "description": null,
            "destination": null,
            "dispute": null,
            "disputed": false,
            "failure_code": null,
            "failure_message": null,
            "fraud_details": {
            },
            "invoice": null,
            "livemode": false,
            "metadata": {
              "zpayment_number": "P-00126890"
            },
            "on_behalf_of": null,
            "order": null,
            "outcome": {
              "network_status": "approved_by_network",
              "reason": null,
              "risk_level": "not_assessed",
              "seller_message": "Payment complete.",
              "type": "authorized"
            },
            "paid": false,
            "payment_intent": "pi_2JPS0AItVxyc3Q6n1Eai3ExG",
            "payment_method": "pm_0JPS09ItVxyc3Q6n4YxpwZAp",
            "payment_method_details": {
              "sepa_debit": {
                "bank_code": "19043",
                "branch_code": null,
                "country": "AT",
                "fingerprint": "vUIITsFzpDpkeigs",
                "last4": "3202",
                "mandate": "mandate_0JPS09ItVxyc3Q6nbjCRwVCD"
              },
              "type": "sepa_debit"
            },
            "receipt_email": null,
            "receipt_number": null,
            "receipt_url": null,
            "refunded": false,
            "refunds": {
              "object": "list",
              "data": [
              ],
              "has_more": false,
              "total_count": 0,
              "url": "/v1/charges/py_2JPS0AItVxyc3Q6n1O3eyhB5/refunds"
            },
            "review": null,
            "shipping": null,
            "source": null,
            "source_transfer": null,
            "statement_descriptor": null,
            "statement_descriptor_suffix": null,
            "status": "failed",
            "transfer_data": null,
            "transfer_group": null
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/charges?payment_intent=pi_2JPS0AItVxyc3Q6n1Eai3ExG"
      },
      "client_secret": "pi_2JPS0AItVxyc3Q6n1Eai3ExG_secret_APuLtVwJ5tvymrq7jbBQY6VEv",
      "confirmation_method": "automatic",
      "created": 1629205606,
      "currency": "eur",
      "customer": "cus_K3Z8s1gjto6COh",
      "description": null,
      "invoice": null,
      "last_payment_error": {
        "code": "payment_intent_payment_attempt_failed",
        "doc_url": "https://stripe.com/docs/error-codes/payment-intent-payment-attempt-failed",
        "message": "The payment failed.",
        "payment_method": {
          "id": "pm_0JPS09ItVxyc3Q6n4YxpwZAp",
          "object": "payment_method",
          "billing_details": {
            "address": {
              "city": null,
              "country": null,
              "line1": null,
              "line2": null,
              "postal_code": null,
              "state": null
            },
            "email": "mr.test@guardian.co.uk",
            "name": "mr test",
            "phone": null
          },
          "created": 1629205605,
          "customer": "cus_K3Z8s1gjto6COh",
          "livemode": false,
          "metadata": {
          },
          "sepa_debit": {
            "bank_code": "19043",
            "branch_code": "",
            "country": "AT",
            "fingerprint": "vUIITsFzpDpkeigs",
            "generated_from": {
              "charge": null,
              "setup_attempt": null
            },
            "last4": "3202"
          },
          "type": "sepa_debit"
        },
        "type": "invalid_request_error"
      },
      "level3": null,
      "livemode": false,
      "metadata": {
        "zpayment_number": "P-00126890"
      },
      "next_action": null,
      "on_behalf_of": null,
      "payment_method": null,
      "payment_method_options": {
        "sepa_debit": {
        }
      },
      "payment_method_types": [
        "sepa_debit"
      ],
      "receipt_email": null,
      "review": null,
      "setup_future_usage": null,
      "shipping": null,
      "source": null,
      "statement_descriptor": null,
      "statement_descriptor_suffix": null,
      "status": "requires_payment_method",
      "transfer_data": null,
      "transfer_group": null
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "payment_intent.payment_failed"
}