├── .gitignore
├── composer.json
├── payments
├── parse-php-sdk-master
│ ├── .gitignore
│ ├── tests
│ │ ├── phpunit.xml
│ │ ├── bootstrap.php
│ │ ├── ParseConfigTest.php
│ │ ├── ParseTestHelper.php
│ │ ├── ParseSubclassTest.php
│ │ ├── cloudcode
│ │ │ └── cloud
│ │ │ │ └── main.js
│ │ ├── ParsePushTest.php
│ │ ├── ParseBytesTest.php
│ │ ├── ParseMemoryStorageTest.php
│ │ ├── ParseSessionStorageTest.php
│ │ ├── ParseAnalyticsTest.php
│ │ └── ParseCloudTest.php
│ ├── src
│ │ └── Parse
│ │ │ ├── ParseInstallation.php
│ │ │ ├── Internal
│ │ │ ├── Encodable.php
│ │ │ ├── FieldOperation.php
│ │ │ ├── DeleteOperation.php
│ │ │ ├── SetOperation.php
│ │ │ ├── IncrementOperation.php
│ │ │ ├── AddOperation.php
│ │ │ ├── RemoveOperation.php
│ │ │ └── AddUniqueOperation.php
│ │ │ ├── ParseException.php
│ │ │ ├── ParseConfig.php
│ │ │ ├── ParseAggregateException.php
│ │ │ ├── ParseCloud.php
│ │ │ ├── ParseMemoryStorage.php
│ │ │ ├── ParseStorageInterface.php
│ │ │ ├── ParseSessionStorage.php
│ │ │ ├── ParseBytes.php
│ │ │ ├── ParseAnalytics.php
│ │ │ ├── ParsePush.php
│ │ │ ├── ParseGeoPoint.php
│ │ │ ├── ParseRole.php
│ │ │ └── ParseRelation.php
│ ├── composer.json
│ ├── LICENSE
│ ├── CONTRIBUTING.md
│ └── autoload.php
├── facebook-php-sdk
│ ├── .gitignore
│ ├── tests
│ │ ├── FacebookTestCredentials.php.dist
│ │ ├── GraphLocationTest.php
│ │ ├── GraphUserTest.php
│ │ ├── GraphSessionInfoTest.php
│ │ ├── FacebookCanvasLoginHelperTest.php
│ │ ├── FacebookJavaScriptLoginHelperTest.php
│ │ ├── FacebookPageTabHelperTest.php
│ │ ├── bootstrap.php
│ │ ├── HttpClients
│ │ │ ├── AbstractTestHttpClient.php
│ │ │ ├── FacebookGuzzleHttpClientTest.php
│ │ │ └── FacebookStreamHttpClientTest.php
│ │ ├── GraphAlbumTest.php
│ │ ├── FacebookTestHelper.php
│ │ ├── FacebookSignedRequestFromInputHelperTest.php
│ │ ├── FacebookSessionTest.php
│ │ ├── GraphObjectTest.php
│ │ ├── FacebookRedirectLoginHelperTest.php
│ │ └── FacebookRequestTest.php
│ ├── CONTRIBUTING.md
│ ├── phpunit.xml.dist
│ ├── composer.json
│ ├── LICENSE
│ ├── docs
│ │ ├── FacebookCanvasLoginHelper.fbmd
│ │ ├── retrieve_user_profile.fbmd
│ │ ├── FacebookRequestException.fbmd
│ │ ├── FacebookJavaScriptLoginHelper.fbmd
│ │ ├── post_links.fbmd
│ │ ├── FacebookRequest.fbmd
│ │ ├── upload_photo.fbmd
│ │ ├── FacebookRedirectLoginHelper.fbmd
│ │ ├── FacebookResponse.fbmd
│ │ ├── sdk_landing_page.fbmd
│ │ └── FacebookSession.fbmd
│ ├── src
│ │ └── Facebook
│ │ │ ├── FacebookSDKException.php
│ │ │ ├── FacebookOtherException.php
│ │ │ ├── FacebookClientException.php
│ │ │ ├── FacebookServerException.php
│ │ │ ├── FacebookThrottleException.php
│ │ │ ├── FacebookPermissionException.php
│ │ │ ├── FacebookAuthorizationException.php
│ │ │ ├── HttpClients
│ │ │ ├── certs
│ │ │ │ └── DigiCertHighAssuranceEVRootCA.pem
│ │ │ ├── FacebookHttpable.php
│ │ │ ├── FacebookStream.php
│ │ │ ├── FacebookCurl.php
│ │ │ └── FacebookGuzzleHttpClient.php
│ │ │ ├── FacebookJavaScriptLoginHelper.php
│ │ │ ├── GraphPage.php
│ │ │ ├── FacebookCanvasLoginHelper.php
│ │ │ ├── GraphUserPage.php
│ │ │ ├── GraphLocation.php
│ │ │ ├── FacebookPageTabHelper.php
│ │ │ ├── GraphSessionInfo.php
│ │ │ └── GraphUser.php
│ ├── autoload.php
│ └── README.md
├── 100coins.html
├── 500coins.html
├── 1000coins.html
└── callback.php
├── images
├── bg.jpg
├── bg2.jpg
├── bomb.png
├── logo.jpg
├── logo.png
├── bomb40.png
├── bundle.png
├── buy64.png
├── coin40.png
├── coin64.png
├── gift64.png
├── heart.png
├── logo64.png
├── pagebg.jpg
├── share.png
├── stage.jpg
├── buybomb40.png
├── heart40.png
├── modal_box.png
├── profile.png
├── scores64.png
├── button_brag.png
├── button_play.png
├── celebs
│ ├── rick.png
│ ├── arnie.png
│ ├── george.png
│ ├── jacko.png
│ ├── jeanluc.png
│ ├── keanu.png
│ ├── sinatra.png
│ ├── xzibit.png
│ ├── einstein.png
│ └── goldsmith.png
├── logo_large.jpg
├── share_icon.png
├── achievement_50.png
├── button_close.png
├── button_scores.png
├── button_store.png
├── close_button.png
├── coin_bundle64.png
├── panel_welcome.png
├── button_brag_hot.png
├── button_challenge.png
├── button_mainmenu.png
├── button_play_hot.png
├── topbar_repeater.jpg
├── button_leaderboard.png
├── button_share_action.png
├── icons
│ ├── button_brag.png
│ ├── button_play.png
│ ├── button_store.png
│ └── button_challenge.png
├── button_challenge_hot.png
├── scoreboardentry_right.png
├── scoreboardentry_header.png
├── button_scoreboardchallenge.png
└── scoreboardentry_tournament.png
├── config.php
├── composer.lock
├── METADATA
├── share.php
├── LICENSE
└── scripts
└── integration
├── app_events.js
├── payments.js
└── requests.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor/
2 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "require": {
3 | "ext-mbstring": "*"
4 | }
5 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | vendor/
3 | composer.lock
4 |
--------------------------------------------------------------------------------
/images/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/bg.jpg
--------------------------------------------------------------------------------
/images/bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/bg2.jpg
--------------------------------------------------------------------------------
/images/bomb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/bomb.png
--------------------------------------------------------------------------------
/images/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/logo.jpg
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/logo.png
--------------------------------------------------------------------------------
/images/bomb40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/bomb40.png
--------------------------------------------------------------------------------
/images/bundle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/bundle.png
--------------------------------------------------------------------------------
/images/buy64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/buy64.png
--------------------------------------------------------------------------------
/images/coin40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/coin40.png
--------------------------------------------------------------------------------
/images/coin64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/coin64.png
--------------------------------------------------------------------------------
/images/gift64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/gift64.png
--------------------------------------------------------------------------------
/images/heart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/heart.png
--------------------------------------------------------------------------------
/images/logo64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/logo64.png
--------------------------------------------------------------------------------
/images/pagebg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/pagebg.jpg
--------------------------------------------------------------------------------
/images/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/share.png
--------------------------------------------------------------------------------
/images/stage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/stage.jpg
--------------------------------------------------------------------------------
/images/buybomb40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/buybomb40.png
--------------------------------------------------------------------------------
/images/heart40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/heart40.png
--------------------------------------------------------------------------------
/images/modal_box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/modal_box.png
--------------------------------------------------------------------------------
/images/profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/profile.png
--------------------------------------------------------------------------------
/images/scores64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/scores64.png
--------------------------------------------------------------------------------
/images/button_brag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_brag.png
--------------------------------------------------------------------------------
/images/button_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_play.png
--------------------------------------------------------------------------------
/images/celebs/rick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/rick.png
--------------------------------------------------------------------------------
/images/logo_large.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/logo_large.jpg
--------------------------------------------------------------------------------
/images/share_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/share_icon.png
--------------------------------------------------------------------------------
/images/achievement_50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/achievement_50.png
--------------------------------------------------------------------------------
/images/button_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_close.png
--------------------------------------------------------------------------------
/images/button_scores.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_scores.png
--------------------------------------------------------------------------------
/images/button_store.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_store.png
--------------------------------------------------------------------------------
/images/celebs/arnie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/arnie.png
--------------------------------------------------------------------------------
/images/celebs/george.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/george.png
--------------------------------------------------------------------------------
/images/celebs/jacko.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/jacko.png
--------------------------------------------------------------------------------
/images/celebs/jeanluc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/jeanluc.png
--------------------------------------------------------------------------------
/images/celebs/keanu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/keanu.png
--------------------------------------------------------------------------------
/images/celebs/sinatra.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/sinatra.png
--------------------------------------------------------------------------------
/images/celebs/xzibit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/xzibit.png
--------------------------------------------------------------------------------
/images/close_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/close_button.png
--------------------------------------------------------------------------------
/images/coin_bundle64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/coin_bundle64.png
--------------------------------------------------------------------------------
/images/panel_welcome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/panel_welcome.png
--------------------------------------------------------------------------------
/images/button_brag_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_brag_hot.png
--------------------------------------------------------------------------------
/images/button_challenge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_challenge.png
--------------------------------------------------------------------------------
/images/button_mainmenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_mainmenu.png
--------------------------------------------------------------------------------
/images/button_play_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_play_hot.png
--------------------------------------------------------------------------------
/images/celebs/einstein.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/einstein.png
--------------------------------------------------------------------------------
/images/celebs/goldsmith.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/celebs/goldsmith.png
--------------------------------------------------------------------------------
/images/topbar_repeater.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/topbar_repeater.jpg
--------------------------------------------------------------------------------
/images/button_leaderboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_leaderboard.png
--------------------------------------------------------------------------------
/images/button_share_action.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_share_action.png
--------------------------------------------------------------------------------
/images/icons/button_brag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/icons/button_brag.png
--------------------------------------------------------------------------------
/images/icons/button_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/icons/button_play.png
--------------------------------------------------------------------------------
/images/icons/button_store.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/icons/button_store.png
--------------------------------------------------------------------------------
/images/button_challenge_hot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_challenge_hot.png
--------------------------------------------------------------------------------
/images/scoreboardentry_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/scoreboardentry_right.png
--------------------------------------------------------------------------------
/images/icons/button_challenge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/icons/button_challenge.png
--------------------------------------------------------------------------------
/images/scoreboardentry_header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/scoreboardentry_header.png
--------------------------------------------------------------------------------
/images/button_scoreboardchallenge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/button_scoreboardchallenge.png
--------------------------------------------------------------------------------
/images/scoreboardentry_tournament.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/facebookarchive/web-friend-smash/HEAD/images/scoreboardentry_tournament.png
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | composer.lock
3 | composer.phar
4 | .DS_Store
5 | .idea/
6 | tests/FacebookTestCredentials.php
7 |
8 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/phpunit.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | tests
6 |
7 |
8 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookTestCredentials.php.dist:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseInstallation.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 | class ParseInstallation extends ParseObject
14 | {
15 |
16 | public static $parseClassName = "_Installation";
17 |
18 | }
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/Encodable.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | interface Encodable
13 | {
14 |
15 | /**
16 | * Returns an associate array encoding of the implementing class.
17 | *
18 | * @return mixed
19 | */
20 | public function _encode();
21 |
22 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing
2 | ------------
3 |
4 | For us to accept contributions you will have to first have signed the
5 | [Contributor License Agreement](https://developers.facebook.com/opensource/cla).
6 |
7 | When committing, keep all lines to less than 80 characters, and try to
8 | follow the existing style.
9 |
10 | Before creating a pull request, squash your commits into a single commit.
11 |
12 | Add the comments where needed, and provide ample explanation in the
13 | commit message.
14 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseConfigTest.php:
--------------------------------------------------------------------------------
1 | setConfig(["foo" => "bar", "some" => 1]);
10 | }
11 | }
12 |
13 | class ParseConfigTest extends PHPUnit_Framework_TestCase
14 | {
15 |
16 | public function testGetConfig()
17 | {
18 | $config = new ParseConfigMock();
19 | $this->assertEquals("bar", $config->get("foo"));
20 | $this->assertEquals(1, $config->get("some"));
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 | ./tests
12 |
13 |
14 |
15 |
16 | ./src/Facebook
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 | "This file is @generated automatically"
6 | ],
7 | "hash": "43f581f6f8afc7f06bdd7160f48f3708",
8 | "content-hash": "adc392ef7340a30855efcdacc40133fd",
9 | "packages": [],
10 | "packages-dev": [],
11 | "aliases": [],
12 | "minimum-stability": "stable",
13 | "stability-flags": [],
14 | "prefer-stable": false,
15 | "prefer-lowest": false,
16 | "platform": {
17 | "ext-mbstring": "*"
18 | },
19 | "platform-dev": []
20 | }
21 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseException.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseException extends \Exception
12 | {
13 |
14 | /**
15 | * Constructs a Parse\Exception
16 | *
17 | * @param string $message Message for the Exception.
18 | * @param int $code Error code.
19 | * @param \Exception $previous Previous Exception.
20 | */
21 | public function __construct($message, $code = 0,
22 | \Exception $previous = null)
23 | {
24 | parent::__construct($message, $code, $previous);
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/GraphLocationTest.php:
--------------------------------------------------------------------------------
1 | execute()->getGraphObject();
18 | $this->assertTrue($response instanceof GraphObject);
19 |
20 | $location = $response->getProperty('location', GraphLocation::className());
21 | $this->assertTrue(is_float($location->getLatitude()));
22 | $this->assertTrue(is_float($location->getLongitude()));
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/METADATA:
--------------------------------------------------------------------------------
1 | {
2 | "title": "Friend Smash - Canvas",
3 | "platform_features": [
4 | {
5 | "feature_group": "graph_api"
6 | }
7 | ],
8 | "platforms": [
9 | {
10 | "name": "html"
11 | },
12 | {
13 | "name": "php"
14 | },
15 | {
16 | "name": "javascript"
17 | }
18 | ],
19 | "sdks": [
20 | {
21 | "name": "javascript",
22 | "version": "671604"
23 | },
24 | {
25 | "name": "php",
26 | "version": "3.0"
27 | }
28 | ],
29 | "screenshots": [
30 | {
31 | "path": "screenshots/friendsmash_1.png"
32 | }
33 | ],
34 | "tutorial": {
35 | "url": "https://developers.facebook.com/docs/tutorials/canvas-games/"
36 | },
37 | "featured": 1,
38 | "deprecated": 0
39 | }
40 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseTestHelper.php:
--------------------------------------------------------------------------------
1 | each(function(ParseObject $obj) {
31 | $obj->destroy(true);
32 | }, true);
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/GraphUserTest.php:
--------------------------------------------------------------------------------
1 | execute()->getGraphObject(GraphUser::className());
17 |
18 | $info = FacebookTestHelper::$testSession->getSessionInfo();
19 |
20 | $this->assertTrue($response instanceof GraphUser);
21 | $this->assertEquals($info->getId(), $response->getId());
22 | $this->assertNotNull($response->getName());
23 | $this->assertNotNull($response->getLastName());
24 | $this->assertNotNull($response->getLink());
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/GraphSessionInfoTest.php:
--------------------------------------------------------------------------------
1 | FacebookTestHelper::$testSession->getToken()
14 | );
15 | $response = (new FacebookRequest(
16 | new FacebookSession(FacebookTestHelper::getAppToken()),
17 | 'GET',
18 | '/debug_token',
19 | $params
20 | ))->execute()->getGraphObject(GraphSessionInfo::className());
21 | $this->assertTrue($response instanceof GraphSessionInfo);
22 | $this->assertNotNull($response->getAppId());
23 | $this->assertTrue($response->isValid());
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookCanvasLoginHelperTest.php:
--------------------------------------------------------------------------------
1 | helper = new FacebookCanvasLoginHelper('123', 'foo_app_secret');
14 | }
15 |
16 | public function testSignedRequestDataCanBeRetrievedFromPostData()
17 | {
18 | $_POST['signed_request'] = $this->rawSignedRequestAuthorized;
19 |
20 | $rawSignedRequest = $this->helper->getRawSignedRequest();
21 |
22 | $this->assertEquals($this->rawSignedRequestAuthorized, $rawSignedRequest);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookJavaScriptLoginHelperTest.php:
--------------------------------------------------------------------------------
1 | rawSignedRequestAuthorized;
15 |
16 | $helper = new FacebookJavaScriptLoginHelper($this->appId, $this->appSecret);
17 |
18 | $rawSignedRequest = $helper->getRawSignedRequest();
19 |
20 | $this->assertEquals($this->rawSignedRequestAuthorized, $rawSignedRequest);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "facebook/php-sdk-v4",
3 | "description": "Facebook SDK for PHP",
4 | "keywords": ["facebook", "sdk"],
5 | "type": "library",
6 | "homepage": "https://github.com/facebook/facebook-php-sdk-v4",
7 | "license": "Facebook Platform",
8 | "authors": [
9 | {
10 | "name": "Facebook",
11 | "homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
12 | }
13 | ],
14 | "require": {
15 | "php": ">=5.4.0"
16 | },
17 | "require-dev": {
18 | "phpunit/phpunit": "3.7.*",
19 | "mockery/mockery": "dev-master",
20 | "guzzlehttp/guzzle": "~4.0"
21 | },
22 | "suggest": {
23 | "guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
24 | },
25 | "autoload": {
26 | "psr-4": {
27 | "Facebook\\": "src/Facebook/"
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/share.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Your comrades need you!
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 | Your comrades need you!
18 | Stop staring at your friends, and start smashing them! Play Friend Smash!
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseConfig.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseConfig {
12 |
13 | private $currentConfig;
14 |
15 | /**
16 | * Creates
17 | */
18 | public function __construct() {
19 | $result = ParseClient::_request("GET", "/1/config");
20 | $this->setConfig($result['params']);
21 | }
22 |
23 | public function get($key) {
24 | if (isset($this->currentConfig[$key])) {
25 | return $this->currentConfig[$key];
26 | }
27 | return null;
28 | }
29 |
30 | public function escape($key) {
31 | if (isset($this->currentConfig[$key])) {
32 | return htmlentities($this->currentConfig[$key]);
33 | }
34 | return null;
35 | }
36 |
37 | protected function setConfig($config) {
38 | $this->currentConfig = $config;
39 | }
40 |
41 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookPageTabHelperTest.php:
--------------------------------------------------------------------------------
1 | rawSignedRequestAuthorized;
13 | $helper = new FacebookPageTabHelper('123', 'foo_app_secret');
14 |
15 | $this->assertTrue($helper->isLiked());
16 | $this->assertFalse($helper->isAdmin());
17 | $this->assertEquals('42', $helper->getPageId());
18 | $this->assertEquals('42', $helper->getPageData('id'));
19 | $this->assertEquals('default', $helper->getPageData('foo', 'default'));
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "parse/php-sdk",
3 | "description": "Parse PHP SDK",
4 | "keywords": ["parse", "sdk"],
5 | "type": "library",
6 | "homepage": "https://github.com/parseplatform/parse-php-sdk",
7 | "license": "Parse Platform License",
8 | "authors": [
9 | {
10 | "name": "Parse",
11 | "homepage": "https://github.com/parseplatform/parse-php-sdk/contributors"
12 | }
13 | ],
14 | "require": {
15 | "php": ">=5.4.0",
16 | "ext-curl": "*",
17 | "ext-json": "*"
18 | },
19 | "require-dev": {
20 | "phpunit/phpunit": "~4.0",
21 | "squizlabs/php_codesniffer": "~1.5",
22 | "phpdocumentor/phpdocumentor": "~2.5"
23 | },
24 | "autoload": {
25 | "psr-4": {
26 | "Parse\\": "src/Parse/"
27 | }
28 | },
29 | "extra": {
30 | "branch-alias": {
31 | "dev-master": "1.0-dev"
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseAggregateException.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseAggregateException extends ParseException
12 | {
13 |
14 | private $errors;
15 |
16 | /**
17 | * Constructs a Parse\ParseAggregateException
18 | *
19 | * @param string $message Message for the Exception.
20 | * @param array $errors Collection of error values.
21 | * @param \Exception $previous Previous exception.
22 | */
23 | public function __construct($message, $errors = array(), $previous = null)
24 | {
25 | parent::__construct($message, 600, $previous);
26 | $this->errors = $errors;
27 | }
28 |
29 | /**
30 | * Return the aggregated errors that were thrown.
31 | *
32 | * @return array
33 | */
34 | public function getErrors()
35 | {
36 | return $this->errors;
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseSubclassTest.php:
--------------------------------------------------------------------------------
1 | assertTrue($install instanceof ParseInstallation);
27 | $this->assertTrue(is_subclass_of($install, 'Parse\ParseObject'));
28 | }
29 |
30 | public function testCreateFromParseObject()
31 | {
32 | $install = ParseObject::create("_Installation");
33 | $this->assertTrue($install instanceof ParseInstallation);
34 | $this->assertTrue(is_subclass_of($install, 'Parse\ParseObject'));
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/FieldOperation.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | interface FieldOperation extends Encodable
12 | {
13 |
14 | /**
15 | * Applies the current operation and returns the result.
16 | *
17 | * @param mixed $oldValue Value prior to this operation.
18 | * @param mixed $object Value for this operation.
19 | * @param string $key Key to perform this operation on.
20 | *
21 | * @return mixed Result of the operation.
22 | */
23 | public function _apply($oldValue, $object, $key);
24 |
25 | /**
26 | * Merge this operation with a previous operation and return the new
27 | * operation.
28 | *
29 | * @param FieldOperation $previous Previous operation.
30 | *
31 | * @return FieldOperation Merged operation result.
32 | */
33 | public function _mergeWithPrevious($previous);
34 |
35 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014, Parse, LLC. All rights reserved.
2 |
3 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
4 | copy, modify, and distribute this software in source code or binary form for use
5 | in connection with the web services and APIs provided by Parse.
6 |
7 | As with any software that integrates with the Parse platform, your use of
8 | this software is subject to the Parse Terms of Service at: https://www.parse.com/about/terms
9 | This copyright notice shall be included in all copies or substantial portions of the
10 | software.
11 |
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseCloud.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseCloud
12 | {
13 |
14 | /**
15 | * Makes a call to a Cloud function
16 | *
17 | * @param string $name Cloud function name
18 | * @param array $data Parameters to pass
19 | * @param boolean $useMasterKey Whether to use the Master Key
20 | *
21 | * @return mixed
22 | */
23 | public static function run($name, $data = array(), $useMasterKey = false)
24 | {
25 | $sessionToken = null;
26 | if (ParseUser::getCurrentUser()) {
27 | $sessionToken = ParseUser::getCurrentUser()->getSessionToken();
28 | }
29 | $response = ParseClient::_request(
30 | 'POST',
31 | '/1/functions/' . $name,
32 | $sessionToken,
33 | json_encode(ParseClient::_encode($data, null, false)),
34 | $useMasterKey
35 | );
36 | return ParseClient::_decode($response['result']);
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
2 |
3 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
4 | copy, modify, and distribute this software in source code or binary form for use
5 | in connection with the web services and APIs provided by Facebook.
6 |
7 | As with any software that integrates with the Facebook platform, your use of
8 | this software is subject to the Facebook Developer Principles and Policies
9 | [http://developers.facebook.com/policy/]. This copyright notice shall be
10 | included in all copies or substantial portions of the software.
11 |
12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
14 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2014 Facebook, Inc.
2 |
3 | You are hereby granted a non-exclusive, worldwide, royalty-free license to
4 | use, copy, modify, and distribute this software in source code or binary
5 | form for use in connection with the web services and APIs provided by
6 | Facebook.
7 |
8 | As with any software that integrates with the Facebook platform, your use
9 | of this software is subject to the Facebook Developer Principles and
10 | Policies [http://developers.facebook.com/policy/]. This copyright notice
11 | shall be included in all copies or substantial portions of the software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 | DEALINGS IN THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookCanvasLoginHelper.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookCanvasLoginHelper for the Facebook SDK for PHP
3 |
4 | A helper class for getting a FacebookSession in a Canvas app
5 |
6 |
7 |
8 | ## Facebook\FacebookCanvasLoginHelper {#overview}
9 |
10 | If your app is loaded through Canvas, Facebook sends a POST request with a signed request. This helper class will handle processing and validating that information with Facebook, and returns a `FacebookSession`.
11 |
12 | Usage:
13 |
14 | ~~~~
15 |
16 | $helper = new FacebookCanvasLoginHelper();
17 | try {
18 | $session = $helper->getSession();
19 | } catch (FacebookRequestException $ex) {
20 | // When Facebook returns an error
21 | } catch (\Exception $ex) {
22 | // When validation fails or other local issues
23 | }
24 | if ($session) {
25 | // Logged in.
26 | }
27 |
28 | ~~~~
29 |
30 |
31 |
32 | ## Instance Methods {#instance-methods}
33 |
34 | ### getSession {#getsession}
35 | `getSession()`
36 | Processes the POST request from Facebook, if present. Returns a `FacebookSession` or `null`.
37 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/cloudcode/cloud/main.js:
--------------------------------------------------------------------------------
1 | Parse.Cloud.define("bar", function(request, response) {
2 | if (request.params.key2 === "value1") {
3 | response.success('Foo');
4 | } else {
5 | response.error("bad stuff happened");
6 | }
7 | });
8 |
9 | Parse.Cloud.define("foo", function(request, response) {
10 | var key1 = request.params.key1;
11 | var key2 = request.params.key2;
12 | if (key1 === "value1" && key2
13 | && key2.length === 3 && key2[0] === 1
14 | && key2[1] === 2 && key2[2] === 3) {
15 | result = {
16 | object: {
17 | __type: 'Object',
18 | className: 'Foo',
19 | objectId: '1',
20 | x: 2,
21 | relation: {
22 | __type: 'Object',
23 | className: 'Bar',
24 | objectId: '2',
25 | x: 3
26 | }
27 | },
28 | array:[
29 | {
30 | __type: 'Object',
31 | className: 'Bar',
32 | objectId: '10',
33 | x: 2
34 | }
35 | ]
36 | };
37 | response.success(result);
38 | } else if (key1 === "value1") {
39 | response.success({a: 2});
40 | } else {
41 | response.error('invalid!');
42 | }
43 | });
44 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseMemoryStorage.php:
--------------------------------------------------------------------------------
1 |
11 | */
12 | class ParseMemoryStorage implements ParseStorageInterface
13 | {
14 |
15 | /**
16 | * @var array
17 | */
18 | private $storage = array();
19 |
20 | public function set($key, $value)
21 | {
22 | $this->storage[$key] = $value;
23 | }
24 |
25 | public function remove($key)
26 | {
27 | unset($this->storage[$key]);
28 | }
29 |
30 | public function get($key)
31 | {
32 | if (isset($this->storage[$key])) {
33 | return $this->storage[$key];
34 | }
35 | return null;
36 | }
37 |
38 | public function clear()
39 | {
40 | $this->storage = array();
41 | }
42 |
43 | public function save()
44 | {
45 | // No action required.
46 | return;
47 | }
48 |
49 | public function getKeys()
50 | {
51 | return array_keys($this->storage);
52 | }
53 |
54 | public function getAll()
55 | {
56 | return $this->storage;
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParsePushTest.php:
--------------------------------------------------------------------------------
1 | array(''),
26 | 'data' => array('alert' => 'sample message')
27 | ));
28 | }
29 |
30 | public function testPushToQuery()
31 | {
32 | $query = ParseInstallation::query();
33 | $query->equalTo('key', 'value');
34 | ParsePush::send(array(
35 | 'data' => array('alert' => 'iPhone 5 is out!'),
36 | 'where' => $query
37 | ));
38 | }
39 |
40 | public function testPushDates()
41 | {
42 | ParsePush::send(array(
43 | 'data' => array('alert' => 'iPhone 5 is out!'),
44 | 'push_time' => new DateTime(),
45 | 'expiration_time' => new DateTime(),
46 | 'channels' => array()
47 | ));
48 | }
49 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/retrieve_user_profile.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # Retrieve User Profile via the Graph API
3 |
4 | This example covers getting profile information for the current user and printing their name, using the Graph API and the Facebook SDK for PHP.
5 |
6 | It assumes that you've already set your default app id and secret, and acquired a `FacebookSession` using an access token or one of the login helper classes found [here](/docs/php).
7 |
8 | For more information, see the documentation for [`GraphObject`](/docs/php/GraphObject), [`GraphUser`](/docs/php/GraphObject/#user-instance-methods), [`FacebookRequest`](/docs/php/FacebookRequest), and [`FacebookRequestException`](/docs/php/FacebookRequestException).
9 |
10 |
11 |
12 |
13 |
14 | ~~~~
15 | use Facebook\FacebookRequest;
16 | use Facebook\GraphUser;
17 | use Facebook\FacebookRequestException;
18 |
19 | if($session) {
20 |
21 | try {
22 |
23 | $user_profile = (new FacebookRequest(
24 | $session, 'GET', '/me'
25 | ))->execute()->getGraphObject(GraphUser::className());
26 |
27 | echo "Name: " . $user_profile->getName();
28 |
29 | } catch(FacebookRequestException $e) {
30 |
31 | echo "Exception occured, code: " . $e->getCode();
32 | echo " with message: " . $e->getMessage();
33 |
34 | }
35 |
36 | }
37 | ~~~~
38 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/DeleteOperation.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class DeleteOperation implements FieldOperation
12 | {
13 |
14 | /**
15 | * Returns an associative array encoding of the current operation.
16 | *
17 | * @return array Associative array encoding the operation.
18 | */
19 | public function _encode()
20 | {
21 | return array('__op' => 'Delete');
22 | }
23 |
24 | /**
25 | * Applies the current operation and returns the result.
26 | *
27 | * @param mixed $oldValue Value prior to this operation.
28 | * @param mixed $object Unused for this operation type.
29 | * @param string $key Key to remove from the target object.
30 | *
31 | * @return null
32 | */
33 | public function _apply($oldValue, $object, $key)
34 | {
35 | return null;
36 | }
37 |
38 | /**
39 | * Merge this operation with a previous operation and return the result.
40 | *
41 | * @param FieldOperation $previous Previous operation.
42 | *
43 | * @return FieldOperation Always returns the current operation.
44 | */
45 | public function _mergeWithPrevious($previous)
46 | {
47 | return $this;
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/FacebookSDKException.php:
--------------------------------------------------------------------------------
1 | set("byteColumn", $bytes);
32 | $obj->save();
33 |
34 | $query = new ParseQuery("BytesObject");
35 | $objAgain = $query->get($obj->getObjectId());
36 | $this->assertEquals("Fosco", $objAgain->get("byteColumn"));
37 | }
38 |
39 | public function testParseBytesFromBase64Data()
40 | {
41 | $obj = ParseObject::create("BytesObject");
42 | $bytes = ParseBytes::createFromBase64Data("R3JhbnRsYW5k");
43 | $obj->set("byteColumn", $bytes);
44 | $obj->save();
45 |
46 | $query = new ParseQuery("BytesObject");
47 | $objAgain = $query->get($obj->getObjectId());
48 | $this->assertEquals("Grantland", $objAgain->get("byteColumn"));
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
3 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
4 | d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
5 | ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
6 | MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
7 | LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
8 | RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
9 | +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
10 | PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
11 | xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
12 | Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
13 | hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
14 | EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
15 | MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
16 | FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
17 | nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
18 | eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
19 | hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
20 | Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
21 | vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
22 | +OkuE6N36B9K
23 | -----END CERTIFICATE-----
24 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/autoload.php:
--------------------------------------------------------------------------------
1 | ';
43 |
44 | // if the file exists, require it
45 | if ( file_exists( $file ) ) {
46 | require $file;
47 | }
48 | });
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookRequestException.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookRequestException for the Facebook SDK for PHP
3 |
4 | Represents an exception thrown by executing a Facebook request.
5 |
6 |
7 |
8 | ## Facebook\FacebookRequestException {#overview}
9 |
10 | This base class has several subclasses:
11 |
12 | `FacebookAuthorizationException`
13 | `FacebookClientException`
14 | `FacebookPermissionException`
15 | `FacebookServerException`
16 | `FacebookThrottleException`
17 | `FacebookOtherException`
18 |
19 | Whenever a FacebookRequestException is thrown, it will be one of these types.
20 | They are derived from the error information here: https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
21 |
22 |
23 |
24 | ## Instance Methods {#instance-methods}
25 |
26 | `FacebookRequestException` extends from the base `\Exception` class, so `getCode()` and `getMessage()` are available by default.
27 |
28 | ### getHttpStatusCode {#gethttpstatus}
29 | `getHttpStatusCode()`
30 | Returns the HTTP status code returned with this exception.
31 | ### getSubErrorCode {#getsuberrorcode}
32 | `getSubErrorCode()`
33 | Returns the numeric sub-error code returned from Facebook.
34 | ### getErrorType {#geterrortype}
35 | `getErrorType()`
36 | Returns the type of error as a string.
37 | ### getResponse {#getresponse}
38 | `getResponse()`
39 | Returns the decoded response used to create the exception.
40 | ### getRawResponse {#getrawresponse}
41 | `getRawResponse()`
42 | Returns the raw response used to create the exception.
43 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookJavaScriptLoginHelper.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookJavaScriptLoginHelper for the Facebook SDK for PHP
3 |
4 | A helper class for getting a FacebookSession using the session from the Facebook SDK for JavaScript.
5 |
6 |
7 |
8 | ## Facebook\FacebookJavaScriptLoginHelper {#overview}
9 |
10 | If your web app uses the Facebook SDK for JavaScript, you can access that in your PHP code as well. This helper class will process and validate the cookie data used by the Facebook SDK for JavaScript, returning a `FacebookSession` on success.
11 |
12 | Usage:
13 |
14 | ~~~~
15 |
16 | $helper = new FacebookJavaScriptLoginHelper();
17 | try {
18 | $session = $helper->getSession();
19 | } catch(FacebookRequestException $ex) {
20 | // When Facebook returns an error
21 | } catch(\Exception $ex) {
22 | // When validation fails or other local issues
23 | }
24 | if ($session) {
25 | // Logged in.
26 | }
27 |
28 | ~~~~
29 |
30 | It's important to note that on first access, or if a session has since expired, these methods will operate on data that is one request-cycle stale. You will likely want to make an Ajax request when the login state changes in the Facebook SDK for JavaScript. Information about that here: (FB.event.subscribe)[https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/#events]
31 |
32 |
33 |
34 | ## Instance Methods {#instance-methods}
35 |
36 | ### getSession {#getsession}
37 | `getSession()`
38 | Processes the data available from the Facebook SDK for JavaScript, if present. Returns a `FacebookSession` or `null`.
39 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/post_links.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # Post Links Using the Graph API
3 |
4 | This example covers posting a link to the current user's timeline using the Graph API and Facebook SDK for PHP.
5 |
6 | It assumes that you've already set your default app id and secret, and acquired a `FacebookSession` using an access token or one of the login helper classes found [here](/docs/php). You must have requested the `publish_actions` scope when logging in the user for this to work.
7 |
8 | For more information, see the documentation for [`GraphObject`](/docs/php/GraphObject), [`FacebookRequest`](/docs/php/FacebookRequest), and [`FacebookRequestException`](/docs/php/FacebookRequestException).
9 |
10 |
11 |
12 |
13 |
14 | ~~~~
15 | use Facebook\FacebookRequest;
16 | use Facebook\GraphObject;
17 | use Facebook\FacebookRequestException;
18 |
19 | if($session) {
20 |
21 | try {
22 |
23 | $response = (new FacebookRequest(
24 | $session, 'POST', '/me/feed', array(
25 | 'link' => 'www.example.com',
26 | 'message' => 'User provided message'
27 | )
28 | ))->execute()->getGraphObject();
29 |
30 | echo "Posted with id: " . $response->getProperty('id');
31 |
32 | } catch(FacebookRequestException $e) {
33 |
34 | echo "Exception occured, code: " . $e->getCode();
35 | echo " with message: " . $e->getMessage();
36 |
37 | }
38 |
39 | }
40 | ~~~~
41 |
42 | Note that the 'message' field must come from the user, as pre-filled content is forbidden by the [Platform Policies](https://developers.intern.facebook.com/policy/#control) (2.3).
43 |
44 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseStorageInterface.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | interface ParseStorageInterface
12 | {
13 |
14 | /**
15 | * Sets a key-value pair in storage.
16 | *
17 | * @param string $key The key to set
18 | * @param mixed $value The value to set
19 | *
20 | * @return null
21 | */
22 | public function set($key, $value);
23 |
24 | /**
25 | * Remove a key from storage.
26 | *
27 | * @param string $key The key to remove.
28 | *
29 | * @return null
30 | */
31 | public function remove($key);
32 |
33 | /**
34 | * Gets the value for a key from storage.
35 | *
36 | * @param string $key The key to get the value for
37 | *
38 | * @return mixed
39 | */
40 | public function get($key);
41 |
42 | /**
43 | * Clear all the values in storage.
44 | *
45 | * @return null
46 | */
47 | public function clear();
48 |
49 | /**
50 | * Save the data, if necessary. This would be a no-op when using the
51 | * $_SESSION implementation, but could be used for saving to file or
52 | * database as an action instead of on every set.
53 | *
54 | * @return null
55 | */
56 | public function save();
57 |
58 | /**
59 | * Get all keys in storage.
60 | *
61 | * @return array
62 | */
63 | public function getKeys();
64 |
65 | /**
66 | * Get all key-value pairs from storage.
67 | *
68 | * @return array
69 | */
70 | public function getAll();
71 |
72 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseSessionStorage.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseSessionStorage implements ParseStorageInterface
12 | {
13 |
14 | /**
15 | * @var string Parse will store its values in a specific key.
16 | */
17 | private $storageKey = 'parseData';
18 |
19 | public function __construct()
20 | {
21 | if (session_status() !== PHP_SESSION_ACTIVE) {
22 | throw new ParseException(
23 | 'PHP session_start() must be called first.'
24 | );
25 | }
26 | if (!isset($_SESSION[$this->storageKey])) {
27 | $_SESSION[$this->storageKey] = array();
28 | }
29 | }
30 |
31 | public function set($key, $value)
32 | {
33 | $_SESSION[$this->storageKey][$key] = $value;
34 | }
35 |
36 | public function remove($key)
37 | {
38 | unset($_SESSION[$this->storageKey][$key]);
39 | }
40 |
41 | public function get($key)
42 | {
43 | if (isset($_SESSION[$this->storageKey][$key])) {
44 | return $_SESSION[$this->storageKey][$key];
45 | }
46 | return null;
47 | }
48 |
49 | public function clear()
50 | {
51 | $_SESSION[$this->storageKey] = array();
52 | }
53 |
54 | public function save()
55 | {
56 | // No action required. PHP handles persistence for $_SESSION.
57 | return;
58 | }
59 |
60 | public function getKeys()
61 | {
62 | return array_keys($_SESSION[$this->storageKey]);
63 | }
64 |
65 | public function getAll()
66 | {
67 | return $_SESSION[$this->storageKey];
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/HttpClients/AbstractTestHttpClient.php:
--------------------------------------------------------------------------------
1 | 'HTTP/1.1 200 OK',
27 | 'Etag' => '"9d86b21aa74d74e574bbb35ba13524a52deb96e3"',
28 | 'Content-Type' => 'text/javascript; charset=UTF-8',
29 | 'X-FB-Rev' => '9244768',
30 | 'Pragma' => 'no-cache',
31 | 'Expires' => 'Sat, 01 Jan 2000 00:00:00 GMT',
32 | 'Connection' => 'close',
33 | 'Date' => 'Mon, 19 May 2014 18:37:17 GMT',
34 | 'X-FB-Debug' => '02QQiffE7JG2rV6i/Agzd0gI2/OOQ2lk5UW0=',
35 | 'Content-Length' => '29',
36 | 'Cache-Control' => 'private, no-cache, no-store, must-revalidate',
37 | 'Access-Control-Allow-Origin' => '*',
38 | );
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/FacebookJavaScriptLoginHelper.php:
--------------------------------------------------------------------------------
1 |
30 | * @author David Poll
31 | */
32 | class FacebookJavaScriptLoginHelper extends FacebookSignedRequestFromInputHelper
33 | {
34 |
35 | /**
36 | * Get raw signed request from the cookie.
37 | *
38 | * @return string|null
39 | */
40 | public function getRawSignedRequest()
41 | {
42 | return $this->getRawSignedRequestFromCookie();
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/scripts/integration/app_events.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | /*
22 | App events allow you to view analytics, measure ad performance and build
23 | audiences for ad targeting for your canvas app on Facebook.com.
24 |
25 | This is done by sending an event from your app via Facebook SDK for JavaScript.
26 | This event can be one of 12 predefined events such as 'added to cart' in a
27 | commerce app or 'level achieved' in a game, or other custom events.
28 |
29 | Log App Event 'game_played' to App Analytics
30 | */
31 | function logGamePlayedEvent(score) {
32 | var params = {
33 | 'score': score
34 | };
35 | FB.AppEvents.logEvent('game_played', null, params);
36 | }
37 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseBytes.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseBytes implements Internal\Encodable
12 | {
13 |
14 | /**
15 | * @var - byte array
16 | */
17 | private $byteArray;
18 |
19 | /**
20 | * Create a ParseBytes object with a given byte array.
21 | *
22 | * @param array $byteArray
23 | *
24 | * @return ParseBytes
25 | */
26 | public static function createFromByteArray(array $byteArray)
27 | {
28 | $bytes = new ParseBytes();
29 | $bytes->setByteArray($byteArray);
30 | return $bytes;
31 | }
32 |
33 | /**
34 | * Create a ParseBytes object with a given base 64 encoded data string
35 | *
36 | * @param string $base64Data
37 | *
38 | * @return ParseBytes
39 | */
40 | public static function createFromBase64Data($base64Data)
41 | {
42 | $bytes = new ParseBytes();
43 | $bytes->setBase64Data($base64Data);
44 | return $bytes;
45 | }
46 |
47 | private function setBase64Data($base64Data)
48 | {
49 | $byteArray = unpack('C*', base64_decode($base64Data));
50 | $this->setByteArray($byteArray);
51 | }
52 |
53 | private function setByteArray(array $byteArray)
54 | {
55 | $this->byteArray = $byteArray;
56 | }
57 |
58 | /**
59 | * Encode to associative array representation
60 | *
61 | * @return array
62 | * @ignore
63 | */
64 | public function _encode()
65 | {
66 | $data = "";
67 | foreach ($this->byteArray as $byte) {
68 | $data .= chr($byte);
69 | }
70 | return array(
71 | '__type' => 'Bytes',
72 | 'base64' => base64_encode($data)
73 | );
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookRequest.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookRequest for the Facebook SDK for PHP
3 |
4 | Represents a request that will be made against the Graph API.
5 |
6 |
7 |
8 | ## Facebook\FacebookRequest {#overview}
9 |
10 | Constructor:
11 |
12 | ~~~~
13 | $request = new FacebookRequest(
14 | FacebookSession $session,
15 | string $httpMethod,
16 | string $path,
17 | array $params = NULL,
18 | string $version = NULL
19 | );
20 | ~~~~
21 |
22 | Usage:
23 |
24 | ~~~~
25 | // Make a new request and execute it.
26 | try {
27 | $response = (new FacebookRequest($session, 'GET', '/me'))->execute();
28 | $object = $response->getGraphObject();
29 | echo $object->getProperty('name');
30 | } catch (FacebookRequestException $ex) {
31 | echo $ex->getMessage();
32 | } catch (\Exception $ex) {
33 | echo $ex->getMessage();
34 | }
35 |
36 | // You can chain methods together and get a strongly typed GraphUser
37 | $me = (new FacebookRequest(
38 | $session, 'GET', '/me'
39 | ))->execute()->getGraphObject(GraphUser::className);
40 | echo $me->getName();
41 | ~~~~
42 |
43 |
44 |
45 | ## Instance Methods {#instance-methods}
46 |
47 | ### execute {#execute}
48 | `execute()`
49 | Returns a `Facebook\FacebookResponse` from this request, from which a strongly-typed result can be retrieved. Throws an exception if the request fails. If the error is returned from Facebook, as opposed to a networking issue, a `Facebook\FacebookRequestException` is thrown.
50 | ### getPath {#getpath}
51 | `getPath()`
52 | Returns a copy of the path for the request, not including the version.
53 | ### getParameters {#getparams}
54 | `getParameters()`
55 | Returns a copy of the parameters array for the request.
56 | ### getSession {#getsession}
57 | `getSession()`
58 | Returns the `Facebook\FacebookSession` object associated with this request.
59 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/GraphAlbumTest.php:
--------------------------------------------------------------------------------
1 | self::ALBUM_NAME,
21 | 'message' => self::ALBUM_DESCRIPTION,
22 | 'value' => 'everyone'
23 | )
24 | ))->execute()->getGraphObject();
25 |
26 | $albumId = $response->getProperty('id');
27 |
28 | $response = (
29 | new FacebookRequest(
30 | FacebookTestHelper::$testSession,
31 | 'GET',
32 | '/'.$albumId
33 | ))->execute()->getGraphObject(GraphAlbum::className());
34 |
35 | $this->assertTrue($response instanceof GraphAlbum);
36 | $this->assertEquals($albumId, $response->getId());
37 | $this->assertTrue($response->getFrom() instanceof \Facebook\GraphUser);
38 | $this->assertTrue($response->canUpload());
39 | $this->assertEquals(0, $response->getCount());
40 | $this->assertEquals(self::ALBUM_NAME, $response->getName());
41 | $this->assertEquals(self::ALBUM_DESCRIPTION, $response->getDescription());
42 | $this->assertNotNull($response->getLink());
43 | $this->assertNotNull($response->getPrivacy());
44 |
45 | $type = array("profile", "mobile", "wall", "normal", "album");
46 | $this->assertTrue(in_array($response->getType(),$type));
47 |
48 | date_default_timezone_set('GMT');
49 | $this->assertTrue($response->getCreatedTime() instanceof DateTime);
50 | $this->assertTrue($response->getUpdatedTime() instanceof DateTime);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/upload_photo.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # Upload Photos to a User's Profile
3 |
4 | This example covers uploading a photo to the current User's profile using the Graph API and the Facebook SDK for PHP.
5 |
6 | It assumes that you've already set your default app id and secret, and acquired a `FacebookSession` using an access token or one of the login helper classes found [here](/docs/php). You must have requested the `publish_actions` scope when logging in the user for this to work.
7 |
8 | For more information, see the documentation for [`GraphObject`](/docs/php/GraphObject), [`FacebookRequest`](/docs/php/FacebookRequest), and [`FacebookRequestException`](/docs/php/FacebookRequestException).
9 |
10 |
11 |
12 |
13 |
14 | ~~~~
15 | use Facebook\FacebookRequest;
16 | use Facebook\GraphObject;
17 | use Facebook\FacebookRequestException;
18 |
19 | if($session) {
20 |
21 | try {
22 |
23 | // Upload to a user's profile. The photo will be in the
24 | // first album in the profile. You can also upload to
25 | // a specific album by using /ALBUM_ID as the path
26 | $response = (new FacebookRequest(
27 | $session, 'POST', '/me/photos', array(
28 | 'source' => new CURLFile('path/to/file.name', 'image/png'),
29 | 'message' => 'User provided message'
30 | )
31 | ))->execute()->getGraphObject();
32 |
33 | // If you're not using PHP 5.5 or later, change the file reference to:
34 | // 'source' => '@/path/to/file.name'
35 |
36 | echo "Posted with id: " . $response->getProperty('id');
37 |
38 | } catch(FacebookRequestException $e) {
39 |
40 | echo "Exception occured, code: " . $e->getCode();
41 | echo " with message: " . $e->getMessage();
42 |
43 | }
44 |
45 | }
46 | ~~~~
47 |
48 | Note that the 'message' field must come from the user, as pre-filled content is forbidden by the [Platform Policies](https://developers.intern.facebook.com/policy/#control) (2.3).
49 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseMemoryStorageTest.php:
--------------------------------------------------------------------------------
1 | clear();
28 | }
29 |
30 | public function testIsUsingDefaultStorage()
31 | {
32 | $this->assertTrue(
33 | self::$parseStorage instanceof Parse\ParseMemoryStorage
34 | );
35 | }
36 |
37 | public function testSetAndGet()
38 | {
39 | self::$parseStorage->set('foo', 'bar');
40 | $this->assertEquals('bar', self::$parseStorage->get('foo'));
41 | }
42 |
43 | public function testRemove()
44 | {
45 | self::$parseStorage->set('foo', 'bar');
46 | self::$parseStorage->remove('foo');
47 | $this->assertNull(self::$parseStorage->get('foo'));
48 | }
49 |
50 | public function testClear()
51 | {
52 | self::$parseStorage->set('foo', 'bar');
53 | self::$parseStorage->set('foo2', 'bar');
54 | self::$parseStorage->set('foo3', 'bar');
55 | self::$parseStorage->clear();
56 | $this->assertEmpty(self::$parseStorage->getKeys());
57 | }
58 |
59 | public function testGetAll()
60 | {
61 | self::$parseStorage->set('foo', 'bar');
62 | self::$parseStorage->set('foo2', 'bar');
63 | self::$parseStorage->set('foo3', 'bar');
64 | $result = self::$parseStorage->getAll();
65 | $this->assertEquals('bar', $result['foo']);
66 | $this->assertEquals('bar', $result['foo2']);
67 | $this->assertEquals('bar', $result['foo3']);
68 | $this->assertEquals(3, count($result));
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/GraphPage.php:
--------------------------------------------------------------------------------
1 |
30 | */
31 | class GraphPage extends GraphObject
32 | {
33 |
34 | /**
35 | * Returns the ID for the user's page as a string if present.
36 | *
37 | * @return string|null
38 | */
39 | public function getId()
40 | {
41 | return $this->getProperty('id');
42 | }
43 |
44 | /**
45 | * Returns the Category for the user's page as a string if present.
46 | *
47 | * @return string|null
48 | */
49 | public function getCategory()
50 | {
51 | return $this->getProperty('category');
52 | }
53 |
54 | /**
55 | * Returns the Name of the user's page as a string if present.
56 | *
57 | * @return string|null
58 | */
59 | public function getName()
60 | {
61 | return $this->getProperty('name');
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/FacebookCanvasLoginHelper.php:
--------------------------------------------------------------------------------
1 |
30 | * @author David Poll
31 | */
32 | class FacebookCanvasLoginHelper extends FacebookSignedRequestFromInputHelper
33 | {
34 |
35 | /**
36 | * Returns the app data value.
37 | *
38 | * @return mixed|null
39 | */
40 | public function getAppData()
41 | {
42 | return $this->signedRequest ? $this->signedRequest->get('app_data') : null;
43 | }
44 |
45 | /**
46 | * Get raw signed request from POST.
47 | *
48 | * @return string|null
49 | */
50 | public function getRawSignedRequest()
51 | {
52 | $rawSignedRequest = $this->getRawSignedRequestFromPost();
53 | if ($rawSignedRequest) {
54 | return $rawSignedRequest;
55 | }
56 |
57 | return null;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookRedirectLoginHelper.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookRedirectLoginHelper for the Facebook SDK for PHP
3 |
4 | A helper class for getting a FacebookSession using the OAuth protocol.
5 |
6 |
7 |
8 | ## Facebook\FacebookRedirectLoginHelper {#overview}
9 |
10 | If your web app uses Facebook Login on the back-end, you'll need to redirect your visitors to a URL at Facebook to initiate a login request. Facebook then redirects the user to your apps callback URL, providing session data. This helper class will generate the login URL for you, and can process and validate the data from Facebook, returning a `FacebookSession` on success.
11 |
12 | This class can be extended, and the `storeState($state)` and `loadState()` methods overridden, to store the state check using another method besides the default `$_SESSION`.
13 |
14 | Usage:
15 |
16 | ~~~~
17 |
18 | $helper = new FacebookRedirectLoginHelper($redirect_url, $appId = NULL, $appSecret = NULL);
19 | echo 'Login with Facebook';
20 |
21 | ~~~~
22 |
23 | Then, in your callback page (at the redirect url) when Facebook sends the user back:
24 |
25 | ~~~~
26 |
27 | $helper = new FacebookRedirectLoginHelper($redirect_url);
28 | try {
29 | $session = $helper->getSessionFromRedirect();
30 | } catch(FacebookRequestException $ex) {
31 | // When Facebook returns an error
32 | } catch(\Exception $ex) {
33 | // When validation fails or other local issues
34 | }
35 | if ($session) {
36 | // Logged in.
37 | }
38 |
39 | ~~~~
40 |
41 |
42 |
43 | ## Instance Methods {#instance-methods}
44 |
45 | ### getLoginUrl {#getloginurl}
46 | `getLoginUrl()`
47 | Generates the URL to redirect a web visitor to Facebook to login to your app.
48 | ### getLogoutUrl {#getlogouturl}
49 | `getLogoutUrl($next_url)`
50 | Generates the URL to redirect a web visitor to Facebook to logout, with a url to redirect to after.
51 | ### getSessionFromRedirect {#getsessionfromredirect}
52 | `getSessionFromRedirect()`
53 | Processes the redirect data from Facebook, if present. Returns a `FacebookSession` or `null`.
54 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseAnalytics.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 | class ParseAnalytics
14 | {
15 |
16 | /**
17 | * Tracks the occurrence of a custom event with additional dimensions.
18 | * Parse will store a data point at the time of invocation with the given
19 | * event name.
20 | *
21 | * Dimensions will allow segmentation of the occurrences of this custom
22 | * event. Keys and values should be strings, and will throw
23 | * otherwise.
24 | *
25 | * To track a user signup along with additional metadata, consider the
26 | * following:
27 | *
28 | * $dimensions = array(
29 | * 'gender' => 'm',
30 | * 'source' => 'web',
31 | * 'dayType' => 'weekend'
32 | * );
33 | * ParseAnalytics::track('signup', $dimensions);
34 | *
35 | *
36 | * There is a default limit of 4 dimensions per event tracked.
37 | *
38 | * @param string $name The name of the custom event
39 | * @param array $dimensions The dictionary of segment information
40 | *
41 | * @throws \Exception
42 | * @return mixed
43 | */
44 | public static function track($name, $dimensions = array())
45 | {
46 | $name = trim($name);
47 | if (strlen($name) === 0) {
48 | throw new Exception('A name for the custom event must be provided.');
49 | }
50 | foreach ($dimensions as $key => $value) {
51 | if (!is_string($key) || !is_string($value)) {
52 | throw new Exception('Dimensions expected string keys and values.');
53 | }
54 | }
55 | return ParseClient::_request(
56 | 'POST',
57 | '/1/events/' . $name,
58 | null,
59 | static::_toSaveJSON($dimensions)
60 | );
61 | }
62 |
63 | /**
64 | * @ignore
65 | */
66 | public static function _toSaveJSON($data)
67 | {
68 | return json_encode(
69 | array(
70 | 'dimensions' => $data
71 | ),
72 | JSON_FORCE_OBJECT
73 | );
74 | }
75 |
76 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseSessionStorageTest.php:
--------------------------------------------------------------------------------
1 | clear();
30 | }
31 |
32 | public static function tearDownAfterClass()
33 | {
34 | session_destroy();
35 | }
36 |
37 | public function testIsUsingParseSession()
38 | {
39 | $this->assertTrue(self::$parseStorage instanceof Parse\ParseSessionStorage);
40 | }
41 |
42 | public function testSetAndGet()
43 | {
44 | self::$parseStorage->set('foo', 'bar');
45 | $this->assertEquals('bar', self::$parseStorage->get('foo'));
46 | }
47 |
48 | public function testRemove()
49 | {
50 | self::$parseStorage->set('foo', 'bar');
51 | self::$parseStorage->remove('foo');
52 | $this->assertNull(self::$parseStorage->get('foo'));
53 | }
54 |
55 | public function testClear()
56 | {
57 | self::$parseStorage->set('foo', 'bar');
58 | self::$parseStorage->set('foo2', 'bar');
59 | self::$parseStorage->set('foo3', 'bar');
60 | self::$parseStorage->clear();
61 | $this->assertEmpty(self::$parseStorage->getKeys());
62 | }
63 |
64 | public function testGetAll()
65 | {
66 | self::$parseStorage->set('foo', 'bar');
67 | self::$parseStorage->set('foo2', 'bar');
68 | self::$parseStorage->set('foo3', 'bar');
69 | $result = self::$parseStorage->getAll();
70 | $this->assertEquals('bar', $result['foo']);
71 | $this->assertEquals('bar', $result['foo2']);
72 | $this->assertEquals('bar', $result['foo3']);
73 | $this->assertEquals(3, count($result));
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookResponse.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookResponse for the Facebook SDK for PHP
3 |
4 | Represents a response from the Graph API.
5 |
6 |
7 |
8 | ## Facebook\FacebookResponse {#overview}
9 |
10 | Usage:
11 |
12 | ~~~~
13 | // A FacebookResponse is returned from an executed FacebookRequest
14 | try {
15 | $response = (new FacebookRequest($session, 'GET', '/me'))->execute();
16 | // You can get the request back:
17 | $request = $response->getRequest();
18 | // You can get the response as a GraphObject:
19 | $object = $response->getGraphObject();
20 | // You can get the response as a subclass of GraphObject:
21 | $me = $response->getGraphObject(GraphUser::className());
22 | // If this response has multiple pages, you can get a request for the next or previous pages:
23 | $nextPageRequest = $response->getRequestForNextPage();
24 | $previousPageRequest = $response->getRequestForPreviousPage();
25 | } catch (FacebookRequestException $ex) {
26 | echo $ex->getMessage();
27 | } catch (\Exception $ex) {
28 | echo $ex->getMessage();
29 | }
30 |
31 | // You can also chain the methods together:
32 | $me = (new FacebookRequest(
33 | $session, 'GET', '/me'
34 | ))->execute()->getGraphObject(GraphUser::className);
35 | echo $me->getName();
36 | ~~~~
37 |
38 |
39 |
40 | ## Instance Methods {#instance-methods}
41 |
42 | ### getGraphObject {#getgraphobject}
43 | `getGraphObject(string $type = 'Facebook\GraphObject')`
44 | Returns the result as a `GraphObject`. If specified, a strongly-typed subclass of `GraphObject` is returned.
45 | ### getGraphObjectList {#getgraphobjectlist}
46 | `getGraphObjectList(string $type = 'Facebook\GraphObject')`
47 | Returns an array of `GraphObject` returned by this request. If specified, a strongly-typed subclass of `GraphObject` is returned.
48 | ### getRequest {#getrequest}
49 | `getRequest()`
50 | Returns the `FacebookRequest` that produced this response.
51 | ### getRequestForNextPage {#getnextpage}
52 | `getRequestForNextPage()`
53 | If the response has paginated data, produces a `FacebookRequest` for the next pge of data.
54 | ### getRequestForPreviousPage {#getpreviouspage}
55 | `getRequestForPreviousPage()`
56 | If the response has paginated data, produces a `FacebookRequest` for the previous page of data.
57 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParsePush.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParsePush
12 | {
13 |
14 | /**
15 | * Sends a push notification.
16 | *
17 | * @param array $data The data of the push notification. Valid fields
18 | * are:
19 | * channels - An Array of channels to push to.
20 | * push_time - A Date object for when to send the push.
21 | * expiration_time - A Date object for when to expire
22 | * the push.
23 | * expiration_interval - The seconds from now to expire the push.
24 | * where - A ParseQuery over ParseInstallation that is used to match
25 | * a set of installations to push to.
26 | * data - The data to send as part of the push
27 | * @param boolean $useMasterKey Whether to use the Master Key for the request
28 | *
29 | * @throws \Exception, ParseException
30 | * @return mixed
31 | */
32 | public static function send($data, $useMasterKey = false)
33 | {
34 | if (isset($data['expiration_time'])
35 | && isset($data['expiration_interval'])) {
36 | throw new \Exception(
37 | 'Both expiration_time and expiration_interval can\'t be set.'
38 | );
39 | }
40 | if (isset($data['where'])) {
41 | if ($data['where'] instanceof ParseQuery) {
42 | $data['where'] = $data['where']->_getOptions()['where'];
43 | } else {
44 | throw new \Exception(
45 | 'Where parameter for Parse Push must be of type ParseQuery'
46 | );
47 | }
48 | }
49 | if (isset($data['push_time'])) {
50 | //Local push date format is different from iso format generally used in Parse
51 | //Schedule does not work if date format not correct
52 | $data['push_time'] = ParseClient::getLocalPushDateFormat($data['push_time']);
53 | }
54 | if (isset($data['expiration_time'])) {
55 | $data['expiration_time'] = ParseClient::_encode(
56 | $data['expiration_time'], false
57 | )['iso'];
58 | }
59 | return ParseClient::_request(
60 | 'POST',
61 | '/1/push',
62 | null,
63 | json_encode($data),
64 | $useMasterKey
65 | );
66 | }
67 |
68 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseAnalyticsTest.php:
--------------------------------------------------------------------------------
1 | assertEquals($expectedJSON, $json);
26 | ParseAnalytics::track($event, $params ?: array());
27 | }
28 |
29 | public function testTrackEvent()
30 | {
31 | $expected = '{"dimensions":{}}';
32 | $this->assertAnalyticsValidation('testTrackEvent', null, $expected);
33 | }
34 |
35 | public function testFailsOnEventName1()
36 | {
37 | $this->setExpectedException(
38 | 'Exception', 'A name for the custom event must be provided.'
39 | );
40 | ParseAnalytics::track('');
41 | }
42 |
43 | public function testFailsOnEventName2()
44 | {
45 | $this->setExpectedException(
46 | 'Exception', 'A name for the custom event must be provided.'
47 | );
48 | ParseAnalytics::track(' ');
49 | }
50 |
51 | public function testFailsOnEventName3()
52 | {
53 | $this->setExpectedException(
54 | 'Exception', 'A name for the custom event must be provided.'
55 | );
56 | ParseAnalytics::track(" \n");
57 | }
58 |
59 | public function testTrackEventDimensions()
60 | {
61 | $expected = '{"dimensions":{"foo":"bar","bar":"baz"}}';
62 | $params = array(
63 | 'foo' => 'bar',
64 | 'bar' => 'baz'
65 | );
66 | $this->assertAnalyticsValidation('testDimensions', $params, $expected);
67 |
68 | $date = date(DATE_RFC3339);
69 | $expected = '{"dimensions":{"foo":"bar","bar":"baz","someDate":"' .
70 | $date . '"}}';
71 | $params = array(
72 | 'foo' => 'bar',
73 | 'bar' => 'baz',
74 | 'someDate' => $date
75 | );
76 | $this->assertAnalyticsValidation('testDate', $params, $expected);
77 | }
78 |
79 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/HttpClients/FacebookHttpable.php:
--------------------------------------------------------------------------------
1 |
31 |
32 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/sdk_landing_page.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # Facebook SDK for PHP
3 |
4 | The Facebook SDK for PHP provides developers with a modern, native library for accessing the Graph API and taking advantage of Facebook Login. Usually this means you're developing with PHP for a Facebook Canvas app, building your own website, or adding server-side functionality to an app that already uses the [Facebook SDK for JavaScript](/docs/reference/javascript/).
5 |
6 | Take a look through our guide, [Getting Started with the Facebook SDK for PHP](/docs/php/gettingstarted), and then check out some of the examples below.
7 |
8 |
9 |
10 | ## Examples {#examples}
11 |
12 | * [Retrieve a users profile](/docs/php/howto/profilewithgraphapi)
13 | * [Post a link to a users feed](/docs/php/howto/postwithgraphapi)
14 | * [Upload a photo to a users profile](/docs/php/howto/uploadphoto)
15 |
16 |
17 |
18 |
19 | ## API Reference - Facebook namespace {#reference}
20 |
21 | [Facebook\FacebookSession](/docs/php/FacebookSession)
22 | An access token backed session used when making requests against the Graph API.
23 |
24 | [Facebook\FacebookRequest](/docs/php/FacebookRequest)
25 | Makes requests against the Graph API.
26 |
27 | [Facebook\FacebookResponse](/docs/php/FacebookResponse)
28 | A successful response from the Graph API resulting from a FacebookRequest.
29 |
30 | [Facebook\FacebookRequestException](/docs/php/FacebookRequestException)
31 | An error returned by the Graph API during a FacebookRequest. Subclasses: FacebookClientException, FacebookServerException, FacebookAuthorizationException, FacebookPermissionException, FacebookThrottleException, FacebookOtherException.
32 |
33 | [Facebook\GraphObject](/docs/php/GraphObject)
34 | Represents an object returned by the Graph API. Subclasses: GraphUser, GraphLocation, GraphSessionInfo
35 |
36 | [Facebook\FacebookRedirectLoginHelper](/docs/php/FacebookRedirectLoginHelper)
37 | A helper class for getting a FacebookSession using the OAuth protocol.
38 |
39 | [Facebook\FacebookCanvasLoginHelper](/docs/php/FacebookCanvasLoginHelper)
40 | A helper class for getting a FacebookSession from Facebook Canvas.
41 |
42 | [Facebook\FacebookJavaScriptLoginHelper](/docs/php/FacebookJavaScriptLoginHelper)
43 | A helper class for getting a FacebookSession from the Facebook SDK for JavaScript.
44 |
45 |
--------------------------------------------------------------------------------
/payments/500coins.html:
--------------------------------------------------------------------------------
1 |
31 |
32 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/payments/1000coins.html:
--------------------------------------------------------------------------------
1 |
31 |
32 |
33 |
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseGeoPoint.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 | class ParseGeoPoint implements \Parse\Internal\Encodable
12 | {
13 |
14 | /**
15 | * @var - Float value for latitude.
16 | */
17 | private $latitude;
18 | /**
19 | * @var - Float value for longitude.
20 | */
21 | private $longitude;
22 |
23 | /**
24 | * Create a Parse GeoPoint object.
25 | *
26 | * @param float $lat Latitude.
27 | * @param float $lon Longitude.
28 | */
29 | public function __construct($lat, $lon)
30 | {
31 | $this->setLatitude($lat);
32 | $this->setLongitude($lon);
33 | }
34 |
35 | /**
36 | * Returns the Latitude value for this GeoPoint.
37 | *
38 | * @return float
39 | */
40 | public function getLatitude()
41 | {
42 | return $this->latitude;
43 | }
44 |
45 | /**
46 | * Set the Latitude value for this GeoPoint.
47 | *
48 | * @param $lat
49 | *
50 | * @throws ParseException
51 | */
52 | public function setLatitude($lat)
53 | {
54 | if ($lat > 90.0 || $lat < -90.0) {
55 | throw new ParseException("Latitude must be within range [-90.0, 90.0]");
56 | }
57 | $this->latitude = $lat;
58 | }
59 |
60 | /**
61 | * Returns the Longitude value for this GeoPoint.
62 | *
63 | * @return float
64 | */
65 | public function getLongitude()
66 | {
67 | return $this->longitude;
68 | }
69 |
70 | /**
71 | * Set the Longitude value for this GeoPoint.
72 | *
73 | * @param $lon
74 | *
75 | * @throws ParseException
76 | */
77 | public function setLongitude($lon)
78 | {
79 | if ($lon > 180.0 || $lon < -180.0) {
80 | throw new ParseException(
81 | "Longitude must be within range [-180.0, 180.0]"
82 | );
83 | }
84 | $this->longitude = $lon;
85 | }
86 |
87 | /**
88 | * Encode to associative array representation
89 | *
90 | * @return array
91 | * @ignore
92 | */
93 | public function _encode()
94 | {
95 | return array(
96 | '__type' => 'GeoPoint',
97 | 'latitude' => $this->latitude,
98 | 'longitude' => $this->longitude
99 | );
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/SetOperation.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 | class SetOperation implements FieldOperation
14 | {
15 |
16 | /**
17 | * @var - Value to set for this operation.
18 | */
19 | private $value;
20 |
21 | /**
22 | * @var - If the value should be forced as object.
23 | */
24 | private $isAssociativeArray;
25 |
26 | /**
27 | * Create a SetOperation with a value.
28 | *
29 | * @param mixed $value Value to set for this operation.
30 | * @param bool $isAssociativeArray If the value should be forced as object.
31 | */
32 | public function __construct($value, $isAssociativeArray = false)
33 | {
34 | $this->value = $value;
35 | $this->isAssociativeArray = $isAssociativeArray;
36 | }
37 |
38 | /**
39 | * Get the value for this operation.
40 | *
41 | * @return mixed Value.
42 | */
43 | public function getValue()
44 | {
45 | return $this->value;
46 | }
47 |
48 | /**
49 | * Returns an associative array encoding of the current operation.
50 | *
51 | * @return mixed
52 | */
53 | public function _encode()
54 | {
55 | if ($this->isAssociativeArray) {
56 | $object = new \stdClass();
57 | foreach ($this->value as $key => $value) {
58 | $object->$key = ParseClient::_encode($value, true);
59 | }
60 | return ParseClient::_encode($object, true);
61 | }
62 | return ParseClient::_encode($this->value, true);
63 | }
64 |
65 | /**
66 | * Apply the current operation and return the result.
67 | *
68 | * @param mixed $oldValue Value prior to this operation.
69 | * @param mixed $object Value for this operation.
70 | * @param string $key Key to set this value on.
71 | *
72 | * @return mixed
73 | */
74 | public function _apply($oldValue, $object, $key)
75 | {
76 | return $this->value;
77 | }
78 |
79 | /**
80 | * Merge this operation with a previous operation and return the
81 | * resulting operation.
82 | *
83 | * @param FieldOperation $previous Previous operation.
84 | *
85 | * @return FieldOperation
86 | */
87 | public function _mergeWithPrevious($previous)
88 | {
89 | return $this;
90 | }
91 |
92 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookTestHelper.php:
--------------------------------------------------------------------------------
1 | true,
42 | 'name' => 'Foo Phpunit User',
43 | 'locale' => 'en_US',
44 | 'permissions' => implode(',', static::$testUserPermissions),
45 | );
46 |
47 | $request = new FacebookRequest(static::getAppSession(), 'POST', $testUserPath, $params);
48 | $response = $request->execute()->getGraphObject();
49 |
50 | static::$testUserId = $response->getProperty('id');
51 | static::$testUserAccessToken = $response->getProperty('access_token');
52 | }
53 |
54 | public static function getAppSession()
55 | {
56 | return new FacebookSession(static::getAppToken());
57 | }
58 |
59 | public static function getAppToken()
60 | {
61 | return FacebookTestCredentials::$appId . '|' . FacebookTestCredentials::$appSecret;
62 | }
63 |
64 | public static function deleteTestUser()
65 | {
66 | if (!static::$testUserId) {
67 | return;
68 | }
69 | $testUserPath = '/' . static::$testUserId;
70 | $request = new FacebookRequest(static::getAppSession(), 'DELETE', $testUserPath);
71 | $request->execute();
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookSignedRequestFromInputHelperTest.php:
--------------------------------------------------------------------------------
1 | helper = new FooSignedRequestHelper('123', 'foo_app_secret');
21 | }
22 |
23 | public function testSignedRequestDataCanBeRetrievedFromGetData()
24 | {
25 | $_GET['signed_request'] = 'foo_signed_request';
26 |
27 | $rawSignedRequest = $this->helper->getRawSignedRequestFromGet();
28 |
29 | $this->assertEquals('foo_signed_request', $rawSignedRequest);
30 | }
31 |
32 | public function testSignedRequestDataCanBeRetrievedFromPostData()
33 | {
34 | $_POST['signed_request'] = 'foo_signed_request';
35 |
36 | $rawSignedRequest = $this->helper->getRawSignedRequestFromPost();
37 |
38 | $this->assertEquals('foo_signed_request', $rawSignedRequest);
39 | }
40 |
41 | public function testSignedRequestDataCanBeRetrievedFromCookieData()
42 | {
43 | $_COOKIE['fbsr_123'] = 'foo_signed_request';
44 |
45 | $rawSignedRequest = $this->helper->getRawSignedRequestFromCookie();
46 |
47 | $this->assertEquals('foo_signed_request', $rawSignedRequest);
48 | }
49 |
50 | public function testSessionWillBeNullWhenAUserHasNotYetAuthorizedTheApp()
51 | {
52 | $this->helper->instantiateSignedRequest($this->rawSignedRequestUnauthorized);
53 | $session = $this->helper->getSession();
54 |
55 | $this->assertNull($session);
56 | }
57 |
58 | public function testAFacebookSessionCanBeInstantiatedWhenAUserHasAuthorizedTheApp()
59 | {
60 | $this->helper->instantiateSignedRequest($this->rawSignedRequestAuthorized);
61 | $session = $this->helper->getSession();
62 |
63 | $this->assertInstanceOf('Facebook\FacebookSession', $session);
64 | $this->assertEquals('foo_token', $session->getToken());
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/HttpClients/FacebookStream.php:
--------------------------------------------------------------------------------
1 | stream = stream_context_create($options);
53 | }
54 |
55 | /**
56 | * The response headers from the stream wrapper
57 | *
58 | * @return array|null
59 | */
60 | public function getResponseHeaders()
61 | {
62 | return $this->responseHeaders;
63 | }
64 |
65 | /**
66 | * Send a stream wrapped request
67 | *
68 | * @param string $url
69 | *
70 | * @return mixed
71 | */
72 | public function fileGetContents($url)
73 | {
74 | $rawResponse = file_get_contents($url, false, $this->stream);
75 | $this->responseHeaders = $http_response_header;
76 | return $rawResponse;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/GraphUserPage.php:
--------------------------------------------------------------------------------
1 |
30 | */
31 | class GraphUserPage extends GraphObject
32 | {
33 |
34 | /**
35 | * Returns the ID for the user's page as a string if present.
36 | *
37 | * @return string|null
38 | */
39 | public function getId()
40 | {
41 | return $this->getProperty('id');
42 | }
43 |
44 | /**
45 | * Returns the Category for the user's page as a string if present.
46 | *
47 | * @return string|null
48 | */
49 | public function getCategory()
50 | {
51 | return $this->getProperty('category');
52 | }
53 |
54 | /**
55 | * Returns the Name of the user's page as a string if present.
56 | *
57 | * @return string|null
58 | */
59 | public function getName()
60 | {
61 | return $this->getProperty('name');
62 | }
63 |
64 | /**
65 | * Returns the Access Token used to access the user's page as a string if present.
66 | *
67 | * @return string|null
68 | */
69 | public function getAccessToken()
70 | {
71 | return $this->getProperty('access_token');
72 | }
73 |
74 | /**
75 | * Returns the Permissions for the user's page as an array if present.
76 | *
77 | * @return array|null
78 | */
79 | public function getPermissions()
80 | {
81 | return $this->getProperty('perms');
82 | }
83 |
84 | }
--------------------------------------------------------------------------------
/scripts/integration/payments.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | /*
22 | URLs for different coin packages that the player can choose to purchase.
23 | */
24 | var coins100 = server_url + '/payments/100coins.html';
25 | var coins500 = server_url + '/payments/500coins.html';
26 | var coins1000 = server_url + '/payments/1000coins.html';
27 |
28 | var coinsForProduct = {
29 | coins100 : 100,
30 | coins500 : 500,
31 | coins1000 : 1000
32 | }
33 |
34 | /*
35 | The Facebook JavaScript API is invoked to display the Pay Dialog. Full details
36 | on this FB.ui() call can be found in the Pay Dialog - API Reference doc.
37 |
38 | https://developers.facebook.com/docs/payments/reference/paydialog
39 |
40 | Notice that we pass the URL of the product that the player wants to buy and the
41 | appropriate quantity.
42 |
43 | This is all that's needed to spawn the Facebook Pay Dialog, and allow the user
44 | to make a payment.
45 | */
46 | function purchaseProduct(product, callback, gift) {
47 | FB.ui({
48 | method: gift ? 'gift' : 'pay',
49 | action: 'purchaseitem',
50 | product: product
51 | }, function(response) {
52 | console.log('Payment completed', response);
53 | if(response.status && response.status == 'completed') {
54 | refreshParseUser().then(renderWelcome);
55 | }
56 | if(callback) callback(response);
57 | } );
58 | }
59 |
60 | /*
61 | Purchase a product as a gift to a friend.
62 | */
63 | function giftProduct(product, callback) {
64 | purchaseProduct(product, callback, true);
65 | }
66 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookSessionTest.php:
--------------------------------------------------------------------------------
1 | assertEquals(
19 | FacebookTestHelper::getAppToken(), $session->getToken()
20 | );
21 | }
22 |
23 | public function testGetSessionInfo()
24 | {
25 | $response = FacebookTestHelper::$testSession->getSessionInfo();
26 | $this->assertTrue($response instanceof GraphSessionInfo);
27 | $this->assertNotNull($response->getAppId());
28 | $this->assertTrue($response->isValid());
29 | $scopes = $response->getPropertyAsArray('scopes');
30 | $this->assertTrue(is_array($scopes));
31 | $this->assertEquals(5, count($scopes));
32 | }
33 |
34 | public function testExtendAccessToken()
35 | {
36 | $response = FacebookTestHelper::$testSession->getLongLivedSession();
37 | $this->assertTrue($response instanceof FacebookSession);
38 | $info = $response->getSessionInfo();
39 | $nextWeek = time() + (60 * 60 * 24 * 7);
40 | $this->assertTrue(
41 | $info->getProperty('expires_at') > $nextWeek
42 | );
43 | }
44 |
45 | public function testSessionFromSignedRequest()
46 | {
47 | $signedRequest = m::mock('Facebook\Entities\SignedRequest');
48 | $signedRequest
49 | ->shouldReceive('get')
50 | ->with('code')
51 | ->once()
52 | ->andReturn(null);
53 | $signedRequest
54 | ->shouldReceive('get')
55 | ->with('oauth_token')
56 | ->once()
57 | ->andReturn('foo_token');
58 | $signedRequest
59 | ->shouldReceive('get')
60 | ->with('expires', 0)
61 | ->once()
62 | ->andReturn(time() + (60 * 60 * 24));
63 | $signedRequest
64 | ->shouldReceive('getUserId')
65 | ->once()
66 | ->andReturn('123');
67 |
68 | $session = FacebookSession::newSessionFromSignedRequest($signedRequest);
69 | $this->assertInstanceOf('Facebook\FacebookSession', $session);
70 | $this->assertEquals('foo_token', $session->getToken());
71 | $this->assertEquals('123', $session->getUserId());
72 | }
73 |
74 | public function testAppSessionValidates()
75 | {
76 | $session = FacebookSession::newAppSession();
77 | try {
78 | $session->validate();
79 | } catch (\Facebook\FacebookSDKException $ex) {
80 | $this->fail('Exception thrown validating app session.');
81 | }
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseRole.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 | class ParseRole extends ParseObject
14 | {
15 |
16 | public static $parseClassName = "_Role";
17 |
18 | /**
19 | * Create a ParseRole object with a given name and ACL.
20 | *
21 | * @param string $name
22 | * @param ParseACL $acl
23 | *
24 | * @return ParseRole
25 | */
26 | public static function createRole($name, ParseACL $acl)
27 | {
28 | $role = ParseObject::create(static::$parseClassName);
29 | $role->setName($name);
30 | $role->setACL($acl);
31 | return $role;
32 | }
33 |
34 | /**
35 | * Returns the role name.
36 | *
37 | * @return string
38 | */
39 | public function getName()
40 | {
41 | return $this->get("name");
42 | }
43 |
44 | /**
45 | * Sets the role name.
46 | *
47 | * @param string $name The role name
48 | *
49 | * @return null
50 | */
51 | public function setName($name)
52 | {
53 | if ($this->getObjectId()) {
54 | throw new ParseException(
55 | "A role's name can only be set before it has been saved."
56 | );
57 | }
58 | if (!is_string($name)) {
59 | throw new ParseException(
60 | "A role's name must be a string."
61 | );
62 | }
63 | return $this->set("name", $name);
64 | }
65 |
66 | /**
67 | * Gets the ParseRelation for the ParseUsers which are direct children of
68 | * this role. These users are granted any privileges that this role
69 | * has been granted.
70 | *
71 | * @return ParseRelation
72 | */
73 | public function getUsers()
74 | {
75 | return $this->getRelation("users");
76 | }
77 |
78 | /**
79 | * Gets the ParseRelation for the ParseRoles which are direct children of
80 | * this role. These roles' users are granted any privileges that this role
81 | * has been granted.
82 | *
83 | * @return ParseRelation
84 | */
85 | public function getRoles()
86 | {
87 | return $this->getRelation("roles");
88 | }
89 |
90 | public function save($useMasterKey = false)
91 | {
92 | if (!$this->getACL()) {
93 | throw new ParseException(
94 | "Roles must have an ACL."
95 | );
96 | }
97 | if (!$this->getName() || !is_string($this->getName())) {
98 | throw new ParseException(
99 | "Roles must have a name."
100 | );
101 | }
102 | return parent::save($useMasterKey);
103 | }
104 |
105 |
106 |
107 | }
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/IncrementOperation.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 | class IncrementOperation implements FieldOperation
14 | {
15 |
16 | /**
17 | * @var int - Amount to increment by.
18 | */
19 | private $value;
20 |
21 | /**
22 | * Creates an IncrementOperation object.
23 | *
24 | * @param int $value Amount to increment by.
25 | */
26 | public function __construct($value = 1)
27 | {
28 | $this->value = $value;
29 | }
30 |
31 | /**
32 | * Get the value for this operation.
33 | *
34 | * @return int
35 | */
36 | public function getValue()
37 | {
38 | return $this->value;
39 | }
40 |
41 | /**
42 | * Get an associative array encoding for this operation.
43 | *
44 | * @return array
45 | */
46 | public function _encode()
47 | {
48 | return array('__op' => 'Increment', 'amount' => $this->value);
49 | }
50 |
51 | /**
52 | * Apply the current operation and return the result.
53 | *
54 | * @param mixed $oldValue Value prior to this operation.
55 | * @param mixed $object Value for this operation.
56 | * @param string $key Key to set Value on.
57 | *
58 | * @return int New value after application.
59 | * @throws ParseException
60 | */
61 | public function _apply($oldValue, $object, $key)
62 | {
63 | if ($oldValue && !is_numeric($oldValue)) {
64 | throw new ParseException('Cannot increment a non-number type.');
65 | }
66 | return $oldValue + $this->value;
67 | }
68 |
69 | /**
70 | * Merge this operation with a previous operation and return the
71 | * resulting operation.
72 | *
73 | * @param FieldOperation $previous Previous Operation.
74 | *
75 | * @return FieldOperation
76 | * @throws ParseException
77 | */
78 | public function _mergeWithPrevious($previous)
79 | {
80 | if (!$previous) {
81 | return $this;
82 | }
83 | if ($previous instanceof DeleteOperation) {
84 | return new SetOperation($this->value);
85 | }
86 | if ($previous instanceof SetOperation) {
87 | return new SetOperation($previous->getValue() + $this->value);
88 | }
89 | if ($previous instanceof IncrementOperation) {
90 | return new IncrementOperation(
91 | $previous->getValue() + $this->value
92 | );
93 | }
94 | throw new ParseException(
95 | 'Operation is invalid after previous operation.'
96 | );
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/scripts/integration/requests.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5 | * copy, modify, and distribute this software in source code or binary form for use
6 | * in connection with the web services and APIs provided by Facebook.
7 | *
8 | * As with any software that integrates with the Facebook platform, your use of
9 | * this software is subject to the Facebook Developer Principles and Policies
10 | * [http://developers.facebook.com/policy/]. This copyright notice shall be
11 | * included in all copies or substantial portions of the software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 | */
20 |
21 | /*
22 | As Friend Smash is a social game that you play with friends, we need a way for
23 | players to invite their friends to play.
24 |
25 | With Requests, we can build a gameplay loop that allows players to challenge
26 | their friends to beat high scores, as well as sending invites to friends who
27 | aren't yet playing the game.
28 | */
29 | function sendChallenge(to, message, callback, turn) {
30 | var options = {
31 | method: 'apprequests'
32 | };
33 | if(to) options.to = to;
34 | if(message) options.message = message;
35 | if(turn) options.action_type = 'turn';
36 | FB.ui(options, function(response) {
37 | if(callback) callback(response);
38 | });
39 | }
40 |
41 | /*
42 | Retrieve challenge request.
43 |
44 | Player has launched game upon receiving and accepting a challenge request. Try
45 | to retrieve more information on the challenge.
46 | */
47 | function getRequestInfo(id, callback) {
48 | FB.api(String(id), {fields: 'from{id,name,picture}' }, function(response){
49 | if( response.error ) {
50 | console.error('getRequestSenderInfo', response.error);
51 | return;
52 | }
53 | if(callback) callback(response);
54 | });
55 | }
56 |
57 | /*
58 | Remove challenge request.
59 |
60 | After accepting a challenge from friend, the request should be deleted.
61 | */
62 | function deleteRequest(id, callback) {
63 | FB.api(String(id), 'delete', function(response){
64 | if( response.error ) {
65 | console.error('deleteRequest', response.error);
66 | return;
67 | }
68 | if(callback) callback(response);
69 | });
70 | }
71 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/autoload.php:
--------------------------------------------------------------------------------
1 | execute()->getGraphObject(GraphUser::className());
45 | echo $me->getName();
46 | } catch (FacebookRequestException $e) {
47 | // The Graph API returned an error
48 | } catch (\Exception $e) {
49 | // Some other error occurred
50 | }
51 |
52 | ```
53 |
54 | Complete documentation, installation instructions, and examples are available at:
55 | [https://developers.facebook.com/docs/php](https://developers.facebook.com/docs/php)
56 |
57 |
58 | Tests
59 | -----
60 |
61 | 1) [Composer](https://getcomposer.org/) is a prerequisite for running the tests.
62 |
63 | Install composer globally, then run `composer install` to install required files.
64 |
65 | 2) Create a test app on [Facebook Developers](https://developers.facebook.com), then
66 | create `tests/FacebookTestCredentials.php` from `tests/FacebookTestCredentials.php.dist`
67 | and edit it to add your credentials.
68 |
69 | 3) The tests can be executed by running this command from the root directory:
70 |
71 | ```bash
72 | ./vendor/bin/phpunit
73 | ```
74 |
75 |
76 | Contributing
77 | ------------
78 |
79 | For us to accept contributions you will have to first have signed the
80 | [Contributor License Agreement](https://developers.facebook.com/opensource/cla).
81 |
82 | When committing, keep all lines to less than 80 characters, and try to
83 | follow the existing style.
84 |
85 | Before creating a pull request, squash your commits into a single commit.
86 |
87 | Add the comments where needed, and provide ample explanation in the
88 | commit message.
89 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/GraphObjectTest.php:
--------------------------------------------------------------------------------
1 | execute()->getGraphObjectList();
19 | $this->assertTrue(is_array($response));
20 | }
21 |
22 | public function testArrayProperties()
23 | {
24 | $backingData = array(
25 | 'id' => 42,
26 | 'friends' => array(
27 | 'data' => array(
28 | array(
29 | 'id' => 1,
30 | 'name' => 'David'
31 | ),
32 | array(
33 | 'id' => 2,
34 | 'name' => 'Fosco'
35 | )
36 | ),
37 | 'paging' => array(
38 | 'next' => 'nexturl'
39 | )
40 | )
41 | );
42 | $obj = new GraphObject($backingData);
43 | $friends = $obj->getPropertyAsArray('friends');
44 | $this->assertEquals(2, count($friends));
45 | $this->assertTrue($friends[0] instanceof GraphObject);
46 | $this->assertTrue($friends[1] instanceof GraphObject);
47 | $this->assertEquals('David', $friends[0]->getProperty('name'));
48 | $this->assertEquals('Fosco', $friends[1]->getProperty('name'));
49 |
50 | $backingData = array(
51 | 'id' => 42,
52 | 'friends' => array(
53 | array(
54 | 'id' => 1,
55 | 'name' => 'Ilya'
56 | ),
57 | array(
58 | 'id' => 2,
59 | 'name' => 'Kevin'
60 | )
61 | )
62 | );
63 | $obj = new GraphObject($backingData);
64 | $friends = $obj->getPropertyAsArray('friends');
65 | $this->assertEquals(2, count($friends));
66 | $this->assertTrue($friends[0] instanceof GraphObject);
67 | $this->assertTrue($friends[1] instanceof GraphObject);
68 | $this->assertEquals('Ilya', $friends[0]->getProperty('name'));
69 | $this->assertEquals('Kevin', $friends[1]->getProperty('name'));
70 |
71 | }
72 |
73 | public function testAsList()
74 | {
75 | $backingData = array(
76 | 'data' => array(
77 | array(
78 | 'id' => 1,
79 | 'name' => 'David'
80 | ),
81 | array(
82 | 'id' => 2,
83 | 'name' => 'Fosco'
84 | )
85 | )
86 | );
87 | $enc = json_encode($backingData);
88 | $response = new FacebookResponse(null, json_decode($enc), $enc);
89 | $list = $response->getGraphObjectList(GraphUser::className());
90 | $this->assertEquals(2, count($list));
91 | $this->assertTrue($list[0] instanceof GraphObject);
92 | $this->assertTrue($list[1] instanceof GraphObject);
93 | $this->assertEquals('David', $list[0]->getName());
94 | $this->assertEquals('Fosco', $list[1]->getName());
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/AddOperation.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | class AddOperation implements FieldOperation
15 | {
16 |
17 | /**
18 | * @var - Array with objects to add.
19 | */
20 | private $objects;
21 |
22 | /**
23 | * Creates an AddOperation with the provided objects.
24 | *
25 | * @param array $objects Objects to add.
26 | *
27 | * @throws ParseException
28 | */
29 | public function __construct($objects)
30 | {
31 | if (!is_array($objects)) {
32 | throw new ParseException("AddOperation requires an array.");
33 | }
34 | $this->objects = $objects;
35 | }
36 |
37 | /**
38 | * Gets the objects for this operation.
39 | *
40 | * @return mixed
41 | */
42 | public function getValue()
43 | {
44 | return $this->objects;
45 | }
46 |
47 | /**
48 | * Returns associative array representing encoded operation.
49 | *
50 | * @return array
51 | */
52 | public function _encode()
53 | {
54 | return array('__op' => 'Add',
55 | 'objects' => ParseClient::_encode($this->objects, true));
56 | }
57 |
58 | /**
59 | * Takes a previous operation and returns a merged operation to replace it.
60 | *
61 | * @param FieldOperation $previous Previous operation.
62 | *
63 | * @return FieldOperation Merged operation.
64 | * @throws ParseException
65 | */
66 | public function _mergeWithPrevious($previous)
67 | {
68 | if (!$previous) {
69 | return $this;
70 | }
71 | if ($previous instanceof DeleteOperation) {
72 | return new SetOperation($this->objects);
73 | }
74 | if ($previous instanceof SetOperation) {
75 | $oldList = $previous->getValue();
76 | return new SetOperation(
77 | array_merge((array)$oldList, (array)$this->objects)
78 | );
79 | }
80 | if ($previous instanceof AddOperation) {
81 | $oldList = $previous->getValue();
82 | return new SetOperation(
83 | array_merge((array)$oldList, (array)$this->objects)
84 | );
85 | }
86 | throw new ParseException(
87 | 'Operation is invalid after previous operation.'
88 | );
89 | }
90 |
91 | /**
92 | * Applies current operation, returns resulting value.
93 | *
94 | * @param mixed $oldValue Value prior to this operation.
95 | * @param mixed $obj Value being applied.
96 | * @param string $key Key this operation affects.
97 | *
98 | * @return array
99 | */
100 | public function _apply($oldValue, $obj, $key)
101 | {
102 | if (!$oldValue) {
103 | return $this->objects;
104 | }
105 | return array_merge((array)$oldValue, (array)$this->objects);
106 | }
107 |
108 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/GraphLocation.php:
--------------------------------------------------------------------------------
1 |
30 | * @author David Poll
31 | */
32 | class GraphLocation extends GraphObject
33 | {
34 |
35 | /**
36 | * Returns the street component of the location
37 | *
38 | * @return string|null
39 | */
40 | public function getStreet()
41 | {
42 | return $this->getProperty('street');
43 | }
44 |
45 | /**
46 | * Returns the city component of the location
47 | *
48 | * @return string|null
49 | */
50 | public function getCity()
51 | {
52 | return $this->getProperty('city');
53 | }
54 |
55 | /**
56 | * Returns the state component of the location
57 | *
58 | * @return string|null
59 | */
60 | public function getState()
61 | {
62 | return $this->getProperty('state');
63 | }
64 |
65 | /**
66 | * Returns the country component of the location
67 | *
68 | * @return string|null
69 | */
70 | public function getCountry()
71 | {
72 | return $this->getProperty('country');
73 | }
74 |
75 | /**
76 | * Returns the zipcode component of the location
77 | *
78 | * @return string|null
79 | */
80 | public function getZip()
81 | {
82 | return $this->getProperty('zip');
83 | }
84 |
85 | /**
86 | * Returns the latitude component of the location
87 | *
88 | * @return float|null
89 | */
90 | public function getLatitude()
91 | {
92 | return $this->getProperty('latitude');
93 | }
94 |
95 | /**
96 | * Returns the street component of the location
97 | *
98 | * @return float|null
99 | */
100 | public function getLongitude()
101 | {
102 | return $this->getProperty('longitude');
103 | }
104 |
105 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/FacebookPageTabHelper.php:
--------------------------------------------------------------------------------
1 |
30 | */
31 | class FacebookPageTabHelper extends FacebookCanvasLoginHelper
32 | {
33 |
34 | /**
35 | * @var array|null
36 | */
37 | protected $pageData;
38 |
39 | /**
40 | * Initialize the helper and process available signed request data.
41 | *
42 | * @param string|null $appId
43 | * @param string|null $appSecret
44 | */
45 | public function __construct($appId = null, $appSecret = null)
46 | {
47 | parent::__construct($appId, $appSecret);
48 |
49 | if (!$this->signedRequest) {
50 | return;
51 | }
52 |
53 | $this->pageData = $this->signedRequest->get('page');
54 | }
55 |
56 | /**
57 | * Returns a value from the page data.
58 | *
59 | * @param string $key
60 | * @param mixed|null $default
61 | *
62 | * @return mixed|null
63 | */
64 | public function getPageData($key, $default = null)
65 | {
66 | if (isset($this->pageData[$key])) {
67 | return $this->pageData[$key];
68 | }
69 | return $default;
70 | }
71 |
72 | /**
73 | * Returns true if the page is liked by the user.
74 | *
75 | * @return boolean
76 | */
77 | public function isLiked()
78 | {
79 | return $this->getPageData('liked') === true;
80 | }
81 |
82 | /**
83 | * Returns true if the user is an admin.
84 | *
85 | * @return boolean
86 | */
87 | public function isAdmin()
88 | {
89 | return $this->getPageData('admin') === true;
90 | }
91 |
92 | /**
93 | * Returns the page id if available.
94 | *
95 | * @return string|null
96 | */
97 | public function getPageId()
98 | {
99 | return $this->getPageData('id');
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/tests/ParseCloudTest.php:
--------------------------------------------------------------------------------
1 | set('name', 'Zanzibar');
21 | $obj->save();
22 | $params = array('key1' => $obj);
23 | $this->setExpectedException('\Exception', 'ParseObjects not allowed');
24 | ParseCloud::run('foo', $params);
25 | }
26 |
27 | public function testFunctionsWithGeoPointParamsDoNotThrow()
28 | {
29 | $params = array('key1' => new ParseGeoPoint(50, 50));
30 | $this->setExpectedException('Parse\ParseException', 'function not found');
31 | ParseCloud::run('unknown_function', $params);
32 | }
33 |
34 | public function testExplicitFunctionFailure()
35 | {
36 | $params = array('key1' => 'value1');
37 | $this->setExpectedException('Parse\ParseException','bad stuff happened');
38 | ParseCloud::run('bar', $params);
39 | }
40 |
41 | public function testUnknownFunctionFailure()
42 | {
43 | $params = array('key1' => 'value1');
44 | $this->setExpectedException('Parse\ParseException','function not found');
45 | ParseCloud::run('unknown_function', $params);
46 | }
47 |
48 | public function testFunctions()
49 | {
50 | $params = array(
51 | 'key1' => 'value1',
52 | 'key2' => array(1,2,3)
53 | );
54 | $response = ParseCloud::run('foo', $params);
55 | $obj = $response['object'];
56 | $this->assertTrue($obj instanceof ParseObject);
57 | $this->assertEquals('Foo', $obj->className);
58 | $this->assertEquals(2, $obj->get('x'));
59 | $relation = $obj->get('relation');
60 | $this->assertTrue($relation instanceof ParseObject);
61 | $this->assertEquals('Bar', $relation->className);
62 | $this->assertEquals(3, $relation->get('x'));
63 | $obj = $response['array'][0];
64 | $this->assertTrue($obj instanceof ParseObject);
65 | $this->assertEquals('Bar', $obj->className);
66 | $this->assertEquals(2, $obj->get('x'));
67 |
68 | $response = ParseCloud::run('foo', array('key1' => 'value1'));
69 | $this->assertEquals(2, $response['a']);
70 |
71 | try {
72 | $response = ParseCloud::run('bar', array('key1' => 'value1'));
73 | $this->fail('Should have thrown an exception.');
74 | } catch(Parse\ParseException $ex) {
75 | // A parse exception should occur.
76 | }
77 |
78 | $response = ParseCloud::run('bar', array('key2' => 'value1'));
79 | $this->assertEquals('Foo', $response);
80 |
81 | $obj = ParseObject::create('SomeClass');
82 | $obj->set('name', 'Zanzibar');
83 | $obj->save();
84 |
85 | $params = array('key2' => 'value1', 'key1' => $obj);
86 | try {
87 | $response = ParseCloud::run('foo', $params);
88 | $this->fail('Should have thrown an exception.');
89 | } catch (\Exception $ex) {
90 | // An exception should occur.
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/GraphSessionInfo.php:
--------------------------------------------------------------------------------
1 |
30 | * @author David Poll
31 | */
32 | class GraphSessionInfo extends GraphObject
33 | {
34 |
35 | /**
36 | * Returns the application id the token was issued for.
37 | *
38 | * @return string|null
39 | */
40 | public function getAppId()
41 | {
42 | return $this->getProperty('app_id');
43 | }
44 |
45 | /**
46 | * Returns the application name the token was issued for.
47 | *
48 | * @return string|null
49 | */
50 | public function getApplication()
51 | {
52 | return $this->getProperty('application');
53 | }
54 |
55 | /**
56 | * Returns the date & time that the token expires.
57 | *
58 | * @return \DateTime|null
59 | */
60 | public function getExpiresAt()
61 | {
62 | $stamp = $this->getProperty('expires_at');
63 | if ($stamp) {
64 | return (new \DateTime())->setTimestamp($stamp);
65 | } else {
66 | return null;
67 | }
68 | }
69 |
70 | /**
71 | * Returns whether the token is valid.
72 | *
73 | * @return boolean
74 | */
75 | public function isValid()
76 | {
77 | return $this->getProperty('is_valid');
78 | }
79 |
80 | /**
81 | * Returns the date & time the token was issued at.
82 | *
83 | * @return \DateTime|null
84 | */
85 | public function getIssuedAt()
86 | {
87 | $stamp = $this->getProperty('issued_at');
88 | if ($stamp) {
89 | return (new \DateTime())->setTimestamp($stamp);
90 | } else {
91 | return null;
92 | }
93 | }
94 |
95 | /**
96 | * Returns the scope permissions associated with the token.
97 | *
98 | * @return array
99 | */
100 | public function getScopes()
101 | {
102 | return $this->getPropertyAsArray('scopes');
103 | }
104 |
105 | /**
106 | * Returns the login id of the user associated with the token.
107 | *
108 | * @return string|null
109 | */
110 | public function getId()
111 | {
112 | return $this->getProperty('user_id');
113 | }
114 |
115 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/HttpClients/FacebookCurl.php:
--------------------------------------------------------------------------------
1 | curl === null) {
46 | $this->curl = curl_init();
47 | }
48 | }
49 |
50 | /**
51 | * Set a curl option
52 | *
53 | * @param $key
54 | * @param $value
55 | */
56 | public function setopt($key, $value)
57 | {
58 | curl_setopt($this->curl, $key, $value);
59 | }
60 |
61 | /**
62 | * Set an array of options to a curl resource
63 | *
64 | * @param array $options
65 | */
66 | public function setopt_array(array $options)
67 | {
68 | curl_setopt_array($this->curl, $options);
69 | }
70 |
71 | /**
72 | * Send a curl request
73 | *
74 | * @return mixed
75 | */
76 | public function exec()
77 | {
78 | return curl_exec($this->curl);
79 | }
80 |
81 | /**
82 | * Return the curl error number
83 | *
84 | * @return int
85 | */
86 | public function errno()
87 | {
88 | return curl_errno($this->curl);
89 | }
90 |
91 | /**
92 | * Return the curl error message
93 | *
94 | * @return string
95 | */
96 | public function error()
97 | {
98 | return curl_error($this->curl);
99 | }
100 |
101 | /**
102 | * Get info from a curl reference
103 | *
104 | * @param $type
105 | *
106 | * @return mixed
107 | */
108 | public function getinfo($type)
109 | {
110 | return curl_getinfo($this->curl, $type);
111 | }
112 |
113 | /**
114 | * Get the currently installed curl version
115 | *
116 | * @return array
117 | */
118 | public function version()
119 | {
120 | return curl_version();
121 | }
122 |
123 | /**
124 | * Close the resource connection to curl
125 | */
126 | public function close()
127 | {
128 | curl_close($this->curl);
129 |
130 | // closed handle has to be initialized again
131 | $this->curl = null;
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/RemoveOperation.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | class RemoveOperation implements FieldOperation
17 | {
18 |
19 | /**
20 | * @var - Array with objects to remove.
21 | */
22 | private $objects;
23 |
24 | /**
25 | * Creates an RemoveOperation with the provided objects.
26 | *
27 | * @param array $objects Objects to remove.
28 | *
29 | * @throws ParseException
30 | */
31 | public function __construct($objects)
32 | {
33 | if (!is_array($objects)) {
34 | throw new ParseException("RemoveOperation requires an array.");
35 | }
36 | $this->objects = $objects;
37 | }
38 |
39 | /**
40 | * Gets the objects for this operation.
41 | *
42 | * @return mixed
43 | */
44 | public function getValue()
45 | {
46 | return $this->objects;
47 | }
48 |
49 | /**
50 | * Returns associative array representing encoded operation.
51 | *
52 | * @return array
53 | */
54 | public function _encode()
55 | {
56 | return array('__op' => 'Remove',
57 | 'objects' => ParseClient::_encode($this->objects, true));
58 | }
59 |
60 | /**
61 | * Takes a previous operation and returns a merged operation to replace it.
62 | *
63 | * @param FieldOperation $previous Previous operation.
64 | *
65 | * @return FieldOperation Merged operation.
66 | * @throws ParseException
67 | */
68 | public function _mergeWithPrevious($previous)
69 | {
70 | if (!$previous) {
71 | return $this;
72 | }
73 | if ($previous instanceof DeleteOperation) {
74 | return $previous;
75 | }
76 | if ($previous instanceof SetOperation) {
77 | return new SetOperation(
78 | $this->_apply($previous->getValue(), $this->objects, null)
79 | );
80 | }
81 | if ($previous instanceof RemoveOperation) {
82 | $oldList = $previous->getValue();
83 | return new RemoveOperation(
84 | array_merge((array)$oldList, (array)$this->objects)
85 | );
86 | }
87 | throw new ParseException(
88 | 'Operation is invalid after previous operation.'
89 | );
90 | }
91 |
92 | /**
93 | * Applies current operation, returns resulting value.
94 | *
95 | * @param mixed $oldValue Value prior to this operation.
96 | * @param mixed $obj Value being applied.
97 | * @param string $key Key this operation affects.
98 | *
99 | * @return array
100 | */
101 | public function _apply($oldValue, $obj, $key)
102 | {
103 | if (empty($oldValue)) {
104 | return array();
105 | }
106 | $newValue = array();
107 | foreach ($oldValue as $oldObject) {
108 | foreach ($this->objects as $newObject) {
109 | if ($oldObject instanceof ParseObject) {
110 | if ($newObject instanceof ParseObject
111 | && !$oldObject->isDirty()
112 | && $oldObject->getObjectId() == $newObject->getObjectId()) {
113 | // found the object, won't add it.
114 | } else {
115 | $newValue[] = $oldObject;
116 | }
117 | } else {
118 | if ($oldObject !== $newObject) {
119 | $newValue[] = $oldObject;
120 | }
121 | }
122 | }
123 | }
124 | return $newValue;
125 | }
126 |
127 | }
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/HttpClients/FacebookGuzzleHttpClientTest.php:
--------------------------------------------------------------------------------
1 | guzzleMock = m::mock('GuzzleHttp\Client');
17 | $this->guzzleClient = new FacebookGuzzleHttpClient($this->guzzleMock);
18 | }
19 |
20 | public function tearDown()
21 | {
22 | m::close();
23 | (new FacebookGuzzleHttpClient()); // Resets the static dependency injection
24 | }
25 |
26 | public function testCanSendNormalRequest()
27 | {
28 | $requestMock = m::mock('GuzzleHttp\Message\RequestInterface');
29 | $requestMock
30 | ->shouldReceive('setHeader')
31 | ->once()
32 | ->with('X-foo', 'bar')
33 | ->andReturn(null);
34 |
35 | $responseMock = m::mock('GuzzleHttp\Message\ResponseInterface');
36 | $responseMock
37 | ->shouldReceive('getStatusCode')
38 | ->once()
39 | ->andReturn(200);
40 | $responseMock
41 | ->shouldReceive('getHeaders')
42 | ->once()
43 | ->andReturn($this->fakeHeadersAsArray);
44 | $responseMock
45 | ->shouldReceive('getBody')
46 | ->once()
47 | ->andReturn($this->fakeRawBody);
48 |
49 | $this->guzzleMock
50 | ->shouldReceive('createRequest')
51 | ->once()
52 | ->with('GET', 'http://foo.com/', m::on(function($arg) {
53 | if (1 !== preg_match('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/', $arg['verify'])) {
54 | return false;
55 | }
56 | return true;
57 | }))
58 | ->andReturn($requestMock);
59 |
60 | $this->guzzleMock
61 | ->shouldReceive('send')
62 | ->once()
63 | ->with($requestMock)
64 | ->andReturn($responseMock);
65 |
66 | $this->guzzleClient->addRequestHeader('X-foo', 'bar');
67 | $responseBody = $this->guzzleClient->send('http://foo.com/');
68 |
69 | $this->assertEquals($responseBody, $this->fakeRawBody);
70 | $this->assertEquals($this->guzzleClient->getResponseHeaders(), $this->fakeHeadersAsArray);
71 | $this->assertEquals(200, $this->guzzleClient->getResponseHttpStatusCode());
72 | }
73 |
74 | /**
75 | * @expectedException \Facebook\FacebookSDKException
76 | */
77 | public function testThrowsExceptionOnClientError()
78 | {
79 | $requestMock = m::mock('GuzzleHttp\Message\RequestInterface');
80 | $exceptionMock = m::mock(
81 | 'GuzzleHttp\Exception\RequestException',
82 | array(
83 | 'Foo Error',
84 | $requestMock,
85 | null,
86 | m::mock('GuzzleHttp\Exception\AdapterException'),
87 | ));
88 |
89 | $this->guzzleMock
90 | ->shouldReceive('createRequest')
91 | ->once()
92 | ->with('GET', 'http://foo.com/', m::on(function($arg) {
93 | if (1 !== preg_match('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/', $arg['verify'])) {
94 | return false;
95 | }
96 | return true;
97 | }))
98 | ->andReturn($requestMock);
99 |
100 | $this->guzzleMock
101 | ->shouldReceive('send')
102 | ->once()
103 | ->with($requestMock)
104 | ->andThrow($exceptionMock);
105 |
106 | $this->guzzleClient->send('http://foo.com/');
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookRedirectLoginHelperTest.php:
--------------------------------------------------------------------------------
1 | disableSessionStatusCheck();
20 | $loginUrl = $helper->getLoginUrl();
21 | $state = $_SESSION['FBRLH_state'];
22 | $params = array(
23 | 'client_id' => FacebookTestCredentials::$appId,
24 | 'redirect_uri' => self::REDIRECT_URL,
25 | 'state' => $state,
26 | 'sdk' => 'php-sdk-' . FacebookRequest::VERSION,
27 | 'scope' => implode(',', array())
28 | );
29 | $expectedUrl = 'https://www.facebook.com/' . FacebookRequest::GRAPH_API_VERSION . '/dialog/oauth?';
30 | $this->assertTrue(strpos($loginUrl, $expectedUrl) === 0, 'Unexpected base login URL returned from getLoginUrl().');
31 | foreach ($params as $key => $value) {
32 | $this->assertContains($key . '=' . urlencode($value), $loginUrl);
33 | }
34 | }
35 |
36 | public function testReRequestUrlContainsState()
37 | {
38 | $helper = new FacebookRedirectLoginHelper(
39 | self::REDIRECT_URL,
40 | FacebookTestCredentials::$appId,
41 | FacebookTestCredentials::$appSecret
42 | );
43 | $helper->disableSessionStatusCheck();
44 |
45 | $reRequestUrl = $helper->getReRequestUrl();
46 | $state = $_SESSION['FBRLH_state'];
47 |
48 | $this->assertContains('state=' . urlencode($state), $reRequestUrl);
49 | }
50 |
51 | public function testLogoutURL()
52 | {
53 | $helper = new FacebookRedirectLoginHelper(
54 | self::REDIRECT_URL,
55 | FacebookTestCredentials::$appId,
56 | FacebookTestCredentials::$appSecret
57 | );
58 | $helper->disableSessionStatusCheck();
59 | $logoutUrl = $helper->getLogoutUrl(
60 | FacebookTestHelper::$testSession, self::REDIRECT_URL
61 | );
62 | $params = array(
63 | 'next' => self::REDIRECT_URL,
64 | 'access_token' => FacebookTestHelper::$testSession->getToken()
65 | );
66 | $expectedUrl = 'https://www.facebook.com/logout.php?';
67 | $this->assertTrue(strpos($logoutUrl, $expectedUrl) !== false);
68 | foreach ($params as $key => $value) {
69 | $this->assertTrue(
70 | strpos($logoutUrl, $key . '=' . urlencode($value)) !== false
71 | );
72 | }
73 | }
74 |
75 | public function testLogoutURLFailsWithAppSession()
76 | {
77 | $helper = new FacebookRedirectLoginHelper(
78 | self::REDIRECT_URL,
79 | FacebookTestCredentials::$appId,
80 | FacebookTestCredentials::$appSecret
81 | );
82 | $helper->disableSessionStatusCheck();
83 | $session = FacebookTestHelper::getAppSession();
84 | $this->setExpectedException(
85 | 'Facebook\\FacebookSDKException', 'Cannot generate a Logout URL with an App Session.'
86 | );
87 | $helper->getLogoutUrl(
88 | $session, self::REDIRECT_URL
89 | );
90 | }
91 |
92 | public function testCSPRNG()
93 | {
94 | $helper = new FacebookRedirectLoginHelper(
95 | self::REDIRECT_URL,
96 | FacebookTestCredentials::$appId,
97 | FacebookTestCredentials::$appSecret
98 | );
99 | $this->assertEquals(1, preg_match('/^([0-9a-f]+)$/', $helper->random(32)));
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/Internal/AddUniqueOperation.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | class AddUniqueOperation implements FieldOperation
15 | {
16 |
17 | /**
18 | * @var - Array containing objects to add.
19 | */
20 | private $objects;
21 |
22 | /**
23 | * Creates an operation for adding unique values to an array key.
24 | *
25 | * @param array $objects Objects to add.
26 | *
27 | * @throws ParseException
28 | */
29 | public function __construct($objects)
30 | {
31 | if (!is_array($objects)) {
32 | throw new ParseException("AddUniqueOperation requires an array.");
33 | }
34 | $this->objects = $objects;
35 | }
36 |
37 | /**
38 | * Returns the values for this operation.
39 | *
40 | * @return mixed
41 | */
42 | public function getValue()
43 | {
44 | return $this->objects;
45 | }
46 |
47 | /**
48 | * Returns an associative array encoding of this operation.
49 | *
50 | * @return array
51 | */
52 | public function _encode()
53 | {
54 | return array('__op' => 'AddUnique',
55 | 'objects' => ParseClient::_encode($this->objects, true));
56 | }
57 |
58 | /**
59 | * Merge this operation with the previous operation and return the result.
60 | *
61 | * @param FieldOperation $previous Previous Operation.
62 | *
63 | * @return FieldOperation Merged Operation.
64 | * @throws ParseException
65 | */
66 | public function _mergeWithPrevious($previous)
67 | {
68 | if (!$previous) {
69 | return $this;
70 | }
71 | if ($previous instanceof DeleteOperation) {
72 | return new SetOperation($this->objects);
73 | }
74 | if ($previous instanceof SetOperation) {
75 | $oldValue = $previous->getValue();
76 | $result = $this->_apply($oldValue, null, null);
77 | return new SetOperation($result);
78 | }
79 | if ($previous instanceof AddUniqueOperation) {
80 | $oldList = $previous->getValue();
81 | $result = $this->_apply($oldList, null, null);
82 | return new AddUniqueOperation($result);
83 | }
84 | throw new ParseException(
85 | 'Operation is invalid after previous operation.'
86 | );
87 | }
88 |
89 | /**
90 | * Apply the current operation and return the result.
91 | *
92 | * @param mixed $oldValue Value prior to this operation.
93 | * @param array $obj Value being applied.
94 | * @param string $key Key this operation affects.
95 | *
96 | * @return array
97 | */
98 | public function _apply($oldValue, $obj, $key)
99 | {
100 | if (!$oldValue) {
101 | return $this->objects;
102 | }
103 | if (!is_array($oldValue)) {
104 | $oldValue = (array)$oldValue;
105 | }
106 | foreach ($this->objects as $object) {
107 | if ($object instanceof ParseObject && $object->getObjectId()) {
108 | if (!$this->isParseObjectInArray($object, $oldValue)) {
109 | $oldValue[] = $object;
110 | }
111 | } else if (is_object($object)) {
112 | if (!in_array($object, $oldValue, true)) {
113 | $oldValue[] = $object;
114 | }
115 | } else {
116 | if (!in_array($object, $oldValue, true)) {
117 | $oldValue[] = $object;
118 | }
119 | }
120 | }
121 | return $oldValue;
122 | }
123 |
124 | private function isParseObjectInArray($parseObject, $oldValue)
125 | {
126 | foreach ($oldValue as $object) {
127 | if ($object instanceof ParseObject && $object->getObjectId() != null) {
128 | if ($object->getObjectId() == $parseObject->getObjectId()) {
129 | return true;
130 | }
131 | }
132 | }
133 | return false;
134 | }
135 |
136 | }
--------------------------------------------------------------------------------
/payments/callback.php:
--------------------------------------------------------------------------------
1 | 100,
39 | '{$serverUrl}/payments/500coins.html' => 500,
40 | '{$serverUrl}/payments/1000coins.html' => 1000,
41 | ];
42 |
43 | // Get the GraphUser object for the current user:
44 |
45 | $method = $_SERVER['REQUEST_METHOD'];
46 | //stdout('RTU');
47 | if ($method == 'GET' && $_GET['hub_verify_token'] === $verify_token) {
48 | echo $_GET['hub_challenge'];
49 | } else {
50 | $data = file_get_contents("php://input");
51 | $json = json_decode($data, true);
52 |
53 | if( $json["object"] && $json["object"] == "payments" ) {
54 | $payment_id = $json["entry"][0]["id"];
55 | try {
56 | $result = (new FacebookRequest(
57 | $session, 'GET', '/' . $payment_id . '?fields=user,actions,items,gift_requests'
58 | ))->execute()->getGraphObject(GraphObject::className());
59 | error_log('payment id: '.$result->getProperty('id'));
60 | $actions = $result->getPropertyAsArray('actions');
61 | if( $actions[0]->getProperty('status') == 'completed' ){
62 |
63 | $gift_requests = $result->getProperty('gift_requests');
64 | $user = $result->getProperty('user');
65 | $items = $result->getPropertyAsArray('items');
66 | $product = $items[0]->getProperty('product');
67 | $coins = $coins_for_product[$product];
68 |
69 | error_log('product '.$product);
70 |
71 | $recipient = '';
72 |
73 | if( $gift_requests ) {
74 | $data = $gift_requests->getPropertyAsArray('data');
75 | $recipient = $data[0]->getProperty('to')->getProperty('id');
76 | error_log('gift to '.$recipient);
77 | } else {
78 | $recipient = $user->getProperty('id');
79 | error_log('purchase for '.$recipient);
80 | }
81 |
82 | $query = new ParseQuery("_User");
83 |
84 | $query = ParseUser::query();
85 | $query->equalTo("fbid", $recipient);
86 |
87 | try {
88 | $parse_user = $query->find()[0];
89 | if( !$parse_user ) return;
90 | error_log($recipient . ' coins: ' . $coins );
91 | $parse_user->increment('coins', $coins);
92 | $parse_user->save(true);
93 | } catch (ParseException $ex) {
94 | error_log($ex);
95 | }
96 | }
97 | } catch (FacebookRequestException $e) {
98 | // The Graph API returned an error
99 | error_log($e->getRawResponse());
100 | } catch (\Exception $e) {
101 | error_log($e);
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/GraphUser.php:
--------------------------------------------------------------------------------
1 |
30 | * @author David Poll
31 | */
32 | class GraphUser extends GraphObject
33 | {
34 |
35 | /**
36 | * Returns the ID for the user as a string if present.
37 | *
38 | * @return string|null
39 | */
40 | public function getId()
41 | {
42 | return $this->getProperty('id');
43 | }
44 |
45 | /**
46 | * Returns the name for the user as a string if present.
47 | *
48 | * @return string|null
49 | */
50 | public function getName()
51 | {
52 | return $this->getProperty('name');
53 | }
54 |
55 | public function getEmail()
56 | {
57 | return $this->getProperty('email');
58 | }
59 |
60 | /**
61 | * Returns the first name for the user as a string if present.
62 | *
63 | * @return string|null
64 | */
65 | public function getFirstName()
66 | {
67 | return $this->getProperty('first_name');
68 | }
69 |
70 | /**
71 | * Returns the middle name for the user as a string if present.
72 | *
73 | * @return string|null
74 | */
75 | public function getMiddleName()
76 | {
77 | return $this->getProperty('middle_name');
78 | }
79 |
80 | /**
81 | * Returns the last name for the user as a string if present.
82 | *
83 | * @return string|null
84 | */
85 | public function getLastName()
86 | {
87 | return $this->getProperty('last_name');
88 | }
89 |
90 | /**
91 | * Returns the gender for the user as a string if present.
92 | *
93 | * @return string|null
94 | */
95 | public function getGender()
96 | {
97 | return $this->getProperty('gender');
98 | }
99 |
100 | /**
101 | * Returns the Facebook URL for the user as a string if available.
102 | *
103 | * @return string|null
104 | */
105 | public function getLink()
106 | {
107 | return $this->getProperty('link');
108 | }
109 |
110 | /**
111 | * Returns the users birthday, if available.
112 | *
113 | * @return \DateTime|null
114 | */
115 | public function getBirthday()
116 | {
117 | $value = $this->getProperty('birthday');
118 | if ($value) {
119 | return new \DateTime($value);
120 | }
121 | return null;
122 | }
123 |
124 | /**
125 | * Returns the current location of the user as a FacebookGraphLocation
126 | * if available.
127 | *
128 | * @return GraphLocation|null
129 | */
130 | public function getLocation()
131 | {
132 | return $this->getProperty('location', GraphLocation::className());
133 | }
134 |
135 | /**
136 | * Returns the timezone for the user as a int if present.
137 | *
138 | * @return string|null
139 | */
140 | public function getTimezone()
141 | {
142 | return $this->getProperty('timezone');
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/docs/FacebookSession.fbmd:
--------------------------------------------------------------------------------
1 |
2 | # FacebookSession for the Facebook SDK for PHP
3 |
4 | Represents a Facebook Session, which is used when making requests to the Graph API.
5 |
6 |
7 |
8 | ## Facebook\FacebookSession {#overview}
9 |
10 | Usage:
11 |
12 | ~~~~
13 | use Facebook\FacebookSession;
14 |
15 | FacebookSession::setDefaultApplication('app-id', 'app-secret');
16 |
17 | // If you already have a valid access token:
18 | $session = new FacebookSession('access-token');
19 |
20 | // If you're making app-level requests:
21 | $session = FacebookSession::newAppSession();
22 |
23 | // To validate the session:
24 | try {
25 | $session->validate();
26 | } catch (FacebookRequestException $ex) {
27 | // Session not valid, Graph API returned an exception with the reason.
28 | echo $ex->getMessage();
29 | } catch (\Exception $ex) {
30 | // Graph API returned info, but it may mismatch the current app or have expired.
31 | echo $ex->getMessage();
32 | }
33 | ~~~~
34 |
35 |
36 |
37 | ## Static Methods {#static-methods}
38 |
39 | ### setDefaultApplication {#setdefaultapp}
40 | `setDefaultApplication(string $appId, string $appSecret)`
41 | Configures and app ID and secret that will be used by default throughout the SDK (but can be overridden whenever necessary using parameters to other methods.
42 | ### validate {#validate}
43 | `validate(Facebook\GraphSessionInfo $sessionInfo, string $appId = NULL, string $appSecret = NULL)`
44 | Ensures that the provided GraphSessionInfo is valid, throwing an exception if not. It does this by ensuring the app ID in the token info matches the given (or default) app ID, ensuring the token itself is valid, and ensuring that the expiration time has not passed.
45 | ### newAppSession {#newappsession}
46 | `newAppSession(string $appId = NULL, string $appSecret = NULL)`
47 | Returns a `Facebook\FacebookSession` configured with a token for the app which can be used for publishing and for requesting app-level information.
48 | ### newSessionFromSignedRequest {#newsessionfromsr}
49 | `newSessionFromSignedRequest(string $signedRequest)`
50 | Returns a `Facebook\FacebookSession` for the given signed request.
51 |
52 |
53 |
54 | ## Instance Methods {#instance-methods}
55 |
56 | ### getToken {#gettoken}
57 | `getToken()`
58 | Returns the token string for the session.
59 | ### getSessionInfo {#getsessioninfo}
60 | `getSessionInfo(string $appId = NULL, string $appSecret = NULL)`
61 | Equivalent to calling the /debug_token endpoint of the Graph API to get the details for the access token for this session. Returns a `Facebook\GraphSessionInfo` object.
62 | ### getLongLivedSession {#getlonglivedsession}
63 | `getLongLivedSession(string $appId = NULL, string $appSecret = NULL)`
64 | Returns a new `Facebook\FacebookSession` resulting from extending a short-lived access token. This method will make a network request. If you know you already have a long-lived session, you do not need to call this. The only time you get a short-lived session as of March 2014 is from the Facebook SDK for JavaScript. If this session is not short-lived, this method will return `$this`. A long-lived session is on the order of months. A short-lived session is on the order of hours. You can figure out whether a session is short-lived or long-lived by checking the expiration date in the session info, but it's not a precise thing.
65 | ### getExchangeToken {#getexchangetoken}
66 | `getExchangeToken(string $appId = NULL, string $appSecret = NULL)`
67 | Returns an exchange token string which can be sent back to clients and exchanged for a device-linked access token. You need this when your user did not log in on a particular device, but you want to be able to make Graph API calls from that device as this user.
68 | ### validate {#validatei}
69 | `validate(string $appId = NULL, string $appSecret = NULL)`
70 | Ensures that a session is valid, throwing an exception if not. It does this by fetching the token info, ensuring the app ID in the token info matches the given (or default) app ID, ensuring the token itself is valid, and ensuring that the expiration time has not passed.
71 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/HttpClients/FacebookStreamHttpClientTest.php:
--------------------------------------------------------------------------------
1 | streamMock = m::mock('Facebook\HttpClients\FacebookStream');
17 | $this->streamClient = new FacebookStreamHttpClient($this->streamMock);
18 | }
19 |
20 | public function tearDown()
21 | {
22 | m::close();
23 | (new FacebookStreamHttpClient()); // Resets the static dependency injection
24 | }
25 |
26 | public function testCanCompileHeader()
27 | {
28 | $this->streamClient->addRequestHeader('X-foo', 'bar');
29 | $this->streamClient->addRequestHeader('X-bar', 'faz');
30 | $header = $this->streamClient->compileHeader();
31 | $this->assertEquals("X-foo: bar\r\nX-bar: faz", $header);
32 | }
33 |
34 | public function testCanFormatHeadersToArray()
35 | {
36 | $raw_header_array = explode("\n", trim($this->fakeRawHeader));
37 | $header_array = FacebookStreamHttpClient::formatHeadersToArray($raw_header_array);
38 | $this->assertEquals($this->fakeHeadersAsArray, $header_array);
39 | }
40 |
41 | public function testCanGetHttpStatusCodeFromResponseHeader()
42 | {
43 | $http_code = FacebookStreamHttpClient::getStatusCodeFromHeader('HTTP/1.1 123 Foo Response');
44 | $this->assertEquals('123', $http_code);
45 | }
46 |
47 | public function testCanSendNormalRequest()
48 | {
49 | $this->streamMock
50 | ->shouldReceive('streamContextCreate')
51 | ->once()
52 | ->with(m::on(function($arg) {
53 | if ( ! isset($arg['http']) || ! isset($arg['ssl'])) {
54 | return false;
55 | }
56 |
57 | if ($arg['http'] !== [
58 | 'method' => 'GET',
59 | 'timeout' => 60,
60 | 'ignore_errors' => true,
61 | 'header' => 'X-foo: bar',
62 | ]) {
63 | return false;
64 | }
65 |
66 | $caInfo = array_diff_assoc($arg['ssl'], [
67 | 'verify_peer' => true,
68 | 'verify_peer_name' => true,
69 | 'allow_self_signed' => true,
70 | ]);
71 |
72 | if (count($caInfo) !== 1) {
73 | return false;
74 | }
75 |
76 | if (1 !== preg_match('/.+\/certs\/DigiCertHighAssuranceEVRootCA\.pem$/', $caInfo['cafile'])) {
77 | return false;
78 | }
79 |
80 | return true;
81 | }))
82 | ->andReturn(null);
83 | $this->streamMock
84 | ->shouldReceive('getResponseHeaders')
85 | ->once()
86 | ->andReturn(explode("\n", trim($this->fakeRawHeader)));
87 | $this->streamMock
88 | ->shouldReceive('fileGetContents')
89 | ->once()
90 | ->with('http://foo.com/')
91 | ->andReturn($this->fakeRawBody);
92 |
93 | $this->streamClient->addRequestHeader('X-foo', 'bar');
94 | $responseBody = $this->streamClient->send('http://foo.com/');
95 |
96 | $this->assertEquals($responseBody, $this->fakeRawBody);
97 | $this->assertEquals($this->streamClient->getResponseHeaders(), $this->fakeHeadersAsArray);
98 | $this->assertEquals(200, $this->streamClient->getResponseHttpStatusCode());
99 | }
100 |
101 | /**
102 | * @expectedException \Facebook\FacebookSDKException
103 | */
104 | public function testThrowsExceptionOnClientError()
105 | {
106 | $this->streamMock
107 | ->shouldReceive('streamContextCreate')
108 | ->once()
109 | ->andReturn(null);
110 | $this->streamMock
111 | ->shouldReceive('getResponseHeaders')
112 | ->once()
113 | ->andReturn(null);
114 | $this->streamMock
115 | ->shouldReceive('fileGetContents')
116 | ->once()
117 | ->with('http://foo.com/')
118 | ->andReturn(false);
119 |
120 | $this->streamClient->send('http://foo.com/');
121 | }
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/payments/parse-php-sdk-master/src/Parse/ParseRelation.php:
--------------------------------------------------------------------------------
1 |
12 | */
13 |
14 | class ParseRelation {
15 |
16 | /**
17 | * @var ParseObject - The parent of this relation.
18 | */
19 | private $parent;
20 | /**
21 | * @var string - The key of the relation in the parent object.
22 | */
23 | private $key;
24 | /**
25 | * @var string - The className of the target objects.
26 | */
27 | private $targetClassName;
28 |
29 | /**
30 | * Creates a new Relation for the given parent object, key and class name of target objects.
31 | *
32 | * @param ParseObject $parent The parent of this relation.
33 | * @param string $key The key of the relation in the parent object.
34 | * @param string $targetClassName The className of the target objects.
35 | */
36 | public function __construct($parent, $key, $targetClassName = null)
37 | {
38 | $this->parent = $parent;
39 | $this->key = $key;
40 | $this->targetClassName = $targetClassName;
41 | }
42 |
43 | /**
44 | * Makes sure that this relation has the right parent and key.
45 | *
46 | * @param $parent
47 | * @param $key
48 | *
49 | * @throws \Exception
50 | */
51 | private function ensureParentAndKey($parent, $key)
52 | {
53 | if (!$this->parent) {
54 | $this->parent = $parent;
55 | }
56 | if (!$this->key) {
57 | $this->key = $key;
58 | }
59 | if ($this->parent != $parent) {
60 | throw new \Exception('Internal Error. Relation retrieved from two different Objects.');
61 | }
62 | if ($this->key != $key) {
63 | throw new \Exception('Internal Error. Relation retrieved from two different keys.');
64 | }
65 | }
66 |
67 | /**
68 | * Adds a ParseObject or an array of ParseObjects to the relation.
69 | *
70 | * @param mixed $objects The item or items to add.
71 | */
72 | public function add($objects)
73 | {
74 | if (!is_array($objects)) {
75 | $objects = [$objects];
76 | }
77 | $operation = new ParseRelationOperation($objects, null);
78 | $this->targetClassName = $operation->_getTargetClass();
79 | $this->parent->_performOperation($this->key, $operation);
80 | }
81 |
82 | /**
83 | * Removes a ParseObject or an array of ParseObjects from this relation.
84 | *
85 | * @param mixed $objects The item or items to remove.
86 | */
87 | public function remove($objects)
88 | {
89 | if (!is_array($objects)) {
90 | $objects = [$objects];
91 | }
92 | $operation = new ParseRelationOperation(null, $objects);
93 | $this->targetClassName = $operation->_getTargetClass();
94 | $this->parent->_performOperation($this->key, $operation);
95 | }
96 |
97 | /**
98 | * Returns the target classname for the relation.
99 | *
100 | * @return string
101 | */
102 | public function getTargetClass()
103 | {
104 | return $this->targetClassName;
105 | }
106 |
107 | /**
108 | * Set the target classname for the relation.
109 | *
110 | * @param $className
111 | */
112 | public function setTargetClass($className)
113 | {
114 | $this->targetClassName = $className;
115 | }
116 |
117 | /**
118 | * Set the parent object for the relation.
119 | *
120 | * @param $parent
121 | */
122 | public function setParent($parent) {
123 | $this->parent = $parent;
124 | }
125 |
126 | /**
127 | * Gets a query that can be used to query the objects in this relation.
128 | *
129 | * @return ParseQuery That restricts the results to objects in this relations.
130 | */
131 | public function getQuery()
132 | {
133 | $query = new ParseQuery($this->targetClassName);
134 | $query->relatedTo('object', $this->parent->_toPointer());
135 | $query->relatedTo('key', $this->key);
136 | return $query;
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php:
--------------------------------------------------------------------------------
1 | requestHeaders[$key] = $value;
71 | }
72 |
73 | /**
74 | * The headers returned in the response
75 | *
76 | * @return array
77 | */
78 | public function getResponseHeaders()
79 | {
80 | return $this->responseHeaders;
81 | }
82 |
83 | /**
84 | * The HTTP status response code
85 | *
86 | * @return int
87 | */
88 | public function getResponseHttpStatusCode()
89 | {
90 | return $this->responseHttpStatusCode;
91 | }
92 |
93 | /**
94 | * Sends a request to the server
95 | *
96 | * @param string $url The endpoint to send the request to
97 | * @param string $method The request method
98 | * @param array $parameters The key value pairs to be sent in the body
99 | *
100 | * @return string Raw response from the server
101 | *
102 | * @throws \Facebook\FacebookSDKException
103 | */
104 | public function send($url, $method = 'GET', $parameters = array())
105 | {
106 | $options = array();
107 | if ($parameters) {
108 | $options = array('body' => $parameters);
109 | }
110 |
111 | $options['verify'] = __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem';
112 |
113 | $request = self::$guzzleClient->createRequest($method, $url, $options);
114 |
115 | foreach($this->requestHeaders as $k => $v) {
116 | $request->setHeader($k, $v);
117 | }
118 |
119 | try {
120 | $rawResponse = self::$guzzleClient->send($request);
121 | } catch (RequestException $e) {
122 | if ($e->getPrevious() instanceof AdapterException) {
123 | throw new FacebookSDKException($e->getMessage(), $e->getCode());
124 | }
125 | $rawResponse = $e->getResponse();
126 | }
127 |
128 | $this->responseHttpStatusCode = $rawResponse->getStatusCode();
129 | $this->responseHeaders = $rawResponse->getHeaders();
130 |
131 | return $rawResponse->getBody();
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/payments/facebook-php-sdk/tests/FacebookRequestTest.php:
--------------------------------------------------------------------------------
1 | execute()->getGraphObject();
17 | $this->assertNotNull($response->getProperty('id'));
18 | $this->assertNotNull($response->getProperty('name'));
19 | }
20 |
21 | public function testCanPostAndDelete()
22 | {
23 | // Create a test user
24 | $params = array(
25 | 'name' => 'Foo User',
26 | );
27 | $response = (
28 | new FacebookRequest(
29 | new FacebookSession(FacebookTestHelper::getAppToken()),
30 | 'POST',
31 | '/' . FacebookTestCredentials::$appId . '/accounts/test-users',
32 | $params
33 | ))->execute()->getGraphObject();
34 | $user_id = $response->getProperty('id');
35 | $this->assertNotNull($user_id);
36 |
37 | // Delete test user
38 | $response = (
39 | new FacebookRequest(
40 | new FacebookSession(FacebookTestHelper::getAppToken()),
41 | 'DELETE',
42 | '/' . $user_id
43 | ))->execute()->getGraphObject()->asArray();
44 | $this->assertEquals(['success' => true], $response);
45 | }
46 |
47 | public function testETagHit()
48 | {
49 | $response = (
50 | new FacebookRequest(
51 | FacebookTestHelper::$testSession,
52 | 'GET',
53 | '/104048449631599'
54 | ))->execute();
55 |
56 | $response = (
57 | new FacebookRequest(
58 | FacebookTestHelper::$testSession,
59 | 'GET',
60 | '/104048449631599',
61 | null,
62 | null,
63 | $response->getETag()
64 | ))->execute();
65 |
66 | $this->assertTrue($response->isETagHit());
67 | $this->assertNull($response->getETag());
68 | }
69 |
70 | public function testETagMiss()
71 | {
72 | $response = (
73 | new FacebookRequest(
74 | FacebookTestHelper::$testSession,
75 | 'GET',
76 | '/104048449631599',
77 | null,
78 | null,
79 | 'someRandomValue'
80 | ))->execute();
81 |
82 | $this->assertFalse($response->isETagHit());
83 | $this->assertNotNull($response->getETag());
84 | }
85 |
86 | public function testGracefullyHandlesUrlAppending()
87 | {
88 | $params = array();
89 | $url = 'https://www.foo.com/';
90 | $processed_url = FacebookRequest::appendParamsToUrl($url, $params);
91 | $this->assertEquals('https://www.foo.com/', $processed_url);
92 |
93 | $params = array(
94 | 'access_token' => 'foo',
95 | );
96 | $url = 'https://www.foo.com/';
97 | $processed_url = FacebookRequest::appendParamsToUrl($url, $params);
98 | $this->assertEquals('https://www.foo.com/?access_token=foo', $processed_url);
99 |
100 | $params = array(
101 | 'access_token' => 'foo',
102 | 'bar' => 'baz',
103 | );
104 | $url = 'https://www.foo.com/?foo=bar';
105 | $processed_url = FacebookRequest::appendParamsToUrl($url, $params);
106 | $this->assertEquals('https://www.foo.com/?access_token=foo&bar=baz&foo=bar', $processed_url);
107 |
108 | $params = array(
109 | 'access_token' => 'foo',
110 | );
111 | $url = 'https://www.foo.com/?foo=bar&access_token=bar';
112 | $processed_url = FacebookRequest::appendParamsToUrl($url, $params);
113 | $this->assertEquals('https://www.foo.com/?access_token=bar&foo=bar', $processed_url);
114 | }
115 |
116 | public function testAppSecretProof()
117 | {
118 | $enableAppSecretProof = FacebookSession::useAppSecretProof();
119 |
120 | FacebookSession::enableAppSecretProof(true);
121 | $request = new FacebookRequest(
122 | FacebookTestHelper::$testSession,
123 | 'GET',
124 | '/me'
125 | );
126 | $this->assertTrue(isset($request->getParameters()['appsecret_proof']));
127 |
128 |
129 | FacebookSession::enableAppSecretProof(false);
130 | $request = new FacebookRequest(
131 | FacebookTestHelper::$testSession,
132 | 'GET',
133 | '/me'
134 | );
135 | $this->assertFalse(isset($request->getParameters()['appsecret_proof']));
136 |
137 | FacebookSession::enableAppSecretProof($enableAppSecretProof);
138 | }
139 |
140 | }
--------------------------------------------------------------------------------