<commit_before>package main

import (
	"encoding/json"
	"koding/kodingemail"
	"socialapi/workers/payment/paymentwebhook/webhookmodels"
	"socialapi/workers/payment/stripe"
)

type stripeCustomerActionType func(*webhookmodels.StripeCustomer) error

func stripeCustomerDeleted(raw []byte, email *kodingemail.SG) error {
	actions := []stripeCustomerActionType{
		stripe.CustomerDeletedWebhook,
	}

	var req *webhookmodels.StripeCustomer

	err := json.Unmarshal(raw, &req)
	if err != nil {
		return err
	}

	for _, action := range actions {
		err := action(req)
		if err != nil {
			return err
		}
	}

	return nil
}<commit_msg>paymentwebhook: refactor stripe customer webhook listeners<commit_after>package main

import (
	"encoding/json"
	"koding/kodingemail"
	"socialapi/workers/payment/paymentwebhook/webhookmodels"
	"socialapi/workers/payment/stripe"
)

func stripeCustomerDeleted(raw []byte, _ *kodingemail.SG) error {
	var customer *webhookmodels.StripeCustomer

	err := json.Unmarshal(raw, &customer)
	if err != nil {
		return err
	}

	return stripe.CustomerDeletedWebhook(customer)
}
{'fraction_non_alphanumeric': 0.10773480662983426, 'fraction_numerical': 0.0, 'mean_word_length': 5.211428571428572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6000216', 'n_tokens_mistral': 379, 'n_tokens_neox': 360, 'n_words': 74}