Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $order->refund->location_id = $this->get_order_meta( $order, 'square_location_id' );
- $order->refund->tender_id = $this->get_order_meta( $order, 'authorization_code' );
- if ( ! $order->refund->tender_id ) {
- try {
- $response = $this->get_api()->get_transaction( $order->refund->trans_id, $order->refund->location_id );
- if ( ! $response->get_authorization_code() ) {
- throw new Framework\SV_WC_Plugin_Exception( 'Tender missing' );
- }
- $this->update_order_meta( $order, 'authorization_code', $response->get_authorization_code() );
- $this->update_order_meta( $order, 'square_location_id', $response->get_location_id() );
- $order->refund->location_id = $response->get_location_id();
- $order->refund->tender_id = $response->get_authorization_code();
- } catch ( Framework\SV_WC_Plugin_Exception $exception ) {
- return new \WP_Error( 'wc_square_refund_tender_missing', __( 'Could not find original transaction tender. Please refund this transaction from your Square dashboard.', 'woocommerce-square' ) );
- }
- }
Add Comment
Please, Sign In to add comment