I'm trying to create a laravel wrapper for paypal sdk, but could not continue due to the annoying fact that as a developer we should edit this
vendor/paypal/sdk-core-php/lib/../config/sdk_config.ini
Is there anyway in the paypal SDK to easily change the config.ini without compromising the structure.
I'm trying not to touch the /vendor/ folder as much as possible.
Or should i create a filesystem editor in my functions that would create an sdk_config.ini for Paypal SDK?
Any concepts?
Yes with old version like sdk 1.4.0 you can do it by declaring sdk_config path , see paypal documentation
I got same issue too, found some error on code after updating the sdk. post an issue on Paypal-sdk
https://github.com/paypal/SDKs/issues/51
hope it helps
In Composer:
Check composer.json be sure you have:
"paypal/rest-api-sdk-php" : "*"
If you have a different string change it and run composer update.
In your php code:
So now you should be able to inject the configuration in the following way:
$cred = new OAuthTokenCredential($paypal_conf['client_id'], $paypal_conf['secret']);
$this->_api_context = new ApiContext($cred);
$this->_api_context->setConfig($paypal_conf['settings']);
Where $paypal_conf is:
array:3 [▼
"client_id" => "..."
"secret" => "..."
"settings" => array:5 [▼
"mode" => "sandbox"
"http.ConnectionTimeOut" => 30
"log.LogEnabled" => true
"log.FileName" => "./storage/logs/paypal.log"
"log.LogLevel" => "FINE"
]
]
Related
After searching around, I found this aws_account_utils which does exactly what I hope to achieve - programmatically create aws account.
Unfortunately as a total ruby noob, I have no idea how to start using it even after reading the README.md.
I suspect I'd need the following steps:
Create create-account.rb
Use the util in the code
Run ruby create-account.rb
How should the content of create-account.rb be like?
Please show me a template.
With that I should be able to start experimenting and hacking.
Any other steps I should do?
Thanks in advance.
Plan below is rough and must be supplemented.
Create Gemfile file. This file is needed to specify project dependencies (libraries)
Put this line into Gemfile
gem 'aws_account_utils'
Run bundle install in your console / terminal
Create create-account.rb file with next code
require 'aws_account_utils'
aws_utils = AwsAccountUtils::AwsAccountUtils.new()
details = { 'fullName' => 'Herman Munster',
'company' => 'The Munsters',
'addressLine1' => '1313 Mockingbird Lane',
'city' => 'Mockingbird Heights',
'state' => 'CA',
'postalCode' => '92000',
'phoneNumber' => '(800) 555-1212',
'guess' => 'Test Account' }
resp = aws_utils.create_account(account_name: 'My Test Account 01',
account_email: 'adfefef#gmail.com',
account_password: 'foobar1212121',
account_details: details)
This code uses aws_account_utils library. Documentation you can find here.
After steps above you can run ruby create-account.rb.
I have recently upgraded my CS Cart website from 4.2.4 to 4.3.1
We have a custom theme installed so encountered a few issues that we didnt have time to address immediatley - so as per instruction, re ran the restore.
Now we have the following fatal error and I don't really know where to start. I am not much of a dev, but can follow instruction and am quite technically minded.
Thanks for any help in advance.
To fix the assets issue please open the config.local.php file in the root directory and replace:
'custom_files' => array(
'dir' => & $config['dir']['var'],
'prefix' => 'custom_files'
)
with
'custom_files' => array(
'dir' => & $config['dir']['var'],
'prefix' => 'custom_files'
),
'assets' => array(
'dir' => & $config['dir']['cache_misc'],
'prefix' => 'assets',
'cdn' => true
),
This is a very interesting issue. I think the fastest way to resolve it, to contact the official CS-Cart Support Team. If you have a legal license, you have support credits, ask the team to resolve the issue will be free.
I am new in the DevOps world and my company uses Fog library to deploy EC2 instances for our Dev Environment. One of my company's products needs a CDN and I am trying to figure out how I can automate CDN using the same Fog Library.
I found info at fog.io and here is the code I put in makeCDN.rb (with a .sh wrapper to deploy it).
#!/usr/bin/ruby
require 'fog'
# create a connection to the service
cdn = Fog::CDN.new({
:provider => 'AWS',
:aws_access_key_id => 'fake_key_id',
:aws_secret_access_key => '2345fake_access_key6789'
})
cdn.post_distribution({
'CustomOrigin' => {
'DNSName' => 'hostname.domain.org', #example name
'HTTPPort' => '80',
'OriginProtocolPolicy' => 'match-viewer',
'DefaultRootObject' => '/',
'Enabled' => 'true',
}
})
So, I am unsure what I am doing wrong but the error I am getting is:
/home/eztheog/.rvm/gems/ruby-1.9.3-p547#fogDev/gems/excon-0.38.0/lib/excon/middlewares/expects.rb:10:in
`response_call': Expected(201) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest)
response => #<Excon::Response:0x00000001d73b78 #data={:body=>"<?xml version=\"1.0\"?>\n<ErrorResponse
xmlns=\"http://cloudfront.amazonaws.com/doc/2010-11-01/\"><Error>
<Type>Sender</Type><Code>MalformedXML</Code><Message>1 validation error
detected: Value null at 'distributionConfig.enabled' failed to satisfy
constraint: Member must not be null</Message></Error>
<RequestId>c2b33cda-abee-11e4-8115-b584e1255c70</RequestId>
</ErrorResponse>", :headers=>{"x-amzn-RequestId"=>"c2b33cda-abee-11e4-8115-b584e1255c70",
"Content-Type"=>"text/xml", "Content-Length"=>"371", "Date"=>"Tue, 03
Feb 2015 21:51:07 GMT"}, :status=>400, :remote_ip=>"205.251.242.229",
:local_port=>39733, :local_address=>"10.100.6.203"}, #body="<?xml
version=\"1.0\"?>\n<ErrorResponse
xmlns=\"http://cloudfront.amazonaws.com/doc/2010-11-01/\"><Error>
<Type>Sender</Type><Code>MalformedXML</Code><Message>1 validation error
detected: Value null at 'distributionConfig.enabled' failed to satisfy
constraint: Member must not be null</Message></Error>
<RequestId>c2b33cda-abee-11e4-8115-b584e1255c70</RequestId>
</ErrorResponse>", #headers={"x-amzn-RequestId"=>"c2b33cda-abee-11e4-
8115-b584e1255c70", "Content-Type"=>"text/xml", "Content-Length"=>"371",
"Date"=>"Tue, 03 Feb 2015 21:51:07 GMT"}, #status=400,
#remote_ip="205.251.242.229", #local_port=39733,
#local_address="10.100.6.203">
I have found information here but am unsure how to parse the info into the ruby file.
There seems to be little blog stuff that I can find to figure out how to do this.
Can anyone point me the right direction?
I found this gist that explains the context.
So, the RubyDoc.info link (in question) said that the Enabled Boolean was an Option. But, in AWS it is not (or so it seems based on the error I got).
But, to resolve this, the :Enabled => true has to be OUTSIDE of the cdn.distribution block.
Hope this helps anyone who is looking for this in the future!
Also, this might be a BUG because the Fog library says that this feature is OPTIONAL but it seems mandatory by AWS.
I have written manifest that installs an .exe and applies a hotfix to it every-time it installs on a new machine.
windowsinstaller { 'AppFabric install 1.1 install':
software_title => 'AppFabric 1.1 for Windows Server',
software_path => '/Microsoft/AppFabric1.1/WindowsServerAppFabricSetup_x64.exe',
install_options => ['/i','/SkipUpdates'],
}
windowsinstaller { 'AppFabric 1.1 HotFix install':
software_title => 'Windows Server AppFabric v1.1 CU5 [KB2932678]',
software_path => '/Microsoft/AppFabric1.1/AppFabric1.1-KB2932678-x64-ENU.exe',
install_options => ['/q','/norestart'],
subscribe => Windowsinstaller['AppFabric install 1.1 install']
}
service { 'Remote Registry Service':
name => 'RemoteRegistry',
ensure => running,
restart => true,
}
I am trying to get this install to run only if it's registry key is absent.
Using puppetlabs registry module you can manage keys, redirect them, and change the values.
reference: http://puppetlabs.com/blog/module-of-the-week-puppetlabs-registry-windows
Unfortunately, I can't seem to find a way to simply check if the key is there, I can either delete it or make sure its present using ensure => present and ensure => absent.
As I can't put resources into variables I am finding it hard to use conditional statements, and as present and absent set the key instead of check it, I don't think I can use meta parameters with the registry_key resource.
I know that I can wrap everything in an if statement and use a custom fact but I have been told that this is not the right way to proceed.
If anyone has an example of where this has been done before either using this module or something else registered in the puppet forge or any ideas it would be greatly appreciated.
The user manbart found the answer 7 months ago with this question
Exec onlyif registry value is not present
calling reg.exe to query the registry in an exec resource.
I'm having a problem getting the HTMLPurifier bundle to work. I installed is as so:
php artisan bundle:install Sanitizer
then I edited application/bundles.php
'sanitize' => array('auto' => true),
when I use it:
$clean_output = Sanitize::purify($bad_input);
I get an Unhandled Exception: Class 'Sanitize' not found
I also noticed that when I try: php artisan bundle:upgrade Sanitize,
I get an error saying bundle not installed.
What am I missing?
Any help greatly appreciated.
This bundle has been setup very badly, especially with the different namings and casings. Generally a bundle uses a standard name across the board. What's happening here is that when you install the bundle it's actually installing it to bundles/laravel-htmlpurifier. What you've defined in your bundles.php file is expecting it to be installed at bundles/sanitize.
You have two options.
Option 1
Rename the laravel-htmlpurifier directory to sanitize.
Option 2
Set the location key in the bundles.php file.
'sanitize' => array('auto' => true, 'location' => 'laravel-htmlpurifier')
This should also resolve the upgrading problems you were having. You shouldn't really have to do this as it's normally the responsibility of the bundle author to ensure everything is named correctly and consistently.