Can I set a maximum and minimum payment amount on Paypal - paypal

I am new to making a payment gate way and require restricting purchases between a predefined minimum and maximum. I searched Google, finding this as the most useful result. Is there a way to accomplish this?

You can set the maximum with MAXAMT - read more
However there is no option to set the minimum with Paypal. But you can write a simple JS that checks on submit the form field value and throws an error if the amount is less than expected:
function checkMinimum() {
var min = 5;
if( parseFloat( document.formName.fieldName.value ) < min ) {
alert("Minimum amount should be not less than $" + min + ". Spend more.");
return false;
}
return true;
}

Related

Gravity Form dynamic population and logic conditional in php

sorry for the noob question and the wrong code.
I need that a gravity form field is populated with a different value depending on the amount entered by the user in a number field. Is possible?
I try this code but only with the first value does it work, how can I write it correctly?
add_filter( 'gform_field_value_custom_price', 'my_price' );
function my_price() {
$master = rgpost( `input_22`);
if ( $master < 51 ) {
return 0.80;
} elseif ( $master > 50 && < 201 {
return 0.60;
}
}
Thank you
Since you're populating static values, you could feasibly just create two different fields, each with their unique amount (0.80 or 0.60) and then use conditional logic on each field to show/hide the correct field dependent on the value entered in the Number field.
If the field you're attempting to populate is a Product field, you might consider Gravity Forms Conditional Pricing which would allow to change the price dynamically on a single field rather than requiring two different fields.

Q: [Anylogic] Measuring production throughput rate

I would like to know how to measure the throughput rate of the production line on Anylogic.
Question: Are there any methods to measure the Time Between Departure of the agent at the sink block? >>(I will calculate the throughput rate by inverting the time between departure value.)
At the moment, I just simply calculated the throughput based on Little's law, which I use the average lead time and WIP level of the line. I am not sure that whether the throughput value based on this calculation will be equal to the inverted value of the time between departure or not?
I hope you guys could help me figure it out.
Thanks in advance!
There is a function "time()" that returns the current model time in model time units. Using this function, you may know the times when agent A and agent B left the system, and calculate the difference between these times. You can do this by writing the code like below in the "On exit" field of the "sink" block:
statistic.add(time() - TimeOfPreviousAgent);
TimeOfPreviousAgent = time();
"TimeOfPreviousAgent" is a variable of "double" type;
"statistic" is a "Statistic" element used to collect the measurements
This approach of measuring time in the process flow is described in the tutorial Bank Office.
As an alternative, you can store leaving time of each agent into a collection. Then, you will need to iterate over the samples stored in the collection to find the difference between each pair of samples.
Not sure if this will help but it stems off Tatiana's answer. In the agents state chart you can create variables TimeIn, TimeOut, and TimeInSystem. Then at the Statechart Entry Point have,
TimeIn = time();
And at the Final state have,
TimeOut = time();
TimeInSystem = TimeOut - TimeIn;
To observe these times for each individual agent you can use the following code,
System.out.println("I came in at " + TimeIn + " and exited at " TimeOut + " and spent " + TimeInSystem + " seconds in the system";
Then for statistical analysis you can calculate the min, avg, and max throughputs of all agents by creating in Main variables, TotalTime, TotalAgentsServiced, AvgServiceTime, MaxServiceTime, MinServiceTime and then add a function call it say TrackAvgTimeInSystem ... within the function add argument NextAgent with type double. In the function body have,
TotalTime += NextAgent;
TotalAgentsServiced += 1;
AverageServiceTime = TotalTime/TotalCarsServiced;
if(MinServiceTimeReported == 0)
{
MinServiceTime = NextAgent;
}
else if(NextAgent < MinServiceTime)
{
MinServiceTime = NextAgent;
}
if(NextAgent > MaxServiceTime)
{
MaxServiceTime = NextAgent;
}
Then within your agent's state charts, in the Final State call the function
get_Main().TrackAvgTimeInSystem(TimeInSystem);
This then calculates the min, max, and average throughput of all agents.

Rounding amount in javascript

I'm trying to round the amount in my form's total, tried several methods provided in different threads but none worked for me.
my form url is http://indushospital.org.pk/qurbani/
The amount shown in total is multiplied with 2.5% additional charges due to which its showing the amount like USD 186.63372, I want to show it like 186.64 Or simply 187.
The additional charges formula is mentioned below:
function getAmountPlusCharges(amount) {
// additionalCharges would result here '250' when '20000' is passed as amount.
var additionalCharges = (amount * 2.564) / 100;
return additionalCharges + amount;
Please help, I
'm not familiar with java functions at all
Thanks in advance.
You just have to use Math.round, then you can use to fixed to make sure its always 2 decimal places.
function getAmountPlusCharges(amount) {
return (Math.round(amount * 102.564 ) / 100).toFixed(2);
}

How would I use recursion to create an array of extra change($100, 50, 20, 10, 5, 1) MATLAB

How would I correctly make a recursive call within every if-statement to get the change of money? Im specifically focusing on the "change" variable.Thanks
TEST CASE 1-------------------------------------------------------------------------------
<>> [change,flag] = makeChangeRecursive(2,100)
change =
50
20
20
5
2
1
flag =
1
My code is the following
function [change,flag] = makeChangeRecursive(cost,paid)
if extra > 0
flag = true;
elseif extra == 0
change = 0;
flag = true;
return
elseif cost > paid;
flag = false;
change = [];
warning('That''s not enough to buy that item.');
return
end
if extra >= 100
change = [change; makeChangeRecursive(cost,paid - change )];
paid =paid-100;
elseif extra >= 50
change = [change; 50];
paid =paid-50;
elseif
This continues for all dollar values.
Let's take a look at your first case:
if extra >= 100
change = [change; makeChangeRecursive(cost,paid - change )];
paid =paid-100;
elseif ...
The first time we call your function, the variable change doesn't have anything in it. In fact, it will never have anything in it at the beginning of the function call because you don't pass it in as a parameter or give it a value prior to this line. So putting change on the right-hand side of the assignment will give you an error.
But that's okay, because that's not what you want to do anyway. You want to build change up from the beginning.
In addition, change is a list of values. We want to pass the recursive calls a single value, paid after updating its value.
Let's build this up step by step:
if extra >= 100
If this is true, we want subtract 100 from the amount paid (what we pass in to the recursive call) and add 100 to our list of change. Let's do the first part:
paid = paid - 100;
As I said, we want to update paid first because we're going to use this value in the recursive call, which happens next, along with adding our new change value to the list:
change = [100; makeChangeRecursive(cost, paid)];
elseif ...
And so on for the remainder of the change values. I'm sure you can take care of the rest of them now by yourself.
I also noticed that you didn't assign a value to extra. This might have been just a cut-and-paste error, but you need to make sure that you have that at the beginning of your function.

Insert code for PayPal minimum order dollar amount

While searching for days for answers to how to set a minimum order subtotal in WordPress with PayPal, I found this thread: Can I set a maximum and minimum payment amount on Paypal
But now that I found an answer, I don't know how to implement it! Can anyone tell me where to put the code suggested?:
function checkMinimum() {
var min = 5;
if( parseFloat( document.formName.fieldName.value ) < min ) {
alert("Minimum amount should be not less than $" + min + ". Spend more.");
return false;
}
return true;
}
If you have a form or page before your site redirects to the paypal site you can place the code on that page