Spring Boot application payment method - mysql

I am currently the back-end part of a Spring Boot application and i am willing to integrate a payment method. But I can't seem to find the right payment option. I am a beginner in app development and working solo. Do you have any suggestions?
APPLICATION:
I am developing a platform where users can rent a car for a certain period of time. The application will have a react and android application on the frontend. The users can see the different locations of the available cars on a map within the react and android app. They can make a reservation for a car and unlock, drive and lock it after usage.
PAYMENT METHOD:
I am looking for a payment where the users admits to the payment when unlocking the car, but the price of the ride is not known yet. When the user is finished using the car, the price of the ride will be determined by the distance and time driven by the user.
POSSIBLE SOLUTIONS:
-PayPal: there is a possibility to let the user authorize a payment, but capture the funds later. The funds can be altered but only after three days and with a maximum value of 115 percent.
-CreditCard: I read in a lot of posts that storing creditcard information in a database is a big NO.
-Stripe: Don't really know, possible option?
Are there any solutions/examples of how this problem can be solved.

PayPal: there is a possibility to let the user authorize a payment, but capture the funds later. The funds can be altered but only after three days and with a maximum value of 115 percent.
There is no need to wait 3 days, that is a misreading of the authorization and capture documentation. If you have a need to capture over 115% of the initial authorization, contact PayPal about this. But a simple solution is to authorize something close to the maximum value of what you will need to dependably capture.

Stripe has the ability to place a hold on a card and then capture funds up to 7 days later for the amount you captured or less.
Place a hold on a card to reserve funds now but only capture them after your business completes the service. For example, a hotel may authorize a payment in full prior to a guest’s arrival, then move the money when the guest checks out.
When a payment is authorized, the bank guarantees the amount and holds it on the customer’s card for up to seven days.
You could place a hold for the maximum amount you expect to charge for the ride (say $50) then capture the actual amount when the ride completes (perhaps $23.50).

Related

How to set a timer with solidity?

I'm writing a Defi project. What I want to do is to set an automatic payment. For example, when a lender asks to lend 10 eth, the money would be automaticly sent to him after a month. I have searched a lot but found nothing. Are there any possible remedy? THANKS!
I'm writing a Defi project. What I want to do is to set an automatic payment. For example, when a lender asks to lend 10 eth, the money would be automaticly sent to him after a month. I have searched a lot but found nothing.
You don't. In Ethereum, transactions are always initiated by the user, or Externally Owned Accounts (EOAs).
You program your smart contract in a way that after certain block.timestamp has passed the user can call claim() function that sends him any payment.
You would have to use chainlink keepers for that.
You can put a require statement that will ensure that the eth won't be sent before the 30 days but there is no way to call the function from solidity after 30 days.

Setting a Google Places API quota?

I'm working on a project using the places api and I'm trying to stay in the free tier. The docs mention setting a daily limit, but the free-tier counts monthly quotas. If I set a 10k daily quota and I use it across different days in the month, will my 10k limit be enforced for the whole month or will I still be able to go over budget?
For questions such as these that doesn't involve coding issues/errors, it is best if you file a support ticket to them directly here. So moving forward, please use their channel instead. They will be able to address all your concerns regarding billing, pricing, free trial, setting limits and API level errors.
Now, if you wish to stay within, say, the $200 free credit you get per month upon enabling billing, there are a couple of things you can do.
Budget Alerts
Set a budget alert to warn you when you exceed your budget.
Note: this is not a hard cap on your bill, but an alert mechanism. The steps to do that are on the Billing documentation
To set up actual limits:
Set a Per API Daily Limit
For each API, you can set limits that are handled on a daily not monthly basis. The full guide can be found here. For the calculation on what the right limit should be, please take note of the tip in the link above.
You can use a simple equation to determine your daily cap depending on how much you want to spend. For example:
(Monthly spend / price per each )/30 = requests per day cap (for one API).
Note that your implementation may use multiple billable APIs, so adjust your equation as needed.
For instance, if you only use, say, the Maps JavaScript API, which has a cost of $7 per 1,000 loads, see this pricing sheet for your reference, you can issue 28,000 free loads per month. If you cap your Maps JavaScript API daily quota to 903 (i.e. 28,000 / 31), you will not be charged. Note that your application will run into errors once that limit is reached. Here are the steps for your convenience:
Go to your dashboard: https://console.cloud.google.com/home/dashboard and click "Go to API's overview"
Select the API
Click quotas
Under the Map Loads or Requests or Elements section (depending on the API you chose) at the very bottom, set your daily limits

