Patreon access is now granted by tier instead of price paid
This commit is contained in:
@@ -68,8 +68,8 @@ if (
|
|||||||
Authorization: "Bearer " + accessToken,
|
Authorization: "Bearer " + accessToken,
|
||||||
},
|
},
|
||||||
qs: {
|
qs: {
|
||||||
"include": "memberships",
|
'include': 'memberships.currently_entitled_tiers',
|
||||||
"fields[member]": "currently_entitled_amount_cents",
|
'fields[tier]': 'amount_cents,title',
|
||||||
}
|
}
|
||||||
}, callback);
|
}, callback);
|
||||||
};
|
};
|
||||||
@@ -112,9 +112,18 @@ if (
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let identity = JSON.parse(body);
|
let identity = JSON.parse(body);
|
||||||
let membership = identity.included[0];
|
let entitledAmount = 0;
|
||||||
let entitledAmount = membership && membership.attributes
|
if (identity && identity.included){
|
||||||
.currently_entitled_amount_cents || 0;
|
identity.included.forEach(doc => {
|
||||||
|
if (
|
||||||
|
doc.type === 'tier' &&
|
||||||
|
doc.attributes &&
|
||||||
|
doc.attributes.amount_cents > entitledAmount
|
||||||
|
){
|
||||||
|
entitledAmount = doc.attributes.amount_cents;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
let patreonUserId = identity.data.id;
|
let patreonUserId = identity.data.id;
|
||||||
writeEntitledCentsAndId(userId, entitledAmount, patreonUserId);
|
writeEntitledCentsAndId(userId, entitledAmount, patreonUserId);
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
|
|||||||
Reference in New Issue
Block a user