Repository: dj-stripe/dj-stripe

Issue:
Add support for other Payment Methods (enum)
**Is your request related to a problem? Please describe.**
The [`PaymentMethodType`](https://github.com/dj-stripe/dj-stripe/blob/8d9a05daac2c4b2eb5c87e4249b9618b824ca901/djstripe/enums.py#L490) enum is only limited to basic methods. Accessing a `Charge` object (for example) with non-supported value (e.g. `customer_balance`) from Django admin will throw a `KeyError`.

**Describe the solution you'd like**
Add all the Stripe-supported payment methods. A detailed example is in https://stripe.com/docs/api/errors#errors-payment_method-type ~~(there's probably more somewhere)~~

EDIT: Found the same list here: https://stripe.com/docs/api/payment_methods/object#payment_method_object-type


**Additional context**
<!-- Add any other context about the request here. -->

Accessing an object in the `Charges` table in Django admin will throw a similar error below if enum is not supported

```
KeyError: 'customer_balance'
  File "django/core/handlers/base.py", line 204, in _get_response
    response = response.render()
  File "django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "django/template/response.py", line 83, in rendered_content
    return template.render(context, self._request)
  File "django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "django/template/base.py", line 170, in render
    return self._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 214, in render
    nodelist.append(node.render_annotated(context))
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/loader_tags.py", line 195, in render
    return template.render(context)
  File "django/template/base.py", line 172, in render
    return self._render(context)
  File "django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 214, in render
    nodelist.append(node.render_annotated(context))
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 214, in render
    nodelist.append(node.render_annotated(context))
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 315, in render
    return nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/defaulttags.py", line 315, in render
    return nodelist.render(context)
  File "django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "django/template/base.py", line 994, in render
    return render_value_in_context(output, context)
  File "django/template/base.py", line 973, in render_value_in_context
    value = str(value)
  File "django/utils/html.py", line 376, in <lambda>
    klass.__str__ = lambda self: mark_safe(klass_str(self))
  File "django/forms/boundfield.py", line 34, in __str__
    return self.as_widget()
  File "django/forms/boundfield.py", line 93, in as_widget
    return widget.render(
  File "django/forms/widgets.py", line 246, in render
    context = self.get_context(name, value, attrs)
  File "django/contrib/admin/widgets.py", line 156, in get_context
    context['link_label'], context['link_url'] = self.label_and_url_for_value(value)
  File "django/contrib/admin/widgets.py", line 192, in label_and_url_for_value
    return Truncator(obj).words(14), url
  File "django/utils/text.py", line 131, in words
    self._setup()
  File "django/utils/functional.py", line 382, in _setup
    self._wrapped = self._setupfunc()
  File "django/utils/text.py", line 65, in <lambda>
    super().__init__(lambda: str(text))
  File "djstripe/models/payment_methods.py", line 870, in __str__
    return f"{enums.PaymentMethodType.humanize(self.type)} is not associated with any customer"
  File "djstripe/enums.py", line 10, in _human_enum_values
    return cls.__choices__[enum]
```



Discussion:

Resolving patch:
diff --git a/djstripe/enums.py b/djstripe/enums.py
--- a/djstripe/enums.py
+++ b/djstripe/enums.py
@@ -491,25 +491,34 @@ class SetupIntentStatus(Enum):
 
 class PaymentMethodType(Enum):
     acss_debit = _("Acss Dbit")
+    affirm = _("Affirm")
     afterpay_clearpay = _("Afterpay Clearpay")
     alipay = _("Alipay")
     au_becs_debit = _("BECS Debit (Australia)")
     bacs_debit = _("Bacs Direct Debit")
     bancontact = _("Bancontact")
+    blik = _("BLIK")
     boleto = _("Boleto")
     card = _("Card")
     card_present = _("Card present")
+    customer_balance = _("Customer Balance")
     eps = _("EPS")
     fpx = _("FPX")
     giropay = _("Giropay")
     grabpay = _("Grabpay")
     ideal = _("iDEAL")
-    klarna = _("Klarna")
     interac_present = _("Interac (card present)")
+    klarna = _("Klarna")
+    konbini = _("Konbini")
+    link = _("Link")
     oxxo = _("OXXO")
     p24 = _("Przelewy24")
+    paynow = _("PayNow")
+    pix = _("Pix")
+    promptpay = _("PromptPay")
     sepa_debit = _("SEPA Direct Debit")
     sofort = _("SOFORT")
+    us_bank_account = _("ACH Direct Debit")
     wechat_pay = _("Wechat Pay")
 
 


Test patch: