mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 20:27:33 -05:00 
			
		
		
		
	
						commit
						d3d4972242
					
				@ -1 +1 @@
 | 
			
		||||
5.5.24
 | 
			
		||||
5.5.25
 | 
			
		||||
@ -109,6 +109,7 @@ class StorePaymentRequest extends Request
 | 
			
		||||
            'credits.*.amount' => ['bail','required', new CreditsSumRule($this->all())],
 | 
			
		||||
            'invoices' => new ValidPayableInvoicesRule(),
 | 
			
		||||
            'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
 | 
			
		||||
            'idempotency_key' => ['nullable', 'bail', 'string','max:64', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -125,6 +125,20 @@ class ACH
 | 
			
		||||
 | 
			
		||||
        $bank_account = Customer::retrieveSource($request->customer, $request->source, [], $this->stripe->stripe_connect_auth);
 | 
			
		||||
 | 
			
		||||
        /* Catch externally validated bank accounts and mark them as verified */
 | 
			
		||||
        if(property_exists($bank_account, 'status') && $bank_account->status == 'verified'){
 | 
			
		||||
 | 
			
		||||
            $meta = $token->meta;
 | 
			
		||||
            $meta->state = 'authorized';
 | 
			
		||||
            $token->meta = $meta;
 | 
			
		||||
            $token->save();
 | 
			
		||||
 | 
			
		||||
            return redirect()
 | 
			
		||||
                ->route('client.payment_methods.show', $token->hashed_id)
 | 
			
		||||
                ->with('message', __('texts.payment_method_verified'));
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            $bank_account->verify(['amounts' => request()->transactions]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,7 @@ class CreditCard
 | 
			
		||||
    public function authorizeView($data)
 | 
			
		||||
    {
 | 
			
		||||
        $data['gateway'] = $this->wepay_payment_driver;
 | 
			
		||||
        $data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
 | 
			
		||||
 | 
			
		||||
        return render('gateways.wepay.authorize.authorize', $data);
 | 
			
		||||
    }
 | 
			
		||||
@ -101,6 +102,7 @@ class CreditCard
 | 
			
		||||
    {
 | 
			
		||||
        $data['gateway'] = $this->wepay_payment_driver;
 | 
			
		||||
        $data['description'] = ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number');
 | 
			
		||||
        $data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
 | 
			
		||||
 | 
			
		||||
        return render('gateways.wepay.credit_card.pay', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -14,8 +14,8 @@ return [
 | 
			
		||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
			
		||||
    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
			
		||||
    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
			
		||||
    'app_version' => '5.5.24',
 | 
			
		||||
    'app_tag' => '5.5.24',
 | 
			
		||||
    'app_version' => '5.5.25',
 | 
			
		||||
    'app_tag' => '5.5.25',
 | 
			
		||||
    'minimum_client_version' => '5.0.16',
 | 
			
		||||
    'terms_version' => '1.0.1',
 | 
			
		||||
    'api_secret' => env('API_SECRET', ''),
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,33 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
 | 
			
		||||
return new class extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('payments', function (Blueprint $table) {
 | 
			
		||||
            $table->string('idempotency_key', 64)->nullable()->index();
 | 
			
		||||
 | 
			
		||||
            $table->unique(['company_id', 'idempotency_key']);
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -22,7 +22,7 @@
 | 
			
		||||
    "/js/clients/linkify-urls.js": "/js/clients/linkify-urls.js?id=2b2fe55f926789abc52f19111006e1ec",
 | 
			
		||||
    "/js/clients/payments/braintree-credit-card.js": "/js/clients/payments/braintree-credit-card.js?id=cf25867ef09115b7f5a209819ba79bbf",
 | 
			
		||||
    "/js/clients/payments/braintree-paypal.js": "/js/clients/payments/braintree-paypal.js?id=5764a8d406c1eda848d073f10d178626",
 | 
			
		||||
    "/js/clients/payments/wepay-credit-card.js": "/js/clients/payments/wepay-credit-card.js?id=bec9106c8ba5a973acee4cfc47301324",
 | 
			
		||||
    "/js/clients/payments/wepay-credit-card.js": "/js/clients/payments/wepay-credit-card.js?id=dbba20d70fbebb326ddbc46115af9771",
 | 
			
		||||
    "/js/clients/payment_methods/wepay-bank-account.js": "/js/clients/payment_methods/wepay-bank-account.js?id=b8706d7de6127f184ad19b2a810880be",
 | 
			
		||||
    "/js/clients/payments/paytrace-credit-card.js": "/js/clients/payments/paytrace-credit-card.js?id=e0b1231a7bf6252672836222285c0f52",
 | 
			
		||||
    "/js/clients/payments/mollie-credit-card.js": "/js/clients/payments/mollie-credit-card.js?id=bbab588ed009a93345bec520cbe66869",
 | 
			
		||||
 | 
			
		||||
@ -82,6 +82,7 @@ class WePayCreditCard {
 | 
			
		||||
            expiration_month: this.myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''),
 | 
			
		||||
            expiration_year: this.myCard.CardJs('expiryYear').replace(/[^\d]/g, ''),
 | 
			
		||||
            address: {
 | 
			
		||||
                country: document.querySelector(['meta[name=country_code']).content,
 | 
			
		||||
                postal_code: document.querySelector(['meta[name=client-postal-code']).content,
 | 
			
		||||
            }
 | 
			
		||||
        }, (data) => {
 | 
			
		||||
@ -127,6 +128,7 @@ class WePayCreditCard {
 | 
			
		||||
            expiration_month: this.myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''),
 | 
			
		||||
            expiration_year: this.myCard.CardJs('expiryYear').replace(/[^\d]/g, ''),
 | 
			
		||||
            address: {
 | 
			
		||||
                country: document.querySelector(['meta[name=country_code']).content,
 | 
			
		||||
                postal_code: document.querySelector(['meta[name=client-postal-code']).content,
 | 
			
		||||
            }
 | 
			
		||||
        }, (data) => {
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@
 | 
			
		||||
 | 
			
		||||
    <meta name="contact-email" content="{{ $contact->email }}">
 | 
			
		||||
    <meta name="client-postal-code" content="{{ $contact->client->postal_code }}">
 | 
			
		||||
    <meta name="country_code" content="{{$country_code}}">
 | 
			
		||||
 | 
			
		||||
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
 | 
			
		||||
    <script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@
 | 
			
		||||
    <meta name="wepay-environment" content="{{ config('ninja.wepay.environment') }}">
 | 
			
		||||
    <meta name="wepay-client-id" content="{{ config('ninja.wepay.client_id') }}">
 | 
			
		||||
    <meta name="contact-email" content="{{ $contact->email }}">
 | 
			
		||||
    <meta name="country_code" content="{{$country_code}}">
 | 
			
		||||
 | 
			
		||||
    <script type="text/javascript" src="https://static.wepay.com/min/js/tokenization.4.latest.js"></script>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
 | 
			
		||||
    <meta name="contact-email" content="{{ $contact->email }}">
 | 
			
		||||
    <meta name="client-postal-code" content="{{ $contact->client->postal_code }}">
 | 
			
		||||
 | 
			
		||||
    <meta name="country_code" content="{{$country_code}}">
 | 
			
		||||
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
 | 
			
		||||
    <script src="{{ asset('js/clients/payments/card-js.min.js') }}"></script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -62,6 +62,55 @@ class PaymentTest extends TestCase
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testStorePaymentIdempotencyKeyIllegalLength()
 | 
			
		||||
    {
 | 
			
		||||
        $client = ClientFactory::create($this->company->id, $this->user->id);
 | 
			
		||||
        $client->save();
 | 
			
		||||
 | 
			
		||||
        $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id
 | 
			
		||||
        $this->invoice->client_id = $client->id;
 | 
			
		||||
 | 
			
		||||
        $this->invoice->line_items = $this->buildLineItems();
 | 
			
		||||
        $this->invoice->uses_inclusive_Taxes = false;
 | 
			
		||||
 | 
			
		||||
        $this->invoice->save();
 | 
			
		||||
 | 
			
		||||
        $this->invoice_calc = new InvoiceSum($this->invoice);
 | 
			
		||||
        $this->invoice_calc->build();
 | 
			
		||||
 | 
			
		||||
        $this->invoice = $this->invoice_calc->getInvoice();
 | 
			
		||||
 | 
			
		||||
        $data = [
 | 
			
		||||
            'amount' => $this->invoice->amount,
 | 
			
		||||
            'client_id' => $client->hashed_id,
 | 
			
		||||
            'invoices' => [
 | 
			
		||||
                [
 | 
			
		||||
                    'invoice_id' => $this->invoice->hashed_id,
 | 
			
		||||
                    'amount' => $this->invoice->amount,
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
            'date' => '2020/12/11',
 | 
			
		||||
            'idempotency_key' => 'dsjafhajklsfhlaksjdhlkajsdjdfjdfljasdfhkjlsafhljfkfhsjlfhiuwayerfiuwaskjgbzmvnjzxnjcbgfkjhdgfoiwwrasdfasdfkashjdfkaskfjdasfda'
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $response = false;
 | 
			
		||||
        try {
 | 
			
		||||
            $response = $this->withHeaders([
 | 
			
		||||
                'X-API-SECRET' => config('ninja.api_secret'),
 | 
			
		||||
                'X-API-TOKEN' => $this->token,
 | 
			
		||||
            ])->post('/api/v1/payments/', $data);
 | 
			
		||||
        } catch (ValidationException $e) {
 | 
			
		||||
            // $message = json_decode($e->validator->getMessageBag(), 1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->assertFalse($response);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function testPaymentList()
 | 
			
		||||
    {
 | 
			
		||||
        Client::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user