square_api = $api_client->getGiftCardsApi(); $this->location_id = $location_id; } /** * Sets data for the `retrieveGiftCardFromNonce` API method. * * @param string $nonce Gift Card payment nonce. */ public function set_retrieve_gift_card_data( $nonce = '' ) { $this->square_request = new \Square\Models\RetrieveGiftCardFromNonceRequest( $nonce ); $this->square_api_method = 'retrieveGiftCardFromNonce'; $this->square_api_args = array( $this->square_request ); } /** * Sets data for the `retrieveGiftCardFromGAN` API method. * * @since 4.2.0 * * @param string $gan Gift card number. */ public function set_retrieve_gift_card_from_gan_data( $gan = '' ) { $this->square_request = new \Square\Models\RetrieveGiftCardFromGANRequest( $gan ); $this->square_api_method = 'retrieveGiftCardFromGAN'; $this->square_api_args = array( $this->square_request ); } /** * Sets data to create a Gift card. * * @since 4.2.0 * * @param $order_id Line item order ID. */ public function set_create_gift_card_data( $order_id ) { $this->square_api_method = 'createGiftCard'; $gift_card = new \Square\Models\GiftCard( \Square\Models\GiftCardType::DIGITAL ); $this->square_request = new \Square\Models\CreateGiftCardRequest( wc_square()->get_idempotency_key( $order_id, false ), $this->location_id, $gift_card ); $this->square_api_args = array( $this->square_request ); } }