PHP 7.4.33
Preview: SubscriptionHelper.php Size: 2.49 KB
/home/godevadmin/www/admin/braintree/final/braintree2/tests/integration/SubscriptionHelper.php

<?php
namespace Test\Integration;

use Braintree;

class SubscriptionHelper
{
    public static function addOnDiscountPlan()
    {
        return [
            'description' => "Plan for integration tests -- with add-ons and discounts",
            'id' => "integration_plan_with_add_ons_and_discounts",
            'price' => '9.99',
            'trial_period' => true,
            'trial_duration' => 2,
            'trial_duration_unit' => 'day'
        ];
    }

    public static function billingDayOfMonthPlan()
    {
        return [
            'description' => 'Plan for integration tests -- with billing day of month',
            'id' => 'integration_plan_with_billing_day_of_month',
			'numberOfBillingCycles' => 5,
            'price' => '8.88',
            'trial_period' => false
        ];
    }

    public static function trialPlan()
    {
        return [
            'description' => 'Plan for integration tests -- with trial',
            'id' => 'integration_trial_plan',
			'numberOfBillingCycles' => 12,
            'price' => '43.21',
            'trial_period' => true,
            'trial_duration' => 2,
            'trial_duration_unit' => 'day'
        ];
    }

    public static function triallessPlan()
    {
        return [
            'description' => 'Plan for integration tests -- without a trial',
            'id' => 'integration_trialless_plan',
			'numberOfBillingCycles' => 12,
            'price' => '12.34',
            'trial_period' => false
        ];
    }

    public static function createCreditCard()
    {
        $customer = Braintree\Customer::createNoValidate([
            'creditCard' => [
                'number' => '5105105105105100',
                'expirationDate' => '05/2010'
            ]
        ]);
        return $customer->creditCards[0];
    }

    public static function createSubscription()
    {
        $plan = self::triallessPlan();
        $result = Braintree\Subscription::create([
            'paymentMethodToken' => self::createCreditCard()->token,
            'price' => '54.99',
            'planId' => $plan['id']
        ]);
        return $result->subscription;
    }

    public static function compareModificationsById($left, $right)
    {
        return strcmp($left->id, $right->id);
    }

    public static function sortModificationsById(&$modifications)
    {
        usort($modifications, ['Test\Integration\SubscriptionHelper', 'compareModificationsById']);
    }
}

Directory Contents

Dirs: 2 × Files: 34

Name Size Perms Modified Actions
Error DIR
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
Result DIR
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.97 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
12.84 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.04 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
56.07 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
11.20 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.84 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.68 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
62.86 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.22 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.09 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.93 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.09 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.63 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.13 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
6.01 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
29.95 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
10.17 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.35 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
13.75 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.60 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
67.92 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
11.34 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.77 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.51 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.49 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
17.89 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
50.99 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.92 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.40 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
65.59 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
173.21 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
12.51 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.28 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.06 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).