I'm trying to implement the CFC (coldfusion) code found here:
http://www.sitekickr.com/blog/integrating-paypal-payflow-pro-rest-api/
I'm still at the testing stage and haven't even tried passing my own variables, just using the CFSET example provided.
<cfset response = paypal.capture( card_type = "visa"
, card_number = "4556747948786484"
, card_exp_month = "12"
, card_exp_year = "2018"
, card_firstname = "Bob"
, card_lastname = "Smith"
, amount = 15.25
, description = "Order 1011"
)>
I'm getting this error:
{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount.total","issue":"Currency
amount must be non-negative number, may optionally contain exactly 2
decimal places separated by '.', optional thousands separator ',',
limited to 7 digits before the decimal point"}],"message":"Invalid
request - see
details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"dfb7b0588d38e"}
It makes no sense because the currency value I'm passing is NOT a negative and contains only two decimal places. There is no obvious error with the "amount" value I'm passing.
So I'm stuck.
Here's how I solved my problem.
I discovered that in my PayPal developer account, I could go to the menu Sandbox/Transactions and get more details on transaction attempts.
Through this, I discovered the value I was actually passing for total was "15.25|||"
PayPal was receiving: "total": "15.25|||"
Upon further investigation, at line 57 of the CFC, I found
"total"= (NumberFormat(arguments.amount, "9.99")) & "|||",
I removed the: & "|||"
And got a successful response from PayPal's sandbox.
Related
I have the formula
=IF(AND(HOUR(D2)<=8,HOUR(D2)>=19), "OPEN", "OOH")
This should return the required text values "OPEN" or "OOH" depending if the hour falls within the noted range.
When trying in cell E2 of this sheet https://docs.google.com/spreadsheets/d/1xNFVHLnQGkRgZdLmejCyU0BByOPBY8NMoIYj6SkTFGY/edit#gid=431567503 it returns a text value but not always the correct one. What could be missing from this formula?
I have also tried swapping the range around without success
=IF(AND(HOUR(D2)>=19),HOUR(D2)<=8, "OPEN", "OOH")
Update: also tried with OR instead of AND but it does no better
=IF(OR(HOUR(C3) >=19, HOUR(C3) <=8), "OPEN", "OOH")
if from 8 to 19 = OPEN then use this in E2:
=INDEX(IF((HOUR(C2:C)>=8)*(HOUR(C2:C)<19), "OPEN", "OOH"))
Your conditions are a bit wrong. The IF form is:
=IF(condition, value_if_true, value_if_false)
In your question, you say hour >=19 OR hour <= 8, so you should be using OR, as you do in your update. However, you switched the true and false values in your updated statement. Try:
=IF(OR(HOUR(C3) >=19, HOUR(C3) <=8), "OOH", "OPEN")
With 8:01, this returns "OOH"
With 9:01, this returns "OPEN"
With 18:01, this returns "OPEN"
With 19:01, this returns "OOH"
Logic error. The thing can't be <=8 and >=19 at the same time.
If you reverse the signs to >8 and <19, you might get closer to what you want.
I use this code to show the sum of my bank
if {?Bank} = {Bank.sum} then {#1} else 0
I have 6 bank accounts and when the bank = Bank has operations, then I show the sumand else I do not show anything.
I do not want to show "0" in my report.
I want to show " "(space), but when I change it to " ".
When I do it, I get the error
A number is required here
How can I fix it?
In that case, use:
if {?Bank} = {Bank.sum} then ToText({#1},0) else ""
The 2nd arg indicates zero decimal points. See online documentation of the ToText() function.
One option:
if {?Bank} = {Bank.sum} then ToText({#1}) else ""
Another option is to use formatting.
When I use the vue-paypal-check:
<PayPal amount="amount"
currency="USD"
:client="credentials"
env="sandbox"
>
</Paypal>
...
computed: {
amount() {
var total_price = Number(this.product_physical_session_storage_from_before.total_price_local)
var abs_total_price = Math.abs(total_price.toFixed(2))
return abs_total_price // there is Number `120.00`
}
},
I get bellow error:
{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount.total","issue":"Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.', optional thousands separator ',', limited to 7 digits before the decimal point"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"efa7b058ad30e"}
Afterwards I found the issue, I was follow the GitHub steps:
<PayPal
amount="10.00"
currency="USD"
:client="credentials">
</PayPal>
the 10.00 is the given number, I'm passing a variable, I should use the
<PayPal
:amount="amount"
currency="USD"
:client="credentials">
</PayPal>
Then I solved my problem.
String formatting:
"#0.##%;(#0.##%); "
The above will format a double into a percentage string with two decimal points, put it into parenthesis if it’s negative and leave it a blank string if it’s zero.
The problem is, if the double value has no decimal points, eg if the value is 2, then for some reason the resulting string is “2%” and not “2.00%”.
My question is: how do I make it go to “2.00%”?
p.s. the formatting is happening on a Syncfusion grid cell object and requires a string mask.
p.s.s. the existing functionality described above in italics must be maintained.
Hashes denote an optional character. Use “#0.00%” (etc.).
You can use the string format #0.00% for 2 digital places.
"#" means optional to show the digital while "0" means mandatory to show. In this case (#0.00%) stands for the 2 digital places are mandatory and the digital right before the "." is mandatory as well. If there is any digital before the "0", it will show up. Otherwise, it won't as this digital is optional.
e.g.
2 -> 2.00%
12 -> 12.00%
120 -> 120.00%
11.234 -> 11.23%
And using "P" or "P2" also works fine in this case. "P" stands for percent, "2" is the amount of digital places.
e.g.
double number = .2468013;
Console.WriteLine(number.ToString("P", CultureInfo.InvariantCulture));
// Displays 24.68 %
Console.WriteLine(number.ToString("P",CultureInfo.CreateSpecificCulture("hr-HR")));
// Displays 24,68%
Console.WriteLine(number.ToString("P1", CultureInfo.InvariantCulture));
// Displays 24.7 %
You can refer to the MSDN for more details.
I have a schema of Row Keys 1-n. In each row there are a variable number of supercolumns with a TimeUUID 'name'. Im hoping to be able to query this data by a time range.
Two issues have come up:
in KeyRange -> the values that I put in for 'start_key' and 'end_key' are getting misunderstood (for lack of a better term) by Thrift. Experimenting with different groups of values Im not seeing what I expect and often get back something completely unexpected.
Example: my row keys are running from 1-1000 with lots of random gaps. I put start_key = 50 and end_key = 20 .. and I get back rows with keys ranging from 99 to 414.
Example: I have a known row with key = 13. Putting this value into start_key and end_key gives me no results.
Second issue: even when I do get results the 'columns' portion of the 'keyslice' is always empty. I have checked via cassandra-cli and I know there is data.
Im using Perl as follows:
my $slice_range = new Cassandra::SliceRange();
$slice_range->{ start } = create_UUID( UUID::Tiny::UUID_TIME, "2010-12-24 00:00:00" );
$slice_range->{ finish } = create_UUID( UUID::Tiny::UUID_TIME, "2011-12-25 00:00:00" );
my $slice_predicate = new Cassandra::SlicePredicate();
$slice_predicate->{ slice_range } = $slice_range;
my $key_range = new Cassandra::KeyRange();
$key_range->{ start_key } = 13;
$key_range->{ end_key } = 13;
my $result = $client->get_range_slices( $column_parent, $slice_predicate, $key_range, $consistency_level );
print Dumper( $result );
Clearly Im misunderstanding some basic precept.
EDIT: It turns out that the Perl library Im using is not properly documented. The UUID creation was not working as advertised. I opened it up, fixed it, and now its all going a bit more as I was expecting. I can slice my supercolumns by date/time range. Still working on getting the key range portion to work.
http://wiki.apache.org/cassandra/FAQ#range_rp covers why you're not seeing what you expect with key ranges.
You need to specify a SlicePredicate that contains the actual range of what you're trying to select. The default of no column_names and no slice_range will result in the empty columns list that you see.