Electing a new leader in distributed systems

I have the following problem:
I have a distributed system where I need to reach a consensus in one way or another when choosing a leader.
I have a group of players that communicate with each other via messages. In order for these players to progress from a stage to another someone has to keep track of their progress. Currently, there are 2 types of players:
leader---when he receives N-1 done messages (for N-1 players) he is responsible for broadcasting to all other users state change
follower ---he is responsible for getting the messages of the leader and updating his internal state-machine.
Each player receives messages from 2 pipelines:
-Status pipeline - He receives an array of type
[user1,user2,user3...userN] where each element is the user that is online.
-Message pipeline -Push based notification. Follower users will post here messages that they are ready for the next step. The leader will keep track of the DONE counter and when the threshold is reached he will broadcast ADVANCE to next step.
For a better idea i included a picture:
I do not know how to deal with leader reelection. In case the leader disconnects (this can be implemented with a timeout), how can the other nodes decide who is the next leader and if they pick randomly, should the current leader be stored in the database? I mean they only exchange messages there's nothing on the server, like a global variable or something.
What you basically need is to implement both 2 phase commit and a leader election recipe. Now, either you can implement them on your own (2 phase commit is well documented, and yes, you would need a shared storage), or if you have the flexibility to use a distributed open source co-ordination service, zookeeper would be your best bet. Have a look at the below article on apache zookeeper's page where they discuss both the recipes which you need. Hope this helps.
https://zookeeper.apache.org/doc/current/recipes.html#sc_recipes_twoPhasedCommit

Can we use mysql with ethereum?

We are thinking of building a dapp for finding salon near me and allowing booking. In such application end users has to be shown the salons which are at a certain distance from their current location. Where would be query that data from. Cause I don't think so that kind of querying is possible in solidity. Do we need to bring in any RDBMS in such a scenario to store salon data so that we can query it easily and booking information can be sent to blockchain.
Is hybrid application the only way out? People are talking about IPFS should be used for storing the images, videos and other data. Is that the solution, if yes then how would we query it from there? Moreover, would it be fast enough?
TL;DR: Short answer: you might, but you shouldn't.
The real question here is what do you need ethereum for in this project?
In Ethereum, each write operation is costly whereas reading data isn't. Write operations are transactions, read are calls.
It means that "uploading" your salon list will cost you money (i.e. gas), but also each data update (opening hours, booking ..).
For the mysql specific part of your question, well Ethereum is not designed for that kind of operation.
Something with an oracle might do the trick but it's truly not designed for. See Ethereum like a way to intermediate transactions between peers that stores every transaction publicly and permanently.
According to the Wikipedia page blockchains are basically a "continuously growing list of records". Ethereum has the possibility to make workers run some code in exchange of gas.
This code (or Smart Contract) only purpose "to facilitate, verify, or enforce the negotiation or performance of a contract" (here contract is a legally binding contract).
From what you described, IMO a simple web application with "standard" SQL is more than enough.
You just have to store the salons' GPS coordinates and do the closest match(es) from the user's GPS coordinates.
You likely want to separate your application into two parts:
- The part which shows the available booking times
- The part which makes a new booking

Getting Your Customer's Bills in to Bill Pay Sites

We are looking at ways to cut costs, and one idea I had was to push our customer's bills into the Bill Pay systems that banks (and other sites) use. Only thing is, I don't know how to do that? My searches in the past didn't turn up any information for the company side.
Can anyone point me in a productive direction? Is there a single clearing house for this or do you have to set something up with each site?
More details: We are a local government that sends out utility bills on a monthly basis. We currently offer ACH and online bill payment (through our web site) options. But with so many (or so it seems) people using the free bill pay that banks are now offering, it would be a great option to push their bills to those that like to use this option. If it's cost effective, that is.
Instead of pushing them to a third party (who you presumably pay for the service) could you build your own system?
Either email a PDF bill, or let them log onto your website to get their balance etc. Then let them pay through your website?
It's not that difficult to sent up an online payment system....