Giter VIP home page Giter VIP logo

quaderno-edd's People

Contributors

bporcelli avatar dormi avatar flowdee avatar polimorfico avatar suhiltzaile avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quaderno-edd's Issues

AJAX response from edd_ajax_recalculate_taxes tied to incorrect element

It appears that line 57 of edd-quardeno.js should reference #edd_checkout_cart_form, not #edd_checkout_cart . The response fromedd_checkout_cart() (which is called via the AJAX function edd_ajax_recalculate_taxes()) includes the #edd_checkout_cart_form div in the HTML response itself, so you end up nesting the div over and over again unintentionally.

Update tax info for payment

Can Quaderno, while generating the invoice, update the subscription payment taxes (product tax and total tax)?

This would help to keep the data across the payments and invoices unified. Now ie. when tax ID is not valid the invoice can have different data than saved within the payment (VAT exempt).

Tax info is not saved in the payment details

The problem is that there's an inconsistency between the Quaderno invoice and EDD payment details.

Ie. someone purchases something, the Quaderno tax is set to 0 and invoice is generated without it while in payment details you can still see the tax, ie. 23%.

Maybe it's because I have the store set up in a way the total price is always the same (tax included).

To save the tax info I can get from Quaderno I created a simple snippet:

function edd_quaderno_tax_rewrite( $payment_id ) {

	$payment = new EDD_Payment( $payment_id );

	if ( $payment->total == 0 || ! function_exists( 'edd_quaderno_tax' ) ) {
		return;
	}

	$metadata   = $payment->get_meta();
	$vat_number = isset( $metadata['vat_number'] ) ? $metadata['vat_number'] : '';

	$tax = edd_quaderno_tax( $payment->address['country'], $payment->address['zip'], $vat_number );

	$tax_rate       = $tax->rate / 100;
	$total          = $payment->total;
	$net            = $total / ( 1 + $tax_rate );
	$tax            = $total - $net;

    // Update each product tax and total.
    foreach ( $payment->cart_details as $item_index => $item_details ) {

    	$item_total = $item_details['item_price'];
    	$item_net   = $item_total / ( 1 + $tax_rate );
    	$item_tax   = $item_total - $item_net;

    	$payment->modify_cart_item( $item_index, array(
    		'item_price' => $item_net,
    		'subtotal'   => $item_net * $item_details['quantity'],
    		'tax'        => $item_tax,
    	) );

    }

    // Update tax rate, tax total is calculated automatically when updating items.
    $payment->tax_rate = $tax_rate;
    $payment->subtotal = $net;
    $payment->total    = $total;

    $payment->save();

}
add_action( 'edd_complete_purchase', 'edd_quaderno_tax_rewrite', 100 );
add_action( 'edd_recurring_record_payment', 'edd_quaderno_tax_rewrite', 100 );

Note: this is untested and probably needs more logic like tax included/excluded and discounts handling.

Billing State / Province is reset when EDD Quaderno is active

If you checkout as a customer with a saved Billing State when EDD Quaderno is active, the saved state does not show up in the Billing State field. This happens because Quaderno triggers the change event on the #billing_country dropdown when the page loads, thus causing EDD to regenerate and replace the Billing State field.

Purchase Receipt Emails: Invoice URL tag

It would be very helpful if the Quaderno invoice URL was available in the EDD Purchase Receipt emails as tag (e.g. quaderno_invoice_url) so we can link it directly in the receipts customers receive.

Bildschirmfoto 2023-10-01 um 07 58 12

Here's the code example from EDD how they easily add their stripe related tag:

/**
 * Register the statement_descriptor email tag.
 *
 * @since 2.6
 * @return void
 */
function edd_stripe_register_email_tags() {
	$statement_descriptor = edds_get_statement_descriptor();
	if ( ! empty( $statement_descriptor ) ) {
		edd_add_email_tag(
			'stripe_statement_descriptor',
			__( 'Outputs a line stating what charges will appear as on customer\'s credit card statements.', 'edds' ),
			'edd_stripe_statement_descriptor_template_tag',
			__( 'Statement Descriptor', 'edds' )
		);
	}
}
add_action( 'edd_add_email_tags', 'edd_stripe_register_email_tags' );

/**
 * Swap the {statement_descriptor} email tag with the string from the option
 *
 * @since 2.6
 * @param $payment_id
 *
 * @return mixed
 */
