Can someone please explain to me the response value (An array with 69 items contained) of Authorize.net [closed] - authorize.net

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to integrate a payment gateway (Authorize.Net, AIM) into my website (PHP v7.0 + Apache2.5), I do it with CURL, like this:
$delimiter = $params['delimiter'];
$post_url = AUTHORIZE_POST_URL;
$post_values = array(
"x_login" => AUTHORIZE_API_LOGIN_ID,
"x_tran_key" => AUTHORIZE_API_TRANSACTION_KEY,
"x_recurring_billing" => FALSE,
"x_version" => "3.1",
"x_delim_data" => "TRUE",
"x_delim_char" => $delimiter,
"x_relay_response" => "FALSE",
"x_type" => "AUTH_CAPTURE",
"x_method" => "CC",
"x_card_num" => $params['card_number'],
"x_exp_date" => $params['card_expire_date'],
"x_amount" => (float) $params['order_amount'],
"x_description" => $params['order_description'],
"x_first_name" => $params['order_first_name'],
"x_last_name" => $params['order_last_name'],
"x_address" => $params['order_address_address'],
"x_city" => $params['order_address_city'],
"x_state" => $params['order_address_state'],
"x_zip" => $params['order_address_zip']
);
$post_string = http_build_query($post_values);
$request = curl_init($post_url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($request, CURLOPT_SSLVERSION, 6);
$post_response = curl_exec($request);
curl_close($request);
return $post_response;
The response will be an Array with 69 item contained, I want to know each of the items means.
Also, I want to integrate the AVS and CCV, I followed the instruction to enable the AVS Filter and CCV Filter in my account of Authorize.net, but somehow, it doesn't work.
Any thoughts will be appreciated!!!
Plus: the response array looks like this:
["1","1","1","This transaction has been approved.","RPPG48","Y","40014513637","","","3.00","CC","auth_capture","","","","","","","","","","","","","","","","","","","","","","","","","","3CDC8404F9E62C3D8F2C0259623F3265","P","2","","","","","","","","","","","XXXX0015","MasterCard","","","","","","","","","","","","","","","","",""]

Authorize.Net AIM is deprecated, but you can find legacy documentation at https://developer.authorize.net/api/upgrade_guide/#aim

Related

How do i intercept an URL with a pathvariable using Regex? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have an interceptor in my angular app where a loading spinner is disabled on specific GET requests. Until now i had no trouble until i had to add an URL with a path variable. I don't know how to capture the path variable with Regex. Here are the essential code snippets:
#Injectable()
export class LoadingScreenInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
let displayLoadingScreen = true;
for (const skippUrl of this.skippUrls) {
if (new RegExp(skippUrl).test(request.url)) {
displayLoadingScreen = false;
break;
}
}
...
The urls that have to be skipped:
skippUrls = [
'/product/images',
'/product/${productId}/image', // Stuck on this one. Simply copy pasting the url string doesn't seem to work
'/category/',
...
Thank you for your help!
Try this Regex:
'\/product\/.*\/(image)$'

Missing creative spec facebook

I'm trying to create an ad using the php sdk.
I can create the campaign, targeting, adset, and the creative (which returns a creative_id that I can validate using the graph explorer).
But when I finally run the code to create the ad itself, I get an exception that looks like this:
"error_user_title" => "Missing creative spec"
"error_user_msg" => "No creative spec found for given adgroup."
I just can't find anything referring to this error.
Below is the relevant portion of my code:
$link_data = new AdCreativeLinkData();
$link_data->setData(array(
AdCreativeLinkDataFields::LINK => $route,
AdCreativeLinkDataFields::MESSAGE => $petition_statement,
AdCreativeLinkDataFields::NAME => $banner_title,
AdCreativeLinkDataFields::IMAGE_HASH => $image_hash,
));
$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
AdCreativeObjectStorySpecFields::PAGE_ID => $pageid,
AdCreativeObjectStorySpecFields::INSTAGRAM_ACTOR_ID=>$instagram_id,
AdCreativeObjectStorySpecFields::LINK_DATA=>$link_data
));
$creative = new AdCreative(null,$account_id);
$creative->setData(array(
AdCreativeFields::TITLE => $banner_title,
AdCreativeFields::BODY => $banner_subtitle,
AdCreativeFields::IMAGE_HASH => $image_hash,
AdCreativeFields::OBJECT_TYPE => 'SHARE',
AdCreativeFields::OBJECT_STORY_SPEC=>$object_story_spec
));
$creative->create();
echo 'Creative ID: '.$creative->id . "\n";
$ad = new Ad(null, $account_id);
$ad->setData(array(
AdFields::NAME => $short_name,
AdFields::ADSET_ID => $adset->id,
AdFields::CREATIVE => $creative,
AdFields::TRACKING_SPECS => array(array(
'action.type' => 'offsite_conversion',
'fb_pixel' => $pixel_code,
))
));
$ad->create(array(Ad::STATUS_PARAM_NAME => Ad::STATUS_PAUSED));
Appreciate any help.
I've often said that the only skill you need to be a successful developer is the ability to agonize over a problem for days, read through source code, google it, refactor, rewrite and then realize you forgot something fucking obvious.
AdFields::CREATIVE => $creative,
should read
AdFields::CREATIVE => $creative->id,
But the ability to persist isn't the skill you need. The real skill is to somehow resist the overwhelming urge to chuck your computer out the window and do something productive with your life instead.
After hours of testing it seems Trevor's answer is incorrect. This is the right syntax:
AdFields::CREATIVE => array('creative_id'=>$creative->id)

