aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/src/purchaser.rs
AgeCommit message (Collapse)Author
2018-11-19license-generator: Respond with text for fulfillment emailTeddy Wing
Paddle will take the text from the response of this endpoint and include it in the purchase fulfillment email to a customer. Include the URL for the purchaser to download their license. Use the 'url' crate's parser to build the URL in order to URL-escape special characters. Honestly I'd rather have had a system where the license file gets included in the receipt email. Unfortunately, with the Paddle fulfillment mechanism I'm using, we can only send text. I learned after building the download endpoint that I could manage fulfillment myself. This would require me to listen to an "alert"-type Paddle webhook, and send the email myself (which would include the license file). Since I already built the license download page, I decided to just use it instead of doing the emailing. Also, my web host limits my SMTP usage, so there could be issues there. I'd have to do the emailing in a separate batch process instead of in the webhook handler to ensure that no emails would get dropped.
2018-11-14purchaser: Add timestamp to secretTeddy Wing
Trying to add a little more entropy to the calculation. Went with chrono instead of `std::time` because it gives me an `i64` timestamp instead of a `Result`.
2018-11-09Purchaser::insert(): Commit the transactionTeddy Wing
I had forgotten to commit the transaction, so the record I was trying to insert wouldn't get persisted in the database.
2018-11-09main(): Create a test purchaserTeddy Wing
Manually check that our purchaser creation and database persistence works. Make `purchaser` entities public in order to call them.
2018-11-09Purchaser::new(): Generate a secret in this methodTeddy Wing
Realised that when we want a new purchaser, we always want to generate a secret. This way we can call `new()` without having to call `generate_secret()` at the call site.
2018-11-09Add `get_database_connection()`Teddy Wing
Function to establish a database connection using a connection pool. Update `Purchaser::insert()` to take a `PooledConn` instead of a simple `Conn`.
2018-11-09Extract code in `lib.rs` to `errors.rs` and `purchaser.rs`Teddy Wing
Split up the code to get things a bit more organised. I want a function to create a connection to the MySQL database and I don't want to lump it in with the rest.