I'm working on e-learning academy system like udemy every instructor have wallets and wallets have three type of balance
1- total balance and it present total earning
2- available balance and it present earning that he can make payout or transfer it to his bank account
3- hold balance and it present earning that is not available for specific time then will be available to transfer it.
Project build by Laravel my issue how can I hold money for 14 days and after that make this money available without any action from my side I need logical idea to make it
can use cron job, or is anyone have this experience before ?
Let me break down the issue as per my understanding so we make sure I'm answering the correct question;
You have a system that has a wallet feature.
This wallet needs to hold some money and make the money unavailable to be paid out (hold status)
Then after 14 days, the money gets paid automatically without any interaction.
If I'm correct, then keep reading the answer below. If i'm not, correct me with a comment and I'll update my answer accordingly.
Answer:
We will create a new table. Let's call it pending_payments. It'll have the following information: user_id, payment_amount, pay_at
That table will hold information about pending payments and to which user they should be paid as well as the amount and the date it should be paid at.
We'll have a Laravel job that can be automated ( read this for more information: https://laravel.com/docs/9.x/scheduling) which will do the following:
a. Run daily on a specific time. Let's say at 13:00 daily for ease.
b. It'll check the pending_payments table for payments that should be paid today.
c. Pay them ( which means run whatever function/task you have to run in order to process the payment).
d. On a successful payment, remove the row from pending_payments table. And on a failure payment, log the error and insert the row again with a later date to be retried again later.
That's it.
We're building a marketplace in NEAR. We have two smart contracts for token and marketplace. Same as NEAR example.
In our platform, we have successfully implemented below features:
Token mint (used contract method: nft_mint)
Token listing for sale at Fixed Price in marketplace (used contract methods: storage_deposit nft_approve)
Token purchase (used contract method: offer)
Apply creator royalty at mint time.
Apply service fee (Transaction fee of Marketplace) on each sale.
Everything is working fine.
Now, we would like to implement the Timed Auction Functionality
Creator can create NFT’s to be sold as an auction so that buyers can bid on them to get a higher price.
Method:- Sell to the highest bidder: where the highest bid wins at the end.
Making a bid on this kind of auction is like making an offer on a fixed-price listing. The seller can choose to accept it at any time, but the buyer will near of the amount of bid to create a bid.
Questions:
How we can implement the Timed Auction Functionality with Marketplace
Contract?
Do we have any documentation or example for the
Timed Auction Functionality?
Example of OpenSea's Timed Auction Functionality:
You can't do that directly from within a contract since the contract does not run all the time you will have to call function trough something like https://cron.cat/ or your own.
Contracts perceive time trough current execution so when a function is called env::block_timestamp_ms() within said fn would give us the current time of execution, you can subtract time from it to get some time in the past. We can do manual checks like is the time stamp past this than do that or the less accurate is the blockheight above certain threshold but all this will have to be executed within a function that needs to be called.
I will preface this post by saying that this is how I would go about solving this in a simple way. There are more complex solutions out there but I'll try and keep it relatively simple. (scroll to the bottom for a TLDR).
Here's a solution to the timed auction functionality. In the marketplace example that you posted, what you'll want to do is store two extra fields in the sale object indicating the desired length of the auction as well as the time when the sale was listed.
Whenever NFTs are put for sale (in the nft_on_approve function), you'll need to add the current block_timestamp (which will give you the number of nanoseconds since the Unix epoch). You'll also need to store the desired length of the auction which is up to you as to how you would like to implement that. It can be time in nanoseconds, milliseconds, seconds, days, either since the Unix epoch or the actual desired duration of the auction.
Once your sale object contains both these new fields, all you would need to do is whenever an offer is made, check if the current block timestamp is within the desired auction length. If it is, proceed, if it's not panic. Since the marketplace can't constantly be polling to see if the auction is finished, a common approach is to use the functionality I described above:
You either bid on the NFT before the timestamp or you didn't. If you did, your bid is accepted, if you don't, it panics.
At this point, there is no way for the marketplace to automatically transfer the NFT to the highest bidder the second the auction closes (due to the marketplace's inability to poll). My suggestion here would be to have a claim function that the highest bidder must call if they want the NFT transferred to them. You can get spicy with this and have timeouts whereby if it isn't claimed within 5 days, the original owner can claim it back but for the sake of simplicity, let's not get into that.
As for the bidding mechanic, there's many different ways you can do this. I'll go over one of the more simple approaches. Currently, when a sale is listed with sale conditions, the NFT can only be purchased for more than or equal to the price as shown here. What you'll want to do is store active bids in the sale object.
You'll need to store both the current highest bidder as well as their bid amount. This will be initialized to empty when the NFT is listed and then once an offer is made for less than the desired list price, it's considered a bid. Bids will only be added if they are less than the desired price and greater than the highest current bid. If the offer is more than the list price, the NFT is automatically sold and the purchase is processed.
Combining everything I've outlined so far in a TLDR:
What you would need to add as a minimum PoC to the sales object:
Store desired length of auction (in whatever format you want)
Store date of listing
Store current highest bidder
Store current highest bid
Listing mechanics:
When a sale is listed, set the date of listing and the desired length of the auction.
Offer mechanics:
make sure the attached deposit is greater than the current highest bid (if none, make sure it's >= 0).
If the attached deposit is greater than the list price, process the purchase. If it's not, add it as the current highest bid.
Make sure that the any offers are made within the desired length of the auction. If they aren't panic, if they are, you're good to go.
If somebody is outbid, make sure you refund them for their deposit!
Claim mechanics:
Claims can only be made if the auction time has passed. Only the highest bidder can claim the NFT. Once claimed, the purchase is processed.
Introduction
In the below example, you can see that the header and sections 1 and 11 have been put in as plain values into the yaml, but sections 2 and 8 have been wrapped in single quotes. This seems to be happening at the to_yaml stage because in the hash everything looks ok. (I'm not simply loading a yaml and converting it back, this is just for the sake of a simplified example)
What I've tried
I've tried seeing if there are any special characters which would cause confusion, but without any luck. For example, on the word vehicle’s there is a curled apostrophe rather than a straight one ', but that is found in all sections. isn't in section 2 has the straight apostrophe. I tried adding/removing each type of apostrophe systematically in different sections to see if that would make any difference but it hasn't
foo.yml
en:
contract:
terms_and_conditions:
FF:
company: Foo Foo SA
spain_checkin_company: Foo Foo Spain SLR
title: Rental Agreement
header: "This Rental Agreement regulates the rental conditions between Foo Foo, hereinafter referred to as the Rental
Firm, and the client, identified by a valid driving license, hereinafter referred to as the Hirer, and it is ruled by all the
general and special conditions described in this agreement, unless there is any written derogation or alteration."
column_1:
section_1:
title: 1. Vehicle conditions
text: "1) The customer acknowledges having received the Vehicle and rented extras in a clean condition and with all the features working. 2) The customer will return the vehicle in a clean condition, with the same amount of fuel at the pick-up, and with all the vehicle’s features operating in a normal way, on the return date, time and location established in the Rental Agreement. Failure to meet these criteria will result in additional charges to the Hirer according to the rental firm price table. Any loss or damage in rented extras, equipment or spare parts, will be fully charged to the Hirer according to the Rental Firm price table."
section_2:
title: 2. Documents
text: "A valid vehicle driver’s license, ID or Passport and credit card (Visa or Mastercard) are required and must be presented upon the vehicle’s collection and signing of the rental agreement. If the Hirer does not bring the necessary documents, the vehicle cannot be rented and regular no show fee will apply. 2) To hold a valid license to drive in Europe is the responsibility of the Hirer 3) The Hirer should be older than 18 years old. 4) If the Hirer is under 25 years of age, purchasing the Standard Insurance plan is mandatory, and he/she isn't allowed to purchase the Basic or Full Insurance plan when renting a vehicle.
5) The credit card owner must be present at the vehicle´s collection.
"
column_2:
section_8:
title: 8. Accident / Vehicle Damage
text: "In the event of an accident or vehicle damage, the Hirer agrees to the following procedures: 1) Immediately notify the Rental Firm and police authorities of any accident, theft, robbery or other misfortune. 2) Take pictures and obtain names and addresses of all persons involved as well as witnesses, that can document what happened 3) Fill the accident report, together with other vehicles that may be involved. 4) Shall not leave the vehicle without taking all measures regarding its protection and . 5) Shall not take any responsibility or pled guilty, in the event of an accident that might hold the Rental Firm liable 6) Collect the accident report signed by all parties involved and the documents prepared by the police authorities, along with the vehicle keys, if retained (in case of vehicle theft) and send it immediately to the Rental firm. Otherwise, all insurances and coverage’s will expire, and the Hirer is liable for all expenses."
section_11:
title: 11. Liability / Security Deposit and After Rental Payments
text: "1) The security deposit can only be paid by credit card (Visa or Mastercard), and the credit card owner must be present at the pick-up. At the vehicle delivery, the Hirer is required to pay the security deposit according to the chosen Insurance option. This amount will be held in the Hirer’s credit card to ensure the excess payment in the event of robbery or accident and any other vehicle damage during the rental period. 2) If the security deposit amount is not authorized by the bank or by the credit card owner, the contract cannot be executed and the vehicle cannot be delivered. In this case, the regular cancelation policy will apply and the full booking amount will be charged to the Hirer. The security deposit will be returned to the Hirer at the end of the rental period, after an inspection by a Rental Firm member staff, who shall state the vehicle is in similar conditions compared to when it was collected. 3) Vehicle damage and equipment/extras damage costs will be charged according to the Rental Firm price table. The Hirer will also be liable for the days not rented during the vehicle reasonable repair time, according to the damages at issue. 4) In case of an accident where the Hirer does not consider himself responsible, the Rental Firm will hold the full amount of the security deposit until the insurance company states the responsibility. 5) If the damage repair costs cannot be determined immediately, the Rental Firm will hold the full amount of the security deposit. A portion of the excess can be refunded in case the final damage repair costs are lower than the amount paid. 6) The Hirer agrees that the Rental Firm is authorized to charge the credit card on file for any further amounts that may arise such as wild camping, parking tickets, fines, traffic offence penalties, tolls, damages to the van (interior or exterior) and overdue amounts. Rental Firm is entitled to verify any of the damages to the van for 30 days after the last day of the rental agreement. In the event of a fine, the Rental Firm will always attempt to forward the fine to the Hirer. On these cases, a 25€ administrative fee will be charged by the Rental Firm. In the event that it is not possible to forward the fine to the Hirer, the Rental Firm will process the fine and charge to the Hirer the total cost of the fine plus VAT and an added administrative fee of 50€. 7) Hirer must provide the Rental Firm with an alternative credit card that can be used to meet Hirer’s obligations under the Rental Firm Terms and Conditions, in case of insufficient funds, declined transactions for any reason, and cancelled or suspended credit card. 8) All unpaid invoices will be added interest, which is the highest legal rate plus a flat fee, corresponding to 20% of the unpaid amount and any compensation for occurred damages / lost profits due by law. In the event of a legal dispute somehow related with this contract, the parties agree that the jurisdiction of the pick-up location will be applied."
hash in Ruby
foo = YAML.load(File.read("#{#PATH}foo.yml"))
=> {"en"=>
{"contract"=>
{"terms_and_conditions"=>
{"FF"=>
{"company"=>"Foo Foo SA",
"spain_checkin_company"=>"Foo Foo Spain SLR",
"title"=>"Rental Agreement",
"header"=>
"This Rental Agreement regulates the rental conditions between Foo Foo, hereinafter referred to as the Rental Firm, and the client, identified by a valid driving license, hereinafter referred to as the Hirer, and it is ruled by all the general and special conditions described in this agreement, unless there is any written derogation or alteration.",
"column_1"=>
{"section_1"=>
{"title"=>"1. Vehicle conditions",
"text"=>
"1) The customer acknowledges having received the Vehicle and rented extras in a clean condition and with all the features working. 2) The customer will return the vehicle in a clean condition, with the same amount of fuel at the pick-up, and with all the vehicle’s features operating in a normal way, on the return date, time and location established in the Rental Agreement. Failure to meet these criteria will result in additional charges to the Hirer according to the rental firm price table. Any loss or damage in rented extras, equipment or spare parts, will be fully charged to the Hirer according to the Rental Firm price table."},
"section_2"=>
{"title"=>"2. Documents",
"text"=>
"A valid vehicle driver’s license, ID or Passport and credit card (Visa or Mastercard) are required and must be presented upon the vehicle’s collection and signing of the rental agreement. If the Hirer does not bring the necessary documents, the vehicle cannot be rented and regular no show fee will apply. 2) To hold a valid license to drive in Europe is the responsibility of the Hirer 3) The Hirer should be older than 18 years old. 4) If the Hirer is under 25 years of age, purchasing the Standard Insurance plan is mandatory, and he/she isn't allowed to purchase the Basic or Full Insurance plan when renting a vehicle. 5) The credit card owner must be present at the vehicle´s collection. "}},
"column_2"=>
{"section_8"=>
{"title"=>"8. Accident / Vehicle Damage",
"text"=>
"In the event of an accident or vehicle damage, the Hirer agrees to the following procedures: 1) Immediately notify the Rental Firm and police authorities of any accident, theft, robbery or other misfortune. 2) Take pictures and obtain names and addresses of all persons involved as well as witnesses, that can document what happened 3) Fill the accident report, together with other vehicles that may be involved. 4) Shall not leave the vehicle without taking all measures regarding its protection and . 5) Shall not take any responsibility or pled guilty, in the event of an accident that might hold the Rental Firm liable 6) Collect the accident report signed by all parties involved and the documents prepared by the police authorities, along with the vehicle keys, if retained (in case of vehicle theft) and send it immediately to the Rental firm. Otherwise, all insurances and coverage’s will expire, and the Hirer is liable for all expenses."},
"section_11"=>
{"title"=>"11. Liability / Security Deposit and After Rental Payments",
"text"=>
"1) The security deposit can only be paid by credit card (Visa or Mastercard), and the credit card owner must be present at the pick-up. At the vehicle delivery, the Hirer is required to pay the security deposit according to the chosen Insurance option. This amount will be held in the Hirer’s credit card to ensure the excess payment in the event of robbery or accident and any other vehicle damage during the rental period. 2) If the security deposit amount is not authorized by the bank or by the credit card owner, the contract cannot be executed and the vehicle cannot be delivered. In this case, the regular cancelation policy will apply and the full booking amount will be charged to the Hirer. The security deposit will be returned to the Hirer at the end of the rental period, after an inspection by a Rental Firm member staff, who shall state the vehicle is in similar conditions compared to when it was collected. 3) Vehicle damage and equipment/extras damage costs will be charged according to the Rental Firm price table. The Hirer will also be liable for the days not rented during the vehicle reasonable repair time, according to the damages at issue. 4) In case of an accident where the Hirer does not consider himself responsible, the Rental Firm will hold the full amount of the security deposit until the insurance company states the responsibility. 5) If the damage repair costs cannot be determined immediately, the Rental Firm will hold the full amount of the security deposit. A portion of the excess can be refunded in case the final damage repair costs are lower than the amount paid. 6) The Hirer agrees that the Rental Firm is authorized to charge the credit card on file for any further amounts that may arise such as wild camping, parking tickets, fines, traffic offence penalties, tolls, damages to the van (interior or exterior) and overdue amounts. Rental Firm is entitled to verify any of the damages to the van for 30 days after the last day of the rental agreement. In the event of a fine, the Rental Firm will always attempt to forward the fine to the Hirer. On these cases, a 25€ administrative fee will be charged by the Rental Firm. In the event that it is not possible to forward the fine to the Hirer, the Rental Firm will process the fine and charge to the Hirer the total cost of the fine plus VAT and an added administrative fee of 50€. 7) Hirer must provide the Rental Firm with an alternative credit card that can be used to meet Hirer’s obligations under the Rental Firm Terms and Conditions, in case of insufficient funds, declined transactions for any reason, and cancelled or suspended credit card. 8) All unpaid invoices will be added interest, which is the highest legal rate plus a flat fee, corresponding to 20% of the unpaid amount and any compensation for occurred damages / lost profits due by law. In the event of a legal dispute somehow related with this contract, the parties agree that the jurisdiction of the pick-up location will be applied."}}}}}}}
Outputted yaml file
File.open("#{#PATH}foo.yml", "w") do |f|
YAML.dump(foo,f)
end
(also used f.puts foo.to_yaml) with the same result
en:
contract:
terms_and_conditions:
FF:
company: Foo Foo SA
spain_checkin_company: Foo Foo Spain SLR
title: Rental Agreement
header: This Rental Agreement regulates the rental conditions between Foo
Foo, hereinafter referred to as the Rental Firm, and the client, identified
by a valid driving license, hereinafter referred to as the Hirer, and it
is ruled by all the general and special conditions described in this agreement,
unless there is any written derogation or alteration.
column_1:
section_1:
title: 1. Vehicle conditions
text: 1) The customer acknowledges having received the Vehicle and rented
extras in a clean condition and with all the features working. 2) The
customer will return the vehicle in a clean condition, with the same
amount of fuel at the pick-up, and with all the vehicle’s features operating
in a normal way, on the return date, time and location established in
the Rental Agreement. Failure to meet these criteria will result in
additional charges to the Hirer according to the rental firm price table.
Any loss or damage in rented extras, equipment or spare parts, will
be fully charged to the Hirer according to the Rental Firm price table.
section_2:
title: 2. Documents
text: 'A valid vehicle driver’s license, ID or Passport and credit card
(Visa or Mastercard) are required and must be presented upon the vehicle’s
collection and signing of the rental agreement. If the Hirer does not
bring the necessary documents, the vehicle cannot be rented and regular
no show fee will apply. 2) To hold a valid license to drive in Europe
is the responsibility of the Hirer 3) The Hirer should be older than
18 years old. 4) If the Hirer is under 25 years of age, purchasing the
Standard Insurance plan is mandatory, and he/she isn''t allowed to purchase
the Basic or Full Insurance plan when renting a vehicle. 5) The credit
card owner must be present at the vehicle´s collection. '
column_2:
section_8:
title: 8. Accident / Vehicle Damage
text: 'In the event of an accident or vehicle damage, the Hirer agrees
to the following procedures: 1) Immediately notify the Rental Firm and
police authorities of any accident, theft, robbery or other misfortune.
2) Take pictures and obtain names and addresses of all persons involved
as well as witnesses, that can document what happened 3) Fill the accident
report, together with other vehicles that may be involved. 4) Shall
not leave the vehicle without taking all measures regarding its protection
and . 5) Shall not take any responsibility or pled guilty, in the event
of an accident that might hold the Rental Firm liable 6) Collect the
accident report signed by all parties involved and the documents prepared
by the police authorities, along with the vehicle keys, if retained
(in case of vehicle theft) and send it immediately to the Rental firm.
Otherwise, all insurances and coverage’s will expire, and the Hirer
is liable for all expenses.'
section_11:
title: 11. Liability / Security Deposit and After Rental Payments
text: 1) The security deposit can only be paid by credit card (Visa or
Mastercard), and the credit card owner must be present at the pick-up.
At the vehicle delivery, the Hirer is required to pay the security deposit
according to the chosen Insurance option. This amount will be held in
the Hirer’s credit card to ensure the excess payment in the event of
robbery or accident and any other vehicle damage during the rental period.
2) If the security deposit amount is not authorized by the bank or by
the credit card owner, the contract cannot be executed and the vehicle
cannot be delivered. In this case, the regular cancelation policy will
apply and the full booking amount will be charged to the Hirer. The
security deposit will be returned to the Hirer at the end of the rental
period, after an inspection by a Rental Firm member staff, who shall
state the vehicle is in similar conditions compared to when it was collected.
3) Vehicle damage and equipment/extras damage costs will be charged
according to the Rental Firm price table. The Hirer will also be liable
for the days not rented during the vehicle reasonable repair time, according
to the damages at issue. 4) In case of an accident where the Hirer does
not consider himself responsible, the Rental Firm will hold the full
amount of the security deposit until the insurance company states the
responsibility. 5) If the damage repair costs cannot be determined immediately,
the Rental Firm will hold the full amount of the security deposit. A
portion of the excess can be refunded in case the final damage repair
costs are lower than the amount paid. 6) The Hirer agrees that the Rental
Firm is authorized to charge the credit card on file for any further
amounts that may arise such as wild camping, parking tickets, fines,
traffic offence penalties, tolls, damages to the van (interior or exterior)
and overdue amounts. Rental Firm is entitled to verify any of the damages
to the van for 30 days after the last day of the rental agreement. In
the event of a fine, the Rental Firm will always attempt to forward
the fine to the Hirer. On these cases, a 25€ administrative fee will
be charged by the Rental Firm. In the event that it is not possible
to forward the fine to the Hirer, the Rental Firm will process the fine
and charge to the Hirer the total cost of the fine plus VAT and an added
administrative fee of 50€. 7) Hirer must provide the Rental Firm with
an alternative credit card that can be used to meet Hirer’s obligations
under the Rental Firm Terms and Conditions, in case of insufficient
funds, declined transactions for any reason, and cancelled or suspended
credit card. 8) All unpaid invoices will be added interest, which is
the highest legal rate plus a flat fee, corresponding to 20% of the
unpaid amount and any compensation for occurred damages / lost profits
due by law. In the event of a legal dispute somehow related with this
contract, the parties agree that the jurisdiction of the pick-up location
will be applied.
Column 1, section 2, text contains a trailing space.
Column 2, section 8, text contains a : character followed by a space.
The specification says:
The plain (unquoted) style has no identifying indicators and provides no form of escaping. It is therefore the most readable, most limited and most context sensitive style. In addition to a restricted character set, a plain scalar must not be empty, or contain leading or trailing white space characters. It is only possible to break a long plain line where a space character is surrounded by non-spaces.
...
Plain scalars must never contain the “: ” and “ #” character combinations. Such combinations would cause ambiguity with mapping key: value pairs and comments. In addition, inside flow collections, or when used as implicit keys, plain scalars must not contain the “[”, “]”, “{”, “}” and “,” characters. These characters would cause ambiguity with flow collection structures.
I just made an account on Admob , I want to integrate my app with it , but what i didnt understand is how it pay to me ? I am finding where i need to enter my account information where i receive the money , but no good help is there for it , any experience use , please help me out , about your experience
AdMob begins processing payments for a month's earnings one month
after the calendar month in which they are earned. There is a
processing time of approximately two to three weeks. You will receive
an email notifying you when payment processing begins. This happens on
the date that funds are removed from your AdMob account and is the
date recorded in the Account Summary page of the Account tab.
In order for the processing to begin, you must meet the threshold for
the method of payment you have selected.
$20 if you selected PayPal $100 if you selected ACH/Wire You must meet
the threshold to be eligible for payment. If your total payable
earnings are less than the threshold amount, AdMob rolls your earnings
over to the following month.
Cf : https://support.google.com/admob/answer/1307281?hl=en
And for payment methods :
https://support.google.com/admob/answer/2956524