wpdb Update function getting "Undefined Index" error for each table column

I'm developing a plugin that lets me add and delete custom table records. Adding and deleting records works fine.
I also want to be able to update the records. This is where I cannot figure out what I'm doing wrong.
Here is my update code if anyone can point me in the right direction (I'm currently focused on the "update selected record" script:
function url_update() {
global $wpdb;
$id = $_GET["id"];
$launchname=$_POST["launchname"];
$url1 = $_POST["url1"];
$url2 = $_POST["url2"];
$urluser = $_POST["urluser"];
$urlpwd = $_POST["urlpwd"];
$wpfirstname = $_POST["wpfirstname"];
$wplastname = $_POST["wplastname"];
$wpemail = $_POST["wpemail"];
$activated = $_POST["activated"];
//update selected record
if(isset($_POST['update'])){
$wpdb->update('launcher',
array(
'id' => $id,
'launchname' => $launchname,
'url1' => $url1,
'url2' => $url2,
'urluser' => $urluser,
'urlpwd' => $urlpwd,
'wpfirstname' => $wpfirstname,
'wplastname' => $wplastname,
'wpemail' => $wpemail,
'activated' => $activated
),
array( 'ID' => $id ), //this line fixed the issue
array('%d','%s','%s','%s','%s','%s','%s','%s','%s','%s'));
}
//delete
else if(isset($_POST['delete'])){
$wpdb->query($wpdb->prepare(
"DELETE FROM wp_tincan_launcher WHERE id = %d",$id
));
}
else{
//selecting row to update
$selected_record = $wpdb->get_results($wpdb->prepare(
"SELECT id,launchname,url1,url2,urluser,urlpwd,wpfirstname,
wplastname,wpemail,activated from launcher where id=%d",$id
));
foreach ( $selected_record as $s ){
$launchname=$s->launchname;
$url1=$s->url1;
$url2=$s->url2;
$urluser=$s->urluser;
$urlpwd=$s->urlpwd;
$wpfirstname=$s->wpfirstname;
$wplastname=$s->wplastname;
$wpemail=$s->wpemail;
$activated=$s->activated;
}
}
I think my code is correct, however, I would really appreciate some feedback that directly addresses my code.
EDIT: Thanks to Pekka for pointing out that I did not identify the error results.
The Error I'm getting from WP is "Notice: Undefined index: each column in the DB."
Best Regards
I resolved it myself by changing my update query to include a new line as follows: array( 'ID' => $id ), before the types line.
None of the links I was led to, not any of the generic advice I was provided was of any help what-so-ever.
I've edited the original code to reflect the complete working code.

Detect Fields that do not have ID attribute using grep and regex [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Need to find the following patern in a file using grep and regular expression :-
$form->AddFields({
type => 'hidden',
name => 'xyz',
value => 0,
});
i think we nee to use multi line grep for this.
Can anyone help please.?
Using awk:
awk '{ printf /id =>/? FS: $0 RS}' RS='});' file
Input:
$form->AddFields({
id => 2048
type => 'hidden',
name => 'xyz',
value => 0,
});
$form->AddFields({
type => 'hidden',
name => 'xyz',
value => 0,
});
$form->AddFields({
type => 'hidden',
name => 'xyz',
id => 1024,
value => 0,
});
Output:
$form->AddFields({
type => 'hidden',
name => 'xyz',
value => 0,
});
It's not a grep statement, but might want to try this Perl script (this assumes you're feeding the input via STDIN). It also assumes that you don't have any forms that are truncated within the input (forms that begin before the input start or end after the input ends), but there's ways to deal with those conditions if they are relevant to you.
use strict;
use warnings;
sub processRecord {
my ($record) = #_;
my $text = join("\n", #{$record});
print "$text\n" unless $text =~ /ID\s*=>\s*/;
}
my $recordStart = qr/^\s*\$form\s*->\s*AddFields\s*\(\s*\{\s*/;
my $recordEnd = qr/\s*\}\s*\)\s*;\s*$/;
my #record;
my $inRecord = 0;
while (my $line=<>) {
next unless $line =~ /\S/;
chomp($line);
$inRecord = 1 if $line =~ /$recordStart/;
if ($line =~ /$recordEnd/) {
push(#record, $line);
processRecord(\#record);
#record = ();
$inRecord = 0;
next;
}
push(#record, $line) if $inRecord;
}

Validation in BlackBerry 10 application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am trying to develop one app in which I need one registration page. How should I apply validation in that for phone numbers and e-mail ? Please somebody help me
You can place validation in your TextFields as follows:
TextField {
id: myTextField
hintText: "Flight number"
inputMode: TextFieldInputMode.NumbersAndPunctuation
validator: Validator {
mode: ValidationMode.Immediate
errorMessage: "Please enter only numbers for this field"
onValidate: {
var valNumeric = /^[0-9 -]+$/i; //Numbers, including space and minus/dash
if (valNumberic.test(parent.text)) {
state = ValidationState.Valid;
} else {
state = ValidationState.Invalid;
}
}
}
}
You can set the inputMode to something such as NumbersAndPunctuation or Email and that will affect the keyboard. Then in the onValidate you can compare the parent.text with a regex expression or in any other way you wish. Setting ValidationState to Invalid will show a validation error with the message you specify in errorMessage.