From 4c7ecbee83950e5f9f2482cedaab18a1ac9bfc9e Mon Sep 17 00:00:00 2001
From: Benjamin Bellamy <ben@podlibre.org>
Date: Sun, 20 Dec 2020 12:31:40 +0100
Subject: [PATCH] feat(rss): update monetization tag so that it meets
 PodcastIndex requirements

---
 app/Helpers/rss_helper.php | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/Helpers/rss_helper.php b/app/Helpers/rss_helper.php
index a00a2b5e2f..e1e8e8670a 100644
--- a/app/Helpers/rss_helper.php
+++ b/app/Helpers/rss_helper.php
@@ -67,11 +67,19 @@ function get_rss_feed($podcast, $serviceSlug = '')
     $channel->addChild('language', $podcast->language_code);
 
     if (!empty($podcast->payment_pointer)) {
-        $channel->addChild(
-            'monetization',
-            $podcast->payment_pointer,
+        $valueElement = $channel->addChild('value', null, $podcast_namespace);
+        $valueElement->addAttribute('type', 'webmonetization');
+        $valueElement->addAttribute('method', '');
+        $valueElement->addAttribute('suggested', '');
+        $recipientElement = $valueElement->addChild(
+            'valueRecipient',
+            null,
             $podcast_namespace
         );
+        $recipientElement->addAttribute('name', $podcast->owner_name);
+        $recipientElement->addAttribute('type', 'ILP');
+        $recipientElement->addAttribute('address', $podcast->payment_pointer);
+        $recipientElement->addAttribute('split', 100);
     }
     $channel
         ->addChild(
-- 
GitLab