internal IRestResponse InviteCustomer( string inviteLink, CustomerInvite invite ) { var request = new RestRequest( inviteLink, Method.POST ); request.RequestFormat = DataFormat.Json; request.AddBody( invite ); return Execute( request ); }
/// <summary> /// Send an invite by email to activate a customers account. /// </summary> /// <param name="customerId">The customer object's Id.</param> /// <param name="invite">Options for the invite email request</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns></returns> public virtual async Task <CustomerInvite> SendInviteAsync(long customerId, CustomerInvite invite = null, CancellationToken cancellationToken = default) { var req = PrepareRequest($"customers/{customerId}/send_invite.json"); var content = new JsonContent(new { customer_invite = invite }); var response = await ExecuteRequestAsync <CustomerInvite>(req, HttpMethod.Post, cancellationToken, content, "customer_invite"); return(response.Result); }
public async Task SendInvite_Customers_Custom() { var created = await Fixture.Create(); long id = created.Id.Value; var options = new CustomerInvite() { Subject = "Custom Subject courtesy of ShopifySharp", CustomMessage = "Custom Message courtesy of ShopifySharp" }; var invite = await Fixture.Service.SendInviteAsync(created.Id.Value, options); Assert.NotNull(invite); Assert.Equal(options.Subject, invite.Subject); Assert.Equal(options.CustomMessage, invite.CustomMessage); }