Right now I have a simple PHP script outside of my drupal installation that just compiles a CSV for my client of orders and the credit card type (Visa, Mastercard..)
It seems like an older version of Drupal 6 just had this part of data serialized in the database "cc_card" however now it seems to be encrypted.
Is there a way to decrypt this data (Stored in us_orders.data) so that I could see the card type?
The uc_credit_cache() function should do what you want:
$order = uc_order_load($order_id);
$cc_data = uc_credit_cache('save', $order->data['cc_data'], TRUE);
$cc_data should look something like this:
Array
(
[cc_type] => visa
[cc_owner] =>
[cc_number] => 4111111111111111
[cc_start_month] =>
[cc_start_year] =>
[cc_exp_month] => 9
[cc_exp_year] => 2012
[cc_issue] =>
[cc_cvv] => 222
[cc_bank] =>
)
Related
I am trying to work with the WooCommerce REST API. So far I have installed the official package and created an index.php file with this code in it:
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
$woocommerce = new Client(
'http://me.commerce.loc/', // Your store URL
'ck_9dadcf73d58fec8b0860bced4b0997d7b3b0f93e', // Your consumer key
'cs_e63d694c035444c45355339171c682052b2707eb', // Your consumer secret
[
'wp_api' => true, // Enable the WP REST API integration
'version' => 'wc/v3' // WooCommerce WP REST API version
]
);
print "<pre>";
print_r($woocommerce);
die();
Printing out $woocommerce gives me this object:
Automattic\WooCommerce\Client Object
(
[http] => Automattic\WooCommerce\HttpClient\HttpClient Object
(
[ch:protected] =>
[url:protected] => http://me.commerce.loc/wp-json/wc/v3/
[consumerKey:protected] => ck_9dadcf73d58fec8b0860bced4b0997d7b3b0f93e
[consumerSecret:protected] => cs_e63d694c035444c45355339171c682052b2707eb
[options:protected] => Automattic\WooCommerce\HttpClient\Options Object
(
[options:Automattic\WooCommerce\HttpClient\Options:private] => Array
(
[wp_api] => 1
[version] => wc/v3
)
)
[request:Automattic\WooCommerce\HttpClient\HttpClient:private] =>
[response:Automattic\WooCommerce\HttpClient\HttpClient:private] =>
[responseHeaders:Automattic\WooCommerce\HttpClient\HttpClient:private] =>
)
)
Is it possible to get wooCommerce data through this object? If no then how can I do it?
Thank you very much.
You do not require to add above code or create index.php
just use this end point to get all orders list : https://example.com/wp-json/wc/v3/orders
To get all Products : https://example.com/wp-json/wc/v3/products
This way you can get list of order and products.
To use rest api and do all operations in woocommerce using rest api please refer this link : https://woocommerce.github.io/woocommerce-rest-api-docs/
There are two woocommerce rest api versions which are V2 and V3 you can use any from this.
Is it possible to define creating a new PayPal account in PayPal Express Checkout as not required?
I'm try this my code and getting two different results - once new paypal account as optional and the other time as an essential.
METHOD => SetExpressCheckout
MAXAMT => 4.50
RETURNURL => https://...
CANCELURL => https://...
REQCONFIRMSHIPPING => 0
SOLUTIONTYPE => SOLE
NOSHIPPING => 0
LOCALECODE => EN
LANDINGPAGE => Billing
HDRIMG => http://.../logo.jpg
PAYFLOWCOLOR =>
CHANNELTYPE => Merchant
ALLOWNOTE => 0
PAYMENTREQUEST_0_SHIPTONAME => Stephan K Schwartz
PAYMENTREQUEST_0_SHIPTOSTREET => Heiligengeistbrücke 76
PAYMENTREQUEST_0_SHIPTOSTREET2 => Freistaat Bayern
PAYMENTREQUEST_0_SHIPTOCITY => Windsbach
PAYMENTREQUEST_0_SHIPTOSTATE =>
PAYMENTREQUEST_0_SHIPTOZIP => 91575
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE => DE
ADDROVERRIDE => 1
PAYMENTREQUEST_0_SHIPPINGAMT =>
PAYMENTREQUEST_0_CURRENCYCODE => EUR
PAYMENTREQUEST_0_PAYMENTACTION => Sale
L_PAYMENTREQUEST_0_DESC0 =>
L_PAYMENTREQUEST_0_NAME0 => Product name
L_PAYMENTREQUEST_0_NUMBER0 => 4260568520853
L_PAYMENTREQUEST_0_AMT0 => 2.50
L_PAYMENTREQUEST_0_QTY0 => 1
L_PAYMENTREQUEST_0_ITEMURL0 => https://....
L_PAYMENTREQUEST_0_NUMBER1 => tax
L_PAYMENTREQUEST_0_NAME1 => VAT 20%
L_PAYMENTREQUEST_0_AMT1 => 0.50
L_PAYMENTREQUEST_0_QTY1 => 1
PAYMENTREQUEST_0_ITEMAMT => 3.00
PAYMENTREQUEST_0_AMT => 3.00
Guest checkout is turned on, of course, in both cases. Version 109.0.
Ok after a few hours of trying I found out it's question about amount of order.
If a customer is paying small order under about 200 USD or 500 EUR (I couldn't find exact limits), the customer will be promped to get registered. (right side of the picture in question)
But if a customer is paying more than the above estimated amount, the registration is not required. (left side of picture in question)
Makes this sense or am I wrong?
I had a similar issue, and there was no answer to it. I even contacted PayPal several times, my problem was that when the user used a mobile device the guest checkout wasn't available, however exactly same page, same product did show a guest checkout when opened from a desktop.
To add to this, the code was running for a while and guest checkout was available on mobile, then one day it disappeared, while nothing was changed on my code.
All I learned from countless calls to tech support is that it's something which is decided at server (PayPal) level and you as a developer don't have too much influence over it.
Yes there is an option to enable guest payment: (See https://developer.paypal.com/docs/integration/direct/payments/guest-payments/# ) but it's not really guaranteed it will work.
To add to this, after a period of time (again without changing the code) the guest option appeared again on the mobile versions.
As a footnote and slightly off topic:
This (and the very high fees) where the reasons I decided to dump PayPal checkout, bite the bullet, set up a PCI compliant server, sign up for a gateway and merchant account, and start taking card payments directly.
Running Drupal 7.26 with nothing fancy and have started to encounter a corruption issue with the menu system. We started seeing the following error (truncated to fit). Doing a drush or a manual clear cache doesn't fix it, setting menu_router.weight to NULL yes, truncating both the menu_links and menu_router tables still produces the error. Links oddly menu still appear on the site, but only some not all.
I suspect that the issue might be caused by a page view (using views3) with a set path, but I can't see why that would be as it is again just a normal path.
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column
'weight' at row 9: INSERT INTO {menu_router} (path, load_functions, to_arg_functions,
access_callback, access_arguments, page_callback, page_arguments, delivery_callback, fit,
number_parts, context, tab_parent, tab_root, title, title_callback, title_arguments,
theme_callback, theme_arguments, type, description, position, weight, include_file) VALUES
.... (truncated) ....
(:db_insert_placeholder_184, :db_insert_placeholder_185, :db_insert_placeholder_186,
:db_insert_placeholder_187, :db_insert_placeholder_188, :db_insert_placeholder_189,
:db_insert_placeholder_190, :db_insert_placeholder_191, :db_insert_placeholder_192,
:db_insert_placeholder_193, :db_insert_placeholder_194, :db_insert_placeholder_195,
:db_insert_placeholder_196, :db_insert_placeholder_197,); Array (
.... (truncated) ....
[:db_insert_placeholder_180] => Ajax callback for view loading.
[:db_insert_placeholder_181] => [:db_insert_placeholder_182] => 0
[:db_insert_placeholder_183] => sites/all/modules/contrib/views/includes/ajax.inc
[:db_insert_placeholder_184] => volunteering/opportunities [:db_insert_placeholder_185] =>
[:db_insert_placeholder_186] => [:db_insert_placeholder_187] => ctools_access_menu
[:db_insert_placeholder_188] => a:1:{i:0;a:2:{s:4:"type";s:4:"none";s:8:"settings";N;}}
[:db_insert_placeholder_189] => page_manager_page_execute [:db_insert_placeholder_190] =>
a:1:{i:0;s:13:"volunteering_";} [:db_insert_placeholder_191] =>
[:db_insert_placeholder_192] => 3 [:db_insert_placeholder_193] => 2
[:db_insert_placeholder_194] => 0 [:db_insert_placeholder_195] =>
[:db_insert_placeholder_196] => volunteering/opportunities [:db_insert_placeholder_197] =>
Volunteering opportunities [:db_insert_placeholder_198] => t [:db_insert_placeholder_199]
=> [:db_insert_placeholder_200] => [:db_insert_placeholder_201] => a:0:{} ) in
_menu_router_save() (line 3837 of /var/mysite/dev/includes/menu.inc).
For some strange reason the function page_manager_list_page() in ctools page manager > page_manager.admin.inc wasn't setting a numeric weight. Not sure how or why it isn't checking it is not a an integer, but it doesn't which caused the issue.
I'm working with SiteCore and I need to pull some data out of the software via either that API or the SQL database using a PHP script. The reason I say both are possible is because even if the database changes later on, that doesn't matter to me.
Anyway...
I'm trying to pull any data fields that I can get from a particular issue. This is my SOAP code so far, and it connects to the service and such, but the return isn't what I need...
try
{
$client = new SoapClient('http://localhost:8083/sitecore/shell/webservice/service.asmx?WSDL');
$credentials = array('Password' => 'mypassword','Username' => 'sitecore\myusername');
$Current_Issue = array(
'id' => '{043B69BA-3175-4184-812F-C925CE80324E}',
//'language' => 'en',
//'version' => '1',
//'allFields' => 'true',
'databaseName' => 'web',
'credentials' => $credentials
);
$response = $client->GetItemMasters($Current_Issue);
print_r($response);
}
catch(SoapFault $e)
{
echo $e->getMessage();
}
catch(Exception $e)
{
echo $e->getMessage();
}
This is my output:
stdClass Object
(
[GetItemMastersResult] => stdClass Object
(
[any] => <sitecore xmlns=""/>
)
)
ANY help is appreciated. If anybody knows an example SQL query that I can use, that would be just as useful as an alternative method.
Thanks
If you are running Sitecore 6.5 / 6.6 you may want to take a look at the Sitecore Item Web API which was released yesterday (5/11/12).
http://sdn.sitecore.net/Products/Sitecore%20Item%20Web%20API.aspx
This allows you to perform RESTful operations against Sitecore items without the need for the old web service / SOAP interface. Using this module you can receive a JSON representation of a Sitecore item or collection of items and even post back changes. You may find it easier to work with :)
If you have to use the SOAP interface, are you sure that your items are published ? Try changing the databaseName -> 'master' and see if you get any results. Other things to check are the permissions of the user credentials you are using.
I'm using CentOS 5.5 Linux (without X), PHP 5.3 and Drupal 7.0.
The core language of my site is Russian (not English)!
I've created a game.info and the following game.module which generates 3 blocks for the front page:
function game_block_info() {
return array(
'game_main' => array(
'info' => t('Set FlashVars and show the flash game.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_winner' => array(
'info' => t('Show the winner of the last week.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_leader' => array(
'info' => t('Show the leader of the current week.'),
'cache' => DRUPAL_NO_CACHE,
);
}
function game_block_view($block_name = '') {
global $user;
if ($block_name == 'game_main') {
if (user_is_logged_in()) {
$content = t('User is logged in.');
} else {
$content = t('User is an anonymous user.');
}
drupal_set_message("<pre>$output</pre>\n");
return array(
'subject' => t('Main Game'),
'content' => $content,
);
} else if ($block_name == 'game_winner') {
....
} else if ($block_name == 'game_leader') {
....
}
}
It works ok, but I need all strings to be in Russian and do not want to hardcode them into my game.module file.
Do I need to create the 3rd file called game.po and add it to the game.info?
How can I create a .po file? I would prefer a simple editing of that file if possible, without obscure tools.
I've also tried a tool:
# xgettext -n game/game.module --keyword=t
xgettext: warning: file `game/game.module' extension `module' is unknown; will try C
game/game.module:87: warning: unterminated character constant
game/game.module:100: warning: unterminated character constant
These should be the steps:
To generate the .pot file, install the module Translation template extractor
Go to the "Extract strings" tab on the Locale administration interface, select your module and submit the form. You will get one single template file generated.
Then you can translate the strings with a tool like Poedit (http://www.poedit.net).
When you are done, files should be copied to a "translations" sub-folder in the module folder, so they are automatically imported by Drupal when installing your game module.
Please, give feedback and tell what problems did you have. Thanks