function edd_stripe_statement_descriptor_template_tag( $payment_id ) {
	$payment = new EDD_Payment( $payment_id );
	if ( 'stripe' !== $payment->gateway ) {
		return '';
	}

	$statement_descriptor = edds_get_statement_descriptor();
	if ( empty( $statement_descriptor ) ) {
		return '';
	}

	// If you want to filter this, use the %s to define where you want the actual statement descriptor to show in your message.
	$email_tag_output = __( apply_filters( 'edd_stripe_statement_descriptor_email_tag', 'Charges will appear on your card statement as %s' ), 'edds' );

	return sprintf( $email_tag_output, $statement_descriptor );
}

PHP warnings

We received the following PHP warnings on a test site.

Occurred when my colleague created an invoice + made a refund.

You should maybe add some checks before working with the variables/properties etc.

[06-Nov-2023 14:54:57 UTC] PHP Warning:  Attempt to read property "ip" on bool in /sites/dev.com/files/wp-content/plugins/edd-quaderno/includes/invoices.php on line 241
[06-Nov-2023 14:56:40 UTC] PHP Warning:  Undefined variable $tax in /sites/dev.com/files/wp-content/plugins/edd-quaderno/includes/credits.php on line 49
[06-Nov-2023 14:56:40 UTC] PHP Warning:  Attempt to read property "notes" on null in /sites/dev.com/files/wp-content/plugins/edd-quaderno/includes/credits.php on line 49
[06-Nov-2023 14:56:40 UTC] PHP Warning:  Undefined variable $tax in /sites/dev.com/files/wp-content/plugins/edd-quaderno/includes/credits.php on line 49

EDD 3.0 compatibility

As a heads-up, the EDD team is working on plugin v3.0 and there's already first beta published.

I think this affects the Quaderno plugin as it stores custom meta within the Payment.

Fatal error:

An error of type E_ERROR was caused in line 85 of the file /sites/bracketspace.com/files/web/app/plugins/edd-quaderno/includes/taxes.php.
Error message: Uncaught Error: Call to undefined function edd_get_customer_by() in /sites/example.com/files/web/app/plugins/edd-quaderno/includes/taxes.php:85

I suppose that function has been introduced in EDD 3.0, we're using EDD 2.11.7 for the sake of another compatibility.

Tax ID field display overrides EDD Stripe's hide/show of address fields

This only happens if a user goes through EDD checkout with a saved address. The EDD Stripe plugin hides all billing address fields, including edd_tax_id_wrap, on page load. The EDD Quaderno JS interferes with this as it fires toggle_tax_id_fields() on the 'edd_gateway_loaded' JS event which causes the Tax ID field to be displayed when all other billing address fields are hidden

Fatal mistake when creating invoices

Hi @polimorfico , i am florian's colleague (@flowdee)

in some cases on our web sites (different server and different domain) the invoices are not generated. If you try to create them manually in EDD, the following critical error occurs:

`Fatal error: Uncaught Error: Too few arguments to function edd_quaderno_get_order_meta(), 1 passed in /sites/files/wp-content/plugins/edd-quaderno/includes/invoices.php on line 241 and exactly 2 expected
in /sites/files/wp-content/plugins/edd-quaderno/includes/order_details.php on line 54

Call stack:

edd_quaderno_get_order_meta()
wp-content/plugins/edd-quaderno/includes/invoices.php:241
edd_quaderno_process_recurring_payment()
wp-content/plugins/edd-quaderno/includes/invoices.php:264
edd_quaderno_resend_invoice()
wp-includes/class-wp-hook.php:308
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:332
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-content/plugins/easy-digital-downloads-pro/includes/admin/admin-actions.php:28
edd_process_actions()
wp-includes/class-wp-hook.php:308
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:332
WP_Hook::do_action()
wp-includes/plugin.php:517
do_action()
wp-admin/admin.php:175
require_once()
wp-admin/edit.php:10`

Do you have any idea?

Thanks, best,
Mirko

EDD Customer: Update VAT details

We regularly experience the issue that customers who got charged for renewal orders (subscriptions) automatically, receive invoices without VAT details.

The problem: When they purchased in the past, they forgot to add their details in the checkout.

Even when we update the details directly via Quaderno (and create credit notes), next year, when subscription renewal hits, the invoices are created again without VAT details. I think it's because the data is missing in EDD?

It would be great if customers (and we EDD admins) could update VAT details (number and company name) via EDD.

1. Via the customer edit screen

Bildschirmfoto 2023-11-02 um 09 25 18

2. The customer themselves via profile edit screen

Shortcode: [edd_profile_editor]

Bildschirmfoto 2023-11-02 um 09 24 22

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.