i try add
'buyer_email_address'=>$post['email'],
and then make $transactions_api->charge
affter this i call $transactions_api->retrieveTransaction
and i dont see 'buyer_email_address'
also i try add
'billing_address'=>array(
'address_line_1'=>$post['address'],
'first_name'=>$post['first_name'],
'last_name'=>$post['last_name']
),
and i dont see this values in transaction details
SquareConnect\Model\Transaction Object
(
...
[tenders:protected] => Array
(
[0] => SquareConnect\Model\Tender Object
(
...
[note:protected] => Online Transaction
[amount_money:protected] => SquareConnect\Model\Money Object
(
[amount:protected] => 100
[currency:protected] => USD
)
[processing_fee_money:protected] =>
[customer_id:protected] =>
[type:protected] => CARD
[card_details:protected] => SquareConnect\Model\TenderCardDetails Object
(
[status:protected] => CAPTURED
[card:protected] => SquareConnect\Model\Card Object
(
[id:protected] =>
[card_brand:protected] => VISA
[last_4:protected] => 5858
[exp_month:protected] =>
[exp_year:protected] =>
[cardholder_name:protected] =>
[billing_address:protected] =>
[fingerprint:protected] =>
)
[entry_method:protected] => KEYED
)
[cash_details:protected] =>
)
)
[refunds:protected] =>
[reference_id:protected] =>
[product:protected] => EXTERNAL_API
[client_id:protected] =>
[order:protected] =>
[shipping_address:protected] =>
How add information about client?
If you would like to add customer information to a transaction, you should Create a Customer and then pass the customer_id along to the Charge endpoint.
Related
In laravel 8 app I use spatie/laravel-medialibrary 9
and how can I check that file returned by getUrl really exists under storage in code :
foreach (Auth::user()->getMedia('avatar') as $mediaImage) {
\Log::info( varDump($mediaImage, ' -1 $mediaImage::') );
return $mediaImage->getUrl();
}
?
$mediaImage var has data like:
Array
(
[id] => 11
[model_type] => App\Models\User
[model_id] => 1
[uuid] => 2fb4fa16-cbdc-4902-bdf5-d7e6d738d91f
[collection_name] => avatar
[name] => b22de6791bca17184093c285e1c4b4b5
[file_name] => avatar_111.jpg
[mime_type] => image/jpg
[disk] => public
[conversions_disk] => public
[size] => 14305
[manipulations] => Array
(
)
[custom_properties] => Array
(
)
[generated_conversions] => Array
(
)
[responsive_images] => Array
(
)
[order_column] => 1
[created_at] => 2021-12-30T14:08:11.000000Z
[updated_at] => 2021-12-30T14:08:11.000000Z
[original_url] => http://127.0.0.1:8000/storage/Photos/11/avatar_111.jpg
[preview_url] =>
)
Looks like nothing about file under storage...
Thanks!
Method :
File::exists($mediaImage->getPath());
helped me!
I have used angelleye/paypal-codeigniter API for implementing the Paypal Adaptive Payment in my Codeigniter Project.
I have the similar setup like that of https://ci.angelleye.com/paypal/samples/demo/ ON MY LOCALHOST
I have developer paypal account which has 2 merchant sandbox account and one sender sandbox account.While payment I am transferring the funds from sender to 2 receivers.
On my localhost I clicked on the link of Adaptive Payment from the three libraries(Payments Pro , Adaptive Payments,PayFlow) mentioned on that page. Everything was working fine till some time back.
But unfortunately now on click of Adaptive Payment link I am getting following errors in $PayPalRequestData as RESPONSE:
Array
(
['Errors'] => array(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 579040
[ExceptionID] =>
[Message] => Receiver PayPal accounts must be unique.
[Parameter] => receiver
[Severity] => Error
[Subdomain] => Application
)
[Ack] => Failure
[Build] => 20420247
[CorrelationID] => 581ecdae58e50
[Timestamp] => 2016-03-04T01:41:05.725-08:00
[PayKey] =>
[PaymentExecStatus] =>
[RedirectURL] =>
[XMLRequest] => <displayed request string>
[XMLResponse] => <displayed response string>
)
Array
(
['Errors'] => array(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 579017
[ExceptionID] =>
[Message] =>The amount for the primary receiver must be greater than
or equal to the total of other chained receiver amounts
[Parameter] => receiver
[Severity] => Error
[Subdomain] => Application
)
[Ack] => Failure
[Build] => 20420247
[CorrelationID] => d85cb50b00e2e
[Timestamp] => 2016-03-04T01:46:01.853-08:00
[PayKey] =>
[PaymentExecStatus] =>
[RedirectURL] =>
[XMLRequest] => <displayed request string>
[XMLResponse] => <displayed response string>
)
The REQUEST I sent is
$Receiver = array(
'Amount' = '12.00',
'Email' = 'receiver_1#domain.com',
'InvoiceID' = '123-ABCDEFG',
'PaymentType' = 'SERVICE',
'PaymentSubType' = '',
'Phone' = array('CountryCode' = '', 'PhoneNumber' = '',
'Extension' = ''),
'Primary' = 'true'
);
$Receiver = array(
'Amount' = '5.00',
'Email' = 'receiver_2#domain.com',
'InvoiceID' = '123-ABCDEFG',
'PaymentType' = 'SERVICE',
'PaymentSubType' = '',
'Phone' = array('CountryCode' = '', 'PhoneNumber' = '',
'Extension' = ''),
'Primary' = 'true'
);
Can someone please tell me what there errors are? and how to solve those errors.
I have a small problem programming with the use of UploadField . I have created pages to make a light CMS on the FrontEnd. But I don't know how retrieve this image to the page «Update».
There is the code from the page «Create» :
$uploadField = new UploadField( 'ImageEvenement', 'Image' );
There is the code I tried to get working for the page «Update»
$evenID = Session::get('evenementID');
$evenement = Versioned::get_by_stage('PageCalendrierEvenement', 'Stage')->byID($evenID);
..
$SavedImage = File::get()->byID($evenement->ImageEvenementID)
$uploadField = new UploadField( 'ImageEvenement', 'Image', $SavedImage );
How can I retrieve the submitted image to $SavedImage ? My idea to get the ID from File don't work.
Another method :
$SavedImage = $evenement->ImageEvenement();
If I dump data from $SavedImage I'm viewing :
Image Object
(
[destroyed] =>
[model:protected] => DataModel Object
(
[customDataLists:protected] => Array
(
)
)
[record:protected] => Array
(
[ClassName] => Image
[Created] => 2015-07-15 14:41:24
[LastEdited] => 2015-07-16 15:03:25
[Name] => images.jpg
[Title] => images
[Filename] => assets/Membres/9/calendrier/images.jpg
[ShowInSearch] => 1
[ParentID] => 15
[OwnerID] => 9
[ID] => 22
[RecordClassName] => Image
)
[changed:DataObject:private] => Array
(
)
[original:protected] => Array
(
[ClassName] => Image
[Created] => 2015-07-15 14:41:24
[LastEdited] => 2015-07-16 15:03:25
[Name] => images.jpg
[Title] => images
[Filename] => assets/Membres/9/calendrier/images.jpg
[ShowInSearch] => 1
[ParentID] => 15
[OwnerID] => 9
[ID] => 22
[RecordClassName] => Image
)
[brokenOnDelete:protected] =>
[brokenOnWrite:protected] =>
[components:protected] =>
[unsavedRelations:protected] =>
[sourceQueryParams:protected] =>
[failover:protected] =>
[customisedObject:protected] =>
[objCache:ViewableData:private] => Array
(
)
[class] => Image
[extension_instances:protected] => Array
(
[BetterButtonDataObject] => BetterButtonDataObject Object
(
[owner:protected] =>
[ownerBaseClass:protected] => DataObject
[ownerRefs:Extension:private] => 0
[class] => BetterButtonDataObject
)
[SiteTreeFileExtension] => SiteTreeFileExtension Object
(
[owner:protected] =>
[ownerBaseClass:protected] => File
[ownerRefs:Extension:private] => 0
[class] => SiteTreeFileExtension
)
[Hierarchy] => Hierarchy Object
(
[markedNodes:protected] =>
[markingFilter:protected] =>
[_cache_numChildren:protected] =>
[owner:protected] =>
[ownerBaseClass:protected] => File
[ownerRefs:Extension:private] => 0
[class] => Hierarchy
)
)
[beforeExtendCallbacks:protected] => Array
(
)
[afterExtendCallbacks:protected] => Array
(
)
)
Any idea?
class PageCalendrierEvenement extends Page {
private static $db = array(
"Titre" => "Varchar(50)",
"DateDepart" => "Date",
"DateFin" => "Date",
);
private static $has_one = array(
'Creator' => 'Member',
'ImageEvenement' => 'Image',
);
..
}
Thank you!
has one relations need the "ID" suffix in the name of the relation (as it's saved to db...), e.g.
$uploadField = new UploadField( 'ImageEvenementID', 'Image', $SavedImage );
then it should save automatically.
OR, what i do for a single relation:
$imageField = UploadField::create('ImageEvenement', 'Image');
$imageField->setAllowedFileCategories('image');
$imageField->setAllowedMaxFileNumber(1);
hope that helps.
My code works fine but are not clean and not using SilverStripe function classes. The reason for non working saving images to dataobject, is because that I have not use :
$form->saveInto($evenement)
I would like to thank you Wmk for give me the get method to fill form with values on another post :
$form->loadDataForm($evenement)
Finaly, all works fine now!
Finaly after long time brain searching, I have found the trick! The command to use with UploadField is setValue($value) with fileIDs include with it. My final code is :
$evenement = Versioned::get_by_stage('PageCalendrierEvenement', 'Stage')->byID($evenID);
...
$uploadField = new UploadField( 'ImageEvenement', 'Image' );
$data['ImageID'] = $evenement->ImageEvenement()->ID;
$fileIDs[]=$data['ImageID'];
$uploadField->setValue(array('Files' => $fileIDs));
Thats it!
I'm using CodeIgniter Payments to integrate with the Paypal API. I believe I am calling the right methods because I'm getting a response of "Success" but I don't see the transaction in the Sandbox. When I use the sample DoDirectPayment file from Paypal I complete the transaction and I can see it in the sandbox.
Here is my code using CodeIgniter Payments:
//load the payment library
$this->load->spark('codeigniter-payments/0.1.4/');
//configure the parameters for the payment request
$paymentParameters = array(
'cc_type' => 'foo',
'cc_number' => 'foo',
'cc_exp' => 'foo',
'first_name' => 'foo',
'last_name' => 'foo',
'street' => 'foo',
'street2' => 'foo',
'city' => 'foo',
'state' => 'foo',
'country' => 'foo',
'postal_code' => 'foo',
'amt' => 'foo',
'currency_code' => 'USD'
);
//make the call
$paymentResponse = $this->payments->oneoff_payment('paypal_paymentspro', $paymentParameters);
//print the response
print_r($paymentResponse);
Here is the response:
stdClass Object
(
[type] => gateway_response
[status] => Success
[response_code] => 100
[response_message] => The authorization was successful.
[details] => stdClass Object
(
[gateway_response] => stdClass Object
(
[TIMESTAMP] => 2012-05-22T19:18:17Z
[CORRELATIONID] => 7939eeaa6c0c0
[ACK] => Success
[VERSION] => 66.0
[BUILD] => 2929894
[AMT] => 20.89
[CURRENCYCODE] => USD
[AVSCODE] => X
[CVV2MATCH] => M
[TRANSACTIONID] => 4RS01101TL8204042
)
[timestamp] => 2012-05-22T19:18:17Z
[identifier] => 4RS01101TL8204042
)
)
You can just switch into using other Paypal libraries. It might save you time than figuring out this problem. http://codeigniter.com/wiki/PayPal_Lib
I had this problem too.
In my case, I did not set my config driver correctly and it ended up sending all my transactions to Calvin's (Author's) default paypal sandbox account.
Double check to make sure that your API tokens are set correctly with:
$gateway_name = 'paypal_paymentspro';
$params = array(
'identifier' => *Your transaction ID from above*
);
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);
Also, if you don't want to set the driver and want to do everything from your PHP file, you can always pass in your API tokens like so:
$gateway_name = 'paypal_paymentspro';
$params = array(
'identifier' => *Your transaction ID from above*
);
$config['api_username'] = *Your api username*;
$config['api_password'] = *Your api password*;
$config['api_signature'] = *Your sig*;
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);
My problem right now is that a Model has a set of Validation rules like so:
var $validate = array(
'title' => array(
'rule' => 'notEmpty'
),
'uri' => array(
'slugged' => array(
'rule' => '/^[a-z0-9-_]+$/i',
'message' => 'This field should only contain characters, numbers, dashes and underscores'
),
'uniqueUrl' => array(
'rule' => array('uniqueUrl'),
'message' => 'A page has already acquired this url'
)
),
'meta_keywords' => array(
'rule' => 'notEmpty'
),
'meta_description' => array(
'rule' => 'notEmpty'
),
'layout' => array(
'rule' => 'notEmpty'
)
);
The problem is that in another model that has hasOne relationship its controller also inserts data into it. I want to NOT require the title, uri and layout from that page. How do I do it?
I have a Post Model and I set Page values from there.
Array
(
[Post] => Array
(
[title] => data[Post][title]
[body] =>
Post Body
)
[Category] => Array
(
[Category] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
)
[Page] => Array
(
[meta_keywords] => data[Page][meta_keywords]
[meta_description] => data[Page][meta_description]
)
)
I do this from the controller to set info for the Page model
$this->data['Page']['title'] = $this->data['Post']['title'];
It turns to be like this:
Array
(
[Post] => Array
(
[title] => data[Post][title]
[body] =>
Post Body
)
[Category] => Array
(
[Category] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
)
[Page] => Array
(
[meta_keywords] => data[Page][meta_keywords]
[meta_description] => data[Page][meta_description]
[title] => data[Post][title]
)
)
My problem is that I do not require a Page field when saving. Post belongsTo Page.
I don't require [Page][layout] when saving a Post as a Post uses the default view of the method in the Post Controller. A page uses static pages and require them when creating a Page, not when creating a Post.
You're preprocessing the data before it goes for validation, so you're taking some control away from validation. As you seem to be making the decision (in code) whether or not certain fields need to be artificially populated you are rendering those parts of the validation redundant and you should remove them. If you have multiple validations in php, you're going to end up confused.
Where to do this or how to do it more cleanly? WellbeforeValidate might be the 'correct' place to do this, but I would do it wherever it best fits with the logic of your application. Function should come before elegance.