@@ -50,7 +50,9 @@ public function __construct()
50
50
*/
51
51
final public function authorize (): PaymentAuthorize
52
52
{
53
- if (! $ this ->order || ! $ this ->order = $ this ->cart ->draftOrder ) {
53
+ $ this ->order = $ this ->cart ->draftOrder ?: $ this ->cart ->completedOrder ;
54
+
55
+ if (! $ this ->order ) {
54
56
try {
55
57
$ this ->order = $ this ->cart ->createOrder ();
56
58
} catch (DisallowMultipleCartOrdersException $ e ) {
@@ -61,14 +63,6 @@ final public function authorize(): PaymentAuthorize
61
63
}
62
64
}
63
65
64
- if ($ this ->order ->placed_at ) {
65
- return new PaymentAuthorize (
66
- success: false ,
67
- message: 'This order has already been placed ' ,
68
- orderId: $ this ->order ->id ,
69
- );
70
- }
71
-
72
66
$ this ->paymentIntent = $ this ->stripe ->paymentIntents ->retrieve (
73
67
$ this ->data ['payment_intent ' ]
74
68
);
@@ -81,14 +75,6 @@ final public function authorize(): PaymentAuthorize
81
75
);
82
76
}
83
77
84
- if ($ this ->paymentIntent ->status == PaymentIntent::STATUS_REQUIRES_PAYMENT_METHOD ) {
85
- return new PaymentAuthorize (
86
- success: false ,
87
- message: 'A payment method is required for this intent. ' ,
88
- orderId: $ this ->order ->id ,
89
- );
90
- }
91
-
92
78
if ($ this ->paymentIntent ->status == PaymentIntent::STATUS_REQUIRES_CAPTURE && $ this ->policy == 'automatic ' ) {
93
79
$ this ->paymentIntent = $ this ->stripe ->paymentIntents ->capture (
94
80
$ this ->data ['payment_intent ' ]
0 commit comments