I am getting weird problem in google php calendar api. It is not returning nextsynctoken.
This is var_export of $service->events->listEvents($calendarId, $optParams);
Google_Service_Calendar_Events::__set_state(array(
'collection_key' => 'items',
'accessRole' => 'owner',
'defaultRemindersType' => 'Google_Service_Calendar_EventReminder',
'defaultRemindersDataType' => 'array',
'description' => NULL,
'etag' => '"p32o8lfd2qbkt20g"',
'itemsType' => 'Google_Service_Calendar_Event',
'itemsDataType' => 'array',
'kind' => 'calendar#events',
'nextPageToken' => NULL,
'nextSyncToken' => NULL,
'summary' => 'Meetings',
'timeZone' => '',
'updated' => '2017-01-30T10:18:50.782Z',
'internal_gapi_mappings' =>
array (
),
'modelData' =>
array (
'defaultReminders' =>
array (
),
'items' =>
array (
),
),
'processed' =>
array (
),
))
While in api explorer, it is sending nextsynctoken.
Github link:
https://github.com/google/google-api-php-client/issues/1141
Thanks in advance.
Thanks guys I got answer. Her
https://github.com/google/google-api-dotnet-client/issues/610
Related
array (
'_attributes' =>
array (
'name' => 'Rothco Product API - Variations',
),
'item_variations' =>
array (
0 =>
stdclass::__set_state(array(
'item_variation_id' => 2,
'item_index' => 3146,
'rothco_item_no' => '10002',
'upc' => '023063601212',
'inventory' => 99,
'created_date' => '2014-11-28 10:06:45.000',
'weight' => '.4000',
'image_filename' => '10002-A.jpg',
'catalog_page_no' => 183,
'msrp' => '20.9900',
'map' => '.0000',
'diameter' => '',
'price' => '8.100000',
'case_price' => NULL,
'case_quantity' => NULL,
'statuses' => '',
)),
),
)
This is my array $list.
I want to access 'item_variations' value from this array,
but if I try $list['item_variations'], or $list->['item_variations']
it is not working
If you want to reach just item_variations then
echo $list['item_variations'];
is sufficient. Things get more tricky if you would like to i.e. get value if created_date from your sample data as you got mix of arrays and objects so that require different access:
echo $list['item_variations'][0]->created_date;
which would output
2014-11-28 10:06:45.000
ref: https://stackoverflow.com/a/25730860/2735734
How to Tell PayPal to automatically process the monthly payment?
UPDATE 1
here is the PayPal Reponses:
CreateAgreement result:
array (
'name' => 'my name',
'description' => 'my description',
'plan' =>
array (
'id' => 'P-95307423V8719480UI4T4SGG',
'state' => 'ACTIVE',
'name' => 'title here',
'description' => 'description here',
'type' => 'INFINITE',
'payment_definitions' =>
array (
0 =>
array (
'id' => 'PD-140035022V340531AI4T4SGG',
'name' => 'Regular Payments',
'type' => 'REGULAR',
'frequency' => 'Month',
'amount' =>
array (
'currency' => 'USD',
'value' => '15.5',
),
'cycles' => '0',
'charge_models' =>
array (
0 =>
array (
'id' => 'CHM-9G272533RU378412KI4T4SGG',
'type' => 'TAX',
'amount' =>
array (
'currency' => 'USD',
'value' => '1',
),
),
),
'frequency_interval' => '1',
),
),
'merchant_preferences' =>
array (
'setup_fee' =>
array (
'currency' => 'USD',
'value' => '0',
),
'max_fail_attempts' => '0',
'return_url' => 'http://example.com/ok',
'cancel_url' => 'http://example.com/cancel',
'auto_bill_amount' => 'YES',
'initial_fail_amount_action' => 'CONTINUE',
),
),
'links' =>
array (
0 =>
array (
'href' => 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4N736816FP8632455',
'rel' => 'approval_url',
'method' => 'REDIRECT',
),
1 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-4N736816FP8632455/agreement-execute',
'rel' => 'execute',
'method' => 'POST',
),
),
'start_date' => '2014-10-25T11:54:20-00:00',
)
AND after the client approved.
ExecuteAgreement result:
array (
'id' => 'I-CD3VD66KJKXX',
'state' => 'Active',
'description' => 'my description',
'plan' =>
array (
'payment_definitions' =>
array (
0 =>
array (
'type' => 'REGULAR',
'frequency' => 'Month',
'amount' =>
array (
'currency' => 'USD',
'value' => '15.50',
),
'cycles' => '0',
'charge_models' =>
array (
0 =>
array (
'type' => 'TAX',
'amount' =>
array (
'currency' => 'USD',
'value' => '1.00',
),
),
1 =>
array (
'type' => 'SHIPPING',
'amount' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
),
),
'frequency_interval' => '1',
),
),
'merchant_preferences' =>
array (
'setup_fee' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
'max_fail_attempts' => '0',
'auto_bill_amount' => 'YES',
),
),
'links' =>
array (
0 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/suspend',
'rel' => 'suspend',
'method' => 'POST',
),
1 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/re-activate',
'rel' => 're_activate',
'method' => 'POST',
),
2 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/cancel',
'rel' => 'cancel',
'method' => 'POST',
),
3 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/bill-balance',
'rel' => 'self',
'method' => 'POST',
),
4 =>
array (
'href' => 'https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-CD3VD66KJKXX/set-balance',
'rel' => 'self',
'method' => 'POST',
),
),
'start_date' => '2014-10-25T07:00:00Z',
'agreement_details' =>
array (
'outstanding_balance' =>
array (
'currency' => 'USD',
'value' => '0.00',
),
'cycles_remaining' => '0',
'cycles_completed' => '0',
'next_billing_date' => '2014-10-25T10:00:00Z',
'final_payment_date' => '1970-01-01T00:00:00Z',
'failed_payment_count' => '0',
),
)
note the start_date for the first reponse to the second...
The first payement isn't made... (And I don't know for the other, I've try today with a daily payement... I have to wait now...)
In the Pre-Approved area on the Sandbox Account, is in Active and inform about next billing correctly.
Once the user completes and submits subscription purchase page you have created, the subscription will begin and will automatically rebill the customer's account on whatever interval you have selected. You do not have to do anything.
Updated: The REST API also automatically processes subscriptions. You do not have to resubmit monthly. The PayPal sandbox was updated in July of this year to enable you to test and process subscriptions. There are no issues being reported in the dev community about this not working, so I suspect it is something on your side.
If you haven't already. please review this:
https://developer.paypal.com/docs/integration/direct/test-the-api/
There are billing plan and billing subscription sections. If you still have a problem, post your billing plan code and the response you are receiving.
The following output is a result of calling var_export($charge);
How can I access the output of 'paid'=>true from $charge? Any ideas would be appreciated.
I have tried $charge->_values->paid, $charge->paid, etc.. I haven't had any luck.
I have also tried $charge['_values']['paid'];
Stripe_Charge::__set_state(array(
'_apiKey' => 'sk_test_BPZyFpcAM',
'_values' =>
array (
'id' => 'ch_102kMF29T6',
'object' => 'charge',
'created' => 1381688,
'livemode' => false,
'paid' => true,
'amount' => 104000,
'currency' => 'usd',
'refunded' => false,
'card' =>
Stripe_Card::__set_state(array(
'_apiKey' => 'sk_test_BPZyFpc',
'_values' =>
array (
'id' => 'card_102kMF29T6',
'object' => 'card',
'last4' => '4242',
'type' => 'Visa',
'exp_month' => 2,
'exp_year' => 2015,
'fingerprint' => '7sRY4jiFM',
'customer' => NULL,
'country' => 'US',
'name' => NULL,
'address_line1' => NULL,
'address_line2' => NULL,
'address_city' => NULL,
'address_state' => NULL,
'address_zip' => NULL,
'address_country' => NULL,
'cvc_check' => 'pass',
'address_line1_check' => NULL,
'address_zip_check' => NULL,
),
'_unsavedValues' =>
Stripe_Util_Set::__set_state(array(
'_elts' =>
array (
),
)),
'_transientValues' =>
Stripe_Util_Set::__set_state(array(
'_elts' =>
array (
),
)),
'_retrieveOptions' =>
array (
),
)),
'captured' => true,
'refunds' =>
array (
),
'balance_transaction' => 'txn_102kMF29T6Z',
'failure_message' => NULL,
'failure_code' => NULL,
'amount_refunded' => 0,
'customer' => NULL,
'invoice' => NULL,
'description' => 'admin#fra.org',
'dispute' => NULL,
'metadata' =>
array (
),
),
'_unsavedValues' =>
Stripe_Util_Set::__set_state(array(
'_elts' =>
array (
),
)),
'_transientValues' =>
Stripe_Util_Set::__set_state(array(
'_elts' =>
array (
),
)),
'_retrieveOptions' =>
array (
),
))
You can use the __toArray($recursive = false) function to get the data in array form.
Example:
$chargeArray = $charge->__toArray(true);
echo $chargeArray['paid'];
I was also able to access the object's data using an array structure before even converting to an array. For me, $charge['paid'] gets me the value.
you can use __toArray() method:
$array = $collection->__toArray(true);
This will work for this case
whatever returns please parse it with json_decode and you will get a assoc array in php
i.e suppose return array is $ret
$ret = json_decode($ret);
$ret->paid;
$ret->captured;
$ret->card->id;
and so on..
Hope it will help you.
echo gettype($charge->paid); //boolean
var_dump($charge->paid); //bool(true)
if($charge->paid==true)echo "==true"; //==true
if($charge->paid===true)echo "===true"; //===true
if($charge->paid==1)echo "==1"; //==1
if($charge->paid===1)echo "===1"; //nada, it's a boolean, not numeric
So using if($charge->paid===true), you should be guaranteed that you are testing what you want to know.
Here in the output via print_r, you can see that paid is displayed as 1.
[_values:protected] => Array ( [id] => ch_10as29724hknftGBm9TxC [object] => charge [created] => 1384696845 [livemode] => [paid] => 1 [amount] => 1400
Thus, depending on where and how paid is being evaluated, it may appear as a number, string, or a boolean. You could run a series of tests for the three possibilities, or just use if($charge->paid){...}
When paid is false, it would probably be returned as empty (""), 0, or a boolean false. A possible thing to look out for is the boolean false being transposed to a string, in which case it would be interpreted as true.
$val = "false";
if($val){
echo "true"; //true
}
So, in your test, just add intval($val) to normalize the values and be on the safe side.
if(intval($charge->paid)){...}
Cheers
*I solved it myself... like 10 minutes later. *
$varbgimg = $row->_field_data['nid']['entity']->field_slideimage['und'][0]['uri'];
Is what I used...
Hope someone can help me. How can I access 'uri' => 'public://veglo8.jpg'?
This is from Drupal and the Views module. If someone could maybe even help me with my ultimate goal, I would appreciate that...
I have a field in Views called slideimage. I want to add a style="background-image:url(image field URL);" to my div. Tried to rewrite the output but it strips the style...
Thanks in advance.
stdClass::__set_state(array(
'nid' => '20',
'node_title' => 'Test 1',
'field_data_field_slideimage_node_entity_type' => 'node',
'field_data_body_node_entity_type' => 'node',
'_field_data' =>
array (
'nid' =>
array (
'entity_type' => 'node',
'entity' =>
stdClass::__set_state(array(
'vid' => '20',
'uid' => '1',
'title' => 'Test 1',
'log' => '',
'status' => '1',
'comment' => '1',
'promote' => '0',
'sticky' => '0',
'nid' => '20',
'type' => 'test',
'language' => 'und',
'created' => '1358336066',
'changed' => '1358337923',
'tnid' => '0',
'translate' => '0',
'revision_timestamp' => '1358337923',
'revision_uid' => '1',
'body' =>
array (
'und' =>
array (
0 =>
array (
'value' => 'Body text here',
'summary' => '',
'format' => 'filtered_html',
'safe_value' => '
Body text here',
'safe_summary' => '',
),
),
),
'field_slideimage' =>
array (
'und' =>
array (
0 =>
array (
'fid' => '8',
'alt' => '',
'title' => '',
'width' => '624',
'height' => '390',
'uid' => '1',
'filename' => 'veglo8.jpg',
'uri' => 'public://veglo8.jpg',
'filemime' => 'image/jpeg',
'filesize' => '27393',
'status' => '1',
'timestamp' => '1358336725',
'rdf_mapping' =>
You can use file_create_url to convert public://... to real world URLs.
$real_url = file_create_url($img_src);
I've used the pathinfo() function for this in the past.
http://php.net/manual/en/function.pathinfo.php
You can apply styles programmatically with this by replacing user-picture[0]['uri'] with your image url. I think you can even place the whole public:// url in there and it will work just fine as well.
THUMBNAIL_STYLE = 'thumbnail';
// now get the full image url from the uri and the style
$default_thumbnail = image_style_url($THUMBNAIL_STYLE, $user->picture[0]['uri']);
http://drupal.org/node/1425836
I have a collection in mongoDb. it is similar to the following.
array(
'_id' => new MongoId("50b35d1217ce10ac1000000f")
'Education' =>
array (
'content' =>
array (
'0' =>
array (
'Organization' => 'SUST',
'Degree' => 'BSC',
'Department' => '',
'Location' => 'Dhaka',
'Session' => '2 Years',
),
'1' =>
array (
'Organization' => 'DU',
'Degree' => 'BSC',
'Department' => '',
'Location' => 'Dhaka',
'Session' => '2 Years',
)
),
'sharing' => 'public',
),
)
I want to delete Education.content.1 from the collection.
So i used the
update(array('_id' => new MongoId('50b35d1217ce10ac1000000f')), array('$unset' => array('Education.content.1' => 1)));
As a result Education.content.1 becomes null.
But I want Education.content.1 to be deleted not to be null.
Please help me if any one knows the solution. Thanks in advance.
Use $pull after $unset:
update(array('_id' => new MongoId('50b35d1217ce10ac1000000f')),
array('$unset' => array('Education.content.1' => 1)));
update(array('_id' => new MongoId('50b35d1217ce10ac1000000f')),
array('$pull' => array('Education.content' => null)));