mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:17:34 -05:00 
			
		
		
		
	Gateways: Stripe: Alipay: Paying with Alipay
This commit is contained in:
		
							parent
							
								
									274703b3b0
								
							
						
					
					
						commit
						a086e726b3
					
				
							
								
								
									
										67
									
								
								tests/Browser/ClientPortal/Gateways/Stripe/AlipayTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								tests/Browser/ClientPortal/Gateways/Stripe/AlipayTest.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,67 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Tests\Browser\ClientPortal\Gateways\Stripe;
 | 
			
		||||
 | 
			
		||||
use App\DataMapper\FeesAndLimits;
 | 
			
		||||
use App\Models\Client;
 | 
			
		||||
use App\Models\CompanyGateway;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
 | 
			
		||||
use Laravel\Dusk\Browser;
 | 
			
		||||
use Tests\Browser\Pages\ClientPortal\Login;
 | 
			
		||||
use Tests\DuskTestCase;
 | 
			
		||||
 | 
			
		||||
class AlipayTest extends DuskTestCase
 | 
			
		||||
{
 | 
			
		||||
    protected function setUp(): void
 | 
			
		||||
    {
 | 
			
		||||
        parent::setUp();
 | 
			
		||||
 | 
			
		||||
        foreach (static::$browsers as $browser) {
 | 
			
		||||
            $browser->driver->manage()->deleteAllCookies();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->browse(function (Browser $browser) {
 | 
			
		||||
            $browser
 | 
			
		||||
                ->visit(new Login())
 | 
			
		||||
                ->auth();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Enable Alipay.
 | 
			
		||||
        $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail();
 | 
			
		||||
        $fees_and_limits = $cg->fees_and_limits;
 | 
			
		||||
        $fees_and_limits->{GatewayType::ALIPAY} = new FeesAndLimits();
 | 
			
		||||
        $cg->fees_and_limits = $fees_and_limits;
 | 
			
		||||
        $cg->save();
 | 
			
		||||
 | 
			
		||||
        // Setting country  to DEU (276).
 | 
			
		||||
        $client = Client::first();
 | 
			
		||||
        $client->country_id = 276;
 | 
			
		||||
        $client->save();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testPayingWithAlipay()
 | 
			
		||||
    {
 | 
			
		||||
        $this->browse(function (Browser $browser) {
 | 
			
		||||
            $browser
 | 
			
		||||
                ->visitRoute('client.invoices.index')
 | 
			
		||||
                ->click('@pay-now')
 | 
			
		||||
                ->press('Pay Now')
 | 
			
		||||
                ->clickLink('Alipay')
 | 
			
		||||
                ->press('Pay Now')
 | 
			
		||||
                ->waitForText('Alipay test payment page', 120)
 | 
			
		||||
                ->press('.common-Button.common-Button--default')
 | 
			
		||||
                ->waitForText('Details of the payment', 60);
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user