Skip to content

Commit

Permalink
New payment events (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Jan 19, 2024
1 parent b9ba8eb commit 2bb05ee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
34 changes: 24 additions & 10 deletions resources/js/components/Checkout/Checkout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ export default {
method: this.checkout.payment_method,
},
})
this.$root.$emit('checkout-payment-selected', {
method: this.checkout.payment_method,
})
this.getTotalsInformation()
},
Expand All @@ -231,22 +236,31 @@ export default {
}
try {
let response = await this.magentoCart('post', 'payment-information', {
billingAddress: this.billingAddress,
shippingAddress: this.shippingAddress,
email: this.user?.email ? this.user.email : this.$root.guestEmail,
paymentMethod: {
method: this.checkout.payment_method,
extension_attributes: {
agreement_ids: this.checkout.agreement_ids,
},
this.$root.$emit('before-checkout-payment-saved', {
order: {
payment_method_code: this.checkout.payment_method,
},
})
let response = {}
if (!window.app.checkout?.preventOrder) {
response = await this.magentoCart('post', 'payment-information', {
billingAddress: this.billingAddress,
shippingAddress: this.shippingAddress,
email: this.user?.email ? this.user.email : this.$root.guestEmail,
paymentMethod: {
method: this.checkout.payment_method,
extension_attributes: {
agreement_ids: this.checkout.agreement_ids,
},
},
})
}
// response.data = orderId
this.$root.$emit('checkout-payment-saved', {
order: {
id: response.data,
id: response?.data,
payment_method_code: this.checkout.payment_method,
},
})
Expand Down
2 changes: 2 additions & 0 deletions src/Models/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Quote extends Model

protected $primaryKey = 'entity_id';

protected $guarded = [];

protected $casts = [
'items' => QuoteItems::class,
'cross_sells' => CommaSeparatedToIntegerArray::class,
Expand Down

0 comments on commit 2bb05ee

Please sign in to comment.