Skip to content

Instantly share code, notes, and snippets.

@theredpea
Last active October 30, 2022 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theredpea/e790ae6ce3db4d4c32f28fec4736e6cd to your computer and use it in GitHub Desktop.
Save theredpea/e790ae6ce3db4d4c32f28fec4736e6cd to your computer and use it in GitHub Desktop.
alert(`Hello Nate! Hope today's Beerfest was a success. So Elizabeth Johnson had signed up for a monthly membership but was double billed for both June and July for a total of $70. Can we reimburse her? Her Venmo account is @E.Johnson-2496. Thanks. Can you verify that she has cancelled her monthly membership? She now would like to pay month to month.`);
// club.spond.com
///=============================
///=============================
///=============================
///=============================
const squid_spond_clubid = "39004B1375F244F4AFECC14513031501"
const fetch_opts = {
"credentials": "include",
"mode": "cors",
};
const spond_headers = {
"x-spond-clubid": squid_spond_clubid,
"x-spond-membershipauth": "undefined",
"content-type": "application/json",
// ...application_json
};
const DENVER_SQUID_PRACTICES_GROUP = {
"groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
"subGroups": [
"4498F709819B45F29461271877229AD5",
"360ED40AB00A4A1B98DF7BE6DFC64AF0",
"95C722BDE6984ED0BC323CD1882B9FC6",
"98005CFF95EB438AB48241EAB5889BC4"
],
"respondent": true,
"roles": []
};
// https://spond.com/api/2.1/sponds/upcoming
// fetch("https://spond.com/api/2.1/sponds?includeComments=true&includeHidden=false&addProfileInfo=true&scheduled=true&order=asc&max=15&minEndTimestamp=2022-10-30T06:00:00.001Z", {
// "headers": spond_headers,
// "referrer": "https://spond.com/client/groups/5A1C0677D3C941C484FDB16C43AA80BA",
// "referrerPolicy": "strict-origin-when-cross-origin",
// "body": null,
// "method": "GET",
// "mode": "cors",
// "credentials": "include"
// });
// fetch("https://spond.com/api/2.1/sponds?includeComments=true&includeHidden=true&addProfileInfo=true&scheduled=true&order=asc&max=20&groupId=5A1C0677D3C941C484FDB16C43AA80BA&minEndTimestamp=2022-10-30T06:00:00.001Z", {
// "headers": spond_headers,
// "referrer": "https://spond.com/client/groups/5A1C0677D3C941C484FDB16C43AA80BA",
// "referrerPolicy": "strict-origin-when-cross-origin",
// "body": null,
// "method": "GET",
// "mode": "cors",
// "credentials": "include"
// });
// spond-web-client-script.js:formatted
// SpondAttendanceSelectorController
// submit:
let group_attendance_list = await fetch(`https://spond.com/api/2.1/search/groups/${DENVER_SQUID_PRACTICES_GROUP.groupId}/sponds?expired=false&fromTimestamp=2019-01-01`, {
"headers": spond_headers,
...fetch_opts
}).then(_ => _.json());
let exportAttendanceBody = { spondIds: group_attendance_list.map(_ => _.spondId) };
/*
angular.module("common.utils.fileUtil", []).factory("fileUtil", ["$http", function(e) {
var t = {
"saveBlobResponse": function(e) {
*/
const saveBlobResponse = async function (e) {
const blob_data = await e.blob();
var t = e.headers.get("Content-Type")
, n = e.headers.get("Content-Disposition")
, r = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(n)
, o = "";
null != r && r[1] && (o = r[1].replace(/['"]/g, ""));
// const l = URL.createObjectURL(blob);
const file = new File([blob_data], o, {
"type": t
});
var c = new FileReader;
c.onload = function (e) {
window.location.href = c.result
}
,
c.readAsDataURL(file);
// if (o) {
// var u = document.createElement("a");
// // _.isUndefined(u.download) ? window.location = l : (u.href = l,
// u.download===undefined ? window.location = l : (u.href = l,
// u.download = o,
// document.body.appendChild(u),
// u.click())
// } else
// window.location = l;
// URL.revokeObjectURL(l)
// var i, a = !_.isUndefined(window.navigator.msSaveBlob), s = window.navigator.userAgent.indexOf("iPhone") || window.navigator.userAgent.indexOf("iPad");
// if (i = angular.isFunction(File) && !a ? new File([e.data],o,{
// "type": t
// }) : new Blob([e.data],{
// "type": t
// }),
// a)
// window.navigator.msSaveBlob(i, o);
// else if (s) {
// var c = new FileReader;
// c.onload = function(e) {
// window.location.href = c.result
// }
// ,
// c.readAsDataURL(i)
// } else {
// window.URL || window.webkitURL;
// var l = URL.createObjectURL(i);
// if (o) {
// var u = document.createElement("a");
// _.isUndefined(u.download) ? window.location = l : (u.href = l,
// u.download = o,
// document.body.appendChild(u),
// u.click())
// } else
// window.location = l;
// URL.revokeObjectURL(l)
// }
}
let export_attendance_result = await fetch(`https://spond.com/api/2.1/group/${DENVER_SQUID_PRACTICES_GROUP.groupId}/exportAttendance`, {
"headers": spond_headers,
...fetch_opts,
"body": JSON.stringify(exportAttendanceBody),
// "body": "{\"spondIds\":[\"FD8896A44ADE4D5B90BB7DA3EC83407D\",...\"414B9C17C357413C811AE51C71F53E59\",\"2FAC63868F254F6FBD6C88DB5519AFEE\"]}",
"method": "POST",
}).then(saveBlobResponse);
// to get payments
//---------------------------------------------v
fetch("https://spond.com/api/2.1/posts?type=PAYMENT&includeComments=true&includeReadStatus=true&includeSeenCount=true&max=10&groupId=5A1C0677D3C941C484FDB16C43AA80BA", {
"headers": spond_headers,
...fetch_opts,
});
// response:
// [
// {
// "id": "8D6F94A0149D4103A4DBED666DDCAE57",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:18:43.464Z",
// "attachments": [],
// "payment": {
// "id": "34BA400A61C3473C8DAF9EB4EC8B325F",
// "title": "DENVER SQUID September 2022 INVOICE - Monthly Membership Di",
// "description": "This invoice reflects that you have met or exceeded (6) practices attended with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022 and have qualified for our membership tier, which means you pay a flat fee of $45 with discounts! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com.",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 4500,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 1,
// "muted": false
// },
// {
// "id": "03EF25B762194EF990FED9FE53621E90",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:17:17.755Z",
// "attachments": [],
// "payment": {
// "id": "26E624832ACB4B84AAA20F976758D2D8",
// "title": "DENVER SQUID September 2022 INVOICE - $10",
// "description": "This invoice reflects that you have attended (1) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022, which means you pay a fee of $10! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 1000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 5,
// "muted": false
// },
// {
// "id": "5FA0AD0A3D7A488E99DBA4FC32F2E4D0",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:12:43.923Z",
// "attachments": [],
// "payment": {
// "id": "F37B51ED0AC0420B8BA3FD194A5A05E6",
// "title": "DENVER SQUID September 2022 INVOICE - $20",
// "description": "This invoice reflects that you have attended (2) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022, which means you pay a fee of $20! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 2000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 4,
// "muted": false
// },
// {
// "id": "F5A8C4F538BC4CD5A045F3F1133C8DCE",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:10:17.911Z",
// "attachments": [],
// "payment": {
// "id": "484654F3EBBC4BB0AE3591743BDD3F69",
// "title": "DENVER SQUID September 2022 INVOICE- $30",
// "description": "This invoice reflects that you have attended (3) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022, which means you pay a fee of $30! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 3000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 9,
// "muted": false
// },
// {
// "id": "98BAA4AB18C440EBA6C718E22FC9E5A0",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:06:47.063Z",
// "attachments": [],
// "payment": {
// "id": "672DD5F1F6D3495299045E4FCCD79648",
// "title": "DENVER SQUID September 2022 INVOICE- $40",
// "description": "This invoice reflects that you have attended (4) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022, which means you pay a fee of $40! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 4000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [
// "3E415362E9274F31BC0B2C6A422DEA47"
// ],
// "respondents": [
// {
// "memberId": "3E415362E9274F31BC0B2C6A422DEA47",
// "response": "paid",
// "summary": {
// "price": 4000,
// "products": []
// },
// "totalPaid": 4000
// }
// ]
// },
// "unread": true,
// "seenCount": 4,
// "muted": false
// },
// {
// "id": "697D0ED68E84402DB505E1E08B6486B6",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T17:01:55.924Z",
// "attachments": [],
// "payment": {
// "id": "C1685DE0F8D7421B81EE5692EF32C06D",
// "title": "DENVER SQUID September 2022 INVOICE- $50",
// "description": "This invoice reflects that you have attended (5) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022, which means you pay a fee of $50! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 5000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 4,
// "muted": false
// },
// {
// "id": "A1A276E2186341A1ABC3CC2EC4FF4680",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-10-10T16:59:13.949Z",
// "attachments": [],
// "payment": {
// "id": "D5B7803A982349899DCC109128E4C5BA",
// "title": "DENVER SQUID September 2022 INVOICE - Monthly Membership",
// "description": "This invoice reflects that you have met or exceeded (6) practices attended with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022 and have qualified for our membership tier, which means you pay a flat fee of $60! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 6000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": true,
// "seenCount": 16,
// "muted": false
// },
// {
// "id": "EB73CBAEAF0D4CBCA5B2F1B49DF3242F",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-09-06T20:04:03.373Z",
// "attachments": [],
// "payment": {
// "id": "6376E924C4B84FB4A31117B65DEF7074",
// "title": "DENVER SQUID August 2022 INVOICE - Monthly Membership Disco",
// "description": "This invoice reflects that you have met or exceeded (6) practices attended with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of August 2022 and have qualified for our membership tier, which means you pay a flat fee of $45 with discounts! Please pay by 9/23/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com.",
// "dueBy": "2022-09-24T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 4500,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": false,
// "seenCount": 2,
// "muted": false
// },
// {
// "id": "5DDDFCCA6511488E8D08BB5DF8AC1299",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-09-06T20:02:18.519Z",
// "attachments": [],
// "payment": {
// "id": "392F99188F0341208B64EF060E126A5D",
// "title": "DENVER SQUID August 2022 INVOICE - $10",
// "description": "This invoice reflects that you have attended (1) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of August 2022, which means you pay a fee of $10! Please pay by 9/23/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-09-24T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 1000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": []
// },
// "unread": false,
// "seenCount": 11,
// "muted": false
// },
// {
// "id": "E679D732844D46788BCC56D4B4699C23",
// "type": "PAYMENT",
// "groupId": "5A1C0677D3C941C484FDB16C43AA80BA",
// "subGroupIds": [],
// "ownerId": "B454BEC07036D44B0259B2252293F004",
// "timestamp": "2022-09-06T19:56:56.788Z",
// "attachments": [],
// "payment": {
// "id": "B6A8D0CE31D24D7AA08B1AF5B97C10F6",
// "title": "DENVER SQUID August 2022 INVOICE - $20",
// "description": "This invoice reflects that you have attended (2) practices with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of August 2022, which means you pay a fee of $20! Please pay by 9/23/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-09-24T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "total": 2000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [
// "3E415362E9274F31BC0B2C6A422DEA47"
// ],
// "respondents": [
// {
// "memberId": "3E415362E9274F31BC0B2C6A422DEA47",
// "response": "paid",
// "summary": {
// "price": 2000,
// "products": []
// },
// "totalPaid": 2000
// }
// ]
// },
// "unread": true,
// "seenCount": 7,
// "muted": false
// }
// ]
//---------------------------------------------v
fetch("https://spond.com/api/2.1/posts?type=PLAIN&includeComments=true&includeReadStatus=true&includeSeenCount=true&max=5&groupId=5A1C0677D3C941C484FDB16C43AA80BA", {
"headers": spond_headers,
...fetch_opts,
});
fetch("https://spond.com/api/2.1/posts/A1A276E2186341A1ABC3CC2EC4FF4680/payment", {
"headers": spond_headers,
...fetch_opts,
});
//
// {
// "id": "D5B7803A982349899DCC109128E4C5BA",
// "title": "DENVER SQUID September 2022 INVOICE - Monthly Membership",
// "description": "This invoice reflects that you have met or exceeded (6) practices attended with Denver Squid - Aquatics Club (Swimming and/or Water Polo) during the month of September 2022 and have qualified for our membership tier, which means you pay a flat fee of $60! Please pay by 10/25/2022 by 9:00pm MT.\n\nIf you have questions on your invoice before paying, please contact Michael Pineda on SPOND or at swim@denversquid.com",
// "dueBy": "2022-10-26T03:00:00.000Z",
// "expired": true,
// "mandatory": true,
// "accountId": "143C387189B1D9930EDDADEF342FD109",
// "accountName": "Colorado Whitewater Aquatics",
// "provider": "STRIPE",
// "basePrice": 6000,
// "payerPaysFee": false,
// "total": 6000,
// "currency": "USD",
// "optionalProducts": [],
// "behalfOfIds": [],
// "respondents": [
// {
// "memberId": "F3BBF305F0344BCFBF6CBFEE81A8300F",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "F31E89399B7B43E5AA2AFAF4428CAA85",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "75B2AD3D7A234953AAA48F698451A793",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "AD5D098279524749996456DD8BF43D01",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "9CA7E0F9C895495299F389AD7896808F",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "8FC0DFB9D9C34AD39CC5F2BF98E0C082",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "71D93AF20D3D4557AE68AC338B2BDC67",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "5612523A2AFF48EBBEFDD51BCF4A76F1",
// "response": "unanswered"
// },
// {
// "memberId": "9471D2E198E24EF6B4CB10FDF9FDF3B9",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "5E99D02443534668BEEFD97FEB93EA0B",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "5DBB5C41291E435387FEF260D4FA0BEA",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "78B2163C478848AD9D68B5611743357B",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "E7347E02D31F4620B91C9EAD801DAE07",
// "response": "paid",
// "summary": {
// "price": 6000,
// "products": []
// },
// "totalPaid": 6000
// },
// {
// "memberId": "1E57AEB20EFB42C18377B8CB716A2CE7",
// "response": "unanswered"
// },
// {
// "memberId": "E3CEB0005CBD49BCB52A4F760533B7D4",
// "response": "unanswered"
// },
// {
// "memberId": "38807848B17545C3AA22AF61DF9C4767",
// "response": "unanswered"
// },
// {
// "memberId": "8740E56FDDD94AD597B1C803A5A5B12D",
// "response": "unanswered"
// },
// {
// "memberId": "C76362A0447B4E31AE93A42B507A3237",
// "response": "unanswered"
// },
// {
// "memberId": "AC1763D9D7FD46BEA6BBDE7A83773DC2",
// "response": "unanswered"
// }
// ]
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment