Handle deleted customer.

@param  array $payload
@return \Symfony\Component\HttpFoundation\Response
423851
protected function handleCustomerDeleted(array $payload)
    {
        $user = $this->getUserByStripeId($payload['data']['object']['id']);

        if ($user) {
            $user->subscriptions->each(function (Subscription $subscription) {
                $subscription->skipTrial()->markAsCancelled();
            });

            $user->forceFill([
                'stripe_id' => null,
                'trial_ends_at' => null,
                'card_brand' => null,
                'card_last_four' => null,
            ])->save();
        }

        return new Response('Webhook Handled', 200);
    }
266180
public static function createPostbackEvent(array $payload)
    {
        $postback = Postback::create($payload['postback']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new PostbackEvent($senderId, $recipientId, $timestamp, $postback);
    }
1136456
public function process($payload) {
        $result = $this->convertToObject($payload, true);

        return $this->processPayload($result);
    }
945990
public function delete($object)
	{
		$deleted = $object->delete();

		if( ! $deleted)
		{
			return new Payload($object, 'not_deleted');
		}

		// Remove the deleted model from cache.
		Cache::tags($this->model->getTable())->flush($updated->getKey());

		return new Payload(null, 'deleted');
	}
341079
function post($payload)
    {
        $this->requestDecorator->setPayload($payload);
        $result = $this->client->post($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
        $this->refresh();
        return $result;
    }
268316
public function pay($endpoint, array $payload): RedirectResponse
    {
        $payload['trade_type'] = $this->getTradeType();

        Events::dispatch(Events::PAY_STARTED, new Events\PayStarted('Wechat', 'Wap', $endpoint, $payload));

        $mweb_url = $this->preOrder($payload)->get('mweb_url');

        $url = is_null(Support::getInstance()->return_url) ? $mweb_url : $mweb_url.
                        '&redirect_url='.urlencode(Support::getInstance()->return_url);

        return RedirectResponse::create($url);
    }
191572
public function handle($payload = null)
    {
        if ($decrypted = $this->app['request']->get('echostr')) {
            $str = $this->app['encryptor_corp']->decrypt(
                $decrypted,
                $this->app['request']->get('msg_signature'),
                $this->app['request']->get('nonce'),
                $this->app['request']->get('timestamp')
            );

            return new FinallyResult($str);
        }
        //把SuiteTicket缓存起来
        if (!empty($payload['SuiteTicket'])) {
            $this->app['suite_ticket']->setTicket($payload['SuiteTicket']);
        }
    }
588654
public function deleteUser($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            $member=Member::get()->filter('ID', intval($data->id))->filter('ID:not', Member::currentUserID())->First();
            if(!empty($member) && $member!==false && $member->ID!=0) {
                $member->delete();
            }
            
            $response['status']='HELO';
            $response['message']=_t('CodeBankAPI.USER_DELETED', '_User deleted successfully');
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
124754
public function process($payload)
    {
        foreach ($this->stages as $stage) {
            $payload = call_user_func($stage, $payload);
        }
        return $payload;
    }
986211
public function deleteCustomer($customer_id)
    {
        list($response, $statusCode, $httpHeader) = $this->deleteCustomerWithHttpInfo ($customer_id);
        return $response; 
    }
530386
def delete_customer(self, customer_id):
        """"""
        request = self._delete("customers/" + str(customer_id))
        return self.responder(request)
219165
protected function callHandler(callable $handler, $payload)
    {
        try {
            return $handler($payload);
        } catch (\Exception $e) {
            if (property_exists($this, 'app') && $this->app instanceof ServiceContainer) {
                $this->app['logger']->error($e->getCode().': '.$e->getMessage(), [
                    'code' => $e->getCode(),
                    'message' => $e->getMessage(),
                    'file' => $e->getFile(),
                    'line' => $e->getLine(),
                ]);
            }
        }
    }
1102998
public function deleteCustomer($id)
    {
        try {
            $response = $this->client->delete('/api/v1/customers/'.$id, array(
                'auth' => $this->auth,
            ));
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        } catch (RequestException $e) {
            return new Response($e->getCode(), $e->getMessage());
        }

        return new Response($response->getStatusCode(), $response->getReasonPhrase());
    }
337251
public function process(array $pipes, $payload)
    {
        foreach ($pipes as $pipe) {
            $payload = $this->resolvePipe($pipe, $payload);
        }

        return $payload;
    }
1074041
public function trigger(Payload $payload)
    {
        if (!$this->command) {
            return $this->targetState();
        }

        return call_user_func($this->command, $payload) ? $this->targetState() : $this->errorState();
    }
1291758
protected function resetAttempts($payload)
	{
		$payload = json_decode($payload, true);

		if (isset($payload['attempts'])) {
			$payload['attempts'] = 1;
		}

		return json_encode($payload);
	}
1073341
public function deleteCustomer($customerId)
    {
        $requestData = new Delete\RequestData($customerId);
        $request = new Delete\Request($requestData);

        return $this->sendRequest($request, Delete\ApiResponse::class);
    }